@mrpatronz/nexusflow 2.18.1 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/commands/skill.js +1 -1
  2. package/dist/commands/skill.js.map +1 -1
  3. package/dist/core/planning-refresh.d.ts +7 -0
  4. package/dist/core/planning-refresh.d.ts.map +1 -0
  5. package/dist/core/planning-refresh.js +15 -0
  6. package/dist/core/planning-refresh.js.map +1 -0
  7. package/dist/core/verify.js +1 -1
  8. package/dist/core/verify.js.map +1 -1
  9. package/dist/generators/plan-generator.d.ts.map +1 -1
  10. package/dist/generators/plan-generator.js +50 -7
  11. package/dist/generators/plan-generator.js.map +1 -1
  12. package/dist/gui/assets/{AgentsPage-B9ejJYsf.js → AgentsPage-DsJ8dxJG.js} +2 -2
  13. package/dist/gui/assets/DashboardPage-CtJnqdvu.js +1 -0
  14. package/dist/gui/assets/{DocumentPreview-CtylgIF0.js → DocumentPreview-B1-9LSiH.js} +1 -1
  15. package/dist/gui/assets/{GettingStartedPage-BM8m5uir.js → GettingStartedPage-KkTgBu7C.js} +1 -1
  16. package/dist/gui/assets/{MonacoDiffAdapter-DHYIkG2a.js → MonacoDiffAdapter-CsyKXuq8.js} +1 -1
  17. package/dist/gui/assets/{ProjectsPage-CNZF11wO.js → ProjectsPage-Dsl46Cx5.js} +1 -1
  18. package/dist/gui/assets/{ScaffoldRepoInline-B5qMbiRV.js → ScaffoldRepoInline-BZBzfuYr.js} +1 -1
  19. package/dist/gui/assets/{SettingsPage-S68Q-rBG.js → SettingsPage-BYuNRM43.js} +1 -1
  20. package/dist/gui/assets/{SkillsPage-B97Al8vk.js → SkillsPage-BmsLo_kt.js} +4 -4
  21. package/dist/gui/assets/StartWorkPage-CY9s8_zb.js +1 -0
  22. package/dist/gui/assets/{StrategiesPage-INv0HW7D.js → StrategiesPage-Bd9vJ5ml.js} +2 -2
  23. package/dist/gui/assets/WorkroomsPage-Yoy1dJFI.js +4 -0
  24. package/dist/gui/assets/WorkspacesPage-CpZsBgiV.js +13 -0
  25. package/dist/gui/assets/{alert-dialog-B-6-jHIr.js → alert-dialog-D24plC11.js} +1 -1
  26. package/dist/gui/assets/index-B5-rK_Uq.css +2 -0
  27. package/dist/gui/assets/index-CxyTuBKc.js +80 -0
  28. package/dist/gui/assets/{queries-CJBjicdw.js → queries-DYi6drfC.js} +1 -1
  29. package/dist/gui/assets/{tabs-CJ2imrHY.js → tabs--FCq-tVR.js} +1 -1
  30. package/dist/gui/index.html +3 -3
  31. package/dist/http/work-guidance-routes.d.ts.map +1 -1
  32. package/dist/http/work-guidance-routes.js +6 -5
  33. package/dist/http/work-guidance-routes.js.map +1 -1
  34. package/dist/mcp/planning-tools.d.ts.map +1 -1
  35. package/dist/mcp/planning-tools.js +6 -5
  36. package/dist/mcp/planning-tools.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/gui/assets/DashboardPage-BwwB7uTm.js +0 -1
  39. package/dist/gui/assets/StartWorkPage-Dq0Ke4hS.js +0 -1
  40. package/dist/gui/assets/WorkroomsPage-uCiHE87E.js +0 -4
  41. package/dist/gui/assets/WorkspacesPage-CAHQrIgk.js +0 -13
  42. package/dist/gui/assets/index-BzqpMUfC.css +0 -2
  43. package/dist/gui/assets/index-DmbV3DA2.js +0 -80
@@ -1,80 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MonacoDiffAdapter-DHYIkG2a.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-DE3RlOCf.js","assets/monaco-DLwhzYMT.js","assets/monaco-d9IpiNv7.css","assets/DocumentPreview-CtylgIF0.js","assets/DashboardPage-BwwB7uTm.js","assets/queries-CJBjicdw.js","assets/button-BrcP8Wxx.js","assets/brand-hHByyyzq.js","assets/client-B5szthbF.js","assets/status-CKOvrZ16.js","assets/card-BMggHY3n.js","assets/ProjectsPage-CNZF11wO.js","assets/badge-BObbahyU.js","assets/ScaffoldRepoInline-B5qMbiRV.js","assets/useValueChanged-DfJmRF2P.js","assets/useAriaLabelledBy-DAWGcnTk.js","assets/trash-2-BrrLX4tD.js","assets/alert-dialog-B-6-jHIr.js","assets/SettingsPage-S68Q-rBG.js","assets/label-C610MHwq.js","assets/alert-CHAmIFAx.js","assets/SkillsPage-B97Al8vk.js","assets/chevron-down-Dy03VL1q.js","assets/square-check-big-DpHMT26q.js","assets/shield-check-FLrrAOFP.js","assets/AgentsPage-B9ejJYsf.js","assets/WorkroomsPage-uCiHE87E.js","assets/tabs-CJ2imrHY.js","assets/isElementDisabled-BONWqXlb.js","assets/StartWorkPage-Dq0Ke4hS.js","assets/vsc-EOWFTqft.js","assets/StrategiesPage-INv0HW7D.js","assets/circle-plus-D0tjHKM4.js","assets/WorkspacesPage-CAHQrIgk.js","assets/GettingStartedPage-BM8m5uir.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{n as r,t as i}from"./jsx-runtime-DE3RlOCf.js";import{$ as a,$t as o,A as s,At as c,B as l,Bn as u,C as d,Ct as f,Dn as p,Dt as m,En as h,Et as g,F as _,G as v,Gn as y,Gt as b,H as x,Ht as S,I as C,J as w,Jn as T,Jt as E,K as D,Kn as ee,Kt as O,L as k,Ln as A,M as te,Mn as j,Mt as M,N,Nt as ne,O as re,On as ie,P,Pn as F,Q as I,R as L,Rt as ae,St as R,Tt as oe,U as z,Un as se,Ut as ce,V as le,Vn as ue,W as de,Wn as fe,Wt as pe,X as me,Xt as he,Y as ge,Yn as _e,Yt as ve,Z as ye,Zt as be,_ as xe,_n as Se,a as Ce,at as we,bn as Te,bt as Ee,c as De,cn as Oe,ct as ke,d as Ae,dt as je,et as Me,f as Ne,ft as Pe,g as Fe,gn as Ie,h as Le,i as Re,in as ze,it as Be,j as Ve,jn as He,jt as Ue,k as We,kt as Ge,l as Ke,lt as qe,m as Je,n as Ye,nn as Xe,nt as Ze,o as Qe,on as $e,p as et,q as tt,qn as nt,qt as rt,r as it,rn as at,s as ot,sn as st,st as ct,t as lt,tn as ut,tt as dt,u as ft,ut as pt,v as mt,wt as ht,xn as gt,xt as _t,yn as vt,yt,z as bt,zn as xt,zt as St}from"./badge-BObbahyU.js";import{$ as Ct,B as wt,C as Tt,F as Et,G as Dt,J as Ot,K as kt,P as At,R as jt,U as Mt,V as Nt,W as Pt,X as Ft,Y as It,Z as Lt,_ as Rt,_t as zt,at as Bt,ct as Vt,dt as Ht,et as Ut,ft as Wt,gt as Gt,h as Kt,ht as qt,it as Jt,k as Yt,lt as Xt,mt as Zt,n as Qt,nt as $t,ot as en,pt as tn,q as nn,rt as rn,st as an,tt as on,ut as sn,vt as cn}from"./queries-CJBjicdw.js";import{c as ln,d as un,f as dn,h as fn,i as pn,l as mn,m as B,n as hn,o as gn,p as _n,s as vn,t as yn}from"./button-BrcP8Wxx.js";import{t as bn}from"./chevron-down-Dy03VL1q.js";import{a as xn,b as Sn,c as Cn,d as wn,f as Tn,g as En,h as Dn,i as On,l as kn,m as An,n as jn,o as Mn,p as Nn,r as Pn,s as Fn,t as In,v as Ln,x as Rn}from"./isElementDisabled-BONWqXlb.js";import{a as zn,g as Bn,i as Vn,m as Hn,o as Un,s as Wn,t as Gn}from"./status-CKOvrZ16.js";import{o as Kn}from"./monaco-DLwhzYMT.js";import{t as qn}from"./useValueChanged-DfJmRF2P.js";import{_ as Jn,a as Yn,f as Xn,h as Zn,i as Qn,l as $n,n as er,p as tr,r as nr,t as rr,u as ir,v as ar,y as or}from"./brand-hHByyyzq.js";import{n as sr}from"./client-B5szthbF.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var cr=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,ee());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ee():S=!1}}}var ee;if(typeof y==`function`)ee=function(){y(D)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=D,ee=function(){k.postMessage(null)}}else ee=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ee()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),lr=n(((e,t)=>{t.exports=cr()})),ur=n((e=>{var t=lr(),n=r(),i=_e();function a(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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(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 c(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 l(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 u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var j=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function P(e){return{current:e}}function F(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function I(e,t){ie++,re[ie]=e.current,e.current=t}var L=P(null),ae=P(null),R=P(null),oe=P(null);function z(e,t){switch(I(R,t),I(ae,e),I(L,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zd(t),e=Qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(L),I(L,e)}function se(){F(L),F(ae),F(R)}function ce(e){e.memoizedState!==null&&I(oe,e);var t=L.current,n=Qd(t,e.type);t!==n&&(I(ae,e),I(L,n))}function le(e){ae.current===e&&(F(L),F(ae)),oe.current===e&&(F(oe),cp._currentValue=ne)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1<e.stack.indexOf(`
3
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
- `+ue+e+de}var pe=!1;function me(e,t){if(!e||pe)return``;pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
- `),l=s.split(`
6
- `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
- Error generating stack: `+e.message+`
9
- `+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(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 Ue(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(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 Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){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 s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Fe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Xe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Fe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Fe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Qe(e,t){var n=t&-t;return n=n&42?1:$e(n),(n&(e.suspendedLanes|t))===0?n:0}function $e(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 et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function tt(){var e=N.p;return e===0?(e=window.event,e===void 0?32:wp(e.type)):e}function nt(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var rt=Math.random().toString(36).slice(2),it=`__reactFiber$`+rt,at=`__reactProps$`+rt,ot=`__reactContainer$`+rt,st=`__reactEvents$`+rt,ct=`__reactListeners$`+rt,lt=`__reactHandles$`+rt,ut=`__reactResources$`+rt,dt=`__reactMarker$`+rt;function ft(e){delete e[it],delete e[at],delete e[st],delete e[ct],delete e[lt]}function pt(e){var t=e[it];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ot]||n[it]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=xf(e);e!==null;){if(n=e[it])return n;e=xf(e)}return t}e=n,n=e.parentNode}return null}function mt(e){if(e=e[it]||e[ot]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function gt(e){var t=e[ut];return t||=e[ut]={hoistableStyles:new Map,hoistableScripts:new Map},t}function _t(e){e[dt]=!0}var vt=new Set,yt={};function bt(e,t){xt(e,t),xt(e+`Capture`,t)}function xt(e,t){for(yt[e]=t,e=0;e<t.length;e++)vt.add(t[e])}var St=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]*$`),Ct={},wt={};function Tt(e){return ve.call(wt,e)?!0:ve.call(Ct,e)?!1:St.test(e)?wt[e]=!0:(Ct[e]=!0,!1)}function Et(e,t,n){if(Tt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Dt(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 Ot(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mt(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Nt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Pt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ft=/[\n"\\]/g;function It(e){return e.replace(Ft,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Lt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):zt(e,o,kt(n)):zt(e,o,kt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+kt(s):e.removeAttribute(`name`)}function Rt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Mt(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Mt(e)}function zt(e,t,n){t===`number`&&Pt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Bt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Vt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Ht(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(j(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Mt(e)}function Ut(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wt=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 Gt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Wt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Kt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Gt(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&Gt(e,o,t[o])}function qt(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 Jt=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`]]),Yt=/^[\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 Xt(e){return Yt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Zt(){}var Qt=null;function $t(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var en=null,tn=null;function nn(e){var t=mt(e);if(t&&(e=t.stateNode)){var n=e[at]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Lt(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="`+It(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[at]||null;if(!i)throw Error(a(90));Lt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Nt(r)}break a;case`textarea`:Vt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Bt(e,!!n.multiple,t,!1)}}}var rn=!1;function an(e,t,n){if(rn)return e(t,n);rn=!0;try{return e(t)}finally{if(rn=!1,(en!==null||tn!==null)&&(Du(),en&&(t=en,e=tn,tn=en=null,nn(t),e)))for(t=0;t<e.length;t++)nn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[at]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,"passive",{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return fn=i.slice(e,1<r?1-r:void 0)}function mn(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 B(){return!0}function hn(){return!1}function gn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?B:hn,this.isPropagationStopped=hn,this}return p(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=B)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=B)},persist:function(){},isPersistent:B}),t}var _n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vn=gn(_n),yn=p({},_n,{view:0,detail:0}),bn=gn(yn),xn,Sn,Cn,wn=p({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fn,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!==Cn&&(Cn&&e.type===`mousemove`?(xn=e.screenX-Cn.screenX,Sn=e.screenY-Cn.screenY):Sn=xn=0,Cn=e),xn)},movementY:function(e){return`movementY`in e?e.movementY:Sn}}),Tn=gn(wn),En=gn(p({},wn,{dataTransfer:0})),Dn=gn(p({},yn,{relatedTarget:0})),On=gn(p({},_n,{animationName:0,elapsedTime:0,pseudoElement:0})),kn=gn(p({},_n,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),An=gn(p({},_n,{data:0})),jn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Mn={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`},Nn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Pn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Nn[e])?!!t[e]:!1}function Fn(){return Pn}var In=gn(p({},yn,{key:function(e){if(e.key){var t=jn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Mn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fn,charCode:function(e){return e.type===`keypress`?mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Ln=gn(p({},wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=gn(p({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fn})),zn=gn(p({},_n,{propertyName:0,elapsedTime:0,pseudoElement:0})),Bn=gn(p({},wn,{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})),Vn=gn(p({},_n,{newState:0,oldState:0})),Hn=[9,13,27,32],Un=sn&&`CompositionEvent`in window,Wn=null;sn&&`documentMode`in document&&(Wn=document.documentMode);var Gn=sn&&`TextEvent`in window&&!Wn,Kn=sn&&(!Un||Wn&&8<Wn&&11>=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=pn(),fn=dn=un=null,Zn=!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 Kn&&t.locale!==`ko`?null:t.data;default:return null}}var er={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 tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!er[e.type]:t===`textarea`}function nr(e,t,n,r){en?tn?tn.push(r):tn=[r]:en=r,t=Fd(t,`onChange`),0<t.length&&(n=new vn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var rr=null,ir=null;function ar(e){Dd(e,0)}function or(e){if(Nt(ht(e)))return e}function sr(e,t){if(e===`change`)return t}var cr=!1;if(sn){var ur;if(sn){var dr=`oninput`in document;if(!dr){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),dr=typeof fr.oninput==`function`}ur=dr}else ur=!1;cr=ur&&(!document.documentMode||9<document.documentMode)}function pr(){rr&&(rr.detachEvent(`onpropertychange`,mr),ir=rr=null)}function mr(e){if(e.propertyName===`value`&&or(ir)){var t=[];nr(t,ir,e,$t(e)),an(ar,t)}}function hr(e,t,n){e===`focusin`?(pr(),rr=t,ir=n,rr.attachEvent(`onpropertychange`,mr)):e===`focusout`&&pr()}function V(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return or(ir)}function gr(e,t){if(e===`click`)return or(t)}function _r(e,t){if(e===`input`||e===`change`)return or(t)}function vr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var yr=typeof Object.is==`function`?Object.is:vr;function br(e,t){if(yr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ve.call(t,i)||!yr(e[i],t[i]))return!1}return!0}function xr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sr(e,t){var n=xr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=xr(n)}}function Cr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(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=Pt(e.document)}return t}function Tr(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 Er=sn&&`documentMode`in document&&11>=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==Pt(r)||(r=Dr,`selectionStart`in r&&Tr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&br(kr,r)||(kr=r,r=Fd(Or,`onSelect`),0<r.length&&(t=new vn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Dr)))}function Mr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Nr={animationend:Mr(`Animation`,`AnimationEnd`),animationiteration:Mr(`Animation`,`AnimationIteration`),animationstart:Mr(`Animation`,`AnimationStart`),transitionrun:Mr(`Transition`,`TransitionRun`),transitionstart:Mr(`Transition`,`TransitionStart`),transitioncancel:Mr(`Transition`,`TransitionCancel`),transitionend:Mr(`Transition`,`TransitionEnd`)},Pr={},Fr={};sn&&(Fr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Nr.animationend.animation,delete Nr.animationiteration.animation,delete Nr.animationstart.animation),`TransitionEvent`in window||delete Nr.transitionend.transition);function Ir(e){if(Pr[e])return Pr[e];if(!Nr[e])return e;var t=Nr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Fr)return Pr[e]=t[n];return e}var Lr=Ir(`animationend`),Rr=Ir(`animationiteration`),zr=Ir(`animationstart`),Br=Ir(`transitionrun`),Vr=Ir(`transitionstart`),Hr=Ir(`transitioncancel`),Ur=Ir(`transitionend`),Wr=new Map,Gr=`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(` `);Gr.push(`scrollEnd`);function Kr(e,t){Wr.set(e,t),bt(t,[e])}var qr=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&&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)},Jr=[],Yr=0,Xr=0;function Zr(){for(var e=Yr,t=Xr=Yr=0;t<e;){var n=Jr[t];Jr[t++]=null;var r=Jr[t];Jr[t++]=null;var i=Jr[t];Jr[t++]=null;var a=Jr[t];if(Jr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ti(n,i,a)}}function Qr(e,t,n,r){Jr[Yr++]=e,Jr[Yr++]=t,Jr[Yr++]=n,Jr[Yr++]=r,Xr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $r(e,t,n,r){return Qr(e,t,n,r),ni(e)}function ei(e,t){return Qr(e,null,null,t),ni(e)}function ti(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Fe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ni(e){if(50<vu)throw vu=0,yu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ri={};function ii(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ai(e,t,n,r){return new ii(e,t,n,r)}function oi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function si(e,t){var n=e.alternate;return n===null?(n=ai(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 ci(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 li(e,t,n,r,i,o){var s=0;if(r=e,typeof e==`function`)oi(e)&&(s=1);else if(typeof e==`string`)s=$f(e,n,L.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=ai(31,n,t,i),e.elementType=D,e.lanes=o,e;case _:return ui(n.children,i,o,t);case v:s=8,i|=24;break;case y:return e=ai(12,n,t,i|2),e.elementType=y,e.lanes=o,e;case C:return e=ai(13,n,t,i),e.elementType=C,e.lanes=o,e;case w:return e=ai(19,n,t,i),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=ai(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=ai(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=ai(6,e,null,t),e.lanes=n,e}function fi(e){var t=ai(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=ai(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var gi=[],_i=0,vi=null,yi=0,bi=[],xi=0,Si=null,Ci=1,wi=``;function Ti(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function Ei(e,t,n){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Si=e;var r=Ci;e=wi;var i=32-Fe(r)-1;r&=~(1<<i),n+=1;var a=32-Fe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-Fe(t)+i|n<<i|r,wi=a+e}else Ci=1<<a|n<<i|r,wi=e}function Di(e){e.return!==null&&(Ti(e,1),Ei(e,1,0))}function H(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===Si;)Si=bi[--xi],bi[xi]=null,wi=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null}function Oi(e,t){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Ci=t.id,wi=t.overflow,Si=e}var ki=null,Ai=null,ji=!1,Mi=null,Ni=!1,Pi=Error(a(519));function Fi(e){throw Vi(hi(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Pi}function Ii(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[it]=e,t[at]=r,n){case`dialog`:Od(`cancel`,t),Od(`close`,t);break;case`iframe`:case`object`:case`embed`:Od(`load`,t);break;case`video`:case`audio`:for(n=0;n<Td.length;n++)Od(Td[n],t);break;case`source`:Od(`error`,t);break;case`img`:case`image`:case`link`:Od(`error`,t),Od(`load`,t);break;case`details`:Od(`toggle`,t);break;case`input`:Od(`invalid`,t),Rt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Od(`invalid`,t);break;case`textarea`:Od(`invalid`,t),Ht(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Vd(t.textContent,n)?(r.popover!=null&&(Od(`beforetoggle`,t),Od(`toggle`,t)),r.onScroll!=null&&Od(`scroll`,t),r.onScrollEnd!=null&&Od(`scrollend`,t),r.onClick!=null&&(t.onclick=Zt),t=!0):t=!1,t||Fi(e,!0)}function Li(e){for(ki=e.return;ki;)switch(ki.tag){case 5:case 31:case 13:Ni=!1;return;case 27:case 3:Ni=!0;return;default:ki=ki.return}}function Ri(e){if(e!==ki)return!1;if(!ji)return Li(e),ji=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||$d(e.type,e.memoizedProps)),n=!n),n&&Ai&&Fi(e),Li(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Ai=bf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));Ai=bf(e)}else t===27?(t=Ai,cf(e.type)?(e=yf,yf=null,Ai=e):Ai=t):Ai=ki?vf(e.stateNode.nextSibling):null;return!0}function zi(){Ai=ki=null,ji=!1}function Bi(){var e=Mi;return e!==null&&(iu===null?iu=e:iu.push.apply(iu,e),Mi=null),e}function Vi(e){Mi===null?Mi=[e]:Mi.push(e)}var Hi=P(null),Ui=null,Wi=null;function Gi(e,t,n){I(Hi,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=Hi.current,F(Hi)}function qi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ji(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),qi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),qi(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Yi(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;yr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===oe.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[cp]:e.push(cp))}i=i.return}e!==null&&Ji(t,e,n,r),t.flags|=262144}function Xi(e){for(e=e.firstContext;e!==null;){if(!yr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zi(e){Ui=e,Wi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qi(e){return ea(Ui,e)}function $i(e,t){return Ui===null&&Zi(e),ea(e,t)}function ea(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wi===null){if(e===null)throw Error(a(308));Wi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wi=Wi.next=t;return n}var ta=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},na=t.unstable_scheduleCallback,ra=t.unstable_NormalPriority,ia={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function aa(){return{controller:new ta,data:new Map,refCount:0}}function oa(e){e.refCount--,e.refCount===0&&na(ra,function(){e.controller.abort()})}var sa=null,ca=0,la=0,ua=null;function da(e,t){if(sa===null){var n=sa=[];ca=0,la=yd(),ua={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ca++,t.then(fa,fa),t}function fa(){if(--ca===0&&sa!==null){ua!==null&&(ua.status=`fulfilled`);var e=sa;sa=null,la=0,ua=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function pa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ma=M.S;M.S=function(e,t){su=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&da(e,t),ma!==null&&ma(e,t)};var ha=P(null);function ga(){var e=ha.current;return e===null?Hl.pooledCache:e}function _a(e,t){t===null?I(ha,ha.current):I(ha,t.pool)}function va(){var e=ga();return e===null?null:{parent:ia._currentValue,pool:e}}var ya=Error(a(460)),ba=Error(a(474)),xa=Error(a(542)),Sa={then:function(){}};function Ca(e){return e=e.status,e===`fulfilled`||e===`rejected`}function wa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Zt,Zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e;default:if(typeof t.status==`string`)t.then(Zt,Zt);else{if(e=Hl,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Oa(e),e}throw Ea=t,ya}}function Ta(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ea=e,ya):e}}var Ea=null;function Da(){if(Ea===null)throw Error(a(459));var e=Ea;return Ea=null,e}function Oa(e){if(e===ya||e===xa)throw Error(a(483))}var ka=null,Aa=0;function ja(e){var t=Aa;return Aa+=1,ka===null&&(ka=[]),wa(ka,e,t)}function Ma(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Na(e,t){throw t.$$typeof===m?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Pa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=si(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===E&&Ta(a)===t.type)?(t=i(t,n.props),Ma(t,n),t.return=e,t):(t=li(n.type,n.key,n.props,null,e.mode,r),Ma(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ui(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=li(t.type,t.key,t.props,null,e.mode,n),Ma(n,t),n.return=e,n;case g:return t=pi(t,e.mode,n),t.return=e,t;case E:return t=Ta(t),f(e,t,n)}if(j(t)||k(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ja(t),n);if(t.$$typeof===x)return f(e,$i(e,t),n);Na(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=Ta(n),p(e,t,n,r)}if(j(n)||k(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ja(n),r);if(n.$$typeof===x)return p(e,t,$i(e,n),r);Na(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=Ta(r),m(e,t,n,r,i)}if(j(r)||k(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ja(r),i);if(r.$$typeof===x)return m(e,t,n,$i(t,r),i);Na(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ji&&Ti(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ji&&Ti(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ji&&Ti(i,h),l}function y(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),ji&&Ti(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ji&&Ti(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),ji&&Ti(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&Ta(l)===r.type){n(e,r.sibling),c=i(r,o.props),Ma(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===_?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Ma(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=Ta(o),b(e,r,o,c)}if(j(o))return v(e,r,o,c);if(k(o)){if(l=k(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ja(o),c);if(o.$$typeof===x)return b(e,r,$i(e,o),c);Na(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Aa=0;var i=b(e,t,n,r);return ka=null,i}catch(t){if(t===ya||t===xa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Fa=Pa(!0),Ia=Pa(!1),La=!1;function Ra(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function za(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 Ba(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Vl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Ha(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Ua(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Wa=!1;function Ga(){if(Wa){var e=ua;if(e!==null)throw e}}function Ka(e,t,n,r){Wa=!1;var i=e.updateQueue;La=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(Wl&f)===f:(r&f)===f){f!==0&&f===la&&(Wa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:La=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ql|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Ja(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)qa(n[e],t)}var Ya=P(null),Xa=P(0);function Za(e,t){e=Xl,I(Xa,e),I(Ya,t),Xl=e|t.baseLanes}function Qa(){I(Xa,Xl),I(Ya,Ya.current)}function $a(){Xl=Xa.current,F(Ya),F(Xa)}var eo=P(null),to=null;function no(e){var t=e.alternate;I(so,so.current&1),I(eo,e),to===null&&(t===null||Ya.current!==null||t.memoizedState!==null)&&(to=e)}function ro(e){I(so,so.current),I(eo,e),to===null&&(to=e)}function io(e){e.tag===22?(I(so,so.current),I(eo,e),to===null&&(to=e)):ao(e)}function ao(){I(so,so.current),I(eo,eo.current)}function oo(e){F(eo),to===e&&(to=null),F(so)}var so=P(0);function co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hf(n)||gf(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 lo=0,uo=null,fo=null,po=null,mo=!1,ho=!1,go=!1,_o=0,vo=0,yo=null,bo=0;function xo(){throw Error(a(321))}function So(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!yr(e[n],t[n]))return!1;return!0}function Co(e,t,n,r,i,a){return lo=a,uo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Bs:Vs,go=!1,a=n(r,i),go=!1,ho&&(a=To(t,n,r,i)),wo(e),a}function wo(e){M.H=zs;var t=fo!==null&&fo.next!==null;if(lo=0,po=fo=uo=null,mo=!1,vo=0,yo=null,t)throw Error(a(300));e===null||ic||(e=e.dependencies,e!==null&&Xi(e)&&(ic=!0))}function To(e,t,n,r){uo=e;var i=0;do{if(ho&&(yo=null),vo=0,ho=!1,25<=i)throw Error(a(301));if(i+=1,po=fo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Hs,o=t(n,r)}while(ho);return o}function Eo(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(fo===null?null:fo.memoizedState)!==e&&(uo.flags|=1024),t}function Do(){var e=_o!==0;return _o=0,e}function Oo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ko(e){if(mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mo=!1}lo=0,po=fo=uo=null,ho=!1,vo=_o=0,yo=null}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return po===null?uo.memoizedState=po=e:po=po.next=e,po}function jo(){if(fo===null){var e=uo.alternate;e=e===null?null:e.memoizedState}else e=fo.next;var t=po===null?uo.memoizedState:po.next;if(t!==null)po=t,fo=e;else{if(e===null)throw uo.alternate===null?Error(a(467)):Error(a(310));fo=e,e={memoizedState:fo.memoizedState,baseState:fo.baseState,baseQueue:fo.baseQueue,queue:fo.queue,next:null},po===null?uo.memoizedState=po=e:po=po.next=e}return po}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=vo;return vo+=1,yo===null&&(yo=[]),e=wa(yo,e,t),t=uo,(po===null?t.memoizedState:po.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Bs:Vs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===x)return Qi(e)}throw Error(a(438,String(e)))}function Fo(e){var t=null,n=uo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=uo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Mo(),uo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(jo(),fo,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(lo&f)===f:(Wl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===la&&(d=!0);else if((lo&p)===p){u=u.next,p===la&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,uo.lanes|=p,Ql|=p;f=u.action,go&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,uo.lanes|=f,Ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!yr(o,e.memoizedState)&&(ic=!0,d&&(n=ua,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=jo(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);yr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=uo,i=jo(),o=ji;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!yr((fo||i).memoizedState,n);if(s&&(i.memoizedState=n,ic=!0),i=i.queue,ds(Uo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||po!==null&&po.memoizedState.tag&1){if(r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,i,n,t),null),Hl===null)throw Error(a(349));o||lo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=uo.updateQueue,t===null?(t=Mo(),uo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yr(e,n)}catch{return!0}}function Go(e){var t=ei(e,2);t!==null&&Su(t,e,2)}function Ko(e){var t=Ao();if(typeof e==`function`){var n=e;if(e=n(),go){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function qo(e,t,n,r){return e.baseState=n,Ro(e,fo,typeof r==`function`?r:Io)}function Jo(e,t,n,r,i){if(Is(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Yo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Xo(e,t,s)}catch(n){Qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Xo(e,t,a)}catch(n){Qo(e,t,n)}}function Xo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Zo(e,t,n)},function(n){return Qo(e,t,n)}):Zo(e,t,n)}function Zo(e,t,n){t.status=`fulfilled`,t.value=n,$o(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yo(e,n)))}function Qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,$o(t),t=t.next;while(t!==r)}e.action=null}function $o(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function es(e,t){return t}function ts(e,t){if(ji){var n=Hl.formState;if(n!==null){a:{var r=uo;if(ji){if(Ai){b:{for(var i=Ai,a=Ni;i.nodeType!==8;){if(!a){i=null;break b}if(i=vf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ai=vf(i.nextSibling),r=i.data===`F!`;break a}}Fi(r)}r=!1}r&&(t=n[0])}}return n=Ao(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=r,n=Ns.bind(null,uo,r),r.dispatch=n,r=Ko(!1),a=Fs.bind(null,uo,!1,r.queue),r=Ao(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Jo.bind(null,uo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ns(e){return rs(jo(),fo,e)}function rs(e,t,n){if(t=Ro(e,t,es)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===ya?xa:e}else r=t;t=jo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(uo.flags|=2048,os(9,{destroy:void 0},is.bind(null,i,n),null)),[r,a,e]}function is(e,t){e.action=t}function as(e){var t=jo(),n=fo;if(n!==null)return rs(t,n,e);jo(),t=t.memoizedState,n=jo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=uo.updateQueue,t===null&&(t=Mo(),uo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return jo().memoizedState}function cs(e,t,n,r){var i=Ao();uo.flags|=e,i.memoizedState=os(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=jo();r=r===void 0?null:r;var a=i.memoizedState.inst;fo!==null&&r!==null&&So(r,fo.memoizedState.deps)?i.memoizedState=os(t,a,n,r):(uo.flags|=e,i.memoizedState=os(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){uo.flags|=4;var t=uo.updateQueue;if(t===null)t=Mo(),uo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=jo().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Vl&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(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 _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&So(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),go){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||lo&1073741824&&!(Wl&261930)?e.memoizedState=t:(e.memoizedState=n,e=xu(),uo.lanes|=e,Ql|=e,n)}function Ss(e,t,n,r){return yr(n,t)?n:Ya.current===null?!(lo&42)||lo&1073741824&&!(Wl&261930)?(ic=!0,e.memoizedState=n):(e=xu(),uo.lanes|=e,Ql|=e,t):(e=xs(e,n,r),yr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Fs(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,pa(c,r),bu(e)):Ps(e,t,r,bu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Es(e).queue;Cs(e,i,t,ne,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},bu())}function Os(){return Qi(cp)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=Ba(n);var r=Va(t,e,n);r!==null&&(Su(r,t,n),Ha(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=$r(e,t,n,r),n!==null&&(Su(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,bu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,yr(s,o))return Qr(e,t,i,0),Hl===null&&Zr(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return Su(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(a(479))}else t=$r(e,n,r,2),t!==null&&Su(t,e,2)}function Is(e){var t=e.alternate;return e===uo||t!==null&&t===uo}function Ls(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var zs={readContext:Qi,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};zs.useEffectEvent=xo;var Bs={readContext:Qi,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,uo,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,uo,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=uo,i=Ao();if(ji){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Hl===null)throw Error(a(349));Wl&127||Vo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Hl.identifierPrefix;if(ji){var n=wi,r=Ci;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=bo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e){var t=Ao();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,uo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return Ao().memoizedState=js.bind(null,uo)},useEffectEvent:function(e){var t=Ao(),n={impl:e};return t.memoizedState=n,function(){if(Vl&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:Qi,use:Po,useCallback:ys,useContext:Qi,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Lo,useRef:ss,useState:function(){return Lo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(jo(),fo.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){return qo(jo(),fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:Qi,use:Po,useCallback:ys,useContext:Qi,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ss,useState:function(){return zo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){var n=jo();return fo===null?xs(n,e,t):Ss(n,fo.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:as,useActionState:as,useOptimistic:function(e,t){var n=jo();return fo===null?(n.baseState=e,[e,n.queue.dispatch]):qo(n,fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ba(r);i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(Su(t,e,r),Ha(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bu(),i=Ba(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Va(e,i,r),t!==null&&(Su(t,e,r),Ha(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bu(),r=Ba(n);r.tag=2,t!=null&&(r.callback=t),t=Va(e,r,n),t!==null&&(Su(t,e,n),Ha(t,e,n))}};function Gs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!br(n,r)||!br(i,a):!0}function Ks(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){qr(e)}function Ys(e){console.error(e)}function Xs(e){qr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Ba(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Ba(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(uu===null?uu=new Set([this]):uu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Yi(t,n,i,!0),n=eo.current,n!==null){switch(n.tag){case 31:case 13:return to===null?Pu():n.alternate===null&&Zl===0&&(Zl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),$u(e,r,i)),!1;case 22:return n.flags|=65536,r===Sa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),$u(e,r,i)),!1}throw Error(a(435,n.tag))}return $u(e,r,i),Pu(),!1}if(ji)return t=eo.current,t===null?(r!==Pi&&(t=Error(a(423),{cause:r}),Vi(hi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=hi(r,n),i=$s(e.stateNode,r,i),Ua(e,i),Zl!==4&&(Zl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Pi&&(e=Error(a(422),{cause:r}),Vi(hi(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=hi(o,n),ru===null?ru=[o]:ru.push(o),Zl!==4&&(Zl=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=$s(n.stateNode,r,e),Ua(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(uu===null||!uu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=ec(i),tc(i,e,n,r),Ua(n,i),!1}n=n.return}while(n!==null);return!1}var rc=Error(a(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?Ia(t,null,n,r):Fa(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Zi(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(ji&&s&&Di(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!oi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?br:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=si(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(br(a,r)&&e.ref===t.ref){if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_a(t,a===null?null:a.cachePool),a===null?Qa():Za(t,a),io(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&_a(t,null),Qa(),ao(t)):(_a(t,a.cachePool),Za(t,a),ao(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=ga();return a=a===null?null:{parent:ia._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&_a(t,null),Qa(),io(t),e!==null&&Yi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Fa(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,oo(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(ji){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(ro(t),(e=Ai)?(e=mf(e,Ni),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ro(t),i){if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558))}else if(ic||Yi(e,t,n,!1),i=(n&e.childLanes)!==0,ic||i){if(r=Hl,r!==null&&(s=Qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ei(e,s),Su(r,e,s),rc;Pu(),t=pc(e,t,n)}else e=o.treeContext,Ai=vf(s.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=fc(t,r),t.flags|=4096;return t}return e=si(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(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(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return Zi(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(ji&&r&&Di(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return Zi(t),t.updateQueue=null,n=To(t,r,n,i),wo(e),r=Do(),e!==null&&!ic?(Oo(e,t,a),Ac(e,t,a)):(ji&&r&&Di(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(Zi(t),t.stateNode===null){var a=ri,o=n.contextType;typeof o==`object`&&o&&(a=Qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ra(t),o=n.contextType,a.context=typeof o==`object`&&o?Qi(o):ri,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),Ka(t,r,a,i),Ga(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ri,typeof u==`object`&&u&&(o=Qi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),La=!1;var f=t.memoizedState;a.state=f,Ka(t,r,a,i),Ga(),l=t.memoizedState,s||f!==l||La?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=La||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,za(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ri,typeof l==`object`&&l&&(c=Qi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),La=!1,f=t.memoizedState,a.state=f,Ka(t,r,a,i),Ga();var p=t.memoizedState;o!==d||f!==p||La||e!==null&&e.dependencies!==null&&Xi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=La||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Xi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Fa(t,e.child,null,i),t.child=Fa(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return zi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:va()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=tu),e}function Cc(e,t,n){var r=t.pendingProps,i=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(so.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(ji){if(i?no(t):ao(t),(e=Ai)?(e=mf(e,Ni),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Fi(t);return gf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(ao(t),i=t.mode,c=Tc({mode:`hidden`,children:c},i),r=ui(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(no(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(no(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(ao(t),c=r.fallback,i=t.mode,r=Tc({mode:`visible`,children:r.children},i),c=ui(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Fa(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(ao(t),t.child=e.child,t.flags|=128,t=null);else if(no(t),gf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(a(419)),r.stack=``,r.digest=s,Vi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Yi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Hl,s!==null&&(r=Qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ei(e,r),Su(s,e,r),rc;hf(c)||Pu(),t=Ec(e,t,n)}else hf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ai=vf(c.nextSibling),ki=t,ji=!0,Mi=null,Ni=!1,e!==null&&Oi(t,e),t=wc(t,r.children),t.flags|=4096);return t}return i?(ao(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=si(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,i,n,null),c.flags|=2):c=si(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(i=c.cachePool,i===null?i=va():(l=ia._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(no(t),n=e.child,e=n.sibling,n=si(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=ai(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Fa(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qi(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=so.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,I(so,o),ac(e,t,r,n),r=ji?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ql|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Yi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=si(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=si(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Xi(e)))}function Mc(e,t,n){switch(t.tag){case 3:z(t,t.stateNode.containerInfo),Gi(t,ia,e.memoizedState.cache),zi();break;case 27:case 5:ce(t);break;case 4:z(t,t.stateNode.containerInfo);break;case 10:Gi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ro(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(no(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(no(t),t.flags|=128,null);no(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Yi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(so,so.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Gi(t,ia,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}}else ic=!1,ji&&t.flags&1048576&&Ei(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ta(t.elementType),t.type=e,typeof e==`function`)oi(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===S){t.tag=11,t=oc(null,t,e,r,n);break a}if(i===T){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=te(e)||e,Error(a(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=qs(r,t.pendingProps),vc(e,t,r,i,n);case 3:a:{if(z(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,za(e,t),Ka(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Gi(t,ia,r),r!==o.cache&&Ji(t,[ia],n,!0),Ga(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}if(r!==i){i=hi(Error(a(424)),t),Vi(i),t=yc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ai=vf(e.firstChild),ki=t,ji=!0,Mi=null,Ni=!0,n=Ia(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(zi(),r===i){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=zf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ji||(n=t.type,e=t.pendingProps,r=Xd(R.current).createElement(n),r[it]=t,r[at]=e,Wd(r,n,e),_t(r),t.stateNode=r):t.memoizedState=zf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&ji&&(r=t.stateNode=Sf(t.type,t.pendingProps,R.current),ki=t,Ni=!0,i=Ai,cf(t.type)?(yf=i,Ai=vf(r.firstChild)):Ai=i),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ji&&((i=r=Ai)&&(r=ff(r,t.type,t.pendingProps,Ni),r===null?i=!1:(t.stateNode=r,ki=t,Ai=vf(r.firstChild),Ni=!1,i=!0)),i||Fi(t)),ce(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,$d(i,o)?r=null:s!==null&&$d(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Co(e,t,Eo,null,null,n),cp._currentValue=i),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&ji&&((e=n=Ai)&&(n=pf(n,t.pendingProps,Ni),n===null?e=!1:(t.stateNode=n,ki=t,Ai=null,e=!0)),e||Fi(t)),null;case 13:return Cc(e,t,n);case 4:return z(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fa(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Gi(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Zi(t),i=Qi(i),r=r(i),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return Zi(t),r=Qi(ia),e===null?(i=ga(),i===null&&(i=Hl,o=aa(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},Ra(t),Gi(t,ia,i)):((e.lanes&n)!==0&&(za(e,t),Ka(t,null,null,n),Ga()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,Gi(t,ia,r),r!==i.cache&&Ji(t,[ia],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Gi(t,ia,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(ju())e.flags|=8192;else throw Ea=Sa,ba}}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!ep(t)){if(ju())e.flags|=8192;else throw Ea=Sa,ba}}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ke(),e.lanes|=t,nu|=t)}function Rc(e,t){if(!ji)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bc(e,t,n){var r=t.pendingProps;switch(H(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ki(ia),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ri(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bi())),zc(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,i,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,i,e,r,n)),null;case 27:if(le(t),n=R.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return zc(t),null}e=L.current,Ri(t)?Ii(t,e):(e=Sf(i,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(le(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return zc(t),null}if(o=L.current,Ri(t))Ii(t,o);else{var s=Xd(R.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Wd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=R.current,Ri(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ki,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Vd(e.nodeValue,n)),e||Fi(t,!0)}else e=Xd(e).createTextNode(r),e[it]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ri(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[it]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(oo(t),t):(oo(t),null);if(t.flags&128)throw Error(a(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ri(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[it]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),i=!1}else i=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(oo(t),t):(oo(t),null)}return oo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return se(),e===null&&jd(t.stateNode.containerInfo),zc(t),null;case 10:return Ki(t.type),zc(t),null;case 19:if(F(so),r=t.memoizedState,r===null)return zc(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)Rc(r,!1);else{if(Zl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=co(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return I(so,so.current&1|2),ji&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>cu&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=co(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ji)return zc(t),null}else 2*Ce()-r.renderingStartTime>cu&&n!==536870912&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=so.current,I(so,i?n&1|2:n&1),ji&&Ti(t,r.treeForkCount),e);case 22:case 23:return oo(t),$a(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&F(ha),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ia),zc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Vc(e,t){switch(H(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ia),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(oo(t),t.alternate===null)throw Error(a(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(oo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F(so),null;case 4:return se(),null;case 10:return Ki(t.type),null;case 22:case 23:return oo(t),$a(),e!==null&&F(ha),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ia),null;case 25:return null;default:return null}}function Hc(e,t){switch(H(t),t.tag){case 3:Ki(ia),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&oo(t);break;case 13:oo(t);break;case 19:F(so);break;case 10:Ki(t.type);break;case 22:case 23:oo(t),$a(),e!==null&&F(ha);break;case 24:Ki(ia)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Qu(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Qu(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ja(t,n)}catch(t){Qu(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Qu(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Qu(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Qu(e,t,n)}else n.current=null}}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Qu(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Gd(r,e.type,n,t),r[at]=t}catch(t){Qu(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&cf(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(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&&cf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zt));else if(r!==4&&(r===27&&cf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&cf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function U(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Wd(t,r,n),t[it]=e,t[at]=n}catch(t){Qu(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Jd=_p,e=wr(e),Tr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Yd={focusedElem:e,selectionRange:n},_p=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,i);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)df(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:df(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(a(163))}if(e=t.sibling,e!==null){e.return=t.return,al=e;break}al=t.return}}function sl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Sl(e,n),r&4&&Uc(5,n);break;case 1:if(Sl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Qu(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Qu(n,n.return,e)}}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Sl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ja(e,t)}catch(e){Qu(n,n.return,e)}}break;case 27:t===null&&r&4&&U(n);case 26:case 5:Sl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Sl(e,n);break;case 31:Sl(e,n),r&4&&pl(e,n);break;case 13:Sl(e,n),r&4&&ml(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=nd.bind(null,n),_f(e,n))));break;case 22:if(r=n.memoizedState!==null||tl,!r){t=t!==null&&t.memoizedState!==null||nl,i=tl;var a=nl;tl=r,(nl=t)&&!a?wl(e,n,!!(n.subtreeFlags&8772)):Sl(e,n),tl=i,nl=a}break;case 30:break;default:Sl(e,n)}}function cl(e){var t=e.alternate;t!==null&&(e.alternate=null,cl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ft(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 ll=null,ul=!1;function dl(e,t,n){for(n=n.child;n!==null;)fl(e,t,n),n=n.sibling}function fl(e,t,n){if(Ne&&typeof Ne.onCommitFiberUnmount==`function`)try{Ne.onCommitFiberUnmount(Me,n)}catch{}switch(n.tag){case 26:nl||Jc(n,t),dl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:nl||Jc(n,t);var r=ll,i=ul;cf(n.type)&&(ll=n.stateNode,ul=!1),dl(e,t,n),Cf(n.stateNode),ll=r,ul=i;break;case 5:nl||Jc(n,t);case 6:if(r=ll,i=ul,ll=null,dl(e,t,n),ll=r,ul=i,ll!==null){if(ul)try{(ll.nodeType===9?ll.body:ll.nodeName===`HTML`?ll.ownerDocument.body:ll).removeChild(n.stateNode)}catch(e){Qu(n,t,e)}else try{ll.removeChild(n.stateNode)}catch(e){Qu(n,t,e)}}break;case 18:ll!==null&&(ul?(e=ll,lf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Up(e)):lf(ll,n.stateNode));break;case 4:r=ll,i=ul,ll=n.stateNode.containerInfo,ul=!0,dl(e,t,n),ll=r,ul=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),nl||Wc(4,n,t),dl(e,t,n);break;case 1:nl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),dl(e,t,n);break;case 21:dl(e,t,n);break;case 22:nl=(r=nl)||n.memoizedState!==null,dl(e,t,n),nl=r;break;default:dl(e,t,n)}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Up(e)}catch(e){Qu(t,t.return,e)}}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Up(e)}catch(e){Qu(t,t.return,e)}}function hl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new il),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new il),t;default:throw Error(a(435,e.tag))}}function gl(e,t){var n=hl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=rd.bind(null,e,t);t.then(r,r)}})}function _l(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(cf(c.type)){ll=c.stateNode,ul=!1;break a}break;case 5:ll=c.stateNode,ul=!1;break a;case 3:case 4:ll=c.stateNode.containerInfo,ul=!0;break a}c=c.return}if(ll===null)throw Error(a(160));fl(o,s,i),ll=null,ul=!1,o=i.alternate,o!==null&&(o.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)yl(t,e),t=t.sibling}var vl=null;function yl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:_l(t,e),bl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:_l(t,e),bl(e),r&512&&(nl||n===null||Jc(n,n.return)),r&64&&tl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=vl;if(_l(t,e),bl(e),r&512&&(nl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:o=i.getElementsByTagName(`title`)[0],(!o||o[dt]||o[it]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector(`head > title`))),Wd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=Zf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=i.createElement(r),Wd(o,r,n),i.head.appendChild(o);break;case`meta`:if(s=Zf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=i.createElement(r),Wd(o,r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[it]=e,_t(o),r=o}e.stateNode=r}else Qf(i,e.type,e.stateNode)}else e.stateNode=Kf(i,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Qf(i,e.type,e.stateNode):Kf(i,r,e.memoizedProps))}break;case 27:_l(t,e),bl(e),r&512&&(nl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(_l(t,e),bl(e),r&512&&(nl||n===null||Jc(n,n.return)),e.flags&32){i=e.stateNode;try{Ut(i,``)}catch(t){Qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Xc(e,i,n===null?i:n.memoizedProps)),r&1024&&(rl=!0);break;case 6:if(_l(t,e),bl(e),r&4){if(e.stateNode===null)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Qu(e,e.return,t)}}break;case 3:if(Xf=null,i=vl,vl=Ef(t.containerInfo),_l(t,e),vl=i,bl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Up(t.containerInfo)}catch(t){Qu(e,e.return,t)}rl&&(rl=!1,xl(e));break;case 4:r=vl,vl=Ef(e.stateNode.containerInfo),_l(t,e),bl(e),vl=r;break;case 12:_l(t,e),bl(e);break;case 31:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 13:_l(t,e),bl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ou=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=tl,d=nl;if(tl=u||i,nl=d||l,_l(t,e),nl=d,tl=u,bl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||tl||nl||Cl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,i)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?uf(m,!0):uf(l.stateNode,!1)}catch(e){Qu(l,l.return,e)}}}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 a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,gl(e,n))));break;case 19:_l(t,e),bl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,gl(e,r)));break;case 30:break;case 21:break;default:_l(t,e),bl(e)}}function bl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;el(e,Qc(e),i);break;case 5:var o=n.stateNode;n.flags&32&&(Ut(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(a(161))}}catch(t){Qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;xl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Sl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)sl(e,t.alternate,t),t=t.sibling}function Cl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),Cl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),Cl(t);break;case 27:Cf(t.stateNode);case 26:case 5:Jc(t,t.return),Cl(t);break;case 22:t.memoizedState===null&&Cl(t);break;case 30:Cl(t);break;default:Cl(t)}e=e.sibling}}function wl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:wl(i,a,n),Uc(4,a);break;case 1:if(wl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Qu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)qa(c[i],s)}catch(e){Qu(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:U(a);case 26:case 5:wl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:wl(i,a,n);break;case 31:wl(i,a,n),n&&o&4&&pl(i,a);break;case 13:wl(i,a,n),n&&o&4&&ml(i,a);break;case 22:a.memoizedState===null&&wl(i,a,n),qc(a,a.return);break;case 30:break;default:wl(i,a,n)}t=t.sibling}}function Tl(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&&oa(n))}function El(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e))}function Dl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ol(e,t,n,r),t=t.sibling}function Ol(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Dl(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Dl(e,t,n,r);break;case 3:Dl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e)));break;case 12:if(i&2048){Dl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Qu(t,t.return,e)}}else Dl(e,t,n,r);break;case 31:Dl(e,t,n,r);break;case 13:Dl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Dl(e,t,n,r):(a._visibility|=2,kl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Dl(e,t,n,r):Al(e,t),i&2048&&Tl(o,t);break;case 24:Dl(e,t,n,r),i&2048&&El(t.alternate,t);break;default:Dl(e,t,n,r)}}function kl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:kl(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,kl(a,o,s,c,i)):u._visibility&2?kl(a,o,s,c,i):Al(a,o),i&&l&2048&&Tl(o.alternate,o);break;case 24:kl(a,o,s,c,i),i&&l&2048&&El(o.alternate,o);break;default:kl(a,o,s,c,i)}t=t.sibling}}function Al(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Al(n,r),i&2048&&Tl(r.alternate,r);break;case 24:Al(n,r),i&2048&&El(r.alternate,r);break;default:Al(n,r)}t=t.sibling}}var jl=8192;function Ml(e,t,n){if(e.subtreeFlags&jl)for(e=e.child;e!==null;)Nl(e,t,n),e=e.sibling}function Nl(e,t,n){switch(e.tag){case 26:Ml(e,t,n),e.flags&jl&&e.memoizedState!==null&&tp(n,vl,e.memoizedState,e.memoizedProps);break;case 5:Ml(e,t,n);break;case 3:case 4:var r=vl;vl=Ef(e.stateNode.containerInfo),Ml(e,t,n),vl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jl,jl=16777216,Ml(e,t,n),jl=r):Ml(e,t,n));break;default:Ml(e,t,n)}}function Pl(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 Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Rl(r,e)}Pl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Il(e),e=e.sibling}function Il(e){switch(e.tag){case 0:case 11:case 15:Fl(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Fl(e);break;case 12:Fl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ll(e)):Fl(e);break;default:Fl(e)}}function Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];al=r,Rl(r,e)}Pl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Ll(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ll(t));break;default:Ll(t)}e=e.sibling}}function Rl(e,t){for(;al!==null;){var n=al;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:oa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,al=r;else a:for(n=e;al!==null;){r=al;var i=r.sibling,a=r.return;if(cl(r),r===n){al=null;break a}if(i!==null){i.return=a,al=i;break a}al=a}}}var zl={getCacheForType:function(e){var t=Qi(ia),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Qi(ia).controller.signal}},Bl=typeof WeakMap==`function`?WeakMap:Map,Vl=0,Hl=null,Ul=null,Wl=0,Gl=0,Kl=null,ql=!1,Jl=!1,Yl=!1,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=null,iu=null,au=!1,ou=0,su=0,cu=1/0,lu=null,uu=null,du=0,fu=null,pu=null,mu=0,hu=0,gu=null,_u=null,vu=0,yu=null;function bu(){return Vl&2&&Wl!==0?Wl&-Wl:M.T===null?tt():yd()}function xu(){if(tu===0){if(!(Wl&536870912)||ji){var e=Be;Be<<=1,!(Be&3932160)&&(Be=262144),tu=e}else tu=536870912}return e=eo.current,e!==null&&(e.flags|=32),tu}function Su(e,t,n){(e===Hl&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)&&(ku(e,0),Eu(e,Wl,tu,!1)),Je(e,n),(!(Vl&2)||e!==Hl)&&(e===Hl&&(!(Vl&2)&&($l|=n),Zl===4&&Eu(e,Wl,tu,!1)),dd(e))}function Cu(e,t,n){if(Vl&6)throw Error(a(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||We(e,t),i=r?Lu(e,t):Fu(e,t,!0),o=r;do{if(i===0){Jl&&!r&&Eu(e,t,0,!1);break}if(n=e.current.alternate,o&&!Tu(n)){i=Fu(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ru;var l=c.current.memoizedState.isDehydrated;if(l&&(ku(c,s).flags|=256),s=Fu(c,s,!1),s!==2){if(Yl&&!l){c.errorRecoveryDisabledLanes|=o,$l|=o,i=4;break a}o=iu,iu=i,o!==null&&(iu===null?iu=o:iu.push.apply(iu,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){ku(e,0),Eu(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:Eu(r,t,tu,!ql);break a;case 2:iu=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=ou+300-Ce(),10<i)){if(Eu(r,t,tu,!ql),Ue(r,0,!0)!==0)break a;mu=t,r.timeoutHandle=nf(wu.bind(null,r,n,iu,lu,au,t,tu,$l,nu,ql,o,`Throttled`,-0,0),i);break a}wu(r,n,iu,lu,au,t,tu,$l,nu,ql,o,null,-0,0)}break}while(1);dd(e)}function wu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zt},Nl(t,a,d);var m=(a&62914560)===a?ou-Ce():(a&4194048)===a?su-Ce():0;if(m=rp(d,m),m!==null){mu=a,e.cancelPendingCommit=m(Wu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Eu(e,a,o,!l);return}}Wu(e,t,a,n,r,i,o,s,c)}function Tu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!yr(a(),i))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 Eu(e,t,n,r){t&=~eu,t&=~$l,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Fe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Xe(e,n,t)}function Du(){return Vl&6?!0:(fd(0,!1),!1)}function Ou(){if(Ul!==null){if(Gl===0)var e=Ul.return;else e=Ul,Wi=Ui=null,ko(e),ka=null,Aa=0,e=Ul;for(;e!==null;)Hc(e.alternate,e),e=e.return;Ul=null}}function ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,rf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),mu=0,Ou(),Hl=e,Ul=n=si(e.current,null),Wl=t,Gl=0,Kl=null,ql=!1,Jl=We(e,t),Yl=!1,nu=tu=eu=$l=Ql=Zl=0,iu=ru=null,au=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Fe(r),a=1<<i;t|=e[i],r&=~a}return Xl=t,Zr(),n}function Au(e,t){uo=null,M.H=zs,t===ya||t===xa?(t=Da(),Gl=3):t===ba?(t=Da(),Gl=4):Gl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Kl=t,Ul===null&&(Zl=1,Zs(e,hi(t,e.current)))}function ju(){var e=eo.current;return e===null?!0:(Wl&4194048)===Wl?to===null:(Wl&62914560)===Wl||Wl&536870912?e===to:!1}function Mu(){var e=M.H;return M.H=zs,e===null?zs:e}function Nu(){var e=M.A;return M.A=zl,e}function Pu(){Zl=4,ql||(Wl&4194048)!==Wl&&eo.current!==null||(Jl=!0),!(Ql&134217727)&&!($l&134217727)||Hl===null||Eu(Hl,Wl,tu,!1)}function Fu(e,t,n){var r=Vl;Vl|=2;var i=Mu(),a=Nu();(Hl!==e||Wl!==t)&&(lu=null,ku(e,t)),t=!1;var o=Zl;a:do try{if(Gl!==0&&Ul!==null){var s=Ul,c=Kl;switch(Gl){case 8:Ou(),o=6;break a;case 3:case 2:case 9:case 6:eo.current===null&&(t=!0);var l=Gl;if(Gl=0,Kl=null,Vu(e,s,c,l),n&&Jl){o=0;break a}break;default:l=Gl,Gl=0,Kl=null,Vu(e,s,c,l)}}Iu(),o=Zl;break}catch(t){Au(e,t)}while(1);return t&&e.shellSuspendCounter++,Wi=Ui=null,Vl=r,M.H=i,M.A=a,Ul===null&&(Hl=null,Wl=0,Zr()),o}function Iu(){for(;Ul!==null;)zu(Ul)}function Lu(e,t){var n=Vl;Vl|=2;var r=Mu(),i=Nu();Hl!==e||Wl!==t?(lu=null,cu=Ce()+500,ku(e,t)):Jl=We(e,t);a:do try{if(Gl!==0&&Ul!==null){t=Ul;var o=Kl;b:switch(Gl){case 1:Gl=0,Kl=null,Vu(e,t,o,1);break;case 2:case 9:if(Ca(o)){Gl=0,Kl=null,Bu(t);break}t=function(){Gl!==2&&Gl!==9||Hl!==e||(Gl=7),dd(e)},o.then(t,t);break a;case 3:Gl=7;break a;case 4:Gl=5;break a;case 7:Ca(o)?(Gl=0,Kl=null,Bu(t)):(Gl=0,Kl=null,Vu(e,t,o,7));break;case 5:var s=null;switch(Ul.tag){case 26:s=Ul.memoizedState;case 5:case 27:var c=Ul;if(s?ep(s):c.stateNode.complete){Gl=0,Kl=null;var l=c.sibling;if(l!==null)Ul=l;else{var u=c.return;u===null?Ul=null:(Ul=u,Hu(u))}break b}}Gl=0,Kl=null,Vu(e,t,o,5);break;case 6:Gl=0,Kl=null,Vu(e,t,o,6);break;case 8:Ou(),Zl=6;break a;default:throw Error(a(462))}}Ru();break}catch(t){Au(e,t)}while(1);return Wi=Ui=null,M.H=r,M.A=i,Vl=n,Ul===null?(Hl=null,Wl=0,Zr(),Zl):0}function Ru(){for(;Ul!==null&&!xe();)zu(Ul)}function zu(e){var t=Nc(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,t===null?Hu(e):Ul=t}function Bu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,Wl);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,Wl);break;case 5:ko(t);default:Hc(n,t),t=Ul=ci(t,Xl),t=Nc(n,t,Xl)}e.memoizedProps=e.pendingProps,t===null?Hu(e):Ul=t}function Vu(e,t,n,r){Wi=Ui=null,ko(t),ka=null,Aa=0;var i=t.return;try{if(nc(e,i,t,n,Wl)){Zl=1,Zs(e,hi(n,e.current)),Ul=null;return}}catch(t){if(i!==null)throw Ul=i,t;Zl=1,Zs(e,hi(n,e.current)),Ul=null;return}t.flags&32768?(ji||r===1?e=!0:Jl||Wl&536870912?e=!1:(ql=e=!0,(r===2||r===9||r===3||r===6)&&(r=eo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Uu(t,e)):Hu(t)}function Hu(e){var t=e;do{if(t.flags&32768){Uu(t,ql);return}e=t.return;var n=Bc(t.alternate,t,Xl);if(n!==null){Ul=n;return}if(t=t.sibling,t!==null){Ul=t;return}Ul=t=e}while(t!==null);Zl===0&&(Zl=5)}function Uu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,Ul=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ul=e;return}Ul=e=n}while(e!==null);Zl=6,Ul=null}function Wu(e,t,n,r,i,o,s,c,l){e.cancelPendingCommit=null;do Yu();while(du!==0);if(Vl&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,o|=Xr,Ye(e,n,o,s,c,l),e===Hl&&(Ul=Hl=null,Wl=0),pu=t,fu=e,mu=n,hu=o,gu=i,_u=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,id(De,function(){return Xu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=M.T,M.T=null,i=N.p,N.p=2,s=Vl,Vl|=4;try{ol(e,t,n)}finally{Vl=s,N.p=i,M.T=r}}du=1,Gu(),Ku(),qu()}}function Gu(){if(du===1){du=0;var e=fu,t=pu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=Vl;Vl|=4;try{yl(t,e);var a=Yd,o=wr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Cr(s.ownerDocument.documentElement,s)){if(c!==null&&Tr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Sr(s,h),v=Sr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}_p=!!Jd,Yd=Jd=null}finally{Vl=i,N.p=r,M.T=n}}e.current=t,du=2}}function Ku(){if(du===2){du=0;var e=fu,t=pu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=Vl;Vl|=4;try{sl(e,t.alternate,t)}finally{Vl=i,N.p=r,M.T=n}}du=3}}function qu(){if(du===4||du===3){du=0,Se();var e=fu,t=pu,n=mu,r=_u;t.subtreeFlags&10256||t.flags&10256?du=5:(du=0,pu=fu=null,Ju(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(uu=null),et(n),t=t.stateNode,Ne&&typeof Ne.onCommitFiberRoot==`function`)try{Ne.onCommitFiberRoot(Me,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}mu&3&&Yu(),dd(e),i=e.pendingLanes,n&261930&&i&42?e===yu?vu++:(vu=0,yu=e):vu=0,fd(0,!1)}}function Ju(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oa(t)))}function Yu(){return Gu(),Ku(),qu(),Xu()}function Xu(){if(du!==5)return!1;var e=fu,t=hu;hu=0;var n=et(mu),r=M.T,i=N.p;try{N.p=32>n?32:n,M.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,Vl&6)throw Error(a(331));var c=Vl;if(Vl|=4,Il(o.current),Ol(o,o.current,s,n),Vl=c,fd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{N.p=i,M.T=r,Ju(e,t)}}function Zu(e,t,n){t=hi(n,t),t=$s(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Je(e,2),dd(e))}function Qu(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=hi(n,e),n=ec(2),r=Va(t,n,2),r!==null&&(tc(n,r,t,e),Je(r,2),dd(r));break}}t=t.return}}function $u(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Yl=!0,i.add(n),e=ed.bind(null,e,t,n),t.then(e,e))}function ed(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Hl===e&&(Wl&n)===n&&(Zl===4||Zl===3&&(Wl&62914560)===Wl&&300>Ce()-ou?!(Vl&2)&&ku(e,0):eu|=n,nu===Wl&&(nu=0)),dd(e)}function td(e,t){t===0&&(t=Ke()),e=ei(e,t),e!==null&&(Je(e,t),dd(e))}function nd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),td(e,n)}function rd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),td(e,n)}function id(e,t){return ye(e,t)}var ad=null,od=null,sd=!1,cd=!1,ld=!1,ud=0;function dd(e){e!==od&&e.next===null&&(od===null?ad=od=e:od=od.next=e),cd=!0,sd||(sd=!0,vd())}function fd(e,t){if(!ld&&cd){ld=!0;do for(var n=!1,r=ad;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,_d(r,a))}else a=Wl,a=Ue(r,r===Hl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,_d(r,a))}r=r.next}while(n);ld=!1}}function pd(){md()}function md(){cd=sd=!1;var e=0;ud!==0&&tf()&&(e=ud);for(var t=Ce(),n=null,r=ad;r!==null;){var i=r.next,a=hd(r,t);a===0?(r.next=null,n===null?ad=i:n.next=i,i===null&&(od=n)):(n=r,(e!==0||a&3)&&(cd=!0)),r=i}du!==0&&du!==5||fd(e,!1),ud!==0&&(ud=0)}function hd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Fe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ge(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Hl,n=Wl,n=Ue(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Gl===2||Gl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||We(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),et(n)){case 2:case 8:n=Ee;break;case 32:n=De;break;case 268435456:n=ke;break;default:n=De}return r=gd.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function gd(e,t){if(du!==0&&du!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Yu()&&e.callbackNode!==n)return null;var r=Wl;return r=Ue(e,e===Hl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Cu(e,r,t),hd(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?gd.bind(null,e):null)}function _d(e,t){if(Yu())return null;Cu(e,t,!0)}function vd(){of(function(){Vl&6?ye(Te,pd):md()})}function yd(){if(ud===0){var e=la;e===0&&(e=ze,ze<<=1,!(ze&261888)&&(ze=256)),ud=e}return ud}function bd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Xt(``+e)}function xd(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 Sd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=bd((i[at]||null).action),o=r.submitter;o&&(t=(t=o[at]||null)?bd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new vn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ud!==0){var e=o?xd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?xd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Cd=0;Cd<Gr.length;Cd++){var wd=Gr[Cd];Kr(wd.toLowerCase(),`on`+(wd[0].toUpperCase()+wd.slice(1)))}Kr(Lr,`onAnimationEnd`),Kr(Rr,`onAnimationIteration`),Kr(zr,`onAnimationStart`),Kr(`dblclick`,`onDoubleClick`),Kr(`focusin`,`onFocus`),Kr(`focusout`,`onBlur`),Kr(Br,`onTransitionRun`),Kr(Vr,`onTransitionStart`),Kr(Hr,`onTransitionCancel`),Kr(Ur,`onTransitionEnd`),xt(`onMouseEnter`,[`mouseout`,`mouseover`]),xt(`onMouseLeave`,[`mouseout`,`mouseover`]),xt(`onPointerEnter`,[`pointerout`,`pointerover`]),xt(`onPointerLeave`,[`pointerout`,`pointerover`]),bt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),bt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),bt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),bt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),bt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Td=`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(` `),Ed=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Td));function Dd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}}}}function Od(e,t){var n=t[st];n===void 0&&(n=t[st]=new Set);var r=e+`__bubble`;n.has(r)||(Md(t,e,2,!1),n.add(r))}function kd(e,t,n){var r=0;t&&(r|=4),Md(n,e,r,t)}var Ad=`_reactListening`+Math.random().toString(36).slice(2);function jd(e){if(!e[Ad]){e[Ad]=!0,vt.forEach(function(t){t!==`selectionchange`&&(Ed.has(t)||kd(t,!1,e),kd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ad]||(t[Ad]=!0,kd(`selectionchange`,!1,t))}}function Md(e,t,n,r){switch(wp(t)){case 2:var i=vp;break;case 8:i=yp;break;default:i=bp}n=i.bind(null,t,n,e),i=void 0,!cn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Nd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=pt(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}an(function(){var r=a,i=$t(n),o=[];a:{var c=Wr.get(e);if(c!==void 0){var l=vn,u=e;switch(e){case`keypress`:if(mn(n)===0)break a;case`keydown`:case`keyup`:l=In;break;case`focusin`:u=`focus`,l=Dn;break;case`focusout`:u=`blur`,l=Dn;break;case`beforeblur`:case`afterblur`:l=Dn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Tn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=En;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Rn;break;case Lr:case Rr:case zr:l=On;break;case Ur:l=zn;break;case`scroll`:case`scrollend`:l=bn;break;case`wheel`:l=Bn;break;case`copy`:case`cut`:case`paste`:l=kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Ln;break;case`toggle`:case`beforetoggle`:l=Vn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=on(m,p),g!=null&&d.push(Pd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Qt&&(u=n.relatedTarget||n.fromElement)&&(pt(u)||u[ot]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?pt(u):null,u!==null&&(f=s(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Tn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Ln,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ht(l),h=u==null?c:ht(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,pt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Id,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ld(o,c,l,d,!1),u!==null&&f!==null&&Ld(o,f,u,d,!0)}}a:{if(c=r?ht(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=sr;else if(tr(c)){if(cr)v=_r;else{v=V;var y=hr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&qt(r.elementType)&&(v=sr):v=gr;if(v&&=v(e,r)){nr(o,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&zt(c,`number`,c.value)}switch(y=r?ht(r):window,e){case`focusin`:(tr(y)||y.contentEditable===`true`)&&(Dr=y,Or=r,kr=null);break;case`focusout`:kr=Or=Dr=null;break;case`mousedown`:Ar=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ar=!1,jr(o,n,i);break;case`selectionchange`:if(Er)break;case`keydown`:case`keyup`:jr(o,n,i)}var b;if(Un)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Zn?Yn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Kn&&n.locale!==`ko`&&(Zn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Zn&&(b=pn()):(un=i,dn=`value`in un?un.value:un.textContent,Zn=!0)),y=Fd(r,x),0<y.length&&(x=new An(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Xn(n),b!==null&&(x.data=b)))),(b=Gn?Qn(e,n):$n(e,n))&&(x=Fd(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),Sd(o,e,r,n,i)}Dd(o,t)})}function Pd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=on(e,n),i!=null&&r.unshift(Pd(e,i,a)),i=on(e,t),i!=null&&r.push(Pd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Id(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ld(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=on(n,a),l!=null&&o.unshift(Pd(n,l,c))):i||(l=on(n,a),l!=null&&o.push(Pd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Rd=/\r\n?/g,zd=/\u0000|\uFFFD/g;function Bd(e){return(typeof e==`string`?e:``+e).replace(Rd,`
10
- `).replace(zd,``)}function Vd(e,t){return t=Bd(t),Bd(e)===t}function Hd(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ut(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Kt(e,r,o);break;case`data`:if(t!==`object`){Dt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Hd(e,t,`name`,i.name,i,null),Hd(e,t,`formEncType`,i.formEncType,i,null),Hd(e,t,`formMethod`,i.formMethod,i,null),Hd(e,t,`formTarget`,i.formTarget,i,null)):(Hd(e,t,`encType`,i.encType,i,null),Hd(e,t,`method`,i.method,i,null),Hd(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Xt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`onScroll`:r!=null&&Od(`scroll`,e);break;case`onScrollEnd`:r!=null&&Od(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Xt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Od(`beforetoggle`,e),Od(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Jt.get(n)||n,Et(e,n,r))}}function Ud(e,t,n,r,i,o){switch(n){case`style`:Kt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ut(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ut(e,``+r);break;case`onScroll`:r!=null&&Od(`scroll`,e);break;case`onScrollEnd`:r!=null&&Od(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!yt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[at]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Et(e,n,r)}}}function Wd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Od(`error`,e),Od(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Hd(e,t,o,s,n,null)}}i&&Hd(e,t,`srcSet`,n.srcSet,n,null),r&&Hd(e,t,`src`,n.src,n,null);return;case`input`:Od(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Hd(e,t,r,d,n,null)}}Rt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in Od(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Hd(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Bt(e,!!r,n,!0):Bt(e,!!r,t,!1);return;case`textarea`:for(s in Od(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:Hd(e,t,s,c,n,null)}Ht(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Hd(e,t,l,r,n,null)}return;case`dialog`:Od(`beforetoggle`,e),Od(`toggle`,e),Od(`cancel`,e),Od(`close`,e);break;case`iframe`:case`object`:Od(`load`,e);break;case`video`:case`audio`:for(r=0;r<Td.length;r++)Od(Td[r],e);break;case`image`:Od(`error`,e),Od(`load`,e);break;case`details`:Od(`toggle`,e);break;case`embed`:case`source`:case`link`:Od(`error`,e),Od(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Hd(e,t,u,r,n,null)}return;default:if(qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ud(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Hd(e,t,c,r,n,null))}function Gd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Hd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&Hd(e,t,p,m,r,f)}}Lt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Hd(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Hd(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Bt(e,!!n,n?[]:``,!1):Bt(e,!!n,t,!0)):Bt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Hd(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&Hd(e,t,s,i,r,o)}Vt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Hd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Hd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Hd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:Hd(e,t,u,p,r,m)}return;default:if(qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ud(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ud(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Hd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Hd(e,t,f,p,r,m)}function Kd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function qd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Kd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Kd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.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 Jd=null,Yd=null;function Xd(e){return e.nodeType===9?e:e.ownerDocument}function Zd(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 Qd(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 $d(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 ef=null;function tf(){var e=window.event;return e&&e.type===`popstate`?e!==ef&&(ef=e,!0):(ef=null,!1)}var nf=typeof setTimeout==`function`?setTimeout:void 0,rf=typeof clearTimeout==`function`?clearTimeout:void 0,af=typeof Promise==`function`?Promise:void 0,of=typeof queueMicrotask==`function`?queueMicrotask:af===void 0?nf:function(e){return af.resolve(null).then(e).catch(sf)};function sf(e){setTimeout(function(){throw e})}function cf(e){return e===`head`}function lf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Up(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Cf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Cf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[dt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Cf(e.ownerDocument.body)}n=i}while(n);Up(t)}function uf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function df(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`:df(n),ft(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function ff(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[dt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=vf(e.nextSibling),e===null)break}return null}function pf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=vf(e.nextSibling),e===null))return null;return e}function mf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=vf(e.nextSibling),e===null))return null;return e}function hf(e){return e.data===`$?`||e.data===`$~`}function gf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function _f(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function vf(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 yf=null;function bf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return vf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function xf(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 Sf(e,t,n){switch(t=Xd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Cf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ft(e)}var wf=new Map,Tf=new Set;function Ef(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Df=N.d;N.d={f:Of,r:kf,D:Mf,C:Nf,L:Pf,m:Ff,X:Lf,S:If,M:Rf};function Of(){var e=Df.f(),t=Du();return e||t}function kf(e){var t=mt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):Df.r(e)}var Af=typeof document>`u`?null:document;function jf(e,t,n){var r=Af;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Tf.has(i)||(Tf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Wd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Mf(e){Df.D(e),jf(`dns-prefetch`,e,null)}function Nf(e,t){Df.C(e,t),jf(`preconnect`,e,t)}function Pf(e,t,n){Df.L(e,t,n);var r=Af;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=Bf(e);break;case`script`:a=Wf(e)}wf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),wf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Vf(a))||t===`script`&&r.querySelector(Gf(a))||(t=r.createElement(`link`),Wd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Ff(e,t){Df.m(e,t);var n=Af;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Wf(e)}if(!wf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),wf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Gf(a)))return}r=n.createElement(`link`),Wd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function If(e,t,n){Df.S(e,t,n);var r=Af;if(r&&e){var i=gt(r).hoistableStyles,a=Bf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Vf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=wf.get(a))&&Jf(e,n);var c=o=r.createElement(`link`);_t(c),Wd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,qf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Lf(e,t){Df.X(e,t);var n=Af;if(n&&e){var r=gt(n).hoistableScripts,i=Wf(e),a=r.get(i);a||(a=n.querySelector(Gf(i)),a||(e=p({src:e,async:!0},t),(t=wf.get(i))&&Yf(e,t),a=n.createElement(`script`),_t(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t){Df.M(e,t);var n=Af;if(n&&e){var r=gt(n).hoistableScripts,i=Wf(e),a=r.get(i);a||(a=n.querySelector(Gf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=wf.get(i))&&Yf(e,t),a=n.createElement(`script`),_t(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zf(e,t,n,r){var i=(i=R.current)?Ef(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Bf(n.href),n=gt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Bf(n.href);var o=gt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Vf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),wf.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},wf.set(e,n),o||Uf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Wf(n),n=gt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Bf(e){return`href="`+It(e)+`"`}function Vf(e){return`link[rel="stylesheet"][`+e+`]`}function Hf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Uf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Wd(t,`link`,n),_t(t),e.head.appendChild(t))}function Wf(e){return`[src="`+It(e)+`"]`}function Gf(e){return`script[async]`+e}function Kf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Wd(r,`style`,i),qf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Bf(n.href);var o=e.querySelector(Vf(i));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Hf(n),(i=wf.get(i))&&Jf(r,i),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Wd(o,`link`,r),t.state.loading|=4,qf(o,n.precedence,e),t.instance=o;case`script`:return o=Wf(n.src),(i=e.querySelector(Gf(o)))?(t.instance=i,_t(i),i):(r=n,(i=wf.get(o))&&(r=p({},n),Yf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),_t(i),Wd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,qf(r,n.precedence,e));return t.instance}function qf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Jf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Yf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Xf=null;function Zf(e,t,n){if(Xf===null){var r=new Map,i=Xf=new Map;i.set(n,r)}else i=Xf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[dt]||a[it]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Qf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function $f(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 ep(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function tp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Bf(r.href),a=t.querySelector(Vf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ip.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Hf(r),(i=wf.get(i))&&Jf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Wd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ip.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var np=0;function rp(e,t){return e.stylesheets&&e.count===0&&op(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&op(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&np===0&&(np=62500*qd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&op(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>np?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ip(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)op(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ap=null;function op(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ap=new Map,t.forEach(sp,e),ap=null,ip.call(e))}function sp(e,t){if(!(t.state.loading&4)){var n=ap.get(e);if(n)var r=n.get(null);else{n=new Map,ap.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ip.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var cp={$$typeof:x,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function lp(e,t,n,r,i,a,o,s,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=qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qe(0),this.hiddenUpdates=qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function up(e,t,n,r,i,a,o,s,c,l,u,d){return e=new lp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ai(3,null,null,t),e.current=a,a.stateNode=e,t=aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ra(a),e}function dp(e){return e?(e=ri,e):ri}function fp(e,t,n,r,i,a){i=dp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ba(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(Su(n,e,t),Ha(n,e,t))}function pp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mp(e,t){pp(e,t),(e=e.alternate)&&pp(e,t)}function hp(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&Su(t,e,67108864),mp(e,67108864)}}function gp(e){if(e.tag===13||e.tag===31){var t=bu();t=$e(t);var n=ei(e,t);n!==null&&Su(n,e,t),mp(e,t)}}var _p=!0;function vp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,bp(e,t,n,r)}finally{N.p=a,M.T=i}}function yp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,bp(e,t,n,r)}finally{N.p=a,M.T=i}}function bp(e,t,n,r){if(_p){var i=xp(r);if(i===null)Nd(e,t,r,Sp,n),Np(e,r);else if(Fp(i,e,t,n,r))r.stopPropagation();else if(Np(e,r),t&4&&-1<Mp.indexOf(e)){for(;i!==null;){var a=mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=He(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Fe(o);s.entanglements[1]|=c,o&=~c}dd(a),!(Vl&6)&&(cu=Ce()+500,fd(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&Su(s,a,2),Du(),mp(a,2)}if(a=xp(r),a===null&&Nd(e,t,r,Sp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Nd(e,t,r,null,n)}}function xp(e){return e=$t(e),Cp(e)}var Sp=null;function Cp(e){if(Sp=null,e=pt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(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 Sp=e,null}function wp(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(we()){case Te:return 2;case Ee:return 8;case De:case Oe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var Tp=!1,Ep=null,Dp=null,Op=null,kp=new Map,Ap=new Map,jp=[],Mp=`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 Np(e,t){switch(e){case`focusin`:case`focusout`:Ep=null;break;case`dragenter`:case`dragleave`:Dp=null;break;case`mouseover`:case`mouseout`:Op=null;break;case`pointerover`:case`pointerout`:kp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ap.delete(t.pointerId)}}function Pp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=mt(t),t!==null&&hp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Fp(e,t,n,r,i){switch(t){case`focusin`:return Ep=Pp(Ep,e,t,n,r,i),!0;case`dragenter`:return Dp=Pp(Dp,e,t,n,r,i),!0;case`mouseover`:return Op=Pp(Op,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return kp.set(a,Pp(kp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ap.set(a,Pp(Ap.get(a)||null,e,t,n,r,i)),!0}return!1}function Ip(e){var t=pt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,nt(e.priority,function(){gp(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,nt(e.priority,function(){gp(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 Lp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qt=r,n.target.dispatchEvent(r),Qt=null}else return t=mt(n),t!==null&&hp(t),e.blockedOn=n,!1;t.shift()}return!0}function Rp(e,t,n){Lp(e)&&n.delete(t)}function zp(){Tp=!1,Ep!==null&&Lp(Ep)&&(Ep=null),Dp!==null&&Lp(Dp)&&(Dp=null),Op!==null&&Lp(Op)&&(Op=null),kp.forEach(Rp),Ap.forEach(Rp)}function Bp(e,n){e.blockedOn===n&&(e.blockedOn=null,Tp||(Tp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zp)))}var Vp=null;function Hp(e){Vp!==e&&(Vp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vp===e&&(Vp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Cp(r||n)===null)continue;break}var a=mt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Up(e){function t(t){return Bp(t,e)}Ep!==null&&Bp(Ep,e),Dp!==null&&Bp(Dp,e),Op!==null&&Bp(Op,e),kp.forEach(t),Ap.forEach(t);for(var n=0;n<jp.length;n++){var r=jp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jp.length&&(n=jp[0],n.blockedOn===null);)Ip(n),n.blockedOn===null&&jp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[at]||null;if(typeof a==`function`)o||Hp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[at]||null)s=o.formAction;else if(Cp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hp(n)}}}function Wp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Gp(e){this._internalRoot=e}Kp.prototype.render=Gp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;fp(n,bu(),e,t,null,null)},Kp.prototype.unmount=Gp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fp(e.current,2,null,e,null,null),Du(),t[ot]=null}};function Kp(e){this._internalRoot=e}Kp.prototype.unstable_scheduleHydration=function(e){if(e){var t=tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jp.length&&t!==0&&t<jp[n].priority;n++);jp.splice(n,0,e),n===0&&Ip(e)}};var qp=n.version;if(qp!==`19.2.8`)throw Error(a(527,qp,`19.2.8`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Jp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Yp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yp.isDisabled&&Yp.supportsFiber)try{Me=Yp.inject(Jp),Ne=Yp}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=up(e,1,!1,null,null,n,r,null,i,s,c,Wp),e[ot]=t.current,jd(e),new Gp(t)}})),dr=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ur()})),fr=class extends an{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new $t({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=pr(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=pr(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=pr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=pr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Bt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ht(t,e))}findAll(e={}){return this.getAll().filter(t=>Ht(e,t))}notify(e){Bt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Bt.batch(()=>Promise.all(e.map(e=>e.continue().catch(tn))))}};function pr(e){return e.options.scope?.id}var mr=class extends an{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??sn(r,t),a=this.get(i);return a||(a=new rn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Bt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Wt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Wt(e,t)):t}notify(e){Bt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Bt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Bt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},hr=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new mr,this.#t=e.mutationCache||new fr,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=en.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Jt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Vt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Bt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Bt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Bt.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Bt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(tn).catch(tn)}invalidateQueries(e,t={}){return Bt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Bt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(tn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(tn)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(qt(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(tn).catch(tn)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(tn).catch(tn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Jt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Xt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Zt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Xt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Zt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=sn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Gt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},V=t(r(),1),gr=dr(),_r=fn(`activity`,[[`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`}]]),vr=fn(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),yr=fn(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),br=fn(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),xr=fn(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),Sr=fn(`bot`,[[`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`}]]),Cr=fn(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),wr=fn(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Tr=fn(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Er=fn(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Dr=fn(`circle-alert`,[[`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`}]]),Or=fn(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),kr=fn(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ar=fn(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),jr=fn(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Mr=fn(`copy`,[[`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`}]]),Nr=fn(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Pr=fn(`file-code-corner`,[[`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`}]]),Fr=fn(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Ir=fn(`file-text`,[[`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`}]]),Lr=fn(`folder`,[[`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`}]]),Rr=fn(`funnel`,[[`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`}]]),zr=fn(`git-branch`,[[`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`}]]),Br=fn(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),Vr=fn(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Hr=fn(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Ur=fn(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Wr=fn(`layers`,[[`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`}]]),Gr=fn(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Kr=fn(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),qr=fn(`lock`,[[`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`}]]),Jr=fn(`maximize-2`,[[`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`}]]),Yr=fn(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Xr=fn(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Zr=fn(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),Qr=fn(`minimize-2`,[[`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`}]]),$r=fn(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ei=fn(`moon`,[[`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`}]]),ti=fn(`panel-left-close`,[[`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`}]]),ni=fn(`panel-left-open`,[[`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`}]]),ri=fn(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),ii=fn(`pencil`,[[`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`}]]),ai=fn(`pi`,[[`line`,{x1:`9`,x2:`9`,y1:`4`,y2:`20`,key:`ovs5a5`}],[`path`,{d:`M4 7c0-1.7 1.3-3 3-3h13`,key:`10pag4`}],[`path`,{d:`M18 20c-1.7 0-3-1.3-3-3V4`,key:`1gaosr`}]]),oi=fn(`play`,[[`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`}]]),si=fn(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),ci=fn(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),li=fn(`refresh-cw`,[[`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`}]]),ui=fn(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),di=fn(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),fi=fn(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),pi=fn(`settings`,[[`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`}]]),mi=fn(`shield`,[[`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`}]]),hi=fn(`sparkles`,[[`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`}]]),gi=fn(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),_i=fn(`square-terminal`,[[`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`}]]),vi=fn(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),yi=fn(`sun`,[[`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`}]]),bi=fn(`target`,[[`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`}]]),xi=fn(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Si=fn(`triangle-alert`,[[`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`}]]),Ci=fn(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),wi=fn(`wifi-off`,[[`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`}]]),Ti=fn(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Ei=fn(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Di=fn(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),H=i();function Oi({size:e=24,className:t,...n}){let r=`context-gradient-${(0,V.useId)().replace(/:/g,``)}`;return(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 200 200`,fill:`none`,width:e,height:e,"aria-hidden":!n[`aria-label`]||void 0,role:n[`aria-label`]?`img`:void 0,className:B(`context-logo shrink-0 select-none`,t),...n,children:[(0,H.jsx)(`defs`,{children:(0,H.jsxs)(`linearGradient`,{id:r,x1:`30`,y1:`20`,x2:`160`,y2:`180`,gradientUnits:`userSpaceOnUse`,children:[(0,H.jsx)(`stop`,{className:`context-logo-stop-first`,offset:`0%`}),(0,H.jsx)(`stop`,{className:`context-logo-stop-middle`,offset:`50%`}),(0,H.jsx)(`stop`,{className:`context-logo-stop-last`,offset:`100%`})]})}),(0,H.jsx)(`path`,{className:`context-logo-mark`,d:`M 178.8 63.3 A 87 87 0 1 0 178.8 136.7 L 141.7 119.4 A 46 46 0 1 1 141.7 80.6 Z`,fill:`url(#${r})`})]})}var ki=V.createContext(void 0);function Ai(e){let t=V.useContext(ki);if(t===void 0&&!e)throw Error(_n(33));return t}var ji=V.createContext(void 0);function Mi(e){let t=V.useContext(ji);if(t===void 0&&!e)throw Error(_n(36));return t}var Ni=V.createContext(void 0);function Pi(e=!0){let t=V.useContext(Ni);if(t===void 0&&!e)throw Error(_n(25));return t}function Fi(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Pi(!0),f=d!==void 0;return V.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:F})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!ut&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&at(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Ii={type:`regular-item`};function Li(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=V.useRef(null),{getButtonProps:d,buttonRef:f}=Xe({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Fi({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=V.useCallback(e=>gn(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=un(u,f);return V.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Ri=V.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Sn({guess:!0,label:a}),f=Ai(!0),p=he(i),{store:m}=Mi(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Li({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Ii});return pn(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})});function zi(e,t){return t!=null&&!ae(t)?0:typeof e==`function`?e():e}function Bi(e,t,n){let r=zi(e,n);return typeof r==`number`?r:r?.[t]}function Vi(e){return typeof e==`function`?e():e}function Hi(e,t){return t||e===`click`||e===`mousedown`}function Ui(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Wi=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(_n(99,this.componentName,e,this.componentName));t.setOpen(!0,ve(j,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,ve(j))}};function Gi(){return new le({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new re,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Ki(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Gi(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ln,inactiveTriggerProps:ln,popupProps:ln}}function qi(e,t,n=!1){return new le({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var Ji=e=>e.triggerIdProp??e.activeTriggerId,Yi=e=>e.openProp??e.open,Xi=e=>(e.popupElement?.id??e.floatingId)||void 0;function Zi(e,t){return t!==void 0&&Yi(e)&&Ji(e)===t}function Qi(e,t){return Zi(e,t)?!0:t!==void 0&&Yi(e)&&Ji(e)==null&&e.triggerCount===1}var $i={open:Yi,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Ji,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Xi,isTriggerActive:(e,t)=>t!==void 0&&Ji(e)===t,isOpenedByTrigger:(e,t)=>Zi(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Ji(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Qi(e,t)?Xi(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement},ea=D();function ta(e){let t=V.useCallback(t=>e===void 0?mn:e.subscribeStore(t),[e]),n=V.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,ea.useSyncExternalStore)(t,n,()=>e?.serverStore)}function na(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=be(),a=I()!=null,o=dn(()=>new le({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new re,floatingId:i,syncOnly:!1,nested:a})).current;return st(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=vt(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var ra=ut&&o;function ia(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=V.useRef(!1),l=V.useRef(null),d=V.useRef(!0),p=ce();V.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=Se(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&Te(e)&&e===Ue(ze(e))&&(s.current=!0)}function a(){d.current=!0}function o(){d.current=!1}return f(ht(t,`blur`,r),ra&&ht(t,`keydown`,a,!0),ra&&ht(t,`pointerdown`,o,!0))},[i,n]),V.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);vt(e)&&(l.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let h=V.useMemo(()=>{function e(){s.current=!1,l.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(l.current===n)return;e()}let a=ne(t.nativeEvent);if(vt(a)){if(ra&&!t.relatedTarget){if(!d.current&&!Ge(a))return}else if(!c(a))return}let o=m(t.relatedTarget,i.context.triggerElements),{nativeEvent:f,currentTarget:h}=t,g=typeof r==`function`?r():r;if(i.select(`open`)&&o||g===0||g===void 0){i.setOpen(!0,ve(u,f,h));return}p.start(g,()=>{s.current||i.setOpen(!0,ve(u,f,h))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=vt(n)&&n.hasAttribute(ct(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;p.start(0,()=>{let e=i.select(`domReferenceElement`),t=Ue(ze(e));!n&&t===e||M(o.current.floatingContext?.refs.floating.current,t)||M(e,t)||a||m(n??t,i.context.triggerElements)||i.setOpen(!1,ve(u,r))})}}},[o,r,i,p]);return V.useMemo(()=>n?{reference:h,trigger:h}:{},[n,h])}var aa=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new S,this.restTimeout=new S,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},oa=new WeakMap;function sa(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&oa.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),oa.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ca(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=oa.get(n);a&&a!==e&&sa(a),sa(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,oa.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function la(e){let t=e.context.dataRef.current,n=dn(()=>t.hoverInteractionState??aa.create()).current;return t.hoverInteractionState||=n,E(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ua(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,o=`rootStore`in e?e.rootStore:e,s=o.useState(`open`),c=o.useState(`floatingElement`),l=o.useState(`domReferenceElement`),{dataRef:u}=o.context,d=a(),p=I(),h=la(o),_=ce(),v=Oe(()=>Hi(u.current.openEvent?.type,h.interactedInside)),y=Oe(()=>Ui(u.current.openEvent?.type)),b=Oe(()=>{sa(h)});st(()=>{s||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,b())},[s,h,b]),V.useEffect(()=>b,[b]),st(()=>{if(n&&s&&h.handleCloseOptions?.blockPointerEvents&&y()&&vt(l)&&c){let e=l,t=c,n=ze(c),r=d?.nodesRef.current.find(e=>e.id===p)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=h.pointerEventsScopeElement===t?null:h.pointerEventsScopeElement,a=r===t?null:r,o=h.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return ca(h,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{b()}}},[n,s,l,c,h,y,d,p,b]),V.useEffect(()=>{if(!n)return;function e(){return!!(d&&p&&ke(d.nodesRef.current,p).length>0)}function t(e){let t=Bi(r,`close`,h.pointerType),n=()=>{o.setOpen(!1,ve(ue,e)),d?.events.emit(`floating.closed`,e)};t?h.openChangeTimeout.start(t,n):(h.openChangeTimeout.clear(),n())}function a(e){let t=ne(e);if(!g(t)){h.interactedInside=!1;return}h.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function s(){h.openChangeTimeout.clear(),_.clear(),d?.events.off(`floating.closed`,x),b()}function l(n){if(e()&&d){d.events.on(`floating.closed`,x);return}if(m(n.relatedTarget,o.context.triggerElements))return;let r=u.current.floatingContext?.nodeId??i,a=n.relatedTarget;if(!(d&&r&&vt(a)&&ke(d.nodesRef.current,r,!1).some(e=>M(e.context?.elements.floating,a)))){if(h.handler){h.handler(n);return}b(),y()&&!v()&&t(n)}}function x(t){!d||!p||e()||_.start(0,()=>{d.events.off(`floating.closed`,x),o.setOpen(!1,ve(ue,t)),d.events.emit(`floating.closed`,t)})}let S=c;return f(S&&ht(S,`mouseenter`,s),S&&ht(S,`mouseleave`,l),S&&ht(S,`pointerdown`,a,!0),()=>{d?.events.off(`floating.closed`,x)})},[n,c,o,u,r,i,y,v,b,h,d,p,_])}var da=t(_e(),1),fa={current:null};function pa(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:o=!1,restMs:s=0,move:c=!0,triggerElementRef:l=fa,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:p,isClosing:h,shouldOpen:g,guardStaleOpen:_=!1}=t,v=`rootStore`in e?e.rootStore:e,{dataRef:y,events:b}=v.context,x=a(u),S=la(v),C=V.useRef(!1),w=R(i),T=R(r),E=R(s),D=R(n),ee=R(g),O=R(h),k=Oe(()=>Hi(y.current.openEvent?.type,S.interactedInside)),A=Oe(()=>ee.current?.()!==!1),te=Oe((e,t,n)=>{let r=v.context.triggerElements;if(r.hasElement(t))return!e||!M(e,t);if(!vt(n))return!1;let i=n;return r.hasMatchingElement(e=>M(e,i))&&(!e||!M(e,i))}),j=Oe(()=>{S.handler&&=(ze(v.select(`domReferenceElement`)).removeEventListener(`mousemove`,S.handler),void 0)}),N=Oe(()=>{sa(S)});return d&&(S.handleCloseOptions=w.current?.__options),V.useEffect(()=>j,[j]),V.useEffect(()=>{if(!n)return;function e(e){e.open?C.current=!1:(C.current=e.reason===ue,j(),S.openChangeTimeout.clear(),S.restTimeout.clear(),S.blockMouseMove=!0,S.restTimeoutPending=!1)}return b.on(`openchange`,e),()=>{b.off(`openchange`,e)}},[n,b,S,j]),V.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Bi(T.current,`close`,S.pointerType);n?S.openChangeTimeout.start(n,()=>{v.setOpen(!1,ve(ue,e)),x?.events.emit(`floating.closed`,e)}):t&&(S.openChangeTimeout.clear(),v.setOpen(!1,ve(ue,e)),x?.events.emit(`floating.closed`,e))}let t=l.current??(d?v.select(`domReferenceElement`):null);if(!vt(t))return;function r(e){if(S.openChangeTimeout.clear(),S.blockMouseMove=!1,o&&!ae(S.pointerType))return;let t=Vi(E.current),n=Bi(T.current,`open`,S.pointerType),r=ne(e),i=e.currentTarget??null,a=v.select(`domReferenceElement`),s=i;if(vt(r)&&!v.context.triggerElements.hasElement(r)){for(let e of v.context.triggerElements.elements())if(M(e,r)){s=e;break}}vt(i)&&vt(a)&&!v.context.triggerElements.hasElement(i)&&M(i,a)&&(s=a);let c=s!=null&&te(a,s,r),l=v.select(`open`),u=O.current?.()??v.select(`transitionStatus`)===`ending`,d=!l&&u&&C.current,f=!c&&vt(s)&&vt(a)&&M(a,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,h=!l||c;if(m){A()&&v.setOpen(!0,ve(ue,e,s));return}p||(n?S.openChangeTimeout.start(n,()=>{h&&A()&&v.setOpen(!0,ve(ue,e,s))}):h&&A()&&v.setOpen(!0,ve(ue,e,s)))}function i(t){if(k()){N();return}j();let n=v.select(`domReferenceElement`),r=ze(n);S.restTimeout.clear(),S.restTimeoutPending=!1;let i=y.current.floatingContext??p?.();if(!m(t.relatedTarget,v.context.triggerElements)){if(w.current&&i){v.select(`open`)||S.openChangeTimeout.clear();let n=l.current;S.handler=w.current({...i,tree:x,x:t.clientX,y:t.clientY,onClose(){N(),j(),D.current&&!k()&&n===v.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,S.handler),S.handler(t);return}(S.pointerType!==`touch`||!M(v.select(`floatingElement`),t.relatedTarget))&&e(t)}}function a(e){M(t,e.relatedTarget)||(S.openChangeTimeout.clear(),S.restTimeout.clear(),S.restTimeoutPending=!1)}let s=_?ht(t,`mouseout`,a):void 0;return c?f(ht(t,`mousemove`,r,{once:!0}),ht(t,`mouseenter`,r),ht(t,`mouseleave`,i),s):f(ht(t,`mouseenter`,r),ht(t,`mouseleave`,i),s)},[j,N,y,T,v,n,w,S,d,te,k,o,c,E,l,x,D,p,O,A,_]),V.useMemo(()=>{if(!n)return;function e(e){S.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=v.select(`domReferenceElement`),i=v.select(`open`),a=te(r,n,e.target);if(o&&!ae(S.pointerType))return;if(i&&a&&S.handleCloseOptions?.blockPointerEvents){let e=v.select(`floatingElement`);if(e){let t=S.handleCloseOptions?.getScope?.()??n.ownerDocument.body;ca(S,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Vi(E.current);if(i&&!a||s===0||!a&&S.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;S.restTimeout.clear();function c(){if(S.restTimeoutPending=!1,k())return;let e=v.select(`open`);!S.blockMouseMove&&(!e||a)&&A()&&v.setOpen(!0,ve(ue,t,n))}S.pointerType===`touch`?da.flushSync(()=>{c()}):a&&i?c():(S.restTimeoutPending=!0,S.restTimeout.start(s,c))}}},[n,S,k,te,o,v,E,A])}var ma=.1,ha=ma*ma,ga=.5;function _a(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function va(e,t,n,r,i,a,o,s,c,l){let u=!1;return _a(e,t,n,r,i,a)&&(u=!u),_a(e,t,i,a,o,s)&&(u=!u),_a(e,t,o,s,c,l)&&(u=!u),_a(e,t,c,l,n,r)&&(u=!u),u}function ya(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function ba(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function xa(e={}){let{blockPointerEvents:t=!1}=e,n=new S,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*ha;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=ne(r),g=r.type===`mouseleave`,_=M(u,h),v=M(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&vt(r.relatedTarget)&&M(u,r.relatedTarget))return;function y(){return!!(s&&ke(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,ee=(T?x:S).right,O=(E?x:S).top,k=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let A=!1;switch(c){case`top`:A=ba(d,f,D,x.top+1,ee,S.bottom-1);break;case`bottom`:A=ba(d,f,D,S.top+1,ee,x.bottom-1);break;case`left`:A=ba(d,f,S.right-1,k,x.left+1,O);break;case`right`:A=ba(d,f,x.right-1,k,S.left+1,O)}if(A)return;if(l&&!ya(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let te=!1;switch(c){case`top`:{let n=T?ga/2:ga*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+ga+1,o=C||T?S.bottom-ga:S.top,s=C?T?S.bottom-ga:S.top:S.bottom-ga;te=va(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?ga/2:ga*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-ga,o=C||T?S.top+ga:S.bottom,s=C?T?S.top+ga:S.bottom:S.top+ga;te=va(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?ga/2:ga*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+ga+1,o=w||E?S.right-ga:S.left,s=w?E?S.right-ga:S.left:S.right-ga;te=va(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?ga/2:ga*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-ga,o=w||E?S.left+ga:S.right,s=w?E?S.left+ga:S.right:S.left+ga;te=va(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}te?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var Sa=V.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Mi(),{side:c,align:l}=Ai(),u=Tn(!0)!=null,f=s.useState(`open`),p=s.useState(`transitionStatus`),m=s.useState(`popupProps`),h=s.useState(`mounted`),g=s.useState(`instantType`),_=s.useState(`activeTriggerElement`),v=s.useState(`parent`),b=s.useState(`lastOpenChangeReason`),x=s.useState(`rootId`),S=s.useState(`floatingRootContext`),C=s.useState(`floatingTreeRoot`),T=s.useState(`closeDelay`),E=s.useState(`hoverEnabled`),D=s.useState(`disabled`),ee=s.useState(`openMethod`),O=v.type===`context-menu`;pe({open:f,ref:s.context.popupRef,onComplete(){f&&s.context.onOpenChangeComplete?.(!0)}}),V.useEffect(()=>{function e(e){s.setOpen(!1,ve(e.reason,e.domEvent))}return C.events.on(`close`,e),()=>{C.events.off(`close`,e)}},[C.events,s]),ua(S,{enabled:E&&!D&&!O&&v.type!==`menubar`,closeDelay:T});let k=s.useStateSetter(`popupElement`),A={transitionStatus:p,side:c,align:l,open:f,nested:v.type===`menu`,instant:g},te=pn(`div`,e,{state:A,ref:[t,s.context.popupRef,k],stateAttributesMapping:y,props:[m,{onKeyDown(e){u&&d.has(e.key)&&e.stopPropagation()}},wn(p),o,{"data-rootownerid":x}]}),j=v.type===void 0||O;return(_||v.type===`menubar`&&b!==`outside-press`)&&(j=!0),(0,H.jsx)(w,{context:S,openInteractionType:ee,modal:O,disabled:!h,returnFocus:a===void 0?j:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:C,previousFocusableElement:_,nextFocusableElement:v.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:te})}),Ca=V.createContext(void 0);function wa(){let e=V.useContext(Ca);if(e===void 0)throw Error(_n(32));return e}var Ta=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Mi();return i.useState(`mounted`)||n?(0,H.jsx)(Ca.Provider,{value:n,children:(0,H.jsx)(dt,{ref:t,...r})}):null}),Ea=V.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Be,style:g,..._}=e,{store:v}=Mi(),y=wa(),x=Pi(!0),S=v.useState(`parent`),C=v.useState(`floatingRootContext`),w=v.useState(`floatingTreeRoot`),T=v.useState(`mounted`),E=v.useState(`open`),D=v.useState(`modal`),ee=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),te=v.useState(`instantType`),j=v.useState(`adaptiveOrigin`),M=v.useState(`lastOpenChangeReason`),N=v.useState(`floatingNodeId`),ne=v.useState(`floatingParentNodeId`),re=C.useState(`domReferenceElement`),ie=V.useRef(null),P=b(A),F=n,I=c,L=l,ae=s,R=h;S.type===`context-menu`&&(F=n??S.context?.anchor,ae??=`start`,!o&&ae!==`center`&&(L=e.alignOffset??2,I=e.sideOffset??-5));let oe=o,z=ae;S.type===`menu`?(oe??=`inline-end`,z??=`start`,R=e.collisionAvoidance??we):S.type===`menubar`&&(oe??=S.context.orientation===`vertical`?`inline-end`:`bottom`,z??=`start`);let se=S.type===`context-menu`,le=kn({anchor:F,floatingRootContext:C,positionMethod:x?`fixed`:r,mounted:T,side:oe,sideOffset:I,align:z,alignOffset:L,arrowPadding:se?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:N,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:R,shift:se?{crossAxis:!(`side`in R&&R.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:w,adaptiveOrigin:j});V.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===N&&v.set(`hoverEnabled`,!1),e.nodeId!==N&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,ve(xt)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[v,w.events,N]),V.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,ve(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,v]);let ue=ce();V.useEffect(()=>{E||ue.clear()},[E,ue]),V.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ue.isStarted()||ue.start(e,()=>{v.setOpen(!1,ve(xt))}):v.setOpen(!1,ve(xt))}else ue.clear()}}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,O,v,ue]),V.useEffect(()=>{let e={open:E,nodeId:N,parentNodeId:ne,reason:v.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,v,N,ne]),st(()=>{let e=re,t=ie.current;if(e&&(ie.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return P(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[re,P,v]);let de={open:E,side:le.side,align:le.align,anchorHidden:le.anchorHidden,nested:S.type===`menu`,instant:te},fe=S.type===`menubar`&&S.context.modal;Mn(E&&(fe||D&&M!==`trigger-hover`),ee===`touch`,A,O);let pe=Fn(e,de,{styles:le.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),me=T&&S.type!==`menu`&&(S.type!==`menubar`&&D&&M!==`trigger-hover`||S.type===`menubar`&&S.context.modal),he=null;return S.type===`menubar`?he=S.context.contentElement:S.type===void 0&&(he=O),(0,H.jsxs)(ki.Provider,{value:le,children:[me&&(0,H.jsx)(Fe,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:mt(!E),cutout:he}),(0,H.jsx)(ge,{id:N,children:(0,H.jsx)(Cn,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:pe})})]})}),Da=V.createContext(null);function Oa(e){let t=V.useContext(Da);if(t===null&&!e)throw Error(_n(5));return t}var ka=class extends x{setState(e){}update(e){}set(e,t){}notifyAll(){}},Aa={...$i,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},ja=class extends x{constructor(e){super({...Na(),...e},Ma(),Aa),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Ma(){return{positionerRef:V.createRef(),popupRef:V.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:V.createRef(),beforeContentFocusGuardRef:V.createRef(),onOpenChangeComplete:void 0,triggerElements:new re}}function Na(){return{...Ki(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Me,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ln,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var Pa=V.createContext(void 0);function Fa(){return V.useContext(Pa)}var Ia=de(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:c,loopFocus:u=!0,orientation:d=`vertical`,actionsRef:f,closeParentOnEsc:p=!1,handle:m,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:v=!0}=e,y=Pi(!0),b=Mi(!0),x=Oa(!0),S=Fa(),w=V.useMemo(()=>S&&b?{type:`menu`,store:b.store}:x?{type:`menubar`,context:x}:y&&!b?{type:`context-menu`,context:y}:{type:void 0},[y,b,x,S]),T=La({open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:w});T.useControlledProp(`openProp`,n),T.useControlledProp(`triggerIdProp`,h),T.useContextCallback(`onOpenChangeComplete`,i);let E=be(),D=be(),ee=T.useState(`floatingTreeRoot`),O=ye(ee),k=I(),A=T.useState(`open`),te=T.useState(`activeTriggerElement`),M=T.useState(`positionerElement`),ne=T.useState(`hoverEnabled`),re=T.useState(`disabled`),ie=T.useState(`lastOpenChangeReason`),F=T.useState(`parent`),L=T.useState(`activeIndex`),ae=T.useState(`payload`),R=T.useState(`floatingParentNodeId`),oe=V.useRef(null),z=V.useRef(F.type!==`context-menu`),se=ce(),le=V.useRef(!0),ue=ce(),de=R!=null,{openMethod:fe,triggerProps:pe}=On(A);T.useSyncedValues({disabled:o,highlightItemOnHover:v,modal:F.type===void 0?c:void 0,openMethod:fe,rootId:E}),P(T);let{forceUnmount:he}=_(A,T,()=>{T.set(`allowMouseEnter`,!1)});st(()=>{y&&!b?T.update({parent:{type:`context-menu`,context:y},floatingNodeId:O,floatingParentNodeId:k}):b&&T.update({floatingNodeId:O,floatingParentNodeId:k})},[y,b,O,k,T]),V.useEffect(()=>{if(A||(oe.current=null),F.type===`context-menu`){if(!A){se.clear(),z.current=!1;return}se.start(500,()=>{z.current=!0})}},[se,A,F.type]),st(()=>{!A&&!ne&&T.set(`hoverEnabled`,!0)},[A,ne,T]);let ge=Oe((e,t)=>{let n=t.reason;if(!e&&!T.select(`open`)||A===e&&t.trigger===te&&ie===n)return;let i=Ve(t);if(!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!le.current)return;e&&n===`trigger-focus`?(le.current=!1,ue.start(300,()=>{le.current=!0})):(le.current=!0,ue.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};oe.current=t.event,N(c,e,t.trigger,i()),T.update(c),F.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?T.set(`instantType`,`group`):o||s?T.set(`instantType`,o?`click`:`dismiss`):T.set(`instantType`,void 0)}),_e=l({popupStore:T,floatingId:D,nested:k!=null,onOpenChange:ge}),Se=_e.context.events;st(()=>{let e=({open:e,eventDetails:t})=>ge(e,t);return Se.on(`setOpen`,e),()=>{Se?.off(`setOpen`,e)}},[Se,ge]);let Ce=V.useCallback(()=>{T.setOpen(!1,ve(j))},[T]);V.useImperativeHandle(f,()=>({unmount:he,close:Ce}),[he,Ce]);let we;F.type===`context-menu`&&(we=F.context),V.useImperativeHandle(we?.positionerRef,()=>M,[M]),V.useImperativeHandle(we?.actionsRef,()=>({setOpen:ge}),[ge]);let Te=tt(_e,{enabled:!re,bubbles:{escapeKey:p&&F.type===`menu`},outsidePress(){return F.type!==`context-menu`||oe.current?.type===`contextmenu`||z.current},externalTree:de?ee:void 0}),Ee=xe(),De=V.useCallback(e=>{T.select(`activeIndex`)!==e&&T.set(`activeIndex`,e)},[T]),ke=An(_e,{enabled:!re,listRef:T.context.itemDomElements,activeIndex:L,nested:F.type!==void 0,loopFocus:u,orientation:d,parentOrientation:F.type===`menubar`?F.context.orientation:void 0,rtl:Ee===`rtl`,disabledIndices:vn,onNavigate:De,openOnArrowKeyDown:F.type!==`context-menu`,externalTree:de?ee:void 0,focusItemOnHover:v}),Ae=V.useCallback(e=>{T.context.typingRef.current=e},[T]),je=Nn(_e,{enabled:!re,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&T.set(`activeIndex`,e)},onTyping:Ae}),Me=V.useMemo(()=>{let e=gn(je.reference,ke.reference,Te.reference,{onMouseMove(){T.set(`allowMouseEnter`,!0)}},pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[T,je.reference,ke.reference,Te.reference,pe,A]),Ne=V.useMemo(()=>{let e=gn(ke.trigger,Te.trigger,pe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ke.trigger,Te.trigger,pe]),Pe=V.useMemo(()=>gn(We,{id:D,role:`menu`,"aria-labelledby":te?.id,onMouseMove(){T.set(`allowMouseEnter`,!0),F.type===`menu`&&T.set(`hoverEnabled`,!1)},onClick(){T.select(`hoverEnabled`)&&T.set(`hoverEnabled`,!1)},onKeyDown(e){let t=T.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},je.floating,ke.floating,Te.floating),[te,D,F.type,T,je.floating,ke.floating,Te.floating]),Fe=ke.item??ln;C(T,{floatingRootContext:_e,activeTriggerProps:Me,inactiveTriggerProps:Ne,popupProps:Pe,itemProps:Fe});let Ie=V.useMemo(()=>({store:T,parent:w}),[T,w]),Le=(0,H.jsxs)(ji.Provider,{value:Ie,children:[m&&(0,H.jsx)(s,{handle:m,store:T}),typeof t==`function`?t({payload:ae}):t]});return F.type===void 0||F.type===`context-menu`?(0,H.jsx)(me,{externalTree:ee,children:Le}):Le});function La(e){return dn(()=>new ja(e)).current}function Ra(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=$e(),{ref:i,index:a}=Sn(e),o=n===a,s=V.useRef(null),c=un(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function za(e){let{render:t,className:n,style:r,state:i=ln,props:a=vn,refs:o=vn,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Ra({metadata:s});return pn(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function Ba(e){if(Te(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!gt(e))return Ba(Ie(e))}function Va(e,t){let n=V.useRef(null);function r(t){da.flushSync(()=>{e.setOpen(!1,ve(He,t.nativeEvent,t.currentTarget))}),je(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Pe(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{da.flushSync(()=>{e.setOpen(!1,ve(He,n.nativeEvent,n.currentTarget))});let i=pt(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&M(r,i);){let e=i;if(i=qe(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Ha(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=V.useRef(!1);return V.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,ze(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:ln,[t,n,r])}var Ua=v(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,nativeButton:s=!0,id:c,openOnHover:l,delay:u=100,closeDelay:d=0,handle:f,payload:m,...h}=e,g=Mi(!0),_=ta(f)??g?.store;if(!_)throw Error(_n(85));let v=he(c),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),C=V.useRef(null),w=Ga(),T=$e(!0),E=a(),D=V.useMemo(()=>E??new Me,[E]),O=ye(D),k=I(),{registerTrigger:A,isMountedByThisTrigger:te}=bt(v,C,_,{payload:m,closeDelay:d,parent:w,floatingTreeRoot:D,floatingNodeId:O,floatingParentNodeId:k,keyboardEventRelay:T?.relayKeyboardEvent}),j=w.type===`menubar`,N=_.useState(`disabled`),ne=o||N||j&&w.context.disabled,{getButtonProps:re,buttonRef:ie}=Xe({disabled:ne,native:s});V.useEffect(()=>{!x&&w.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,x,w.type]);let P=V.useRef(null),F=ce(),L=Oe(e=>{if(!P.current)return;F.clear(),_.context.allowMouseUpTriggerRef.current=!1;let t=e.target;M(P.current,t)||M(_.select(`positionerElement`),t)||t===P.current||(t==null||Ba(t)!==_.select(`rootId`))&&(Pn(e,P.current)||D.events.emit(`close`,{domEvent:e,reason:p}))});V.useEffect(()=>{x&&_.select(`lastOpenChangeReason`)===`trigger-hover`&&ze(P.current).addEventListener(`mouseup`,L,{once:!0})},[x,L,_]);let ae=j&&w.context.hasSubmenuOpen,R=pa(b,{enabled:(l??ae)&&!ne&&(!j||ae&&!te),handleClose:xa({blockPointerEvents:!j}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:d},triggerElementRef:C,externalTree:D,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),oe=Wa(x,_.select(`lastOpenChangeReason`)),z=En(b,{enabled:!ne,event:x&&j?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&oe}),se=ia(b,{enabled:!ne&&ae}),le=Ha({open:x,enabled:j,mouseDownAction:`open`}),ue=V.useMemo(()=>gn(se.reference,z.reference),[se.reference,z.reference]),de=_.useState(`triggerProps`,te),{preFocusGuardRef:fe,handlePreFocusGuardFocus:pe,handleFocusTargetFocus:me}=Va(_,C),ge={disabled:ne,open:x},_e=[P,t,ie,A,C],ve=[ue,R??ln,de,{"aria-haspopup":`menu`,"aria-controls":S,id:v,onMouseDown:e=>{_.select(`open`)||(F.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),ze(e.currentTarget).addEventListener(`mouseup`,L,{once:!0}))}},j?{role:`menuitem`}:{},le,h,re],be=pn(`button`,e,{enabled:!j,stateAttributesMapping:ee,state:ge,ref:_e,props:ve});return j?(0,H.jsx)(za,{tag:`button`,render:n,className:r,style:i,state:ge,refs:_e,props:ve,stateAttributesMapping:ee}):x?(0,H.jsxs)(V.Fragment,{children:[(0,H.jsx)(yt,{ref:fe,onFocus:pe},`${v}-pre-focus-guard`),(0,H.jsx)(V.Fragment,{children:be},v),(0,H.jsx)(yt,{ref:_.context.triggerFocusTargetRef,onFocus:me},`${v}-post-focus-guard`)]}):(0,H.jsx)(V.Fragment,{children:be},v)});function Wa(e,t){let n=ce(),[r,i]=V.useState(!1);return st(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Ga(){let e=Oa(!0);return V.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var Ka=V.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return pn(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),qa=Ia;function Ja({className:e,children:t,...n}){return(0,H.jsx)(Ua,{className:e,"data-slot":`menu-trigger`,...n,children:t})}function Ya({children:e,className:t,sideOffset:n=4,align:r=`center`,alignOffset:i,side:a=`bottom`,anchor:o,...s}){return(0,H.jsx)(Ta,{children:(0,H.jsx)(Ea,{align:r,alignOffset:i,anchor:o,className:`z-50`,"data-slot":`menu-positioner`,side:a,sideOffset:n,children:(0,H.jsx)(Sa,{className:B(`relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t),"data-slot":`menu-popup`,...s,children:(0,H.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:e})})})})}function Xa({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(Ri,{className:B(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,e),"data-inset":t,"data-slot":`menu-item`,"data-variant":n,...r})}function Za({className:e,...t}){return(0,H.jsx)(Ka,{className:B(`mx-2 my-1 h-px bg-border`,e),"data-slot":`menu-separator`,...t})}var Qa=V.createContext(void 0);function $a(e){let t=V.useContext(Qa);if(!e&&t===void 0)throw Error(_n(27));return t}var eo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=$a(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return pn(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:y,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),to=V.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=$a(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Xe({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,ve(ie,e.nativeEvent))}return pn(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),no=V.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=$a(),c=he(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),pn(`p`,e,{ref:t,props:[{id:c},o]})}),ro=V.createContext(void 0);function io(){let e=V.useContext(ro);if(e===void 0)throw Error(_n(26));return e}var ao={...fe,...T,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},oo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=$a(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),f=c.useState(`floatingRootContext`),p=c.useState(`popupProps`),m=c.useState(`modal`),h=c.useState(`mounted`),g=c.useState(`nested`),_=c.useState(`nestedOpenDialogCount`),v=c.useState(`open`),y=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`),C=f.useState(`floatingId`);io(),pe({open:v,ref:c.context.popupRef,onComplete(){v&&c.context.onOpenChangeComplete?.(!0)}});let T=o===void 0?te(c.context.popupRef):o,E=_>0,D=c.useStateSetter(`popupElement`),ee=pn(`div`,e,{state:{open:v,nested:g,transitionStatus:x,nestedDialogOpen:E},props:[p,{id:C,"aria-labelledby":b,"aria-describedby":l,role:S,...We,hidden:!h,onKeyDown(e){d.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":_}},s],ref:[t,c.context.popupRef,D],stateAttributesMapping:ao});return(0,H.jsx)(w,{context:f,openInteractionType:y,disabled:!h,closeOnFocusOut:!u,initialFocus:T,returnFocus:a,modal:m!==!1,restoreFocus:`popup`,children:ee})}),so=V.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=$a(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,H.jsx)(ro.Provider,{value:n,children:(0,H.jsxs)(dt,{ref:t,...r,children:[a&&o===!0&&(0,H.jsx)(Fe,{ref:i.context.internalBackdropRef,inert:mt(!s)}),e.children]})}):null});function co({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=V.useState(0),[u,d]=V.useState(0),f=c===0,p=tt(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=ne(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||M(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return Le(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),st(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),C(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var lo={...$i,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},uo=class extends x{constructor(e,t,n){let r=new re,i=po(e,r,t,n);super(i,mo(r),lo)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};N(n,e,t.trigger),this.update(n)}};function fo(){let e=new re;return new ka(Object.freeze(po(void 0,e)),Object.freeze(mo(e)),lo)}function po(e,t,n,r=!1){let i={...Ki(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=qi(t,n,r),i}function mo(e){return{popupRef:V.createRef(),backdropRef:V.createRef(),internalBackdropRef:V.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function ho(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:c=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:p=null}=t,m=e===`drawer`,h=e===`alert-dialog`,g=h?!0:l,v=h||c,y=h?`alertdialog`:`dialog`,b=$a(!0),x={modal:g,disablePointerDismissal:v,nested:b!=null,role:y},S=k((e,t)=>new uo({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...x},e,t),!0);S.useControlledProp(`openProp`,r),S.useControlledProp(`triggerIdProp`,f),S.useSyncedValues(x),S.useContextCallback(`onOpenChange`,a),S.useContextCallback(`onOpenChangeComplete`,o);let C=S.useState(`open`),w=S.useState(`mounted`),T=S.useState(`payload`);L(S,C),P(S);let{forceUnmount:E}=_(C,S);V.useImperativeHandle(u,()=>({unmount:E,close:()=>S.setOpen(!1,ve(j))}),[E,S]);let D=C||w;return(0,H.jsxs)(Qa.Provider,{value:S,children:[d&&(0,H.jsx)(s,{handle:d,store:S}),D&&(0,H.jsx)(co,{store:S,parentContext:b?.context,isDrawer:m}),typeof n==`function`?n({payload:T}):n]})}function go(e){return ho(`dialog`,e)}var _o=V.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=io(),c=$a(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`transitionStatus`),f=c.useState(`nestedOpenDialogCount`),p=c.useState(`mounted`),m=c.useStateSetter(`viewportElement`);return pn(`div`,e,{enabled:s||p,state:{open:l,nested:u,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,m],stateAttributesMapping:ao,props:[{role:`presentation`,hidden:!p,style:{pointerEvents:l?void 0:`none`},children:a},o]})}),vo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=$a(),c=he(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),pn(`h2`,e,{ref:t,props:[{id:c},o]})}),yo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=$a(!0),f=ta(l)??d;if(!f)throw Error(_n(79));let p=he(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=V.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=bt(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Xe({disabled:a,native:o}),S=En(m),C=xn(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return pn(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Ze]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:nt})}),bo=class extends Wi{constructor(){super(fo(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let t=this.attachedStore;t!==null&&(t.set(`payload`,e),t.setOpen(!0,ve(j)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}},xo=V.createContext(void 0);function So(){let e=V.useContext(xo);if(e===void 0)throw Error(_n(53));return e}function Co(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var wo=e=>t=>t?{[e]:``}:null,To={hasOverflowX:wo(`data-has-overflow-x`),hasOverflowY:wo(`data-has-overflow-y`),overflowXStart:wo(`data-overflow-x-start`),overflowXEnd:wo(`data-overflow-x-end`),overflowYStart:wo(`data-overflow-y-start`),overflowYEnd:wo(`data-overflow-y-end`),cornerHidden:()=>null},Eo={x:0,y:0},Do={width:0,height:0},Oo={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},ko={x:!0,y:!0,corner:!0},Ao=V.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=jo(i),d=he(),f=ce(),p=ce(),{nonce:m,disableStyleElements:h}=et(),[g,_]=V.useState(!1),[v,y]=V.useState(!1),[b,x]=V.useState(!1),[S,C]=V.useState(!1),[w,T]=V.useState(!1),[E,D]=V.useState(Do),[ee,O]=V.useState(Do),[k,A]=V.useState(Oo),[te,j]=V.useState(ko),N=V.useRef(null),ne=V.useRef(null),re=V.useRef(null),ie=V.useRef(null),P=V.useRef(null),F=V.useRef(null),I=V.useRef(null),L=V.useRef(null),ae=V.useRef(0),R=V.useRef(0),oe=V.useRef(0),z=V.useRef(0),se=V.useRef(`vertical`),le=V.useRef(Eo),ue=V.useRef(null);function de(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let fe=Oe(e=>{let t=e.x-le.current.x,n=e.y-le.current.y;le.current=e,n!==0&&de(!0),t!==0&&de(!1)}),pe=Oe(()=>{let e=ne.current;e&&ue.current===null&&(ue.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),me=Oe(e=>{if(e.button!==0||L.current!==null&&(se.current===`vertical`?P.current:F.current)?.hasPointerCapture(L.current))return;L.current=e.pointerId,ae.current=e.clientY,R.current=e.clientX,se.current=e.currentTarget.getAttribute(`data-orientation`);let t=ne.current;t&&(oe.current=t.scrollTop,z.current=t.scrollLeft,pe()),(se.current===`vertical`?P.current:F.current)?.setPointerCapture(e.pointerId)}),ge=Oe(e=>{if(e.pointerId!==L.current)return;L.current=null,(se.current===`vertical`?x:y)(!1),ue.current!==null&&(ne.current&&(ne.current.style.scrollSnapType=ue.current),ue.current=null);let t=se.current===`vertical`?P.current:F.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),_e=Oe(e=>{if(e.pointerId!==L.current)return;if(e.buttons%2==0){ge(e);return}let t=ne.current;if(!t)return;let n=se.current===`vertical`,r=n?P.current:F.current,i=n?re.current:ie.current;if(!r||!i)return;let a=n?`y`:`x`,o=Co(i,`padding`,a),s=Co(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-ae.current:e.clientX-R.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?oe.current:z.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),de(n)});function ve(e){C(e.pointerType===`touch`)}function ye(e){if(ve(e),e.pointerType!==`touch`){let t=M(N.current,e.target);_(t)}}let be=V.useMemo(()=>({scrolling:v||b,hasOverflowX:!te.x,hasOverflowY:!te.y,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:te.corner}),[v,b,te.x,te.y,te.corner,k]),xe={role:`presentation`,onPointerEnter:ye,onPointerMove:ye,onPointerDown:ve,onPointerLeave(){_(!1)},style:{position:`relative`,"--scroll-area-corner-height":`${E.height}px`,"--scroll-area-corner-width":`${E.width}px`}},Se=pn(`div`,e,{state:be,ref:[t,N],props:[xe,o],stateAttributesMapping:To}),Ce=V.useMemo(()=>({handlePointerDown:me,handlePointerMove:_e,handlePointerUp:ge,handleScroll:fe,disableViewportSnap:pe,cornerSize:E,setCornerSize:D,thumbSize:ee,setThumbSize:O,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:I,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:ne,scrollbarYRef:re,scrollbarXRef:ie,thumbYRef:P,thumbXRef:F,rootId:d,hiddenState:te,setHiddenState:j,overflowEdges:k,setOverflowEdges:A,viewportState:be,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[me,_e,ge,fe,pe,E,ee,w,S,v,b,g,d,te,k,be,s,c,l,u]);return(0,H.jsxs)(xo.Provider,{value:Ce,children:[!h&&Je.getElement(m),Se]})});function jo(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var Mo=V.createContext(void 0),No=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],Po=!1;function Fo(){Po||o||(typeof CSS<`u`&&`registerProperty`in CSS&&No.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),Po=!0)}var Io=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=So(),T=xe(),E=V.useRef(!0),D=V.useRef([NaN,NaN,NaN,NaN]),ee=ce(),O=ce(),k=Oe(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,ee=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,ee&&v(!0),h===0||_===0)return;let O=Lo(e),k=O.y,A=O.x,te=b/_,j=y/h,M=Math.max(0,_-b),N=Math.max(0,h-y),ne=0,re=0;A||(ne=Ae(T===`rtl`?-w:w,M),re=M-ne);let ie=k?0:Ae(x,N),P=k?0:N-ie,F=A?0:b,I=k?0:y,L=0,ae=0;!A&&!k&&(L=t?.offsetWidth||0,ae=n?.offsetHeight||0);let R=f.width===0&&f.height===0,oe=R?L:0,z=R?ae:0,se=Co(n,`padding`,`x`),ce=Co(t,`padding`,`y`),le=Co(i,`margin`,`x`),ue=Co(r,`margin`,`y`),de=F-se-le,fe=I-ce-ue,pe=n?Math.min(n.offsetWidth-oe,de):de,me=t?Math.min(t.offsetHeight-z,fe):fe,he=Math.max(16,pe*te),ge=Math.max(16,me*j);if(m(e=>Ro(e,{width:he,height:ge})),t&&r){let e=zo(r,`--scroll-area-thumb-height`,x,N,h,ge,t.offsetHeight-ge-ce-ue);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-he-se-le,t=zo(i,`--scroll-area-thumb-width`,T===`rtl`?-w:w,M,_,he,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let _e=[ne,re,ie,P];No.forEach((t,n)=>{e.style.setProperty(t,`${_e[n]}px`)}),a&&p(e=>Ro(e,{width:L,height:ae})),g(e=>Ro(e,O));let ve={xStart:!A&&ne>C.xStart,xEnd:!A&&re>C.xEnd,yStart:!k&&ie>C.yStart,yEnd:!k&&P>C.yEnd};S(e=>Ro(e,ve))});st(()=>{Fo()},[]),st(()=>{queueMicrotask(k)},[k,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),st(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),st(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}k()});return n.observe(e),O.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(k).catch(()=>{})}),()=>{n.disconnect(),O.clear()}},[k,o,O]);function A(){E.current=!1}let te={role:`presentation`,...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:Je.className,style:{overflow:`scroll`},onScroll(){o.current&&(k(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),ee.start(100,()=>{E.current=!0}))},onWheel:A,onPointerMove:A,onPointerEnter:A,onKeyDown:A},j=pn(`div`,e,{ref:[t,o],state:w,props:[te,a],stateAttributesMapping:To}),M=V.useMemo(()=>({computeThumbPosition:k}),[k]);return(0,H.jsx)(Mo.Provider,{value:M,children:j})});function Lo(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function Ro(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function zo(e,t,n,r,i,a,o){let s=Ne(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var Bo=V.createContext(void 0);function Vo(){let e=V.useContext(Bo);if(e===void 0)throw Error(_n(54));return e}var Ho=V.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=So(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=xe(),ee=!C&&!a,O=T?d.y:d.x,k=a||!O;V.useEffect(()=>{if(!k)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return ht(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,k,m]);let A={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(e){if(e.button!==0)return;let t=ne(e.nativeEvent),n=T?h.current:g.current;if(n&&M(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=Co(n,`margin`,a),s=Co(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:ee?`hidden`:void 0,...T?{top:0,bottom:`var(--scroll-area-corner-height)`,insetInlineEnd:0,"--scroll-area-thumb-height":`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(--scroll-area-corner-width)`,bottom:0,"--scroll-area-thumb-width":`${S.width}px`}}},te=pn(`div`,e,{ref:[t,T?f:p],state:E,props:[A,s],stateAttributesMapping:To});return k?(0,H.jsx)(Bo.Provider,{value:i,children:te}):null}),Uo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=So(),m=Vo(),h=m===`vertical`;return pn(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),Wo=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=So(),l=pn(`div`,e,{ref:[t,o],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function Go({className:e,children:t,scrollFade:n=!1,scrollbarGutter:r=!1,hideScrollbars:i=!1,chainVerticalScroll:a=!1,...o}){return(0,H.jsxs)(Ao,{className:B(`relative size-full min-h-0 overflow-hidden rounded-[inherit]`,e),...o,children:[(0,H.jsx)(Io,{className:B(`h-full max-h-[inherit] overflow-auto overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain`,a&&`overscroll-y-auto`,n&&`mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]`,r&&`scrollbar-gutter-stable`,i&&`[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`),"data-slot":`scroll-area-viewport`,children:t}),!i&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ko,{orientation:`vertical`}),(0,H.jsx)(Ko,{orientation:`horizontal`}),(0,H.jsx)(Wo,{"data-slot":`scroll-area-corner`})]})]})}function Ko({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(Ho,{className:B(`m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100`,e),"data-slot":`scroll-area-scrollbar`,orientation:t,...n,children:(0,H.jsx)(Uo,{className:`relative flex-1 rounded-full bg-foreground/20`,"data-slot":`scroll-area-thumb`})})}var qo=go,Jo=so;function Yo(e){return(0,H.jsx)(yo,{"data-slot":`sheet-trigger`,...e})}function Xo({className:e,...t}){return(0,H.jsx)(eo,{className:B(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`sheet-backdrop`,...t})}function Zo({className:e,side:t,variant:n=`default`,...r}){return(0,H.jsx)(_o,{className:B(`fixed inset-0 z-50 grid`,t===`bottom`&&`grid grid-rows-[1fr_auto] pt-12`,t===`top`&&`grid grid-rows-[auto_1fr] pb-12`,t===`left`&&`flex justify-start`,t===`right`&&`flex justify-end`,n===`inset`&&`sm:p-4`,e),"data-slot":`sheet-viewport`,...r})}function Qo({className:e,children:t,showCloseButton:n=!0,keepMounted:r=!1,side:i=`right`,variant:a=`default`,...o}){return(0,H.jsxs)(Jo,{keepMounted:r,children:[(0,H.jsx)(Xo,{}),(0,H.jsx)(Zo,{side:i,variant:a,children:(0,H.jsxs)(oo,{className:B(`relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,i===`bottom`&&`row-start-2 border-t data-ending-style:translate-y-8 data-starting-style:translate-y-8`,i===`top`&&`data-ending-style:-translate-y-8 data-starting-style:-translate-y-8 border-b`,i===`left`&&`data-ending-style:-translate-x-8 data-starting-style:-translate-x-8 w-[calc(100%-(--spacing(12)))] max-w-md border-e`,i===`right`&&`col-start-2 w-[calc(100%-(--spacing(12)))] max-w-md border-s data-ending-style:translate-x-8 data-starting-style:translate-x-8`,a===`inset`&&`before:hidden sm:rounded-2xl sm:border sm:before:rounded-[calc(var(--radius-2xl)-1px)] sm:**:data-[slot=sheet-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]`,e),"data-slot":`sheet-popup`,...o,children:[t,n&&(0,H.jsx)(to,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,H.jsx)(yn,{size:`icon`,variant:`ghost`}),children:(0,H.jsx)(Ei,{})})]})})]})}function $o({className:e,...t}){return(0,H.jsx)(vo,{className:B(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`sheet-title`,...t})}function es(){return typeof window>`u`?!1:window.matchMedia(`(max-width: 767px)`).matches}function ts(){let[e,t]=V.useState(es);return V.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function ns({workspaces:e}){let t=(0,V.useRef)(null),n=(0,V.useRef)(null),r=Lt(),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(0),c=[{title:`Start work`,detail:`Create a workspace`,route:`/new`},{title:`Overview`,detail:`Your workspace home`,route:`/overview`},...e.map(e=>({title:e.branchName,detail:`${e.repos.length} repositories · ${e.description||`Open workspace`}`,route:`/workspaces/${encodeURIComponent(e.branchName)}`})),{title:`Projects`,detail:`Manage repositories`,route:`/projects`},{title:`Workrooms`,detail:`Collaborate with your team`,route:`/workrooms`},{title:`Resource Library`,detail:`Skills and agents`,route:`/skills`},{title:`Settings`,detail:`Make this space yours`,route:`/settings`}].filter(e=>`${e.title} ${e.detail}`.toLowerCase().includes(i.trim().toLowerCase())),l=Math.min(o,Math.max(c.length-1,0));function u(){a(``),s(0),t.current?.showModal(),n.current?.focus()}function d(e){t.current?.close(),r(e)}return(0,V.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.current?.open?t.current.close():u())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,V.useEffect)(()=>{t.current?.open&&document.getElementById(`quick-result-${l}`)?.scrollIntoView({block:`nearest`})},[l]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,onClick:u,className:`mx-2.5 my-2 flex h-9 items-center gap-2 rounded-lg border border-input bg-background/60 px-2.5 text-xs text-muted-foreground transition-colors hover:border-primary/50 hover:text-foreground`,"aria-label":`Search and jump to a workspace`,"aria-keyshortcuts":`Control+k Meta+k`,children:[(0,H.jsx)(Ct,{size:14}),(0,H.jsx)(`span`,{children:`Jump to…`}),(0,H.jsx)(`kbd`,{className:`ml-auto rounded border border-border px-1 text-[10px]`,children:`⌘ / Ctrl K`})]}),(0,H.jsxs)(`dialog`,{ref:t,"aria-labelledby":`quick-switch-title`,className:`context-switch m-auto w-[min(560px,calc(100vw-32px))] overflow-hidden rounded-2xl border border-border bg-popover p-0 text-popover-foreground shadow-2xl`,onClick:e=>{if(e.target===t.current){let n=e.currentTarget.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&t.current.close()}},children:[(0,H.jsx)(`h2`,{id:`quick-switch-title`,className:`sr-only`,children:`Jump to a workspace or page`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-5`,children:[(0,H.jsx)(Ct,{size:18,className:`text-primary`}),(0,H.jsx)(`input`,{ref:n,value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),s(c.length?(l+(e.key===`ArrowDown`?1:-1)+c.length)%c.length:0)),e.key===`Enter`&&c[l]&&(e.preventDefault(),d(c[l].route))},role:`combobox`,"aria-expanded":`true`,"aria-controls":`quick-results`,"aria-autocomplete":`list`,"aria-activedescendant":c[l]?`quick-result-${l}`:void 0,"aria-label":`Search pages and workspaces`,placeholder:`Where do you want to go?`,className:`h-16 min-w-0 flex-1 bg-transparent text-sm outline-none`}),(0,H.jsx)(`button`,{onClick:()=>t.current?.close(),"aria-label":`Close search`,className:`rounded p-1 text-muted-foreground hover:bg-accent`,children:(0,H.jsx)(Ei,{size:17})})]}),(0,H.jsxs)(`div`,{id:`quick-results`,role:`listbox`,"aria-label":`Destinations`,className:`max-h-[min(400px,60vh)] overflow-y-auto p-2`,children:[c.map((e,t)=>(0,H.jsxs)(`div`,{id:`quick-result-${t}`,role:`option`,"aria-selected":t===l,onMouseMove:()=>s(t),onClick:()=>d(e.route),className:`flex cursor-pointer items-center gap-3 rounded-lg p-3 ${t===l?`bg-accent text-accent-foreground`:``}`,children:[(0,H.jsx)(Ut,{size:17,className:`shrink-0 text-primary`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,H.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.detail})]}),(0,H.jsx)(yr,{size:14})]},e.route)),!c.length&&(0,H.jsx)(`p`,{className:`p-8 text-center text-sm text-muted-foreground`,children:`No results. Try a workspace name or “Settings”.`})]}),(0,H.jsx)(`div`,{className:`border-t border-border px-5 py-3 text-[10px] text-muted-foreground`,children:`↑ ↓ to navigate · Enter to open · Esc to close`})]})]})}var rs=[{id:`sunset`,label:`Sunset`,favicon:`/favicon.svg`,dotClass:`bg-gradient-to-r from-amber-400 to-rose-500`,description:`ContextSpace classic warm twilight`},{id:`aurora`,label:`Aurora`,favicon:`/favicon-aurora.svg`,dotClass:`bg-gradient-to-r from-teal-400 to-indigo-400`,description:`Cool boreal teal and cyan`},{id:`forest`,label:`Forest`,favicon:`/favicon-forest.svg`,dotClass:`bg-gradient-to-r from-emerald-400 to-teal-500`,description:`Lush emerald and pine`},{id:`nebula`,label:`Nebula`,favicon:`/favicon-nebula.svg`,dotClass:`bg-gradient-to-r from-pink-400 to-violet-500`,description:`Cosmic violet and vibrant magenta`},{id:`glacier`,label:`Glacier`,favicon:`/favicon-glacier.svg`,dotClass:`bg-gradient-to-r from-sky-300 to-blue-500`,description:`Crisp arctic slate and ice blue`}];function is(e){return rs.find(t=>t.id===e)?.favicon||`/favicon.svg`}var as=(0,V.createContext)({theme:`dark`,setTheme:()=>{},colorTheme:`sunset`,setColorTheme:()=>{}});function os(){try{let e=localStorage.getItem(or)||localStorage.getItem(Zn);if(e===`light`||e===`dark`)return e}catch{}return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function ss(){try{let e=localStorage.getItem(Yn);if(e&&rs.some(t=>t.id===e))return e}catch{}return`sunset`}function cs({children:e}){let[t,n]=(0,V.useState)(os),[r,i]=(0,V.useState)(ss);(0,V.useEffect)(()=>{let e=document.documentElement;e.classList.add(`no-transitions`),e.classList.toggle(`dark`,t===`dark`),e.dataset.colorTheme=r;let n=document.querySelector(`link[rel="icon"]`);n&&(n.href=is(r));let i=requestAnimationFrame(()=>e.classList.remove(`no-transitions`));return()=>{cancelAnimationFrame(i),e.classList.remove(`no-transitions`)}},[t,r]);let a=(0,V.useCallback)(e=>{try{localStorage.setItem(or,e)}catch{}n(e)},[]),o=(0,V.useCallback)(e=>{if(rs.some(t=>t.id===e)){try{localStorage.setItem(Yn,e)}catch{}i(e)}},[]);return(0,H.jsx)(as.Provider,{value:{theme:t,setTheme:a,colorTheme:r,setColorTheme:o},children:e})}function ls(){return(0,V.useContext)(as)}var us=({worktree:e,isActive:t,onSelect:n,onEditTitle:r})=>{let i=e.commitInfo?.shortSha||e.commitSha?.slice(0,7)||`unknown`;return(0,H.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},className:B(`group relative flex flex-col gap-1 px-2.5 py-2 rounded-lg text-left transition-all cursor-pointer select-none border`,t?`bg-primary/10 border-primary/40 shadow-xs`:`bg-card/40 hover:bg-accent/60 border-border/40 hover:border-border/80 text-muted-foreground hover:text-foreground`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0 flex-1`,children:[(0,H.jsx)(Pr,{size:13,className:B(`shrink-0`,t?`text-primary`:`text-muted-foreground/70`)}),(0,H.jsx)(`span`,{className:B(`text-xs font-medium tracking-tight truncate`,t?`text-foreground font-semibold`:`text-foreground/90`),title:e.intent||e.title,children:e.title})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.status===`active_review`||t?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[9px] font-semibold px-1.5 py-0.5 rounded bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30`,title:`Active worktree in code review`,children:[(0,H.jsx)(kr,{size:5,className:`fill-current text-emerald-500`}),(0,H.jsx)(`span`,{children:`in review`})]}):e.status===`agent_running`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-mono text-[9px] font-semibold px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-600 dark:text-amber-400 border border-amber-500/30 animate-pulse`,title:`Autonomous agent executing in this worktree`,children:[(0,H.jsx)(Di,{size:9,className:`text-amber-500`}),(0,H.jsx)(`span`,{children:`agent`})]}):e.status===`host_readonly`?(0,H.jsx)(`span`,{className:`font-mono text-[9px] font-medium px-1.5 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/50 uppercase tracking-wider`,title:`Host repository reference (Read-Only)`,children:`host: ro`}):e.dirtyFilesCount===null?(0,H.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:`status unknown`}):e.dirtyFilesCount>0?(0,H.jsxs)(`span`,{className:`font-mono text-[9px] font-semibold px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-600 dark:text-amber-400 border border-amber-500/30`,title:`${e.dirtyFilesCount} modified uncommitted files`,children:[`±`,e.dirtyFilesCount]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 font-mono text-[9px] font-medium px-1 py-0.5 rounded bg-muted/50 text-muted-foreground/80 border border-border/40`,title:`Git worktree clean`,children:[(0,H.jsx)(wr,{size:9,className:`text-emerald-500/80`}),(0,H.jsx)(`span`,{children:`clean`})]}),r&&(0,H.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(e)},title:`Edit human title and intent`,className:`opacity-0 group-hover:opacity-100 p-0.5 hover:text-foreground text-muted-foreground/60 transition-opacity rounded`,children:(0,H.jsx)(ii,{size:11})})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[10px] text-muted-foreground/75 min-w-0 pl-4.5`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0 truncate`,children:[(0,H.jsx)(zr,{size:10,className:`shrink-0 text-muted-foreground/60`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.branchName})]}),(0,H.jsxs)(`span`,{className:`shrink-0 text-muted-foreground/50`,children:[`@`,i]}),e.isPinned&&(0,H.jsx)(`span`,{className:`shrink-0 flex items-center gap-0.5 text-primary/80`,title:`Worktree locked against pruning`,children:(0,H.jsx)(qr,{size:9})})]})]})},ds=({worktree:e,isOpen:t,onClose:n,onSave:r})=>{let[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``);return(0,V.useEffect)(()=>{e&&(a(e.title||``),s(e.intent||``))},[e]),!t||!e?null:(0,H.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs p-4 animate-in fade-in duration-150`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-card p-5 shadow-2xl space-y-4`,role:`dialog`,"aria-modal":`true`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`p-1.5 rounded-lg bg-primary/10 text-primary`,children:(0,H.jsx)(bi,{size:18})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Edit Worktree Metadata`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground`,children:[(0,H.jsx)(zr,{size:10}),(0,H.jsx)(`span`,{children:e.branchName}),(0,H.jsx)(`span`,{children:`•`}),(0,H.jsx)(`span`,{children:e.repoName})]})]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/80 transition-colors`,children:(0,H.jsx)(Ei,{size:16})})]}),(0,H.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),i.trim()&&(r(e.id,i.trim(),o.trim()),n())},className:`space-y-3.5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-xs font-medium text-foreground/90 mb-1`,children:`Human Title (Semantic Intent)`}),(0,H.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Vacation Agreement Calc Engine`,required:!0,autoFocus:!0,className:`w-full rounded-lg border border-border bg-background px-3 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-primary`}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1`,children:`High-contrast title displayed prominently across the left panel and cockpit header.`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-xs font-medium text-foreground/90 mb-1`,children:`Intent / Strategic Objective`}),(0,H.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:`Describe the architectural objective or feature requirements of this worktree slice...`,rows:3,className:`w-full rounded-lg border border-border bg-background px-3 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-primary resize-none`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-border/60`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors cursor-pointer`,children:`Cancel`}),(0,H.jsxs)(`button`,{type:`submit`,disabled:!i.trim(),className:`inline-flex items-center gap-1.5 px-3.5 py-1.5 text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 disabled:opacity-50 rounded-lg transition-colors cursor-pointer shadow-xs`,children:[(0,H.jsx)(di,{size:13}),(0,H.jsx)(`span`,{children:`Save Metadata`})]})]})]})]})})},fs=({repoGroups:e,activeWorktreeId:t,onSelectWorktree:n,onNewWorktree:r,onUpdateWorktreeTitle:i,customTitles:a={}})=>{let[o,s]=(0,V.useState)({}),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(null),f=e=>{s(t=>({...t,[e]:!(t[e]??!0)}))},p=(0,V.useMemo)(()=>e.map(e=>({...e,worktrees:e.worktrees.map(e=>{let t=a[e.id];return t?{...e,title:t.title||e.title,intent:t.intent===void 0?e.intent:t.intent}:e})})),[e,a]),m=(0,V.useMemo)(()=>{if(!c.trim())return p;let e=c.toLowerCase();return p.map(t=>({...t,worktrees:t.worktrees.filter(t=>t.title.toLowerCase().includes(e)||t.branchName.toLowerCase().includes(e)||t.repoName.toLowerCase().includes(e)||t.intent&&t.intent.toLowerCase().includes(e))}))},[p,c]),h=(0,V.useMemo)(()=>p.reduce((e,t)=>e+t.worktrees.length,0),[p]);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-0 w-full`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between px-1 text-xs text-muted-foreground`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,H.jsx)(Wr,{size:13,className:`text-primary`}),(0,H.jsx)(`span`,{children:`Worktrees`}),(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.2 rounded-full bg-muted font-mono`,children:h})]})}),(0,H.jsxs)(`div`,{className:`relative w-full`,children:[(0,H.jsx)(Ct,{size:12,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/60 pointer-events-none`}),(0,H.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`Filter worktrees...`,className:`w-full rounded-md border border-border/60 bg-muted/30 pl-8 pr-2.5 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus:bg-background focus:outline-hidden focus:ring-1 focus:ring-primary transition-colors`})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-2 mt-1 min-w-0`,children:m.map(e=>{let i=o[e.repoName]??!0;return(0,H.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border/40 bg-card/20 overflow-hidden`,children:[(0,H.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>f(e.repoName),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),f(e.repoName))},className:`flex items-center justify-between px-2.5 py-1.5 bg-muted/30 hover:bg-muted/60 transition-colors cursor-pointer select-none text-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[i?(0,H.jsx)(bn,{size:13,className:`text-muted-foreground shrink-0`}):(0,H.jsx)(Er,{size:13,className:`text-muted-foreground shrink-0`}),(0,H.jsx)(Ut,{size:13,className:`text-muted-foreground shrink-0`}),(0,H.jsx)(`span`,{className:`font-semibold text-foreground truncate`,children:e.repoName}),e.isHostRepo&&(0,H.jsx)(`span`,{className:`font-mono text-[9px] px-1 py-0.2 rounded bg-muted text-muted-foreground/80 border border-border/40 uppercase`,children:`ro`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground/70`,children:[e.worktrees.length,` wt`]}),r&&(0,H.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(e.repoName)},title:`Isolate new worktree in ${e.repoName}`,className:`p-0.5 hover:text-foreground text-muted-foreground hover:bg-accent rounded transition-colors`,children:(0,H.jsx)(ci,{size:12})})]})]}),i&&(0,H.jsx)(`div`,{className:`p-1.5 flex flex-col gap-1`,children:e.worktrees.length===0?(0,H.jsx)(`div`,{className:`px-2 py-2 text-[11px] italic text-muted-foreground text-center`,children:`No worktrees match filter`}):e.worktrees.map(e=>(0,H.jsx)(us,{worktree:e,isActive:e.id===t,onSelect:n,onEditTitle:e=>d(e)},e.id))})]},e.repoName)})}),(0,H.jsx)(ds,{worktree:u,isOpen:!!u,onClose:()=>d(null),onSave:(e,t,n)=>{i?.(e,t,n)}})]})};function ps(e,t){if(!e||typeof e!=`object`)return[];let n=[],r=Array.isArray(e.repos)?e.repos:[];for(let i of r){if(!i||typeof i!=`string`)continue;let a=i.split(/[/\\]/).filter(Boolean).pop()||i,o=i.replace(/[^a-zA-Z0-9]/g,`_`),s=e.isolatedRepos?.[a],c=e.mode===`in-place`,l=e.originalRepos?.find(e=>e.split(/[/\\]/).filter(Boolean).pop()===a)||i,u=s?.worktreePath||i,d=s?.branchName||(c?e.repoBranches?.[a]:e.branchName)||`unknown`,f=t&&(r.length===1||t.changedFiles===0)?Math.max(0,t.changedFiles):null,p=[{id:`wt-${a}-${d}-${o}`,workspaceId:e.branchName||``,repoName:a,repoPath:i,sourcePath:l,worktreePath:u,branchName:d,baseBranch:s?.baseBranch,title:e.description&&e.description.length>3&&e.description.length<55?e.description:ms(d),intent:e.description||`Working repository on ${d}`,status:f===null?`unknown`:f>0?`dirty`:`clean`,isPinned:!1,isHostReadOnly:!1,commitSha:``,dirtyFilesCount:f,isolatedAt:s?.isolatedAt||e.createdAt}];l!==u&&p.push({id:`wt-${a}-host-${o}`,workspaceId:e.branchName||``,repoName:a,repoPath:l,sourcePath:l,worktreePath:l,branchName:s?.baseBranch||`unknown`,title:`${a} Host Baseline`,intent:`Source repository reference`,status:`host_readonly`,isPinned:!1,isHostReadOnly:!0,commitSha:``,dirtyFilesCount:null}),n.push({repoName:a,repoPath:i,isHostRepo:c&&!s,sourcePath:l,worktrees:p})}return n}function ms(e){return!e||typeof e!=`string`?`Untitled Worktree`:e.replace(/^(feat|fix|bug|refactor|epic|chore)\//i,``).split(/[-_]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var hs=`ctxspace_sidebar_collapsed`,gs=`ctxspace_worktree_titles`;function _s(){try{let e=localStorage.getItem(gs);return e?JSON.parse(e):{}}catch{return{}}}function vs(e,t,n){try{let r=_s();r[e]={title:t,intent:n},localStorage.setItem(gs,JSON.stringify(r))}catch{}}function ys(){let[e,t]=(0,V.useState)(()=>{try{return localStorage.getItem(hs)===`true`}catch{return!1}}),[n,r]=(0,V.useState)({}),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(()=>_s());(0,V.useEffect)(()=>{let e=e=>{if(e.key===gs&&e.newValue)try{l(JSON.parse(e.newValue))}catch{}else e.key===hs&&t(e.newValue===`true`)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let u=(0,V.useCallback)(()=>{t(e=>{let t=!e;try{localStorage.setItem(hs,String(t))}catch{}return t})},[]);return{isCollapsed:e,setIsCollapsed:(0,V.useCallback)(e=>{t(e);try{localStorage.setItem(hs,String(e))}catch{}},[]),toggleCollapsed:u,expandedRepos:n,toggleRepo:(0,V.useCallback)(e=>{r(t=>({...t,[e]:!(t[e]??!0)}))},[]),searchFilter:i,setSearchFilter:a,editingWorktree:o,setEditingWorktree:s,customTitles:c,updateTitle:(0,V.useCallback)((e,t,n)=>{vs(e,t,n),l(r=>({...r,[e]:{title:t,intent:n}}))},[])}}var bs={workspaceId:null,workspaceTitle:``,workspaceIntent:``,activeIterationId:null,activeWorktreeId:null,activeStage:`diff`,diffViewMode:`side-by-side`,isZenMode:!1,gateStatus:{overallStatus:`idle`,summaryText:`No verification gate run yet`},iterations:[],worktrees:{}},xs={...bs},Ss=new Set;function Cs(){for(let e of Ss)e()}var ws={getState:()=>xs,subscribe:e=>(Ss.add(e),()=>Ss.delete(e)),setWorkspaceData:e=>{let t=xs.workspaceId!==e.workspaceId,n;n=t?e.activeIterationId&&e.iterations.some(t=>t.id===e.activeIterationId)?e.activeIterationId:(e.iterations.find(e=>e.status===`agent_running`||e.status===`review_ready`)||e.iterations[0])?.id||null:e.activeIterationId&&e.iterations.some(t=>t.id===e.activeIterationId)?e.activeIterationId:xs.activeIterationId&&e.iterations.some(e=>e.id===xs.activeIterationId)?xs.activeIterationId:(e.iterations.find(e=>e.status===`agent_running`||e.status===`review_ready`)||e.iterations[0])?.id||null;let r;r=t?e.activeWorktreeId&&e.worktrees[e.activeWorktreeId]?e.activeWorktreeId:Object.keys(e.worktrees)[0]||null:e.activeWorktreeId&&e.worktrees[e.activeWorktreeId]?e.activeWorktreeId:xs.activeWorktreeId&&e.worktrees[xs.activeWorktreeId]?xs.activeWorktreeId:Object.keys(e.worktrees)[0]||null,xs={...xs,workspaceId:e.workspaceId,workspaceTitle:e.workspaceTitle,workspaceIntent:e.workspaceIntent,iterations:e.iterations,worktrees:e.worktrees,activeIterationId:n,activeWorktreeId:r,gateStatus:e.gateStatus||(t?{overallStatus:`idle`,summaryText:`No verification gate run yet`}:xs.gateStatus)},Cs()},selectIteration:e=>{let t=xs.iterations.find(t=>t.id===e)?.worktreeId||xs.activeWorktreeId;xs={...xs,activeIterationId:e,activeWorktreeId:t},Cs()},selectWorktree:e=>{let t=xs.iterations.find(t=>t.worktreeId===e);xs={...xs,activeWorktreeId:e,activeIterationId:t?t.id:xs.activeIterationId},Cs()},setActiveStage:e=>{xs={...xs,activeStage:e},Cs()},toggleDiffMode:()=>{xs={...xs,diffViewMode:xs.diffViewMode===`side-by-side`?`unified`:`side-by-side`},Cs()},setDiffMode:e=>{xs={...xs,diffViewMode:e},Cs()},toggleZenMode:()=>{xs={...xs,isZenMode:!xs.isZenMode},Cs()},setZenMode:e=>{xs={...xs,isZenMode:e},Cs()},setGateStatus:e=>{xs={...xs,gateStatus:e},Cs()},reset:()=>{xs={...bs},Cs()}};function Ts(){return{...(0,V.useSyncExternalStore)(ws.subscribe,ws.getState,()=>bs),...ws}}function Es(e,t,n,r,i){let a=e.description&&e.description.length>3&&e.description.length<50?e.description:ms(e.branchName),o=e.description||`Workspace Process and Code Review Cockpit`,s=ps(e,n),c={};for(let e of s)for(let t of e.worktrees)c[t.id]=t;let l=[],u=Object.keys(c)[0]||`wt-${e.branchName}`;t?.steps&&t.steps.length>0&&(l=t.steps.map((t,r)=>{let i=`planned`;t.status===`completed`||t.status===`verified`?i=`done`:t.status===`in_progress`&&(i=(n?.changedFiles??0)>0?`review_ready`:`agent_running`);let a=Object.values(c).find(e=>t.branch&&e.branchName===t.branch),o=t.title||`Iteration ${r+1}`,s=o.toLowerCase().startsWith(`iteration`)||o.toLowerCase().startsWith(`milestone`)?o:`Iteration ${r+1}: ${o}`;return{id:`iter-${t.id||r+1}`,number:r+1,title:s,goal:t.description,status:i,worktreeId:a?.id||u,branchName:t.branch||e.branchName,changesCount:t.status===`in_progress`?n?.changedFiles??0:0}}));let d;if(i){let e=i.overallStatus;d={overallStatus:e===`pass`||e===`pass_dirty`?`pass`:e===`fail`||e===`timeout`?`fail`:`idle`,durationMs:i.durationMs,summaryText:`Verification: ${e.replace(`_`,` `)} (${i.repos?.length??0} repos)`}}else d={overallStatus:`idle`,summaryText:`No verification gate run yet`};return{workspaceTitle:a,workspaceIntent:o,worktrees:c,iterations:l,gateStatus:d}}var Ds=[{label:`Projects`,to:`/projects`,icon:Ut,match:e=>e.startsWith(`/projects`)},{label:`Workrooms`,to:`/workrooms`,icon:Ci,match:e=>e.startsWith(`/workrooms`)},{label:`Resource Library`,to:`/skills`,icon:Cr,match:e=>e.startsWith(`/skills`)||e.startsWith(`/agents`)},{label:`Strategies`,to:`/workflows`,icon:Ti,match:e=>e.startsWith(`/workflows`)||e.startsWith(`/strategies`)},{label:`Settings`,to:`/settings`,icon:pi,match:e=>e.startsWith(`/settings`)}];function Os({appVersion:e,workspaces:t=[],workspaceStatuses:n={},workspacesLoading:r=!1,activeWsId:i=null,onSelectWorkspace:a}){let{pathname:o}=Ft(),s=Lt(),{theme:c,setTheme:l,colorTheme:u,setColorTheme:d}=ls(),{open:f}=Mt(),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(`created-desc`),[_,v]=(0,V.useState)(!1),{isCollapsed:y,toggleCollapsed:b,customTitles:x,updateTitle:S}=ys(),C=Ts(),w=o.match(/\/workspaces\/([^/]+)/),T=w?decodeURIComponent(w[1]):i,E=!!T,D=(0,V.useMemo)(()=>T&&t.find(e=>e.branchName===T||e.id===T)||null,[t,T]),ee=(0,V.useMemo)(()=>D?ps(D,n[D.branchName]):[],[D,n]);(0,V.useEffect)(()=>{let e=e=>{let t=e.target;t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable||e.ctrlKey||e.metaKey||e.altKey||(e.key===`z`||e.key===`Z`||e.key===`[`)&&b()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b]);let O=(0,V.useMemo)(()=>{let e=t,r=p.trim().toLowerCase();return r&&(e=e.filter(e=>`${e.branchName} ${e.description}`.toLowerCase().includes(r))),[...e].sort((e,t)=>{switch(h){case`created-desc`:{let n=new Date(e.createdAt||0).getTime();return new Date(t.createdAt||0).getTime()-n}case`created-asc`:return new Date(e.createdAt||0).getTime()-new Date(t.createdAt||0).getTime();case`changes-desc`:{let r=n[e.branchName]?.changedFiles||0;return(n[t.branchName]?.changedFiles||0)-r}case`repos-desc`:return(t.repos?.length||0)-(e.repos?.length||0);case`name-asc`:return e.branchName.localeCompare(t.branchName);default:return 0}})},[t,p,h,n]),k=e=>B(`flex items-center gap-2 rounded-md px-2 py-1.5 text-xs font-medium transition-colors cursor-pointer`,e?`bg-primary/10 text-primary font-semibold`:`text-muted-foreground hover:bg-accent hover:text-foreground`),A={"created-desc":`Newest`,"created-asc":`Oldest`,"changes-desc":`Changes`,"name-asc":`A–Z`,"repos-desc":`Repos`};return y?(0,H.jsxs)(`aside`,{className:`context-sidebar flex w-14 shrink-0 flex-col border-r border-border bg-card select-none h-screen overflow-hidden transition-[width] duration-200 items-center py-3 justify-between z-30`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,H.jsx)(Dt,{to:`/overview`,title:`${rr} v${e}`,children:(0,H.jsx)(Oi,{size:24,className:`rounded-md shadow-xs hover:scale-105 transition-transform`})}),(0,H.jsx)(kt,{to:`/overview`,title:`Overview Activity`,className:({isActive:e})=>B(`p-2 rounded-lg transition-colors cursor-pointer`,e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:(0,H.jsx)(_r,{size:16})}),(0,H.jsx)(kt,{to:`/new`,title:`Start new work`,className:`p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,children:(0,H.jsx)(ci,{size:16})}),E&&(0,H.jsx)(`div`,{className:`my-1 w-6 border-t border-border/60`}),E&&D&&(0,H.jsxs)(`button`,{type:`button`,onClick:b,title:`Active Workspace: ${D.branchName} (Click to expand)`,className:`relative p-2 rounded-lg bg-primary/15 text-primary border border-primary/30 cursor-pointer hover:bg-primary/25 transition-colors`,children:[(0,H.jsx)(Ut,{size:16}),(n[D.branchName]?.changedFiles??0)>0&&(0,H.jsx)(`span`,{className:`absolute top-1 right-1 size-1.5 rounded-full bg-amber-400 animate-pulse`})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(c===`dark`?`light`:`dark`),title:c===`dark`?`Switch to light mode`:`Switch to dark mode`,className:`p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,children:c===`dark`?(0,H.jsx)(yi,{size:15}):(0,H.jsx)(ei,{size:15})}),(0,H.jsx)(`button`,{type:`button`,onClick:b,title:`Expand Cockpit Sidebar (Shortcut: z)`,className:`p-2 rounded-lg text-muted-foreground hover:text-primary hover:bg-primary/10 border border-border/50 transition-colors cursor-pointer`,children:(0,H.jsx)(ni,{size:16})})]})]}):(0,H.jsxs)(`aside`,{className:`context-sidebar flex w-60 shrink-0 flex-col border-r border-border bg-card select-none h-screen overflow-hidden transition-[width] duration-200`,children:[(0,H.jsxs)(`div`,{className:`flex h-11 items-center justify-between px-3 border-b border-border/60`,children:[(0,H.jsxs)(Dt,{to:`/overview`,className:`flex items-center gap-2 group`,children:[(0,H.jsx)(Oi,{size:22,className:`rounded-md shadow-xs transition-transform duration-200 group-hover:scale-105`}),(0,H.jsx)(`span`,{className:`text-xs font-bold tracking-tight text-foreground group-hover:text-primary transition-colors`,children:rr})]}),(0,H.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:[`v`,e]})]}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar p-2 flex flex-col gap-2`,children:[E&&D?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(`/overview`),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/60 px-2 py-1 rounded transition-colors cursor-pointer`,children:[(0,H.jsx)(vr,{size:12}),(0,H.jsx)(`span`,{children:`All Workspaces`})]}),(0,H.jsxs)(`div`,{className:`p-2.5 rounded-lg border border-border/60 bg-muted/20 flex flex-col gap-1`,children:[(0,H.jsx)(`div`,{className:`text-xs font-semibold text-foreground truncate`,title:D.description||D.branchName,children:C.workspaceTitle||D.description||D.branchName}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground truncate`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:D.branchName}),(0,H.jsx)(`span`,{children:`•`}),(0,H.jsxs)(`span`,{children:[D.repos.length,` repos`]})]})]}),(0,H.jsx)(fs,{repoGroups:ee,activeWorktreeId:C.activeWorktreeId,onSelectWorktree:e=>C.selectWorktree(e.id),customTitles:x,onUpdateWorktreeTitle:(e,t,n)=>{S(e,t,n)},onNewWorktree:e=>{s(`/new?repo=${encodeURIComponent(e)}`)}})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-0`,children:[(0,H.jsx)(ns,{workspaces:t}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsxs)(kt,{to:`/overview`,className:({isActive:e})=>k(e),children:[(0,H.jsx)(_r,{size:14}),(0,H.jsx)(`span`,{children:`Overview`})]}),(0,H.jsxs)(kt,{to:`/new`,className:({isActive:e})=>k(e),children:[(0,H.jsx)(ci,{size:14}),(0,H.jsx)(`span`,{children:`Start work`})]})]}),(0,H.jsxs)(`div`,{className:`pt-2 border-t border-border/60`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between pb-1 px-1`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Workspaces`}),(0,H.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground/80`,children:t.length})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 mb-2`,children:[(0,H.jsxs)(`div`,{className:`relative flex-1`,children:[(0,H.jsx)(Ct,{size:11,className:`absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground/60`}),(0,H.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`Filter...`,className:`w-full rounded-md border border-border/60 bg-muted/30 pl-6 pr-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus:bg-background focus:outline-hidden focus:ring-1 focus:ring-primary`})]}),(0,H.jsxs)(qa,{children:[(0,H.jsx)(Ja,{"aria-label":`Sort workspaces`,className:`inline-flex size-6 items-center justify-center rounded-md border border-border/60 bg-muted/30 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors cursor-pointer`,children:(0,H.jsx)(br,{size:11})}),(0,H.jsx)(Ya,{side:`bottom`,align:`end`,className:`w-36 text-xs`,children:Object.keys(A).map(e=>(0,H.jsxs)(Xa,{onClick:()=>g(e),className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{children:A[e]}),h===e&&(0,H.jsx)(wr,{size:12,className:`text-primary`})]},e))})]})]}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:r&&t.length===0?(0,H.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground italic`,children:`Loading workspaces...`}):O.length===0?(0,H.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground italic`,children:`No workspaces match`}):O.map(e=>{let t=i===e.branchName||i===e.id,r=n[e.branchName],o=!!(r&&r.changedFiles>0);return(0,H.jsxs)(Dt,{to:`/workspaces/${encodeURIComponent(e.branchName)}`,onClick:()=>a?.(e.branchName),className:B(`group flex flex-col gap-0.5 rounded-md px-2.5 py-1.5 text-xs transition-colors cursor-pointer border`,t?`bg-accent text-foreground font-medium border-border/70 shadow-2xs`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground border-transparent`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5 min-w-0`,children:[(0,H.jsx)(`span`,{className:`truncate font-mono tracking-tight font-medium text-foreground`,children:e.branchName}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[r?.activeAssistants&&r.activeAssistants.length>0&&(0,H.jsx)(`div`,{className:`flex items-center gap-1`,children:r.activeAssistants.map(e=>(0,H.jsx)(`span`,{className:`inline-flex size-3.5 opacity-75`,children:e===`antigravity`?(0,H.jsx)(Vn,{className:`size-3`}):e===`claude`?(0,H.jsx)(zn,{className:`size-2.5 text-[#D97757]`}):e===`codex`?(0,H.jsx)(Hn,{className:`size-2.5 text-foreground`}):e===`cursor`?(0,H.jsx)(Un,{className:`size-2.5 text-foreground`}):(0,H.jsx)(Wn,{className:`size-2.5 text-blue-400`})},e))}),(0,H.jsx)(`button`,{type:`button`,onClick:t=>{t.preventDefault(),t.stopPropagation(),f(e.branchName)},className:`opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-background text-muted-foreground`,title:`Open floating chat`,children:(0,H.jsx)(Zr,{size:11})}),(0,H.jsx)(`span`,{className:B(`size-1.5 rounded-full shrink-0`,o?`bg-amber-500`:`bg-emerald-500`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground/80 font-mono`,children:[(0,H.jsxs)(`span`,{children:[e.repos.length,` `,e.repos.length===1?`repo`:`repos`]}),o&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`•`}),(0,H.jsxs)(`span`,{className:`text-amber-500 font-semibold`,children:[`±`,r.changedFiles]})]})]})]},e.id)})})]})]}),(0,H.jsxs)(`div`,{className:`mt-auto pt-2 border-t border-border/60`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>v(!_),"aria-expanded":_,className:`flex w-full items-center justify-between px-2 py-1 text-[11px] font-semibold text-muted-foreground hover:text-foreground uppercase tracking-wider transition-colors cursor-pointer`,children:[(0,H.jsx)(`span`,{children:`Tools & Library`}),(0,H.jsx)(bn,{size:12,className:B(`transition-transform duration-200`,!_&&`-rotate-90`)})]}),_&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 mt-1`,children:[Ds.map(e=>{let t=e.icon,n=e.match(o);return(0,H.jsxs)(kt,{to:e.to,className:k(n),children:[(0,H.jsx)(t,{size:13}),(0,H.jsx)(`span`,{children:e.label})]},e.to)}),(0,H.jsxs)(`a`,{href:`https://github.com/antan87/NexusFlow#readme`,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-2 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,H.jsx)(xr,{size:13}),(0,H.jsx)(`span`,{children:`Guide`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between px-2 text-[11px] text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,H.jsx)(`span`,{className:`size-2 rounded-full bg-primary`}),(0,H.jsxs)(`span`,{children:[`Theme: `,rs.find(e=>e.id===u)?.label??`Sunset`]})]})}),(0,H.jsx)(`div`,{className:`grid grid-cols-5 gap-1 px-1`,children:rs.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),"aria-label":`Switch to ${e.label} palette`,"aria-pressed":u===e.id,title:`${e.label} palette — ${e.description}`,className:B(`flex flex-col items-center justify-center py-1 px-0.5 rounded text-[10px] font-medium transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,u===e.id?`bg-accent text-accent-foreground font-semibold ring-1 ring-border shadow-xs`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[(0,H.jsx)(`span`,{className:B(`size-2 rounded-full mb-0.5`,e.dotClass)}),(0,H.jsx)(`span`,{className:`truncate max-w-full tracking-tight`,children:e.label})]},e.id))})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l(c===`dark`?`light`:`dark`),"aria-label":`Switch to ${c===`dark`?`light`:`dark`} theme`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground transition-colors cursor-pointer`,children:[c===`dark`?(0,H.jsx)(yi,{size:13}):(0,H.jsx)(ei,{size:13}),(0,H.jsx)(`span`,{children:c===`dark`?`Light mode`:`Dark mode`})]})]})]})]}),(0,H.jsxs)(`div`,{className:`h-9 px-3 border-t border-border/60 flex items-center justify-between text-xs text-muted-foreground bg-muted/20`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:b,className:`flex items-center gap-1.5 hover:text-foreground transition-colors cursor-pointer text-[11px]`,title:`Collapse rail into icon strip (Shortcut: z)`,children:[(0,H.jsx)(ti,{size:13}),(0,H.jsx)(`span`,{children:`Collapse (z)`})]}),(0,H.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground/50`,children:`240px`})]})]})}function ks(e){let t=ts(),[n,r]=(0,V.useState)(!1),i=Ft();return(0,V.useEffect)(()=>{r(!1)},[i.pathname]),t?(0,H.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-40 flex h-12 items-center border-b border-border bg-card px-3 md:hidden`,children:(0,H.jsxs)(qo,{open:n,onOpenChange:r,children:[(0,H.jsxs)(Yo,{className:`inline-flex items-center gap-2 rounded-md px-2 py-2 text-sm font-medium`,"aria-label":`Open navigation`,children:[(0,H.jsx)(Yr,{size:20}),` `,rr]}),(0,H.jsxs)(Qo,{side:`left`,className:`w-72`,onClick:e=>{e.target.closest(`a`)&&r(!1)},children:[(0,H.jsx)($o,{className:`sr-only`,children:`Navigation`}),(0,H.jsx)(Os,{...e,onSelectWorkspace:t=>{e.onSelectWorkspace?.(t),r(!1)}})]})]})}):(0,H.jsx)(Os,{...e})}function As({toasts:e,onDismiss:t}){return(0,H.jsx)(`div`,{className:`fixed bottom-5 right-5 z-[9999] flex flex-col gap-3 pointer-events-none max-w-md w-full`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`pointer-events-auto flex items-start justify-between gap-3 rounded-xl border px-4 py-3 shadow-sm transition-all duration-300 animate-rise ${e.type===`success`?`border-success/32 bg-success/10 text-success-foreground`:e.type===`error`?`border-destructive/32 bg-destructive/10 text-destructive-foreground`:`border-info/32 bg-info/10 text-info-foreground`}`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5 text-xs font-semibold flex-1`,children:[e.type===`success`&&(0,H.jsx)(wr,{className:`mt-0.5 shrink-0 text-success`,size:16}),e.type===`error`&&(0,H.jsx)(Dr,{className:`mt-0.5 shrink-0 text-destructive`,size:16}),e.type===`info`&&(0,H.jsx)(Ur,{className:`mt-0.5 shrink-0 text-info`,size:16}),(0,H.jsx)(`span`,{className:`whitespace-pre-line text-left leading-relaxed`,children:e.message})]}),(0,H.jsx)(`button`,{onClick:()=>t(e.id),className:`mt-0.5 shrink-0 cursor-pointer text-muted-foreground transition-colors hover:text-foreground`,children:(0,H.jsx)(Ei,{size:14})})]},e.id))})}var js=512e3;function Ms(e,t,n){let[r,i]=(0,V.useState)({logs:``,connected:!1}),a=(0,V.useCallback)(()=>i(e=>({...e,logs:``})),[]);return(0,V.useEffect)(()=>{let r=!1,a=null,o=null;if(i({logs:``,connected:!1}),!n||!e||!t)return;let s=encodeURIComponent(e),c=encodeURIComponent(t),l=async()=>{if(r)return;let e=0;try{let t=await(await fetch(`/api/workspace/${s}/services/logs/${c}`)).json();if(r)return;e=typeof t.size==`number`?t.size:0,i({logs:typeof t.logs==`string`?t.logs:``,connected:!1})}catch{}if(r)return;let t=new EventSource(`/api/workspace/${s}/services/logs/${c}/stream?offset=${e}`);a=t,t.addEventListener(`open`,()=>{r||i(e=>({...e,connected:!0}))}),t.addEventListener(`log`,e=>{try{let{chunk:t}=JSON.parse(e.data);typeof t==`string`&&!r&&i(e=>{let n=e.logs+t;return{...e,logs:n.length>js?n.slice(-512e3):n}})}catch{}}),t.onerror=()=>{t.close(),a===t&&(a=null),!r&&(i(e=>({...e,connected:!1})),o=setTimeout(l,2e3))}};return l(),()=>{r=!0,o&&clearTimeout(o),a?.close(),a=null}},[e,t,n]),{logs:r.logs,connected:r.connected,clear:a}}function Ns({activeWsId:e,setActiveWsId:t,appVersion:n,workspaces:r,executeTerminal:i}){let[a,o]=(0,V.useState)(null),s=jt(e),c=s.data?.services??[],l=s.data?.runningState??[],u=Yt(e??``),{logs:d}=Ms(e,a,!!e);(0,V.useEffect)(()=>{c.length===0?a!==null&&o(null):(!a||!c.some(e=>e.name===a))&&o(c[0].name)},[c]);let f=(0,V.useRef)(null);(0,V.useEffect)(()=>{f.current?.scrollIntoView({behavior:`smooth`})},[d]);let p=l.filter(e=>e.pid>0).length;return(0,H.jsxs)(`div`,{className:`flex flex-col h-screen w-full bg-background text-foreground font-mono text-[11px] overflow-hidden select-none border-t border-border`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-card border-b border-border shrink-0 text-[10px]`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-bold text-primary`,children:`CONTEXTSPACE_SHELL`}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`ws: `,e||`none`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,H.jsx)(`button`,{onClick:()=>{t(null),o(null)},className:`text-primary hover:text-primary/90 hover:underline transition-colors cursor-pointer bg-transparent border-none p-0 outline-none`,children:`[Change WS]`}),n&&(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`v`,n]})]})]}),e?(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,H.jsxs)(`div`,{className:`p-3 border-b border-border shrink-0 bg-muted/30`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2 mb-3`,children:[(0,H.jsxs)(`button`,{onClick:()=>u.mutate({action:`start`}),disabled:u.isPending,className:`flex-1 inline-flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-success/20 bg-success/10 hover:bg-success/20 text-success font-bold transition-all cursor-pointer text-[10px] disabled:opacity-50`,children:[(0,H.jsx)(oi,{size:10}),` [START SERVICES]`]}),(0,H.jsxs)(`button`,{onClick:()=>u.mutate({action:`stop`}),disabled:u.isPending,className:`flex-1 inline-flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-destructive/20 bg-destructive/10 hover:bg-destructive/20 text-destructive font-bold transition-all cursor-pointer text-[10px] disabled:opacity-50`,children:[(0,H.jsx)(Ei,{size:10}),` [STOP SERVICES]`]})]}),(0,H.jsxs)(`div`,{className:`mb-3`,children:[(0,H.jsxs)(`div`,{className:`text-[10px] text-muted-foreground uppercase font-bold tracking-wider mb-1 px-1`,children:[`Background Services (`,p,`/`,c.length,`)`]}),c.length===0?(0,H.jsx)(`div`,{className:`text-muted-foreground/50 italic px-1 text-[10px]`,children:`No services detected in workspace.`}):(0,H.jsx)(`div`,{className:`flex flex-col gap-1 max-h-[120px] overflow-y-auto pr-1`,children:c.map(e=>{let t=l.some(t=>t.name===e.name&&t.pid>0),n=a===e.name;return(0,H.jsxs)(`div`,{onClick:()=>o(e.name),className:`flex items-center justify-between p-1.5 border rounded cursor-pointer transition-all ${n?`bg-primary/20 border-primary/50 text-foreground`:`bg-muted/20 border-border hover:border-border/80 text-muted-foreground`}`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 truncate`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${t?`bg-success`:`bg-destructive`}`}),(0,H.jsx)(`span`,{className:`font-bold truncate`,children:e.name})]}),(0,H.jsx)(`span`,{className:`text-[10px] font-mono shrink-0`,children:t?(0,H.jsx)(`span`,{className:`text-success bg-success/10 px-1 py-0.2 rounded border border-success/20 text-[8px] font-bold uppercase`,children:`on`}):(0,H.jsx)(`span`,{className:`text-muted-foreground bg-muted px-1 py-0.2 rounded border border-border text-[8px] font-bold uppercase`,children:`off`})})]},e.name)})})]}),(0,H.jsxs)(`div`,{className:`mb-3 border-t border-border pt-2.5`,children:[(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-bold uppercase mb-1 px-1`,children:`Active Local MCP Tools`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 px-1 text-[10px] text-muted-foreground font-mono`,children:[(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{children:`• search_workspace`}),(0,H.jsx)(`span`,{className:`text-primary font-bold`,children:`READY`})]}),(0,H.jsxs)(`div`,{className:`flex justify-between`,children:[(0,H.jsx)(`span`,{children:`• get_service_logs`}),(0,H.jsx)(`span`,{className:`text-primary font-bold`,children:`READY`})]})]})]}),(0,H.jsxs)(`div`,{className:`border-t border-border pt-2.5`,children:[(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-bold uppercase mb-1.5 px-1`,children:`Terminal Commands (Click to Run)`}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[`ctxspace sync`,`ctxspace diff`,`ctxspace handoff`,`ctxspace status`].map(e=>(0,H.jsxs)(`button`,{onClick:()=>i(e),className:`px-2 py-1.5 text-left border border-border hover:border-primary bg-muted/40 rounded text-muted-foreground hover:text-foreground hover:bg-primary/10 transition-all font-mono text-[9px] cursor-pointer`,children:[`$ `,e]},e))})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 bg-background`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-between px-3 py-1.5 bg-card border-b border-border shrink-0 text-[9px] text-muted-foreground uppercase tracking-wider font-bold`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary`}),(0,H.jsxs)(`span`,{children:[`log_stream: `,a||`none`]})]})}),(0,H.jsxs)(`div`,{className:`flex-1 p-3 overflow-y-auto font-mono text-[10px] leading-relaxed whitespace-pre-wrap select-text selection:bg-primary/30 text-foreground`,children:[d.trim()?d:(0,H.jsx)(`span`,{className:`text-muted-foreground/50 italic font-mono`,children:`(no logs recorded yet)`}),(0,H.jsx)(`div`,{ref:f})]})]})]}):(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-6 text-center overflow-y-auto`,children:[(0,H.jsx)(`div`,{className:`text-primary font-bold mb-4 text-[12px] uppercase`,children:`=== Select Active Workspace ===`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 w-full max-w-xs`,children:[r.map(e=>(0,H.jsxs)(`button`,{onClick:()=>t(e.branchName),className:`w-full text-left p-2.5 bg-muted border border-border hover:border-primary rounded hover:bg-primary/10 text-muted-foreground hover:text-foreground transition-all text-[11px] cursor-pointer`,children:[`> `,e.branchName]},e.branchName)),r.length===0&&(0,H.jsx)(`div`,{className:`text-muted-foreground italic`,children:`No workspaces found. Initialize one via the CLI.`})]})]})]})}function Ps(e){let t=V.useRef(!0);t.current&&(t.current=!1,e())}var Fs=V.createContext(null);function Is(){let e=V.useContext(Fs);if(e===null)throw Error(_n(60));return e}var Ls=(e,t)=>Object.is(e,t);function Rs(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function zs(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Rs(e,t,n))}function Bs(e,t,n){return e.filter(e=>!Rs(t,e,n))}function Vs(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Hs(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Us(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Hs(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ws(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Vs(e)}function Gs(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Vs(e.value):Vs(e)}function Ks(e,t,n){function r(){return Ws(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Hs(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function qs(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,H.jsx)(V.Fragment,{children:Ks(r,t,n)},i)),e),[])}var Js={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Gs(t,r)!==``},hasNullItemLabel:(e,t)=>t?Us(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Rs(t,e,n)):Rs(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Ys(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Xs(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:g,inputRef:_,onOpenChangeComplete:v,items:y,multiple:b=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Ls,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=ot(),{setDirty:ee,setTouched:k,setFocused:te,validityData:j,setFilled:M,name:N,disabled:ne,validation:re,validationMode:ie}=De(),P=Ce({id:t}),F=ne||d,I=N??c,[L,ae]=h({controlled:n,default:b?r??vn:r,name:`Select`,state:`value`}),[oe,se]=h({controlled:a,default:o,name:`Select`,state:`open`}),ce=V.useRef([]),le=V.useRef([]),ue=V.useRef(null),de=V.useRef(null),fe=V.useRef(0),me=V.useRef(null),he=V.useRef([]),ge=V.useRef(!1),_e=V.useRef(null),ye=V.useRef(null),be=V.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=V.useRef(!1),{mounted:Se,setMounted:we,transitionStatus:Te}=O(oe),{openMethod:ke,triggerProps:je}=On(oe),Me=dn(()=>new x({id:P,labelId:void 0,modal:m,multiple:b,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:L,open:oe,mounted:Se,transitionStatus:Te,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ne=z(Me,Js.activeIndex),Pe=z(Me,Js.selectedIndex),Fe=z(Me,Js.triggerElement),Ie=z(Me,Js.positionerElement),Le=jn(ke),ze=ke??Le,Be=V.useMemo(()=>b?``:Gs(L,C),[b,L,C]),Ve=V.useMemo(()=>b&&Array.isArray(L)?L.map(e=>Gs(e,C)):Gs(L,C),[b,L,C]),He=R(Fe),Ue=Oe(()=>Ve);Re(He,P,L,Ue,!F,c);let Ge=V.useRef(L),Ke=b?Array.isArray(L)&&L.length>0:L!=null&&Be!==``;st(()=>{M(Ke)},[Ke,M]),st(function(){let e=L,t=!1;if(b){let n=Array.isArray(L)?L:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:zs(he.current,e,w),r=n===-1?null:n;r===null&&(ye.current=null),!oe&&Me.set(`selectedIndex`,r)},[b,oe,L,w,Me]);function qe(e){let t=j.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Ys(e,t,(e,t)=>Rs(e,t,w)):e!==t}qn(L,()=>{D(I),ee(qe(L)),re.change(L)});let Je=Oe((e,t)=>{s?.(e,t),!t.isCanceled&&(se(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),te(!1),ie===`onBlur`&&re.commit(L)))}),Ye=Oe(()=>{we(!1),Me.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)});pe({enabled:!g,open:oe,ref:ue,onComplete(){oe||Ye()}}),V.useImperativeHandle(g,()=>({unmount:Ye}),[Ye]);let Xe=Oe((e,t)=>{i?.(e,t),!t.isCanceled&&ae(e)}),Ze=Oe(e=>{let t=ft(e.scrollHeight,e.clientHeight),n=Ae(e.scrollTop,t),r=n>0,i=n<t;Me.set(`scrollUpArrowVisible`,r),Me.set(`scrollDownArrowVisible`,i)}),Qe=na({open:oe,onOpenChange:Je,elements:{reference:Fe,floating:Ie}}),$e=En(Qe,{enabled:!f&&!F,event:`mousedown`}),et=tt(Qe),nt=An(Qe,{enabled:!f&&!F,listRef:ce,activeIndex:Ne,selectedIndex:Pe,disabledIndices:vn,onNavigate(e){e===null&&!oe||Me.set(`activeIndex`,e)},focusItemOnHover:T}),rt=Nn(Qe,{enabled:!f&&!F&&(oe||!b),listRef:le,activeIndex:Ne,selectedIndex:Pe,disabledIndices:e=>In(ce.current[e]),onMatch(e){oe?Me.set(`activeIndex`,e):Xe(he.current[e],ve(A))},onTyping(e){ge.current=e}}),it=V.useMemo(()=>gn(rt.reference,nt.reference,et.reference,$e.reference,je),[$e.reference,rt.reference,nt.reference,et.reference,je]),at=V.useMemo(()=>gn(We,rt.floating,nt.floating,et.floating),[rt.floating,nt.floating,et.floating]),ct=nt.item??ln;Ps(()=>{Me.update({popupProps:at,triggerProps:it})}),Me.useSyncedValues({id:P,modal:m,multiple:b,value:L,open:oe,mounted:Se,transitionStatus:Te,popupProps:at,triggerProps:it,items:y,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:ze});let lt=V.useMemo(()=>({store:Me,floatingContext:Qe,required:p,disabled:F,readOnly:f,multiple:b,highlightItemOnHover:T,setValue:Xe,setOpen:Je,listRef:ce,popupRef:ue,scrollHandlerRef:de,handleScrollArrowVisibility:Ze,scrollArrowsMountedCountRef:fe,itemProps:ct,valueRef:me,valuesRef:he,labelsRef:le,typingRef:ge,selectionRef:be,firstItemTextRef:_e,selectedItemTextRef:ye,validation:re,onOpenChangeComplete:v,alignItemWithTriggerActiveRef:xe,initialValueRef:Ge}),[Me,Qe,p,F,f,b,T,Xe,Je,ct,re,v,Ze]),ut=un(_,re.inputRef),dt=b?void 0:I,pt=V.useMemo(()=>!b||!Array.isArray(L)||!I?null:L.map(e=>{let t=Gs(e,C);return(0,H.jsx)(`input`,{type:`hidden`,form:l,name:I,value:t,disabled:F},t)}),[b,L,l,I,C,F]);return(0,H.jsxs)(Fs.Provider,{value:lt,children:[E,(0,H.jsx)(`input`,{...re.getValidationProps(F,{onFocus(){Me.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||F||f)return;let t=e.currentTarget.value,n=ve(A,e.nativeEvent);function r(){if(b)return;let e=t.toLowerCase(),r=he.current.findIndex(t=>Gs(t,C).toLowerCase()===e||Ws(t,S).toLowerCase()===e);r===-1&&(r=he.current.findIndex((t,n)=>{let r=le.current[n];return r!=null&&r.toLowerCase()===e}));let i=he.current[r];i!=null&&Xe(i,n)}Me.set(`forceMount`,!0),queueMicrotask(r)}}),id:P&&dt==null?`${P}-hidden-input`:void 0,form:l,name:dt,autoComplete:u,value:Be,disabled:F,required:p&&!(b&&Ke),readOnly:f,ref:ut,style:I?_t:Ee,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),pt]})}function Zs(e,t){return e??t}var Qs=400,$s={...ee,...Ke,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},ec=V.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:m}=De(),{labelId:h}=Qe(),{store:g,setOpen:_,selectionRef:v,validation:y,readOnly:b,required:x,alignItemWithTriggerActiveRef:S,disabled:C}=Is(),w=m||C||a,T=z(g,Js.open),E=z(g,Js.mounted),D=z(g,Js.value),ee=z(g,Js.triggerProps),O=z(g,Js.positionerElement),k=z(g,Js.listElement),te=z(g,Js.popupSide),j=z(g,Js.id),N=z(g,Js.labelId),ne=z(g,Js.hasSelectedValue),re=E&&O?te:null,ie=i??j,P=Zs(h,N);Ce({id:ie});let F=R(O),I=V.useRef(null),{getButtonProps:L,buttonRef:ae}=Xe({disabled:w,native:o}),se=g.useStateSetter(`triggerElement`),le=ce(),ue=ce(),de=ce();V.useEffect(()=>{if(T)return de.start(Qs,()=>{v.current.allowUnselectedMouseUp=!0,v.current.allowSelectedMouseUp=!0}),()=>{de.clear()};v.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ue.clear()},[T,v,ue,de]);let fe=gn(ee,{id:ie,role:`combobox`,"aria-expanded":T,"aria-haspopup":`listbox`,"aria-controls":T?k?.id??oe(O)?.id:void 0,"aria-labelledby":P,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:w?-1:0,onFocus(e){u(!0),T&&S.current&&_(!1,ve(A,e.nativeEvent)),le.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){M(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&y.commit(D))},onMouseDown(e){if(T)return;let t=ze(e.currentTarget);function n(e){if(!I.current)return;let t=e.target;M(I.current,t)||M(F.current,t)||Pn(e,I.current)||_(!1,ve(p,e))}ue.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,L),pe=y.getValidationProps(w,fe);pe.role=`combobox`;let me={...f,open:T,disabled:w,value:D,readOnly:b,popupSide:re,placeholder:!ne};return pn(`button`,e,{ref:[t,I,ae,se],state:me,stateAttributesMapping:$s,props:pe})}),tc={value:()=>null},nc=V.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Is(),u=z(c,Js.value),d=z(c,Js.items),f=z(c,Js.itemToStringLabel),p=z(c,Js.hasSelectedValue),m=!p&&a!=null&&i==null,h=z(c,Js.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?qs(u,d,f):Ks(u,d,f)),pn(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:tc})}),rc=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Is(),s={open:z(o,Js.open)};return pn(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:nt})}),ic=V.forwardRef(function(e,t){let{store:n}=Is(),r=z(n,Js.mounted),i=z(n,Js.forceMount);return r||i?(0,H.jsx)(dt,{ref:t,...e}):null}),ac=V.createContext(void 0);function oc(){let e=V.useContext(ac);if(!e)throw Error(_n(59));return e}function sc(e,t){e&&Object.assign(e.style,t)}var cc={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},lc={position:`fixed`},uc=V.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=Be,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:ee}=Is(),O=z(y,Js.open),k=z(y,Js.mounted),te=z(y,Js.modal),j=z(y,Js.value),M=z(y,Js.openMethod),N=z(y,Js.positionerElement),ne=z(y,Js.triggerElement),re=z(y,Js.isItemEqualToValue),ie=z(y,Js.transitionStatus),P=V.useRef(null),F=V.useRef(null),[I,L]=V.useState(h),ae=k&&I&&M!==`touch`;!k&&I!==h&&L(h),V.useImperativeHandle(S,()=>ae),Mn((ae||te)&&O,M===`touch`,N,ne);let R=kn({anchor:n,floatingRootContext:ee,positionMethod:a,mounted:k,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??ae,collisionAvoidance:g,keepMounted:!0}),oe=ae?`none`:R.side,se=ae?lc:R.positionerStyles,ce={open:O,side:oe,align:R.align,anchorHidden:R.anchorHidden};st(()=>{y.set(`popupSide`,R.side)},[y,R.side]);let le=y.useStateSetter(`positionerElement`),ue=Fn(e,ce,{styles:se,transitionStatus:ie,props:v,refs:[t,le],hidden:!k,inert:!O}),de=V.useRef(0),fe=Oe(e=>{if(w.current.length===0)return;let t=de.current;if(de.current=e.size,e.size===t)return;let n=ve(A);if(t!==0&&!y.state.multiple&&j!==null&&zs(w.current,j,re)===-1){let e=T.current,t=e!=null&&zs(w.current,e,re)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(j)){let e=j.filter(e=>zs(w.current,e,re)!==-1);e.length!==j.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(O&&ae){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};sc(N,e),sc(E.current,e)}}),pe=V.useMemo(()=>({...R,side:oe,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:L,scrollUpArrowRef:P,scrollDownArrowRef:F}),[R,oe,ae,L]);return(0,H.jsx)(Cn,{elementsRef:b,labelsRef:x,onMapChange:fe,children:(0,H.jsxs)(ac.Provider,{value:pe,children:[k&&te&&(0,H.jsx)(Fe,{inert:mt(!O),cutout:ne}),ue]})})}),dc={...fe,...T},fc=V.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...s}=e,{store:c,popupRef:l,onOpenChangeComplete:u,setOpen:f,valueRef:p,firstItemTextRef:m,selectedItemTextRef:h,multiple:g,handleScrollArrowVisibility:_,scrollHandlerRef:v,listRef:y,highlightItemOnHover:b,floatingContext:x}=Is(),{side:S,align:C,alignItemWithTriggerActive:T,isPositioned:E,setControlledAlignItemWithTrigger:D}=oc(),ee=Tn(!0)!=null,O=xe(),{nonce:k,disableStyleElements:A}=et(),te=z(c,Js.id),j=z(c,Js.open),M=z(c,Js.openMethod),N=z(c,Js.mounted),ne=z(c,Js.popupProps),re=z(c,Js.transitionStatus),ie=z(c,Js.triggerElement),P=z(c,Js.positionerElement),F=z(c,Js.listElement),I=V.useRef(!1),L=V.useRef(!1),ae=V.useRef({}),R=rt(),oe=Oe(e=>{if(!P||!l.current||!L.current)return;let t=P.style.top===`0px`,n=P.style.bottom===`0px`;if(I.current||!T||!t&&!n){_(e);return}let r=hc(P),i=gc(P.getBoundingClientRect().height,`y`,r),a=ze(P),o=Se(P),s=o.getComputedStyle(P),c=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=pc(o.getComputedStyle(l.current)),f=Math.min(a.documentElement.clientHeight-c-u,d),p=e.scrollTop,m=mc(e),h=null,g=e=>{P.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=Ne(v,0,f-i);n>0&&g(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(I.current=!0),_(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&g(b),h!=null){let t=Ne(h,0,mc(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(I.current=!0),_(e)});V.useImperativeHandle(v,()=>oe,[oe]),pe({open:j,ref:l,onComplete(){j&&u?.(!0)}});let ce={open:j,transitionStatus:re,side:S,align:C};st(()=>{!P||!l.current||Object.keys(ae.current).length||(ae.current={top:P.style.top||`0`,left:P.style.left||`0`,right:P.style.right,height:P.style.height,bottom:P.style.bottom,minHeight:P.style.minHeight,maxHeight:P.style.maxHeight,marginTop:P.style.marginTop,marginBottom:P.style.marginBottom})},[l,P]),st(()=>{j||T||(L.current=!1,I.current=!1,sc(P,ae.current))},[j,T,P,l]),st(()=>{let e=l.current;if(!j||!ie||!P||!e||T&&!E||c.state.transitionStatus===`ending`)return;if(L.current=!0,e.style.removeProperty(`--transform-origin`),!T){R.request(()=>_(F||e));return}let t=yc(e);try{let t=h.current;t?.isConnected||(t=!Js.hasSelectedValue(c.state)&&m.current?.isConnected?m.current:null);let n=p.current,r=Se(P),i=r.getComputedStyle(P),a=r.getComputedStyle(e),s=ze(ie),l=hc(ie),u=_c(ie.getBoundingClientRect(),l),d=_c(P.getBoundingClientRect(),l),f=u.height,g=F||e,v=g.scrollHeight,x=parseFloat(a.borderBottomWidth),S=parseFloat(i.marginTop)||10,C=parseFloat(i.marginBottom)||10,w=parseFloat(i.minHeight)||100,T=pc(a),E=s.documentElement.clientHeight-S-C,ee=s.documentElement.clientWidth,k=E-u.bottom+f,A,te=O===`rtl`?u.right-d.width:u.left,j=0;if(t&&n){let e=_c(n.getBoundingClientRect(),l);A=_c(t.getBoundingClientRect(),l),te=d.left+(O===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-u.top+e.height/2;j=A.top-d.top+A.height/2-r}let M=k+j+C+x,N=Math.min(E,M),ne=E-S-C,re=M-N,L=ee-5;P.style.left=`${Ne(te,5,L-d.width)}px`,P.style.height=`${N}px`,P.style.maxHeight=`none`,P.style.marginTop=`${S}px`,P.style.marginBottom=`${C}px`,e.style.height=`100%`;let R=mc(g),oe=re>=R-1;oe&&(N=Math.min(E,d.height)-(re-R));let z=u.top<20||u.bottom>E-20||Math.ceil(N)+1<Math.min(v,w),se=(r.visualViewport?.scale??1)!==1&&o;if(z||se){sc(P,ae.current),D(!1);return}let ce=Math.max(w,N);if(oe){let e=Math.max(0,E-M);P.style.top=d.height>=ne?`0`:`${e}px`,P.style.height=`${N}px`,g.scrollTop=mc(g)}else P.style.bottom=`0`,g.scrollTop=re;if(A){let t=d.top,n=d.height,r=A.top+A.height/2,i=Ne(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ce===E||N>=T)&&(I.current=!0),_(g),b&&c.state.selectedIndex===null&&c.state.activeIndex===null&&y.current[0]!=null&&c.set(`activeIndex`,0)}finally{t()}},[c,j,P,ie,p,m,h,l,_,T,D,R,F,y,b,O,E]),V.useEffect(()=>{if(!T||!P||!j)return;let e=Se(P);function t(e){f(!1,ve(se,e))}return ht(e,`resize`,t)},[f,T,P,j]);let le={...F?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":g||void 0,id:`${te}-list`},onKeyDown(e){ee&&d.has(e.key)&&e.stopPropagation()},onScroll(e){F||oe(e.currentTarget)},...T&&{style:F?{height:`100%`}:cc},className:!F&&T?Je.className:void 0},ue=pn(`div`,e,{ref:[t,l],state:ce,stateAttributesMapping:dc,props:[ne,le,wn(re),s]});return(0,H.jsxs)(V.Fragment,{children:[!A&&Je.getElement(k),(0,H.jsx)(w,{context:x,modal:!1,disabled:!N,openInteractionType:M,returnFocus:a,restoreFocus:!0,children:ue})]})});function pc(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function mc(e){return ft(e.scrollHeight,e.clientHeight)}function hc(e){return Dn.getScale(e)}function gc(e,t,n){return e/n[t]}function _c(e,t){return Ln({x:gc(e.x,`x`,t),y:gc(e.y,`y`,t),width:gc(e.width,`x`,t),height:gc(e.height,`y`,t)})}var vc=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function yc(e){let{style:t}=e,n={};for(let[e,r]of vc)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of vc){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var bc=V.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Is(),{alignItemWithTriggerActive:l}=oc(),u=z(o,Js.hasScrollArrows),d=z(o,Js.openMethod),f={id:`${z(o,Js.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:cc},className:u&&d!==`touch`?Je.className:void 0},p=o.useStateSetter(`listElement`);return pn(`div`,e,{ref:[t,p],props:[f,a]})}),xc=V.createContext(void 0);function Sc(){let e=V.useContext(xc);if(!e)throw Error(_n(57));return e}var Cc=V.memo(V.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=V.useRef(null),d=Sn({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Is(),C=x||s,w=z(f,Js.isActive,d.index),T=z(f,Js.open),E=z(f,Js.isSelected,a),D=z(f,Js.isSelectedByFocus,d.index),ee=z(f,Js.isItemEqualToValue),O=d.index,k=V.useRef(null);st(()=>{let e=v.current;return e[O]=a,()=>{delete e[O]}},[O,a,v]),st(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Rs(a,t,ee)&&(f.set(`selectedIndex`,O),u.current&&(b.current=u.current))},[O,y,ee,f,a,b]);let A=V.useRef(`mouse`),te=V.useRef(!1),{getButtonProps:j,buttonRef:M}=Xe({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),N={disabled:C,selected:E,highlighted:w};function ne(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?Bs(n,a,ee):[...n,a];h(r,ve(F,e))}else h(a,ve(F,e)),m(!1,ve(F,e))}function re(){g.current.dragY=0}let ie={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,O),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=A.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&St(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!te.current;te.current=!1,!(C||i)&&ne(e.nativeEvent)},onPointerEnter(e){A.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){A.current=e.pointerType,te.current=!0,re()},onMouseUp(){if(re(),C||A.current===`touch`||te.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(te.current=!0,k.current?.click(),te.current=!1)}},P=pn(`div`,e,{ref:[M,t,d.ref,k],state:N,props:[p,ie,l,j]}),I=V.useMemo(()=>({selected:E,index:O,textRef:u,selectedByFocus:D}),[E,O,u,D]);return(0,H.jsx)(xc.Provider,{value:I,children:P})})),wc=V.forwardRef(function(e,t){let{selected:n}=Sc();return e.keepMounted||n?(0,H.jsx)(Tc,{...e,ref:t}):null}),Tc=V.memo(V.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Sc(),c=V.useRef(null),{transitionStatus:l,setMounted:u}=O(s),d=pn(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:T});return pe({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Ec=V.memo(V.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Sc(),{firstItemTextRef:a,selectedItemTextRef:o}=Is(),{render:s,className:c,style:l,...u}=e,d=V.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return pn(`div`,e,{ref:[d,t,r],props:u})})),Dc=V.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Is(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=oc(),_=c?Js.scrollUpArrowVisible:Js.scrollDownArrowVisible,v=z(l,_),y=z(l,Js.openMethod),b=v&&y!==`touch`,x=ce(),S=c?g:h,{mounted:C,transitionStatus:w,setMounted:E}=O(b);st(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),pe({open:b,ref:S,onComplete(){b||E(!1)}});let D=pn(`div`,e,{ref:[t,S],state:{direction:a,visible:b,side:m,transitionStatus:w},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||x.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=ft(e.scrollHeight,e.clientHeight),r=Ae(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){x.clear();return}if(a.length>0){let t=S.current?.offsetHeight||0;e.scrollTop=Oc(a,c,r,e.clientHeight,t,n)}x.start(40,t)}x.start(40,t)},onMouseLeave(){x.clear()}},s],stateAttributesMapping:T});return C||o?D:null});function Oc(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?Ae(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?Ae(l.offsetTop+l.offsetHeight-r+i,a):a}var kc=V.forwardRef(function(e,t){return(0,H.jsx)(Dc,{...e,ref:t,direction:`down`})}),Ac=V.forwardRef(function(e,t){return(0,H.jsx)(Dc,{...e,ref:t,direction:`up`})}),jc=Xs,Mc=hn(`relative inline-flex cursor-pointer select-none items-center justify-between gap-2 border rounded-lg text-left text-base outline-none transition-[color,box-shadow,background-color] data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4`,{defaultVariants:{size:`default`,variant:`default`},variants:{variant:{default:`w-full min-w-36 border-input bg-background not-dark:bg-clip-padding text-foreground shadow-xs/5 ring-ring/24 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='text-'])]:text-muted-foreground [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none`,ghost:`border-transparent text-muted-foreground/70 focus-visible:ring-2 focus-visible:ring-ring data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-foreground/80`},size:{default:`min-h-9 px-[calc(--spacing(3)-1px)] sm:min-h-8`,lg:`min-h-10 px-[calc(--spacing(3)-1px)] sm:min-h-9`,sm:`min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`}}});function Nc({className:e,size:t=`default`,variant:n=`default`,children:r,...i}){return(0,H.jsxs)(ec,{className:B(Mc({size:t,variant:n}),e),"data-slot":`select-trigger`,...i,children:[r,(0,H.jsx)(rc,{"data-slot":`select-icon`,children:(0,H.jsx)(bn,{className:`-me-1 size-3 opacity-50`})})]})}function Pc({className:e,...t}){return(0,H.jsx)(nc,{className:B(`flex-1 truncate data-placeholder:text-muted-foreground`,e),"data-slot":`select-value`,...t})}function Fc({className:e,popupClassName:t,children:n,side:r=`bottom`,sideOffset:i=4,align:a=`start`,alignOffset:o=0,alignItemWithTrigger:s=!0,matchTriggerWidth:c=!0,anchor:l,...u}){return(0,H.jsx)(ic,{children:(0,H.jsx)(uc,{align:a,alignItemWithTrigger:s,alignOffset:o,anchor:l,className:`z-50 select-none`,"data-slot":`select-positioner`,side:r,sideOffset:i,children:(0,H.jsxs)(fc,{className:`origin-(--transform-origin) rounded-lg text-foreground outline-none`,"data-slot":`select-popup`,...u,children:[(0,H.jsx)(Ac,{className:`top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover`,"data-slot":`select-scroll-up-arrow`,children:(0,H.jsx)(Rn,{className:`relative size-4.5 sm:size-4`})}),(0,H.jsx)(`div`,{className:B(`relative h-full rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,c&&`min-w-(--anchor-width)`,t),children:(0,H.jsx)(bc,{className:B(`max-h-(--available-height) overflow-y-auto p-1`,e),"data-slot":`select-list`,children:n})}),(0,H.jsx)(kc,{className:`bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover`,"data-slot":`select-scroll-down-arrow`,children:(0,H.jsx)(bn,{className:`relative size-4.5 sm:size-4`})})]})})})}function Ic({className:e,children:t,hideIndicator:n=!1,...r}){return(0,H.jsxs)(Cc,{className:B(`grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,n?`grid-cols-[1fr] ps-3 pe-3`:`grid-cols-[1rem_1fr] ps-2 pe-4`,e),"data-slot":`select-item`,...r,children:[n?null:(0,H.jsx)(wc,{className:`col-start-1`,"data-slot":`select-item-indicator`,children:(0,H.jsx)(`svg`,{fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/1500/svg`,children:(0,H.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),(0,H.jsx)(Ec,{className:B(`min-w-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n?`col-start-1`:`col-start-2`),"data-slot":`select-item-text`,children:t})]})}function Lc({config:e,setConfig:t,defaultPaths:n,adapters:r,saveAppConfig:i}){let a=e.devDir.trim()!==``&&e.workspacesDir.trim()!==``;return(0,H.jsx)(`div`,{className:`flex min-h-screen bg-background text-foreground font-sans items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`max-w-6xl w-full bg-card border border-border rounded-xl p-10 shadow-sm grid grid-cols-1 lg:grid-cols-12 gap-12`,children:[(0,H.jsxs)(`div`,{className:`lg:col-span-7 flex flex-col justify-between`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/10 text-primary border border-primary/20 text-xs font-semibold uppercase tracking-wider mb-5`,children:`Onboarding Guide`}),(0,H.jsxs)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground mb-2`,children:[`Welcome to `,rr]}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-8 max-w-xl leading-relaxed`,children:[rr,` orchestrates multi-repository developer environments. It combines isolated Git worktrees, automatic code analyzer sweeps, and background process running into a single dashboard.`]}),(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,H.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-primary/10 border border-primary/20 text-primary flex items-center justify-center font-bold text-sm shrink-0 group-hover:bg-primary/20 transition-colors`,children:`1`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground transition-colors`,children:`Configure Development Folders`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-relaxed`,children:`Specify your local code path and target workspaces path. For the first setup, these paths start empty so you can explicitly configure them.`})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,H.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-primary/10 border border-primary/20 text-primary flex items-center justify-center font-bold text-sm shrink-0 group-hover:bg-primary/20 transition-colors`,children:`2`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground transition-colors`,children:`Build Isolated Branch Workspaces`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-relaxed`,children:[`Choose repositories and input your feature branch. `,rr,` runs `,(0,H.jsx)(`code`,{children:`git worktree`}),` to checkout dependencies under a unified folder structure, leaving your primary repository directories clean.`]})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,H.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-primary/10 border border-primary/20 text-primary flex items-center justify-center font-bold text-sm shrink-0 group-hover:bg-primary/20 transition-colors`,children:`3`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground transition-colors`,children:`Align AI Coding Contexts`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-relaxed`,children:[rr,` automatically generates configuration files (`,(0,H.jsx)(`code`,{children:`CLAUDE.md`}),`, `,(0,H.jsx)(`code`,{children:`.cursorrules`}),`, `,(0,H.jsx)(`code`,{children:`AGENTS.md`}),`) that instruct the AI assistant to analyze project inter-dependencies, document its assumptions in `,(0,H.jsx)(`code`,{children:Jn}),`, and highlight clarifying questions.`]})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-4 group`,children:[(0,H.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-primary/10 border border-primary/20 text-primary flex items-center justify-center font-bold text-sm shrink-0 group-hover:bg-primary/20 transition-colors`,children:`4`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground transition-colors`,children:`Orchestrate Background Services`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 leading-relaxed`,children:`Run APIs, database scripts, and frontend watch tasks concurrently from the web portal. Monitor real-time logs inside a unified terminal pane.`})]})]})]})]}),(0,H.jsx)(`div`,{className:`mt-8 pt-6 border-t border-border`,children:(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[rr,` offers native worktrees and local AI orchestration without the overhead of containers or virtual machines.`]})})]}),(0,H.jsx)(`div`,{className:`lg:col-span-5 flex flex-col justify-center`,children:(0,H.jsxs)(`div`,{className:`bg-muted border border-border rounded-xl p-8 shadow-sm`,children:[(0,H.jsxs)(`h2`,{className:`text-xl font-semibold text-foreground mb-1 flex items-center gap-2`,children:[(0,H.jsx)(pi,{className:`text-primary`,size:20}),` Initialize Config`]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground mb-6`,children:`Define the directories on your machine. The fields are empty so you can provide your paths.`}),(0,H.jsxs)(`div`,{className:`space-y-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-foreground mb-2`,children:`Development Directory`}),(0,H.jsx)(Ye,{type:`text`,placeholder:`e.g. C:\\Users\\username\\dev`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),n&&(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1.5 flex justify-between items-center`,children:(0,H.jsxs)(`span`,{children:[`Suggested: `,(0,H.jsx)(`code`,{className:`text-primary`,children:n.devDir})]})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`label`,{className:`block text-sm font-medium text-foreground mb-2`,children:`Workspaces Directory`}),(0,H.jsx)(Ye,{type:`text`,placeholder:`e.g. C:\\Users\\username\\dev\\workspaces`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),n&&(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1.5 flex justify-between items-center`,children:(0,H.jsxs)(`span`,{children:[`Suggested: `,(0,H.jsx)(`code`,{className:`text-primary`,children:n.workspacesDir})]})})]}),(0,H.jsxs)(`div`,{className:`pt-2`,children:[(0,H.jsx)(`label`,{htmlFor:`onboardingStorageProvider`,className:`text-sm font-medium text-foreground block mb-2`,children:`Storage Provider`}),(0,H.jsxs)(jc,{value:e.storageProvider||`local`,onValueChange:n=>{if(!n)return;let i={...e,storageProvider:n},a=r.find(e=>e.name===n);a?.configFields?.length&&(i.adapterConfig||={},i.adapterConfig[n]||(i.adapterConfig[n]={}),a.configFields.forEach(e=>{i.adapterConfig[n][e.key]===void 0&&e.default!==void 0&&(i.adapterConfig[n][e.key]=e.default)})),t(i)},children:[(0,H.jsx)(Nc,{id:`onboardingStorageProvider`,children:(0,H.jsx)(Pc,{placeholder:`Select a provider`})}),(0,H.jsx)(Fc,{children:r.length>0?r.map(e=>(0,H.jsx)(Ic,{value:e.name,children:e.displayName},e.name)):(0,H.jsx)(Ic,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground mt-1 block leading-normal`,children:r.find(t=>t.name===(e.storageProvider||`local`))?.description||`Where the generated context files are written. They must sit at the workspace root for an assistant to load them.`})]}),(0,H.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,H.jsx)(yn,{variant:`outline`,className:`flex-1`,onClick:()=>{n&&t({...e,devDir:n.devDir,workspacesDir:n.workspacesDir})},children:`Suggest Defaults`}),(0,H.jsx)(yn,{variant:`ghost`,onClick:()=>{t({...e,devDir:``,workspacesDir:``})},children:`Clear`})]}),(0,H.jsx)(`div`,{className:`pt-4`,children:(0,H.jsxs)(yn,{className:`w-full gap-2`,disabled:!a,onClick:()=>i(e),children:[`Save & Get Started `,(0,H.jsx)(yr,{size:16})]})})]})]})})]})})}function Rc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var zc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vc={};function Hc(e,t){return((t||Vc).jsx?Bc:zc).test(e)}var Uc=/[ \t\n\f\r]/g;function Wc(e){return typeof e==`object`?e.type===`text`&&Gc(e.value):Gc(e)}function Gc(e){return e.replace(Uc,``)===``}var Kc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Kc.prototype.normal={},Kc.prototype.property={},Kc.prototype.space=void 0;function qc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Kc(n,r,t)}function Jc(e){return e.toLowerCase()}var Yc=class{constructor(e,t){this.attribute=t,this.property=e}};Yc.prototype.attribute=``,Yc.prototype.booleanish=!1,Yc.prototype.boolean=!1,Yc.prototype.commaOrSpaceSeparated=!1,Yc.prototype.commaSeparated=!1,Yc.prototype.defined=!1,Yc.prototype.mustUseProperty=!1,Yc.prototype.number=!1,Yc.prototype.overloadedBoolean=!1,Yc.prototype.property=``,Yc.prototype.spaceSeparated=!1,Yc.prototype.space=void 0;var Xc=e({boolean:()=>Qc,booleanish:()=>$c,commaOrSpaceSeparated:()=>rl,commaSeparated:()=>nl,number:()=>U,overloadedBoolean:()=>el,spaceSeparated:()=>tl}),Zc=0,Qc=il(),$c=il(),el=il(),U=il(),tl=il(),nl=il(),rl=il();function il(){return 2**++Zc}var al=Object.keys(Xc),ol=class extends Yc{constructor(e,t,n,r){let i=-1;if(super(e,t),sl(this,`space`,r),typeof n==`number`)for(;++i<al.length;){let e=al[i];sl(this,al[i],(n&Xc[e])===Xc[e])}}};ol.prototype.defined=!0;function sl(e,t,n){n&&(e[t]=n)}function cl(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ol(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Jc(r)]=r,n[Jc(a.attribute)]=r}return new Kc(t,n,e.space)}var ll=cl({properties:{ariaActiveDescendant:null,ariaAtomic:$c,ariaAutoComplete:null,ariaBusy:$c,ariaChecked:$c,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:tl,ariaCurrent:null,ariaDescribedBy:tl,ariaDetails:null,ariaDisabled:$c,ariaDropEffect:tl,ariaErrorMessage:null,ariaExpanded:$c,ariaFlowTo:tl,ariaGrabbed:$c,ariaHasPopup:null,ariaHidden:$c,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tl,ariaLevel:U,ariaLive:null,ariaModal:$c,ariaMultiLine:$c,ariaMultiSelectable:$c,ariaOrientation:null,ariaOwns:tl,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:$c,ariaReadOnly:$c,ariaRelevant:null,ariaRequired:$c,ariaRoleDescription:tl,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:$c,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ul(e,t){return t in e?e[t]:t}function dl(e,t){return ul(e,t.toLowerCase())}var fl=cl({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:nl,acceptCharset:tl,accessKey:tl,action:null,allow:null,allowFullScreen:Qc,allowPaymentRequest:Qc,allowUserMedia:Qc,alpha:Qc,alt:null,as:null,async:Qc,autoCapitalize:null,autoComplete:tl,autoFocus:Qc,autoPlay:Qc,blocking:tl,capture:null,charSet:null,checked:Qc,cite:null,className:tl,closedBy:null,colorSpace:null,cols:U,colSpan:U,command:null,commandFor:null,content:null,contentEditable:$c,controls:Qc,controlsList:tl,coords:U|nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qc,defer:Qc,dir:null,dirName:null,disabled:Qc,download:el,draggable:$c,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qc,formTarget:null,headers:tl,height:U,hidden:el,high:U,href:null,hrefLang:null,htmlFor:tl,httpEquiv:tl,id:null,imageSizes:null,imageSrcSet:null,inert:Qc,inputMode:null,integrity:null,is:null,isMap:Qc,itemId:null,itemProp:tl,itemRef:tl,itemScope:Qc,itemType:tl,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qc,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:Qc,muted:Qc,name:null,nonce:null,noModule:Qc,noValidate:Qc,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:Qc,optimum:U,pattern:null,ping:tl,placeholder:null,playsInline:Qc,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qc,referrerPolicy:null,rel:tl,required:Qc,reversed:Qc,rows:U,rowSpan:U,sandbox:tl,scope:null,scoped:Qc,seamless:Qc,selected:Qc,shadowRootClonable:Qc,shadowRootCustomElementRegistry:Qc,shadowRootDelegatesFocus:Qc,shadowRootMode:null,shadowRootSerializable:Qc,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:$c,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:Qc,useMap:null,value:$c,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tl,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qc,declare:Qc,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:Qc,noHref:Qc,noShade:Qc,noWrap:Qc,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:$c,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Qc,disablePictureInPicture:Qc,disableRemotePlayback:Qc,exportParts:nl,part:tl,prefix:null,property:null,results:U,security:null,unselectable:null},space:`html`,transform:dl}),pl=cl({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:rl,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:tl,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:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:Qc,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,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:nl,g2:nl,glyphName:nl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:rl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,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:U,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:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tl,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rl,rev:rl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rl,requiredFeatures:rl,requiredFonts:rl,requiredFormats:rl,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:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:rl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rl,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ul}),ml=cl({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()}}),hl=cl({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:dl}),gl=cl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),_l={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`},vl=/[A-Z]/g,yl=/-[a-z]/g,bl=/^data[-\w.:]+$/i;function xl(e,t){let n=Jc(t),r=t,i=Yc;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&bl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(yl,Cl);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!yl.test(e)){let n=e.replace(vl,Sl);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ol}return new i(r,t)}function Sl(e){return`-`+e.toLowerCase()}function Cl(e){return e.charAt(1).toUpperCase()}var wl=qc([ll,fl,ml,hl,gl],`html`),Tl=qc([ll,pl,ml,hl,gl],`svg`);function El(e){return e.join(` `).trim()}var Dl=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
11
- `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Ol=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Dl());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),kl=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Al=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ol()),r=kl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),jl=Nl(`end`),Ml=Nl(`start`);function Nl(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Pl(e){let t=Ml(e),n=jl(e);if(t&&n)return{start:t,end:n}}function Fl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ll(e.position):`start`in e||`end`in e?Ll(e):`line`in e||`column`in e?Il(e):``}function Il(e){return Rl(e&&e.line)+`:`+Rl(e&&e.column)}function Ll(e){return Il(e&&e.start)+`-`+Il(e&&e.end)}function Rl(e){return e&&typeof e==`number`?e:1}var zl=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=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=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Fl(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=a&&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}};zl.prototype.file=``,zl.prototype.name=``,zl.prototype.reason=``,zl.prototype.message=``,zl.prototype.stack=``,zl.prototype.column=void 0,zl.prototype.line=void 0,zl.prototype.ancestors=void 0,zl.prototype.cause=void 0,zl.prototype.fatal=void 0,zl.prototype.place=void 0,zl.prototype.ruleId=void 0,zl.prototype.source=void 0;var Bl=t(Al(),1),Vl={}.hasOwnProperty,Hl=new Map,Ul=/[A-Z]/g,Wl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Gl=new Set([`td`,`th`]),Kl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function ql(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=iu(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ru(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Tl:wl,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Jl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Jl(e,t,n){if(t.type===`element`)return Yl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Xl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ql(e,t,n);if(t.type===`mdxjsEsm`)return Zl(e,t);if(t.type===`root`)return $l(e,t,n);if(t.type===`text`)return eu(e,t)}function Yl(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Tl,e.schema=i),e.ancestors.push(t);let a=uu(e,t.tagName,!1),o=au(e,t),s=su(e,t);return Wl.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Wc(e)})),tu(e,o,a,t),nu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Xl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}du(e,t.position)}function Zl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);du(e,t.position)}function Ql(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Tl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:uu(e,t.name,!0),o=ou(e,t),s=su(e,t);return tu(e,o,a,t),nu(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $l(e,t,n){let r={};return nu(r,su(e,t)),e.create(t,e.Fragment,r,n)}function eu(e,t){return t.value}function tu(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nu(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ru(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function iu(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ml(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function au(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Vl.call(t.properties,i)){let a=cu(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Gl.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ou(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else du(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else du(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function su(e,t){let n=[],r=-1,i=e.passKeys?new Map:Hl;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Jl(e,a,o);s!==void 0&&n.push(s)}return n}function cu(e,t,n){let r=xl(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Rc(n):El(n)),r.property===`style`){let t=typeof n==`object`?n:lu(e,String(n));return e.stylePropertyNameCase===`css`&&(t=fu(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?_l[r.property]||r.property:r.attribute,n]}}function lu(e,t){try{return(0,Bl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new zl("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Kl+`#cannot-parse-style-attribute`,r}}function uu(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Hc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Hc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Vl.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);du(e)}function du(e,t){let n=new zl("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=Kl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function fu(e){let t={},n;for(n in e)Vl.call(e,n)&&(t[pu(n)]=e[n]);return t}function pu(e){let t=e.replace(Ul,mu);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function mu(e){return`-`+e.toLowerCase()}var hu={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`]},gu={};function _u(e,t){let n=t||gu;return vu(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function vu(e,t,n){if(bu(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 yu(e.children,t,n)}return Array.isArray(e)?yu(e,t,n):``}function yu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vu(e[i],t,n);return r.join(``)}function bu(e){return!!(e&&typeof e==`object`)}var xu=document.createElement(`i`);function Su(e){let t=`&`+e+`;`;xu.innerHTML=t;let n=xu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Cu(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function wu(e,t){return e.length>0?(Cu(e,e.length,0,t),e):t}var Tu={}.hasOwnProperty;function Eu(e){let t={},n=-1;for(;++n<e.length;)Du(t,e[n]);return t}function Du(e,t){let n;for(n in t){let r=(Tu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Tu.call(r,a)||(r[a]=[]);let e=i[a];Ou(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ou(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Cu(e,0,0,r)}function ku(e,t){let 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 Au(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var ju=Uu(/[A-Za-z]/),Mu=Uu(/[\dA-Za-z]/),Nu=Uu(/[#-'*+\--9=?A-Z^-~]/);function Pu(e){return e!==null&&(e<32||e===127)}var Fu=Uu(/\d/),Iu=Uu(/[\dA-Fa-f]/),Lu=Uu(/[!-/:-@[-`{-~]/);function Ru(e){return e!==null&&e<-2}function zu(e){return e!==null&&(e<0||e===32)}function Bu(e){return e===-2||e===-1||e===32}var Vu=Uu(/\p{P}|\p{S}/u),Hu=Uu(/\s/);function Uu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Wu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Mu(e.charCodeAt(n+1))&&Mu(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Gu(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Bu(r)?(e.enter(n),s(r)):t(r)}function s(r){return Bu(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Ku={tokenize:qu};function qu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Gu(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Ru(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ju={tokenize:Xu},Yu={tokenize:Zu};function Xu(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Cu(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Yu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Ru(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Cu(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Zu(e,t,n){return Gu(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qu(e){if(e===null||zu(e)||Hu(e))return 1;if(Vu(e))return 2}function $u(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var ed={name:`attention`,resolveAll:td,tokenize:nd};function td(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};rd(d,-c),rd(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=wu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=wu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=wu(l,$u(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=wu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=wu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Cu(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function nd(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qu(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Qu(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function rd(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var id={name:`autolink`,tokenize:ad};function ad(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return ju(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Mu(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Mu(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Pu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Nu(t)?(e.consume(t),l):n(t)}function u(e){return Mu(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Mu(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var od={partial:!0,tokenize:sd};function sd(e,t,n){return r;function r(t){return Bu(t)?Gu(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Ru(e)?t(e):n(e)}}var cd={continuation:{tokenize:ud},exit:dd,name:`blockQuote`,tokenize:ld};function ld(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Bu(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ud(e,t,n){let r=this;return i;function i(t){return Bu(t)?Gu(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(cd,t,n)(r)}}function dd(e){e.exit(`blockQuote`)}var fd={name:`characterEscape`,tokenize:pd};function pd(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Lu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var md={name:`characterReference`,tokenize:hd};function hd(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Mu,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Iu,u):(e.enter(`characterReferenceValue`),a=7,o=Fu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Mu&&!Su(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var gd={partial:!0,tokenize:yd},_d={concrete:!0,name:`codeFenced`,tokenize:vd};function vd(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Bu(t)?Gu(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Ru(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(gd,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Ru(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Bu(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Gu(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Ru(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Ru(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Bu(t)?Gu(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Ru(t)?e.check(gd,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Ru(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Bu(t)?Gu(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Bu(t)?Gu(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Ru(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function yd(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var bd={name:`codeIndented`,tokenize:Sd},xd={partial:!0,tokenize:Cd};function Sd(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Gu(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Ru(t)?e.attempt(xd,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Ru(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Cd(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Ru(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Gu(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Ru(e)?i(e):n(e)}}var wd={name:`codeText`,previous:Ed,resolve:Td,tokenize:Dd};function Td(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Ed(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Dd(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Ru(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Ru(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Od=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&kd(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),kd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),kd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);kd(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);kd(this.left,t.reverse())}}}};function kd(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 Ad(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Od(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,jd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Cu(e,0,1/0,u.slice(0)),!l}function jd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Md={resolve:Pd,tokenize:Fd},Nd={partial:!0,tokenize:Id};function Pd(e){return Ad(e),e}function Fd(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Ru(t)?e.check(Nd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Id(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gu(e,a,`linePrefix`)}function a(i){if(i===null||Ru(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Ld(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Pu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Ru(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||zu(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Pu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Rd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Ru(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Ru(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Bu(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function zd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Ru(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Gu(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Ru(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Bd(e,t){let n;return r;function r(i){return Ru(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Bu(i)?Gu(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vd={name:`definition`,tokenize:Ud},Hd={partial:!0,tokenize:Wd};function Ud(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Rd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Au(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return zu(t)?Bd(e,l)(t):l(t)}function l(t){return Ld(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hd,d,d)(t)}function d(t){return Bu(t)?Gu(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Ru(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wd(e,t,n){return r;function r(t){return zu(t)?Bd(e,i)(t):n(t)}function i(t){return zd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Bu(t)?Gu(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Ru(e)?t(e):n(e)}}var Gd={name:`hardBreakEscape`,tokenize:Kd};function Kd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Ru(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qd={name:`headingAtx`,resolve:Jd,tokenize:Yd};function Jd(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Cu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Yd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||zu(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Ru(n)?(e.exit(`atxHeading`),t(n)):Bu(n)?Gu(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||zu(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xd=`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`.split(`.`),Zd=[`pre`,`script`,`style`,`textarea`],Qd={concrete:!0,name:`htmlFlow`,resolveTo:tf,tokenize:nf},$d={partial:!0,tokenize:af},ef={partial:!0,tokenize:rf};function tf(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 nf(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ne):ju(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):ju(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:ee:m):n(i)}function h(t){return ju(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||zu(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Zd.includes(l)?(i=1,r.interrupt?t(s):ee(s)):Xd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):ee(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Mu(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:ee):n(i)}function v(t){return Bu(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||ju(t)?(e.consume(t),b):Bu(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Mu(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Bu(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Bu(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Ru(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||zu(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Bu(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Ru(t)?ee(t):Bu(t)?(e.consume(t),D):n(t)}function ee(t){return t===45&&i===2?(e.consume(t),te):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),N):Ru(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($d,ie,O)(t)):t===null||Ru(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),ee)}function O(t){return e.check(ef,k,ie)(t)}function k(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return t===null||Ru(t)?O(t):(e.enter(`htmlFlowData`),ee(t))}function te(t){return t===45?(e.consume(t),ne):ee(t)}function j(t){return t===47?(e.consume(t),o=``,M):ee(t)}function M(t){if(t===62){let n=o.toLowerCase();return Zd.includes(n)?(e.consume(t),re):ee(t)}return ju(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):ee(t)}function N(t){return t===93?(e.consume(t),ne):ee(t)}function ne(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),ne):ee(t)}function re(t){return t===null||Ru(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function rf(e,t,n){let r=this;return i;function i(t){return Ru(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function af(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(od,t,n)}}var of={name:`htmlText`,tokenize:sf};function sf(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):ju(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):ju(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Ru(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?te(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Ru(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?te(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?te(t):Ru(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Ru(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?te(e):y(e)}function x(t){return ju(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Mu(t)?(e.consume(t),S):C(t)}function C(t){return Ru(t)?(o=C,j(t)):Bu(t)?(e.consume(t),C):te(t)}function w(t){return t===45||Mu(t)?(e.consume(t),w):t===47||t===62||zu(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),te):t===58||t===95||ju(t)?(e.consume(t),E):Ru(t)?(o=T,j(t)):Bu(t)?(e.consume(t),T):te(t)}function E(t){return t===45||t===46||t===58||t===95||Mu(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),ee):Ru(t)?(o=D,j(t)):Bu(t)?(e.consume(t),D):T(t)}function ee(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,O):Ru(t)?(o=ee,j(t)):Bu(t)?(e.consume(t),ee):(e.consume(t),k)}function O(t){return t===i?(e.consume(t),i=void 0,A):t===null?n(t):Ru(t)?(o=O,j(t)):(e.consume(t),O)}function k(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||zu(t)?T(t):(e.consume(t),k)}function A(e){return e===47||e===62||zu(e)?T(e):n(e)}function te(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Bu(t)?Gu(e,N,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):N(t)}function N(t){return e.enter(`htmlTextData`),o(t)}}var cf={name:`labelEnd`,resolveAll:ff,resolveTo:pf,tokenize:mf},lf={tokenize:hf},uf={tokenize:gf},df={tokenize:_f};function ff(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Cu(e,0,e.length,n),e}function pf(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=wu(s,e.slice(a+1,a+r+3)),s=wu(s,[[`enter`,u,t]]),s=wu(s,$u(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=wu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=wu(s,e.slice(o+1)),s=wu(s,[[`exit`,c,t]]),Cu(e,a,e.length,s),e}function mf(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Au(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(lf,u,o?u:d)(t):t===91?e.attempt(uf,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(df,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function hf(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return zu(t)?Bd(e,a)(t):a(t)}function a(t){return t===41?u(t):Ld(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return zu(t)?Bd(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?zd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return zu(t)?Bd(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function gf(e,t,n){let r=this;return i;function i(t){return Rd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Au(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function _f(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var vf={name:`labelStartImage`,resolveAll:cf.resolveAll,tokenize:yf};function yf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var bf={name:`labelStartLink`,resolveAll:cf.resolveAll,tokenize:xf};function xf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Sf={name:`lineEnding`,tokenize:Cf};function Cf(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Gu(e,t,`linePrefix`)}}var wf={name:`thematicBreak`,tokenize:Tf};function Tf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Ru(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Bu(t)?Gu(e,s,`whitespace`)(t):s(t))}}var Ef={continuation:{tokenize:Af},exit:Mf,name:`list`,tokenize:kf},Df={partial:!0,tokenize:Nf},Of={partial:!0,tokenize:jf};function kf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Fu(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(wf,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Fu(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(od,r.interrupt?n:u,e.attempt(Df,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Bu(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Af(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(od,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gu(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Bu(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Of,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gu(e,e.attempt(Ef,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function jf(e,t,n){let r=this;return Gu(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Mf(e){e.exit(this.containerState.type)}function Nf(e,t,n){let r=this;return Gu(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Bu(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Pf={name:`setextUnderline`,resolveTo:Ff,tokenize:If};function Ff(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function If(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Bu(t)?Gu(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Ru(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Lf={tokenize:Rf};function Rf(e){let t=this,n=e.attempt(od,r,e.attempt(this.parser.constructs.flowInitial,i,Gu(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Md,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var zf={resolveAll:Uf()},Bf=Hf(`string`),Vf=Hf(`text`);function Hf(e){return{resolveAll:Uf(e===`text`?Wf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Uf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Wf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Gf=e({attentionMarkers:()=>$f,contentInitial:()=>qf,disable:()=>ep,document:()=>Kf,flow:()=>Yf,flowInitial:()=>Jf,insideSpan:()=>Qf,string:()=>Xf,text:()=>Zf}),Kf={42:Ef,43:Ef,45:Ef,48:Ef,49:Ef,50:Ef,51:Ef,52:Ef,53:Ef,54:Ef,55:Ef,56:Ef,57:Ef,62:cd},qf={91:Vd},Jf={[-2]:bd,[-1]:bd,32:bd},Yf={35:qd,42:wf,45:[Pf,wf],60:Qd,61:Pf,95:wf,96:_d,126:_d},Xf={38:md,92:fd},Zf={[-5]:Sf,[-4]:Sf,[-3]:Sf,33:vf,38:md,42:ed,60:[id,of],91:bf,92:[Gd,fd],93:cf,95:ed,96:wd},Qf={null:[ed,zf]},$f={null:[42,95]},ep={null:[]};function tp(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=wu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$u(a,l.events,l),l.events):[]}function f(e,t){return rp(p(e),t)}function p(e){return np(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Ru(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Cu(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function np(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function rp(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
12
- `;break;case-3:o=`\r
13
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function ip(e){let t={constructs:Eu([Gf,...(e||{}).extensions||[]]),content:n(Ku),defined:[],document:n(Ju),flow:n(Lf),lazy:{},string:n(Bf),text:n(Vf)};return t;function n(e){return n;function n(n){return tp(t,e,n)}}}function ap(e){for(;!Ad(e););return e}var op=/[\0\t\n\r]/g;function sp(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(op.lastIndex=u,c=op.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var cp=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lp(e){return e.replace(cp,up)}function up(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return ku(n.slice(t?2:1),t?16:10)}return Su(n)||e}var dp={}.hasOwnProperty;function fp(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),pp(n)(ap(ip(n).document().write(sp()(e,t,!0))))}function pp(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(he),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(de),blockQuote:a(z),characterEscape:T,characterReference:T,codeFenced:a(se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(se,o),codeText:a(ce,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ue),hardBreakEscape:a(fe),hardBreakTrailing:a(fe),htmlFlow:a(pe,o),htmlFlowData:T,htmlText:a(pe,o),htmlTextData:T,image:a(me),label:o,link:a(he),listItem:a(_e),listItemValue:f,listOrdered:a(ge,d),listUnordered:a(ge),paragraph:a(ve),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(de),strong:a(ye),thematicBreak:a(xe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:oe,autolinkProtocol:R,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:L,characterReference:ae,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(A),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(ee),hardBreakTrailing:c(ee),htmlFlow:c(O),htmlFlowData:E,htmlText:c(k),htmlTextData:E,image:c(j),label:N,labelText:M,lineEnding:D,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:F,resourceDestinationString:ne,resourceTitleString:re,resource:ie,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};hp(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];dp.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||_p).call(a,void 0,e[0])}for(r.position={start:mp(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:mp(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:mp(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||_p).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Fl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=mp(e.end)}function u(){return _u(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Au(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=be(),n.position={start:mp(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=mp(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=mp(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function ee(){this.data.atHardBreak=!0}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=lp(t),n.identifier=Au(t).toLowerCase()}function N(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ie(){this.data.inReference=void 0}function P(){this.data.referenceType=`collapsed`}function F(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Au(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function I(e){this.data.characterReferenceType=e.type}function L(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=ku(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Su(t);let i=this.stack[this.stack.length-1];i.value+=r}function ae(e){let t=this.stack.pop();t.position.end=mp(e.end)}function R(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function oe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function z(){return{type:`blockquote`,children:[]}}function se(){return{type:`code`,lang:null,meta:null,value:``}}function ce(){return{type:`inlineCode`,value:``}}function le(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ue(){return{type:`emphasis`,children:[]}}function de(){return{type:`heading`,depth:0,children:[]}}function fe(){return{type:`break`}}function pe(){return{type:`html`,value:``}}function me(){return{type:`image`,title:null,url:``,alt:null}}function he(){return{type:`link`,title:null,url:``,children:[]}}function ge(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function _e(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ve(){return{type:`paragraph`,children:[]}}function ye(){return{type:`strong`,children:[]}}function be(){return{type:`text`,value:``}}function xe(){return{type:`thematicBreak`}}}function mp(e){return{line:e.line,column:e.column,offset:e.offset}}function hp(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?hp(e,r):gp(e,r)}}function gp(e,t){let n;for(n in t)if(dp.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function _p(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Fl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Fl({start:t.start,end:t.end})+`) is still open`)}function vp(e){let t=this;t.parser=n;function n(n){return fp(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function yp(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function bp(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
14
- `}]}function xp(e,t){let n=t.value?t.value+`
15
- `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Sp(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cp(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wp(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Wu(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Tp(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Dp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Op(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Dp(e,t);let i={src:Wu(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function kp(e,t){let n={src:Wu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Ap(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function jp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Dp(e,t);let i={href:Wu(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Mp(e,t){let n={href:Wu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Np(e,t,n){let r=e.all(t),i=n?Pp(n):Fp(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
16
- `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
17
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Pp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Fp(n[r])}return t}function Fp(e){return e.spread??e.children.length>1}function Ip(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Lp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function zp(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ml(t.children[1]),o=jl(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Vp(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Hp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Up=9,Wp=32;function Gp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Kp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Kp(t.slice(i),i>0,!1)),a.join(``)}function Kp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Up||t===Wp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Up||t===Wp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function qp(e,t){let n={type:`text`,value:Gp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Jp(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Yp={blockquote:yp,break:bp,code:xp,delete:Sp,emphasis:Cp,footnoteReference:wp,heading:Tp,html:Ep,imageReference:Op,image:kp,inlineCode:Ap,linkReference:jp,link:Mp,listItem:Np,list:Ip,paragraph:Lp,root:Rp,strong:zp,table:Bp,tableCell:Hp,tableRow:Vp,text:qp,thematicBreak:Jp,toml:Xp,yaml:Xp,definition:Xp,footnoteDefinition:Xp};function Xp(){}var Zp=typeof self==`object`?self:globalThis,Qp=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Zp[e](t)},$p=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(Qp(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(Qp(a,o),i)};return r},em=e=>$p(new Map,e)(0),tm=``,{toString:nm}={},{keys:rm}=Object,im=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=nm.call(e).slice(8,-1);switch(n){case`Array`:return[1,tm];case`Object`:return[2,tm];case`Date`:return[3,tm];case`RegExp`:return[4,tm];case`Map`:return[5,tm];case`Set`:return[6,tm];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},am=([e,t])=>e===0&&(t===`function`||t===`symbol`),om=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=im(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of rm(r))(e||!am(im(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?tm:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(am(im(n))||am(im(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!am(im(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},sm=(e,{json:t,lossy:n}={})=>{let r=[];return om(!(t||n),!!t,new Map,r)(e),r},cm=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?em(sm(e,t)):structuredClone(e):(e,t)=>em(sm(e,t));function lm(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function um(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function dm(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||lm,r=e.options.footnoteBackLabel||um,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Wu(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...cm(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
18
- `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
19
- `}]}}var fm=(function(e){if(e==null)return _m;if(typeof e==`function`)return gm(e);if(typeof e==`object`)return Array.isArray(e)?pm(e):mm(e);if(typeof e==`string`)return hm(e);throw Error(`Expected function, string, or object as test`)});function pm(e){let t=[],n=-1;for(;++n<e.length;)t[n]=fm(e[n]);return gm(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function mm(e){let t=e;return gm(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function hm(e){return gm(t);function t(t){return t&&t.type===e}}function gm(e){return t;function t(t,n,r){return!!(vm(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function _m(){return!0}function vm(e){return typeof e==`object`&&!!e&&`type`in e}function ym(e){return e}var bm=[];function xm(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=fm(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+ym(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=bm,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Sm(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Sm(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?bm:[e]}function Cm(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),xm(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var wm={}.hasOwnProperty,Tm={};function Em(e,t){let n=t||Tm,r=new Map,i=new Map,a={all:s,applyData:Om,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Yp,...n.handlers},one:o,options:n,patch:Dm,wrap:Am};return Cm(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(wm.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=cm(n);return r.children=a.all(e),r}return cm(e)}return(a.options.unknownHandler||km)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=jm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=jm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Dm(e,t){e.position&&(t.position=Pl(e))}function Om(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,cm(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function km(e,t){let n=t.data||{},r=`value`in t&&!(wm.call(n,`hProperties`)||wm.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Am(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
20
- `});++r<e.length;)r&&n.push({type:`text`,value:`
21
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
22
- `}),n}function jm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Mm(e,t){let n=Em(e,t),r=n.one(e,void 0),i=dm(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
23
- `},i)),a}function Nm(e,t){return e&&`run`in e?async function(n,r){let i=Mm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Mm(n,{file:r,...e||t})}}function Pm(e){if(e)throw e}var Fm=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Im(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Lm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Rm(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Rm(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var zm={basename:Bm,dirname:Vm,extname:Hm,join:Um,sep:`/`};function Bm(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Km(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Vm(e){if(Km(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Hm(e){Km(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Um(...e){let t=-1,n;for(;++t<e.length;)Km(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Wm(n)}function Wm(e){Km(e);let t=e.codePointAt(0)===47,n=Gm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Gm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==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=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Km(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var qm={cwd:Jm};function Jm(){return`/`}function Ym(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Xm(e){if(typeof e==`string`)e=new URL(e);else if(!Ym(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Zm(e)}function Zm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Qm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],$m=class{constructor(e){let t;t=e?Ym(e)?{path:e}:typeof e==`string`||rh(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:qm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Qm.length;){let e=Qm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Qm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?zm.basename(this.path):void 0}set basename(e){th(e,`basename`),eh(e,`basename`),this.path=zm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?zm.dirname(this.path):void 0}set dirname(e){nh(this.basename,`dirname`),this.path=zm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?zm.extname(this.path):void 0}set extname(e){if(eh(e,`extname`),nh(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=zm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ym(e)&&(e=Xm(e)),th(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?zm.basename(this.path,this.extname):void 0}set stem(e){th(e,`stem`),eh(e,`stem`),this.path=zm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new zl(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function eh(e,t){if(e&&e.includes(zm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+zm.sep+"`")}function th(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nh(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function rh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var ih=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),ah=t(Fm(),1),oh={}.hasOwnProperty,sh=new class e extends ih{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=Lm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,ah.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(uh(`data`,this.frozen),this.namespace[e]=t,this):oh.call(this.namespace,e)&&this.namespace[e]||void 0:e?(uh(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=ph(e),n=this.parser||this.Parser;return ch(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),ch(`process`,this.parser||this.Parser),lh(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=ph(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);hh(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),ch(`processSync`,this.parser||this.Parser),lh(`processSync`,this.compiler||this.Compiler),this.process(e,r),fh(`processSync`,`process`,t),n;function r(e,r){t=!0,Pm(e),n=r}}run(e,t,n){dh(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=ph(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),fh(`runSync`,`run`,n),r;function i(e,t){Pm(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=ph(t),r=this.compiler||this.Compiler;return lh(`stringify`,r),dh(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(uh(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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");o(e.plugins),e.settings&&(r.settings=(0,ah.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Im(o)&&Im(r)&&(r=(0,ah.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function ch(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function lh(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function uh(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function dh(e){if(!Im(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function fh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function ph(e){return mh(e)?e:new $m(e)}function mh(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function hh(e){return typeof e==`string`||gh(e)}function gh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var _h=[],vh={allowDangerousHtml:!0},yh=/^(https?|ircs?|mailto|xmpp)$/i,bh=[{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:`className`,id:`remove-classname`},{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 xh(e){let t=Sh(e),n=Ch(e);return wh(t.runSync(t.parse(n),n),e)}function Sh(e){let t=e.rehypePlugins||_h,n=e.remarkPlugins||_h,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vh}:vh;return sh().use(vp).use(n).use(Nm,r).use(t)}function Ch(e){let t=e.children||``,n=new $m;return typeof t==`string`?n.value=t:``+t,n}function wh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Th;for(let e of bh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Cm(e,l),ql(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in hu)if(Object.hasOwn(hu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=hu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Th(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||yh.test(e.slice(0,t))?e:``}function Eh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Dh(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Oh(e,t,n){let r=fm((n||{}).ignore||[]),i=kh(t),a=-1;for(;++a<i.length;)xm(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function kh(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Ah(e[0]),jh(e[1])])}return t}function Ah(e){return typeof e==`string`?new RegExp(Dh(e),`g`):e}function jh(e){return typeof e==`function`?e:function(){return e}}var Mh=`phrasing`,Nh=[`autolink`,`link`,`image`,`label`];function Ph(){return{transforms:[Hh],enter:{literalAutolink:Ih,literalAutolinkEmail:Lh,literalAutolinkHttp:Lh,literalAutolinkWww:Lh},exit:{literalAutolink:Vh,literalAutolinkEmail:Bh,literalAutolinkHttp:Rh,literalAutolinkWww:zh}}}function Fh(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Mh,notInConstruct:Nh},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Mh,notInConstruct:Nh},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Mh,notInConstruct:Nh}]}}function Ih(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Lh(e){this.config.enter.autolinkProtocol.call(this,e)}function Rh(e){this.config.exit.autolinkProtocol.call(this,e)}function zh(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Bh(e){this.config.exit.autolinkEmail.call(this,e)}function Vh(e){this.exit(e)}function Hh(e){Oh(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Uh],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Wh]],{ignore:[`link`,`linkReference`]})}function Uh(e,t,n,r,i){let a=``;if(!qh(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Gh(n)))return!1;let o=Kh(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Wh(e,t,n,r){return!qh(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Gh(e){let 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 Kh(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Eh(e,`(`),a=Eh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function qh(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Hu(n)||Vu(n))&&(!t||n!==47)}rg.peek=ng;function Jh(){this.buffer()}function Yh(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Xh(){this.buffer()}function Zh(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Qh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $h(e){this.exit(e)}function eg(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function tg(e){this.exit(e)}function ng(){return`[`}function rg(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function ig(){return{enter:{gfmFootnoteCallString:Jh,gfmFootnoteCall:Yh,gfmFootnoteDefinitionLabelString:Xh,gfmFootnoteDefinition:Zh},exit:{gfmFootnoteCallString:Qh,gfmFootnoteCall:$h,gfmFootnoteDefinitionLabelString:eg,gfmFootnoteDefinition:tg}}}function ag(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:rg},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
24
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?sg:og))),s(),o}}function og(e,t,n){return t===0?e:sg(e,t,n)}function sg(e,t,n){return(n?``:` `)+e}var cg=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];pg.peek=mg;function lg(){return{canContainEols:[`delete`],enter:{strikethrough:dg},exit:{strikethrough:fg}}}function ug(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:cg}],handlers:{delete:pg}}}function dg(e){this.enter({type:`delete`,children:[]},e)}function fg(e){this.exit(e)}function pg(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function mg(){return`~`}function hg(e){return e.length}function gg(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||hg,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=_g(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=vg(r[d]);else{let e=vg(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
25
- `)}function _g(e){return e==null?``:String(e)}function vg(e){let 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}function yg(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),bg);return i(),o}function bg(e,t,n){return`>`+(n?``:` `)+e}function xg(e,t){return Sg(e,t.inConstruct,!0)&&!Sg(e,t.notInConstruct,!1)}function Sg(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Cg(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
26
- `&&xg(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
27
- `}function wg(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Tg(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 Eg(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Dg(e,t,n,r){let i=Eg(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Tg(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Og);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(wg(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
28
- `,encode:["`"],...s.current()})),t()}return u+=s.move(`
29
- `),a&&(u+=s.move(a+`
30
- `)),u+=s.move(c),l(),u}function Og(e,t,n){return(n?``:` `)+e}function kg(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Ag(e,t,n,r){let i=kg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
31
- `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function jg(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Mg(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Ng(e,t,n){let r=Qu(e),i=Qu(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Pg.peek=Fg;function Pg(e,t,n,r){let i=jg(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Ng(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Mg(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Ng(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Mg(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Fg(e,t,n){return n.options.emphasis||`*`}function Ig(e,t){let n=!1;return Cm(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&_u(e)&&(t.options.setext||n))}function Lg(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Ig(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
32
- `,after:`
33
- `});return r(),t(),o+`
34
- `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
35
- `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
36
- `,...a.current()});return/^[\t ]/.test(l)&&(l=Mg(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Rg.peek=zg;function Rg(e){return e.value||``}function zg(){return`<`}Bg.peek=Vg;function Bg(e,t,n,r){let i=kg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Vg(){return`!`}Hg.peek=Ug;function Hg(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Ug(){return`!`}Wg.peek=Gg;function Wg(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Gg(){return"`"}function Kg(e,t){let n=_u(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))}qg.peek=Jg;function qg(e,t,n,r){let i=kg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Kg(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Jg(e,t,n){return Kg(e,n)?`<`:`[`}Yg.peek=Xg;function Yg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Xg(){return`[`}function Zg(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Qg(e){let t=Zg(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function $g(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function e_(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function t_(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?$g(n):Zg(n),s=e.ordered?o===`.`?`)`:`.`:Qg(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.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),e_(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function n_(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function r_(e,t,n,r){let i=n_(n),a=n.bulletCurrent||Zg(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function i_(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var a_=fm([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function o_(e,t,n,r){return(e.children.some(function(e){return a_(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function s_(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}c_.peek=l_;function c_(e,t,n,r){let i=s_(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Ng(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Mg(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Ng(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Mg(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function l_(e,t,n){return n.options.strong||`*`}function u_(e,t,n,r){return n.safe(e.value,r)}function d_(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function f_(e,t,n){let r=(e_(n)+(n.options.ruleSpaces?` `:``)).repeat(d_(n));return n.options.ruleSpaces?r.slice(0,-1):r}var p_={blockquote:yg,break:Cg,code:Dg,definition:Ag,emphasis:Pg,hardBreak:Cg,heading:Lg,html:Rg,image:Bg,imageReference:Hg,inlineCode:Wg,link:qg,linkReference:Yg,list:t_,listItem:r_,paragraph:i_,root:o_,strong:c_,text:u_,thematicBreak:f_};function m_(){return{enter:{table:h_,tableData:y_,tableHeader:y_,tableRow:__},exit:{codeText:b_,table:g_,tableData:v_,tableHeader:v_,tableRow:v_}}}function h_(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function g_(e){this.exit(e),this.data.inTable=void 0}function __(e){this.enter({type:`tableRow`,children:[]},e)}function v_(e){this.exit(e)}function y_(e){this.enter({type:`tableCell`,children:[]},e)}function b_(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,x_));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function x_(e,t){return t===`|`?t:e}function S_(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
37
- `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
38
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return gg(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=p_.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function C_(){return{exit:{taskListCheckValueChecked:T_,taskListCheckValueUnchecked:T_,paragraph:E_}}}function w_(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:D_}}}function T_(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function E_(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function D_(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=p_.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function O_(){return[Ph(),ig(),lg(),m_(),C_()]}function k_(e){return{extensions:[Fh(),ag(e),ug(),S_(e),w_()]}}var A_={tokenize:W_,partial:!0},j_={tokenize:G_,partial:!0},M_={tokenize:K_,partial:!0},N_={tokenize:q_,partial:!0},P_={tokenize:J_,partial:!0},F_={name:`wwwAutolink`,tokenize:H_,previous:Y_},I_={name:`protocolAutolink`,tokenize:U_,previous:X_},L_={name:`emailAutolink`,tokenize:V_,previous:Z_},R_={};function z_(){return{text:R_}}for(var B_=48;B_<123;)R_[B_]=L_,B_++,B_===58?B_=65:B_===91&&(B_=97);R_[43]=L_,R_[45]=L_,R_[46]=L_,R_[95]=L_,R_[72]=[L_,I_],R_[104]=[L_,I_],R_[87]=[L_,F_],R_[119]=[L_,F_];function V_(e,t,n){let r=this,i,a;return o;function o(t){return!Q_(t)||!Z_.call(r,r.previous)||$_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Q_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(P_,u,l)(t):t===45||t===95||Mu(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&ju(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function H_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Y_.call(r,r.previous)||$_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(A_,e.attempt(j_,e.attempt(M_,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function U_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&X_.call(r,r.previous)&&!$_(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(ju(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Pu(t)||zu(t)||Hu(t)||Vu(t)?n(t):e.attempt(j_,e.attempt(M_,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function W_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function G_(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(N_,c,s)(t):t===null||zu(t)||Hu(t)||t!==45&&Vu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function K_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(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(N_,t,a)(o):o===null||zu(o)||Hu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function q_(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||zu(o)||Hu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||zu(e)||Hu(e)?t(e):r(e)}function a(e){return ju(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):ju(t)?(e.consume(t),o):n(t)}}function J_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Mu(e)?n(e):t(e)}}function Y_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zu(e)}function X_(e){return!ju(e)}function Z_(e){return!(e===47||Q_(e))}function Q_(e){return e===43||e===45||e===46||e===95||Mu(e)}function $_(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var ev={tokenize:cv,partial:!0};function tv(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:av,continuation:{tokenize:ov},exit:sv}},text:{91:{name:`gfmFootnoteCall`,tokenize:iv},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:nv,resolveTo:rv}}}}function nv(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Au(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function rv(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`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function iv(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||zu(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Au(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return zu(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function av(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||zu(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Au(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return zu(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Gu(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function ov(e,t,n){return e.check(od,t,e.attempt(ev,t,n))}function sv(e){e.exit(`gfmFootnoteDefinition`)}function cv(e,t,n){let r=this;return Gu(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function lv(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Cu(o,o.length,0,$u(s,e.slice(r+1,n),t)),Cu(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Cu(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Qu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Qu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var uv=class{constructor(){this.map=[]}add(e,t,n){dv(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function dv(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function fv(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function pv(){return{flow:{null:{name:`table`,tokenize:mv,resolveAll:hv}}}}function mv(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Ru(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Bu(t)?Gu(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||zu(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Bu(t)?Gu(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Bu(t)?Gu(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Ru(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Bu(t)?Gu(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Ru(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Ru(n)?(e.exit(`tableRow`),t(n)):Bu(n)?Gu(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||zu(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function hv(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new uv;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(_v(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=gv(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=gv(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=gv(f,t,o,i,n,d)):(o[0]=o[1],d=gv(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&_v(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=fv(t.events,n))}return e}function gv(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},vv(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=vv(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=vv(t.events,n[2]),a=vv(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},vv(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function _v(e,t,n,r,i){let a=[],o=vv(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function vv(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var yv={name:`tasklistCheck`,tokenize:xv};function bv(){return{text:{91:yv}}}function xv(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return zu(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Ru(r)?t(r):Bu(r)?e.check({tokenize:Sv},t,n)(r):n(r)}}function Sv(e,t,n){return Gu(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Cv(e){return Eu([z_(),tv(),lv(e),pv(),bv()])}var wv={};function Tv(e){let t=this,n=e||wv,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Cv(n)),a.push(O_()),o.push(k_(n))}var Ev=[Tv],Dv=({content:e})=>(0,H.jsx)(`div`,{className:`prose prose-sm max-w-none text-foreground prose-a:text-primary prose-code:text-foreground prose-headings:text-foreground prose-pre:border prose-pre:border-border prose-pre:bg-muted/50 prose-strong:text-foreground prose-li:marker:text-muted-foreground`,children:(0,H.jsx)(xh,{remarkPlugins:Ev,children:e})}),Ov=go,kv=so;function Av({className:e,...t}){return(0,H.jsx)(eo,{forceRender:!0,className:B(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`dialog-backdrop`,...t})}function jv({className:e,...t}){return(0,H.jsx)(_o,{className:B(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`dialog-viewport`,...t})}function Mv({className:e,children:t,showCloseButton:n=!0,bottomStickOnMobile:r=!0,...i}){return(0,H.jsxs)(kv,{children:[(0,H.jsx)(Av,{}),(0,H.jsx)(jv,{className:B(r&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,H.jsxs)(oo,{className:B(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-xl scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-xl border border-border bg-popover text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-2xl transition-[scale,opacity,translate] duration-150 ease-out will-change-transform data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,r&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4`,e),"data-slot":`dialog-popup`,...i,children:[t,n&&(0,H.jsx)(to,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,H.jsx)(yn,{size:`icon`,variant:`ghost`}),children:(0,H.jsx)(Ei,{})})]})})]})}function Nv({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4`,e),"data-slot":`dialog-header`,...t})}function Pv({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{className:B(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3 pt-4 pb-6`,e),"data-slot":`dialog-footer`,...n})}function Fv({className:e,...t}){return(0,H.jsx)(vo,{className:B(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`dialog-title`,...t})}function Iv({className:e,...t}){return(0,H.jsx)(no,{className:B(`text-muted-foreground text-sm`,e),"data-slot":`dialog-description`,...t})}function Lv({className:e,scrollFade:t=!0,...n}){return(0,H.jsx)(Go,{scrollFade:t,children:(0,H.jsx)(`div`,{className:B(`p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:has([data-slot=dialog-footer]:not(.border-t))]:pb-1`,e),"data-slot":`dialog-panel`,...n})})}function Rv({className:e,...t}){return(0,H.jsx)(Kr,{"aria-label":`Loading`,className:B(`animate-spin`,e),role:`status`,...t})}var zv=hn(`inline-flex w-fit shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-2 py-0.5 font-medium text-[11px] tracking-tight transition-colors`,{defaultVariants:{tone:`neutral`},variants:{tone:{success:`border-emerald-500/20 bg-emerald-500/10 text-emerald-600 dark:border-emerald-500/25 dark:bg-emerald-500/15 dark:text-emerald-300`,warning:`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:border-amber-500/25 dark:bg-amber-500/15 dark:text-amber-300`,danger:`border-rose-500/20 bg-rose-500/10 text-rose-600 dark:border-rose-500/25 dark:bg-rose-500/15 dark:text-rose-300`,running:`border-sky-500/20 bg-sky-500/10 text-sky-700 dark:border-sky-500/25 dark:bg-sky-500/15 dark:text-sky-300`,info:`border-blue-500/20 bg-blue-500/10 text-blue-600 dark:border-blue-500/25 dark:bg-blue-500/15 dark:text-blue-300`,accent:`border-primary/25 bg-primary/10 text-primary`,idle:`border-border/70 bg-muted/60 text-muted-foreground`,neutral:`border-border/70 bg-muted/60 text-muted-foreground`,"in-place":`border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300 font-mono text-[10px]`,worktree:`border-primary/20 bg-primary/10 text-primary font-mono text-[10px]`}}});function Bv({className:e,tone:t,dot:n=!0,children:r,...i}){return(0,H.jsxs)(`span`,{className:B(zv({className:e,tone:t})),"data-slot":`status-badge`,...i,children:[n&&(0,H.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-current opacity-70`}),r]})}var Vv=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),W;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(W||={});var Hv={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function Uv(e){return e>=55296&&e<=57343}function Wv(e){return e>=56320&&e<=57343}function Gv(e,t){return(e-55296)*1024+9216+t}function Kv(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function qv(e){return e>=64976&&e<=65007||Vv.has(e)}var G;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(G||={});var Jv=65536,Yv=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Jv,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(Wv(t))return this.pos++,this._addGap(),Gv(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,W.EOF;return this._err(G.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,W.EOF;let n=this.html.charCodeAt(t);return n===W.CARRIAGE_RETURN?W.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,W.EOF;let e=this.html.charCodeAt(this.pos);return e===W.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,W.LINE_FEED):e===W.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Uv(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===W.LINE_FEED||e===W.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){Kv(e)?this._err(G.controlCharacterInInputStream):qv(e)&&this._err(G.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},Xv;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(Xv||={});function Zv(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Qv=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function $v(e){return e===0||e>=55296&&e<=57343||e>1114111}function ey(e){return $v(e)?65533:e>=128&&e<=159&&Qv[e-128]||e}function ty(e){return $v(e)?65533:e}var ny=(()=>{let e=new Uint8Array(127),t=0;for(let n=33;n<=126;n++)n!==34&&n!==36&&n!==92&&(e[n]=t++);return e})();function ry(e,t,n,r,i,a){let o=e.length,s=a*90,c=0,l=()=>{let t=ny[e.charCodeAt(c++)];return t<a?t:t*91-s+ny[e.charCodeAt(c++)]},u=n-r,d=n+i,f=new Int32Array(d);f.fill(-1,r,a),f.fill(-1,a+u,d);let p=new Int32Array(d),m=new Int32Array(d);function h(t,n){let r=0,i=n,a=n+t;for(;i<a;){let t=ny[e.charCodeAt(c++)];if(t<89)r+=t,f[i++]=r;else if(t===89){let t=ny[e.charCodeAt(c++)]+2;for(;t--;)f[i++]=++r}else{let t=ny[e.charCodeAt(c++)];r+=89+(t<90?t*91+ny[e.charCodeAt(c++)]:ny[e.charCodeAt(c++)]*8281+ny[e.charCodeAt(c++)]*91+ny[e.charCodeAt(c++)]),f[i++]=r}}}h(r,0),h(u,a);let g=new Int32Array(i*2),_=0,v=0;function y(e,t){for(let n=0;n<e;n++){let e=t+n,r=l(),i=l();g[v*2]=r,g[v*2+1]=i,v+=1,p[e]=_;let a=(f[r]<0?m[r]:1)+(f[i]<0?m[i]:1);m[e]=a,_+=a}}y(i-a+r,a+u),y(a-r,r);let b=new Uint16Array(_),x=0;for(let e=0;e<v;e++)for(let t=0;t<2;t++){let n=g[e*2+t],r=f[n];if(r<0){let e=p[n],t=e+m[n];for(;e<t;)b[x++]=b[e++]}else b[x++]=r}let S=new Uint16Array(t),C=0;for(;c<o;){let t=ny[e.charCodeAt(c++)];t>=a&&(t=t*91-s+ny[e.charCodeAt(c++)]);let n=f[t];if(n<0){let e=p[t],n=e+m[t];for(;e<n;)S[C++]=b[e++]}else S[C++]=n}return S}var iy=ry("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#<B%##%%'%+~#;#@%}#&%#&&%#(~#H1}'%'##&&~#?A}&'~#D#%32}'&&&&~#[}'(#%}'~#;C})&}%%#%~#=&%,3}%'(#%%~#^'#&&)#%'~#Y%-~#d-%'~#^%%&#&&&}#~#b~2t*&'~&(~&@~0%~e~3}%*''0})&}+~!9##-}#%-hD*)1fC#%/&/fB#40~!+#)*4~!+~!K'&:~!/*7~!.#~!H~!L':~%x&~!H#~!*~%1~!I#~!+A~#p'~!F~~#-#~,,(~.Z~!V~%;'B'mq-W~!N~%I%#&&#&}#%},%%}'%}+X#%}#&}(%}'%}<%}#%}%%'}'%}:~![)9@~%>~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37</31&83##&0#),H(?'&?/1##%#&&#%''-%&&&#(&''&#.-'%#%%(,')*'&#&#'##%(%(#%('#&##%%%%('%#%#%%#%#&%##h>w+v<ayvyvcg.uuhKr}g/v|g>u9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a0<or[yc3Dtq>6Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.<rAJwLZtT~?r@dZa%!a.&^*Za(/Reu[ya>6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:9<B@bX~3jVv&v@s@5Re[d/rQt{uAvo&a&a*)a2!,0Wf!3Dt0=Bs'>6Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh<vu5Rgq<=C::9bb~#dZ#T&Ta6Y.X*Dt>[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s<DtDJvyZqY5aws3Jvy!&Wei~Hr1:au5@Bag>23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay<a]C;b`}Vd6s/t{uAvoaxa()!a,a7%-a#a2Dt,[yF2Wo[>6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=<qnJvh_[xhg3v,Rh3kOwOw-sDuev/Re^dha[a%!%!a+#Ta7)-5TaCaO!aka!a)sf[yb2>Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2<E}5xIo9a*X#Y(;5RePJvD_g>vyRgNj8w)v8<wggs:RgXiZt|vjx,hSq3ah!-(~@:Ro/Ou!5RhWj^v(pyw8unRhUdx-UY#^Ua.a3a70!)%UX1TaDa)'omRiRRhE[y:3Dsz=Br,>6Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|i<ARk<c:Z(6Vy}Juh'!wziMRoS:F|vkLuauJv5vtvQRh1d='T+Y#VyO~DR|jcF#T'7R|g97R|kJv3'!ay<Rj,Jvh&!:ReXcsa6*a+#a#_aIRf9aLRf?c,Z&Rf5Rf7c.Z&Rf;Rf>cQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf<d~'Ua%U*^UYa(!a,-!#a4YaTalaEX0a8a<Weo3Dt/3Dsx=Br93Wen~Dr;~<5p<JwNZt2@3p=Pw:5p;Ou!5r3c7&!#:p>3Ds}KvGB)_6Vyk2sM=<r7x'eovA(!hFu1ARf}cV#X&@r5j6rvwQa^Rf3c=Za'wkghJv__g;unRggA53B9=b^}%j6uduo5Jq;!(hIv%2Re`Ou4ARe_e%a#^^^Xa&!a*a2!&a6YaP!*ad!#a:aE/5Rn?[y@>6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<<sSjJpqvewOJq/(!hNw'5ReBk0s2u3w/w'5ReE5@Jq.!a+JQ!&WeU23d(#Y&RjG5]jBk!u7w&u0udARjEe#+^^^Ub#!a2/a`Z(agT1!a-a;|@TaG!aS[yV=Re~fow'RguNuPRe?bz#'>RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=<r#ijuuv/sIKuYD'ZtG@3p9~Gr&d2#`(g<vtRgFj`u5w&rqpxRf2CJuY!+:wfnTOu!5Rg}jNs1ucv&RfwJvA!&3@q|BDcC#T,k/unq8w8Q5RkTklwQuzunq8w8Q5Rk9dga#!a'!a=#a0!:+Tb*b@aO.a4!aba8aFJv^}?!VyR~Dr<g;u%Rn.~<5p[x'e`wNZtR@3p]Pw:5pZhNvjBp.woe_g5u-r4JwF!%DtO3:ooc7&!#:p^3DtpLuGw(!+%)Dtk6Vz#2sd=<r8d'#Y([y#<x3gJt`w@!)%}MRiowzikRij=]ilxAf3,U(#B2Rf#g0v-Rm[ck{`U#]giKv3>)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9<E|u2@H|rx3gJu?w'!+'1Nu7Reg4=H~+9<wxgY95Rm]xLggZ-`(X}U2:Ri4h<uOawRmsJv__5@bb{jbV~3dka#a'a]!,#a+U=a>b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=<qoJvA!{~Jup!%@qk7Rn/KvyD!}''[xz;>wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;Rm<Rm=Rm>Rm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta<aKbD!2wphBRnk[yPw}hE|.=Br-3Dtm>6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2<H|*xHn]#-UX'3Ro)z=iT}6ARns=Bwsn_wpnaRncw]aR(#UXa&Ua*a/=]iPd'#Y&Ro'WnXf{QRm2hNvj]nZd`'T~&1`{|`#9b]{}c:'!#Wl{>@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQ<s7Nu;padH#X'`+WmJ@>RmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe<E|IJva!&WmNg8vsRmLd`*.`#Y'Xa!axRn*]hrA8Rhug5s@rXg8u!RmMd8#X'X*3@rV72smdI*#UY&RmICARho~GsgxVgd)Ta'U-Y&Xa!T#RnEWnA@Wffg1uDRi0hFvK5RnBxGnG&#`%owp)@wsf+bX}Ze-*1!a*^^^Ua|!#a.aq&Ya2!a>.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.<Ju(!&SoG}6Shd}6<Ju(!&SoH}6She}6Kur@._g5vHRieJvx!{L2G{Kx6gd'T#?Rh82Wi5cZ#X(g1w)Rm5dW-Y(Ta#!a)!#aYa=wnfE=su2>>bU{0j9udv:<svj8uQv-7RgHdE%#^'sq9sp=>Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_g<v~Rm#JvG'!6Vz0=<r{Ju{%!:pj@WfsiXuJu3Rm:JvZ&!WfA~Bph@c4Z&Dtwax5rubx(#:awRk1@d,#Y&RfjRfid1#,Y(@Wfp2Wlrg5s@ryKu[@!,'=]ig9wlk?Rk>g5u-rqJvy'!@9RkQcH(T#=>Ri~@<wkj(Wj(KuZB*!&<7rw@9RkRcH(T#=>Ri}@<wkj)Wj)dg(Ta2Xa9X#`-!a*CARhg@@=I}d9x;c~#X%so=<sj>2@@=aybb}XjWv0Q~EfEj3vLv;<d,#Y(56H}`978H}_dgaPaFa'a/!#a3Y0a_a;a|!1(a7-[yE3[xt;:pJNvZrrg3uJrvJwNZt=@3pIh=rt3rxPw:5pGOu!5rpJvG'!6Vys=<rz@c4Z&Dt(ax5rtJvZ!&~BpH@wsfNg-vaRlNci*U#=<wei<F}a5@Jq.!a*JQ!%@qZ23d(#Y&RjH5]jCk!u7w&u0udARjFd/prq=tyvpaEa(a:.!a1aZ(@@=I}:9wpd%=<sX55w_h}@@=I{t=ay<aU@@=I}T=ay<2@@=I})?C9:9au@9Cb]}DP~=x-fAZ(2Wl1=ay<aU@@=I}>5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}<BqP=4qS9:ReMg/ujReNJw0!/<Jui%!bd{kawwnemRelAxUa?a3#*.&UX(Ya+a/RhvRnQ<o}9Wmtd-#Y&RgSRmw9;Rmxay=Rmyg-vaRmuxEhSrNu,v-voC!%(aR.a(a7+1Ro1>Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=<r%JrM_=]h2@Wlud'#)U'Wf'b]{i=]h/Jvh!&~BpWg=v]RnMx+ny#'Nu;pVwjnu=]nwxJnx,T#`&Reqwjnt=]nvieu9vrRjLLuYwP(#+!th@wih5pX~Gr'g5v/Rh4KunA'!-CARnP@wwiN:Rm_9x'cvw>!|l=<saKvAA!0&3@q}>w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5<B92:E{ZLvhwA(a;a%!igQuyRmad+#Y}m@3Rh5d8#X'X*:AqUAHzmaxwbh<aXRnVcF}RT#Nw&cj#U(BWnug/vsRntdka)(a3+.Zb7aYYan1!bVa@Xa}[y^@b[{G=H{+hFu73Rj&Pv#5ReQcK%T#sig1v{Rj'Ku+D#'!t]~Grm~?rkKuMB!01d5#`'Vy.ta3Dtu~Hroc8#'{^45s85AwZbP&!#Rn!wghxWn#KvEA!)&2RlA2RlBx:h|#(T,=]j09Wobz>x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@<plJvf!%b`{(9;Rgwc;.!#2x7cw#T|UDb]|T5Ju={(!=@E{&Jv)&!Ab`{'awJvf!~*>>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8<RhmkMu9vrsBuev/RhlCJvB!,g<v{wchh~@:Rhji[vrv{wchi~@:RhkdS&a5UY#Ta!RgPwwiI5BwciI~@:Rh`x'iJvj'!5]iJPu8Bwch]~@:Rhach)U#h3rp]gLh@t|Ax,hTq3ah!-(~@:Ro0Ou!5RhXj^v(pyw8unRhVd|)`,^UYas!a?/a2Z'a^Ta{Tb7Ta(a#!a,Wf&9sZ3DtAadamov=Bqt3[xig8vsRm~>waiL2b`{QJv*_Ouv2qgj<v]v2BqfdR'X*X#Y-@3qr~Gqv~?p6hHv-]glPup5Lq+q?_%*b_{qF{n9b^{rOu4ARhpKvCD!+&~Bqp:5Dbb}nwoiKl&unuTuBv]v+ueunaXRf0=Jvh!0nKufu8v1w&w7q%w&uHrz:Rgnj5w,uxDJq/(!hNw'5ReCk0s2u3w/w'5ReFd>Za&!*UaA=<wkgsRnSJv^!%Refifw3vyRgOKu_B'!,<]gkiiu:w&Rh<=C@a^<B57@2F{[<B5@aW:=3away9A5aW=<B=C@a^<B57@2F{Ie-#`(^^^bCara.b8aza6!/bZ,!adTbnTbOb+aFaS!aAT9@Wf~2Wli3Dtl2@d,#Y&RfnRfmJwJZtN~GqyJva&!VyMg<v~Rm%iXuJu3Rm9Jv[_=]ih9wlkDRkCd1#`(@Wg>2Wls3cH#T(@<Rj*=>Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@<Rj+=>Ri{cNu+vlax-!(#a0qa9<Rii2;;bU{H;x<i=&X#Rk`<4wwi=C9H~8xAI(Y#<azRi@45wXI<B9;5bb~7dL(X#Xa(+!aL6Vy{g5QqOau:5au2@ay547EzbxOcU(UX-T#Ta#:Cbb|A?wjh/b_|SOw6ARgtihr}u7Rhy<d1#T)X1@@=I|~=ay<2@@=aybb}Sj3vLv;<d,#Y(56H}A978H}@dGpvs@uAu`vcw9*!aFa+ai%(b!aXa8.a?a[ozWey=sU2@G}Nch&U#Rf_WexKu+D#'!t:~Gr`~?r^j]uNr|~FRg*j^psurwJt|RmcKv)@&!)7Rkv~Br[@wxfO:Rl3co#U'6Rezj_q#vIuavjRltwzeyh@vr5JqD0!>aY?C9:9au@9Cb]}9cl#U*5;5<H||jbuus1ucv&Rfvg1v~d/pppzqFr^a--a~!aMat1(hFv;Wiz@@=Izoj5uuv-7Rix~Cw`fk2WlVcZ#X,k)u3vWs@u2]ktg;wEx'fBq(_2Wg/jTv|vV~EfoJv]!15x'hzqG!(P~EfU~CRl_j6v(us5x4i-#T(2WmZ?C2F|d>Kq<aj1!*jTqIsBv=Wl`~Cw`fi2WlWj`v0u*~>RlR=c>Z,k#u3vWs@u2]kr<c1Z+jTqIsBv=Wla~Cw`fm2WlXdmb3!a{(arZa`bkTa%TbQTa-a9+c'!aM!/[yL=Bqug.w'RifhFvyDRj.g>vgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9<H|yd'%_X#skDtb3awwqkgNulRkgdB#^',9:p'hJwSaxRmEBwVb8@4=H|qLu+w50&!)@3qs~?pU>Awwn;;Rn=c:Z'ARn<=<qwKvC@!/&~BqqJv6!&]eVb^z^xRge'/a%+^`#Sge}6<4Rn3=]n0Pw2>Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=<wkaNw~h3z_c5Z{=wjh#=]nLKv^D!&)Vyz=bW|swYb<WetcG#T(2wxa@qVx@gD#Y&b^|V5JwG&!5bb|pg/w&RgD@x=kHs=uAvn!a%%/'+RmSRh694Ro`g-vaRmRhHv-]mlxCcS#`&ba~.5cD#Ta)P~=d,#Y(56H{>978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(Xa<!aiX#(55RiG54RiHcI#T'WiU3RiVNvdwtfcRlKNvdd,#Y&RlHRlExQgf.1*^T'X#Sgf}6Wn4=]hfPrk>Rn7Jw0!&>Rn5>Rn9Lunw?&a2!,5<oq@@wqfdRlJj5Q~=d,#Y(~ARfcOuN]fdDKw;ay(}i!547E}j?cI#T(@5bV}iCbV}hdv(^^Tb?a40,b##Tbo!a*bR!a<b|a/!aKai!aU[yK=]o^g:v>ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Sh<eeJw;!&axEzOg,Qosc!#*:wkeJ]eJ>x'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUg<s2Rkod]+UY0TZ'!a&A9sw<=bczLNvuw{gqzNhJwSaxRmCKuLay!#&s_Rf-55b^{uJvZa!!c%#(55Ri654wmiu5RiuawLu,vp!+}^%b_}Y9;wkgxba}o>A9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8u<uJ5RmbjQrquJu3x,k>uq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;<!aJaYai'anasb(=azRmV:Cbb{MLq2vb!%')RjuRjrRjtRjqx3jnqCw3!%')Rk(Rk+Rk&Rk)Lq2vb!%')Rj{RjxRjzRjwLq2vb!%')RjsRjpRjfRjex3jcqCw3!%')Rk'Rk*RjkRjl9<CbbzfOu4ARhxLq2vb!%')RjyRjvRjhRjgx=joq*uKvb!%')+-Rk.Rk%Rj~Rk-Rk#Rj}x=jdq*uKvb!%')+-Rk,Rk!Rj|RjmRjjRjidAq&qKs@uAv8Aa.'*-a@a&0!aM@a5[y73Dsy3Ds|3Dt):wxgI2sHJwJZt.~Gqxwsf0ikrzt}Rl0Jvy_[xj~HqzKv_A|D!&WfP8axRoVcf,U#k(v]v+ueunaXRf1Ju}'!g8u#Ri=jQw!sCunLprq>!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{N<capoq2r[a&!aPa9,'Pw;5s:@@=I|,55w_h|@@=IzcP~=x'fCqB_2Wl2>aU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#<bI}l5@B932:aV2G{BOuNBJq:|M!5Ezt=<B=C@a^<B57@2F{v>cB{/T#=ay<bI{3Jv6!a.6BKq0ah&+!5E}HP~Ef{978BaU@@=Iza<7d#.Y#978BaU@@=IzH~AJq0!(@@=IzG978BaU@@=IzFe,aU*Y&^^^bvJb,b:bFad!a,c2Ta>aL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[g<v~Rm!==G|>JvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+<E|&2@H|%dE#(^,g;u.RiEg6vjRiC9xCkA{O|zY#g=ucRmXKs0@!&*@G|m@awRknJuh!,3d(}gY}eJvj!%Rm):Jw3!%Rm+Rm-Ls0w(&!a(a#@b[|6cZ#X'7RkxWgAOu4ARn'dH'U#Y*Vz-Wm'CARm}d]*#a%^a*T'aK!a<9bV{PC=p*Jw4!&SgxcbB5r]idw(wBRmF7xFkt#&`(Rm/Rm8E|!JuY_9:Rl5=wrgr2:bbxd@xXfB(a*#T+!.X0X1Ta/a'T&RlDRfL>RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`a<XaKYa1,a'P~=wxfB2bZ}}?C972@@=I}r8@55B9;5bb}G978B2@@=aybb}3j3vLv;<Jw3&!>Rfk=ayb^}4~Ad1#`*@@=aybb{w2@>==<bbz]dx+UY#^UaF!a9!bB'Ya1.!ajXa#%olRhD[y=3Dt#Ov5BrHKuMB%!(Rf^Wep~HrJwkiQjKr|~FRg)Ku+D#'!t5~GrF~?rDdV)UY,Z/_7RkuG{<~BrBg,rlsO:235B@bX}|d?a1!#`(6Vyn5@d##Y+jTv|vV~EfIj]uNpn~FRfH7Lq2vb1!a9-978BaU@@=Iz9978BbU}#~AJq0!(@@=Iz8978BaU@@=Iz7~AJQ|}!978BbU}!JvkaK!AdUa21-U#`a+(g/vsRn~Ou!5RPj:rmu9WhOjXuvvNr}:RhAj^v(pyw8unRn[kPr}p|u7vwv]RiSBd;pppzq@qHQa?(b.!a.a`@.|xa(hFv;Wiyj5uuv-7Riw~Cw`fg2WlU978BbU|wOuNBJqG!(P~EfD~CRlQcZ#X,k)u3vWs@u2]ksg;wEx'f@q1_2Wg.j]uNpn~FRfqJv]!15x'h{qG!(@@=IzK~CRl^j6v(us5x4i,#T(2WmY?C2F{1>Kq<aj1!*jTqIsBv=Wld~Cw`fj2Wl[j`v0u*~>RlT=c>Z,k#u3vWs@u2]kq<c1Z+jTqIsBv=Wle~Cw`fn2Wl]dn1#c(a(b^a2!b/bAT(bj!aDa7bu,a_a{c0!2T0g:v>ReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJ<!+'@Wg(g?QRlC@Jv`!%b[zIwsfII}8JQ_@w|kW|=Jv(%!AqcOuNBJvEzh!bYzjLs@wP#(0!oy@>RkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}w<zizixNgwa#Z'U+!/!a'!a+w~g~z6wcn{Rn}wcnzRn|5Rh%=]nJg5vuRmvNvdRlvcprJu}w*az*a#!%.a.'Bot9qT]kj@Wg'ay2Gzv@Jv`!%b[zEwsfHI}1;ck#Ux`<Cbbx_Lu+w!a&0*!wko*wwo,So,}6Juqxf!E}PigQuyRm`d3(`#8>Rn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=<riifuaw&RmoKrNA!%(Ro4>Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']o<CauRoRAd-#Y':RkpauRoQKu]C.!&;RoFJvB!%RoNRoPBx'h]v+_?w~ha}t5?w~he}ue!/UbhYacXaW^Tc&a;b:a-c/#b&aja1(!cL+!bKbt!bmcRc9aIc?8[yW3Dtt94Rg`Jv}!&SiRMzBhEebShEMNuPRe>x7gL#TzuwjirRipc<Z&>on;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJ<!+'@Wg%g/QRl@@Jv`!&awRl<wsfFIzgLu(w*!.*&ShBMwvhIRhI9;RhNx1hK'!#Sn]Mx1hK~0!#:2<H~7cNu+w7D*'1ZtW>Rn1~?rOc:Z&Rn2=<rQ<7wjh&=BSnLMc]#X(6Vz)w[b=a!U#9wzgMc3#&(RgMRitRis<x,gKt`ax!&+SioM=BSilMc3#&(RgKRinRimKurB,!&SiQMzBhDebShDM6BJQ!(P~Efx978B2@@=I}WLrJw!!,a*&@G}O@9wkibRid@@x'fKwC!&SlDMSfLMjUv~Q~EfKKv3@a+!(hFv-]mpx/hYZ(C5RiWz<o/MwkhY?So/M@x,gbvfB*&!SgEM:SoeeehFu3:Rgbda(,^TZa)X/7Sg[eb:2RgI~BrMC@wgkc:wwkcRerx3h(uUvK!&*,SnOM4Sh*MArRg;wHRh(x=h;rJvPwI!a4',a'0@Wg&=BSh/Mg>w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^<Rm^Jvv_@Wl(g;u1Si/ebKu'B&!*Sh?eb@Wl'z@aPeb95Si.ebcpputyvjB)!,&a+0a%ShAMWeK@G}C@WfJ9;RhMwvhH9w{ia}ix,hJvRA1(!zAn[MRhHx1hJ~*!#hFv(BSn[MBJQ!(@@=I~'978B2@@=I}2db.Ua<'X}+T#a0XaG2G}E;wkg|wuh!Rh!x,hZu,@)!&So0MVy)C5RiXACJvB!&5RiY5RiZg8w)cG}*T#2@bU}=KsA>(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUg<v~Rl~==G|<Jv+'!aYShC}6@B<5?ba~8@Jw3'!g2QRljhLrpWlOd+#Y'g.w'rIg>w*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2<H{mx3n[t{vl!,&a%3Ro(z=iS}6ARnr=Bwsn^wvn`Rnbd`*T}B0!#^X'BG{c9b]{a>>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}<j3vLv;<Jw3&!>Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==<bbzl?C972@@=Ix^d6rSu,v7w*C(0a)a6#B+a%!sQ[y?3Dt%3[xn~<5rLOu!5p@Ku+D#'!t7~GrP~?rNKvlaya7'!h+v-5qMg=t|cd,U#5AAaa5Abb{S@52B5@a[@52B5Gx[iXueu;d<#`a(!/549C;ag>23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!b<bwA!#5@B932:aV2G|:d-)Y#hJrL>RhG<7@C5<H|_=Cau:5aj5@B932:bJ|ng>vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5<H|Eg>unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2<BaY?C2F|GOu!5x,g|p{ah!-(?C2F|c9:4E|OjXuvvNr}:Rh&i[w*t|cd+U#jJvsu)vsSn~Mkfrmu9p}u7vwv]So!McW#Xa!ax5@A5aY:5;5<H|>kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2<BaY?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P",13494,2713,49,25,61),ay=new Uint16Array([512,26465,29036,7,0,2,4,116,24638,116,24636,8693,29807,24610,621,1,0,0,3,112,24614,111,115,24615]),oy;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`,e[e.VALUE_MASK=8191]=`VALUE_MASK`})(oy||={});var sy;(function(e){e[e.AMP=38]=`AMP`,e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_X=120]=`LOWER_X`})(sy||={});var cy=32;function ly(e){return e-sy.ZERO>>>0<=9}function uy(e){return(e|cy)-sy.LOWER_A>>>0<=5}function dy(e){return(e|cy)-sy.LOWER_A>>>0<=25}function fy(e){return e===sy.EQUALS||dy(e)||ly(e)}var py;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(py||={});var my;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(my||={});var hy=class{decodeTree;emitCodePoint;errors;state=py.EntityStart;consumed=1;result=0;treeIndex=0;excess=1;decodeMode=my.Strict;runConsumed=0;constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n}startEntity(e){this.decodeMode=e,this.state=py.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(e,t){switch(this.state){case py.EntityStart:return e.charCodeAt(t)===sy.NUM?(this.state=py.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=py.NamedEntity,this.stateNamedEntity(e,t));case py.NumericStart:return this.stateNumericStart(e,t);case py.NumericDecimal:return this.stateNumericDecimal(e,t);case py.NumericHex:return this.stateNumericHex(e,t);default:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|cy)===sy.LOWER_X?(this.state=py.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=py.NumericDecimal,this.stateNumericDecimal(e,t))}stateNumericHex(e,t){let n=e.length,{result:r}=this,{consumed:i}=this;for(;t<n;){let n=e.charCodeAt(t);if(ly(n)||uy(n)){let e=n<=sy.NINE?n-sy.ZERO:(n|cy)-sy.LOWER_A+10;r=r*16+e,i+=1,t+=1}else return this.result=r,this.consumed=i,this.emitNumericEntity(n,3)}return this.result=r,this.consumed=i,-1}stateNumericDecimal(e,t){let n=e.length,{result:r}=this,{consumed:i}=this;for(;t<n;){let n=e.charCodeAt(t)-sy.ZERO;if(n>>>0>9)return this.result=r,this.consumed=i,this.emitNumericEntity(n+sy.ZERO,2);r=r*10+n,i+=1,t+=1}return this.result=r,this.consumed=i,-1}emitNumericEntity(e,t){if(this.consumed<=t)return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===sy.SEMI)this.consumed+=1;else if(this.decodeMode===my.Strict)return 0;return this.emitCodePoint((this.decodeTree===ay?ty:ey)(this.result),this.consumed),this.errors&&(e!==sy.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}flushAndEmitLegacyOrReject(e,t,n,r){return this.consumed=e,this.excess=t,this.result===0||this.decodeMode===my.Attribute&&(r===0||t>1||fy(n))?0:this.emitNotTerminatedNamedEntity()}stateNamedEntity(e,t){let{decodeTree:n}=this,r=e.length,i=this.decodeMode===my.Strict,{treeIndex:a}=this,{excess:o}=this,{consumed:s}=this,c=n[a];for(;t<r;){for(;(c&(oy.VALUE_LENGTH|oy.FLAG13))===0&&(c&oy.JUMP_TABLE)!==0;){let i=e.charCodeAt(t),l=c&oy.JUMP_TABLE,u=(c&oy.BRANCH_LENGTH)>>7;if(u===0){if(i!==l)return this.flushAndEmitLegacyOrReject(s,o,i,0);a+=1}else{let e=i-l;if(e>>>0>=u)return this.flushAndEmitLegacyOrReject(s,o,i,0);let t=n[a+1+e];if(t===0)return this.flushAndEmitLegacyOrReject(s,o,i,0);a=a+u+t&65535}if(c=n[a],t+=1,o+=1,t>=r)break}if(t>=r)break;if((c&(oy.VALUE_LENGTH|oy.FLAG13))===oy.FLAG13){let i=(c&oy.BRANCH_LENGTH)>>7,{runConsumed:l}=this;if(l===0){let n=e.charCodeAt(t);if(n!==(c&oy.JUMP_TABLE))return this.flushAndEmitLegacyOrReject(s,o,n,0);t+=1,o+=1,l=1}for(;l<i;){if(t>=r)return this.treeIndex=a,this.excess=o,this.consumed=s,this.runConsumed=l,-1;let i=l-1,c=n[a+1+(i>>1)]>>((i&1)<<3)&255,u=e.charCodeAt(t);if(u!==c)return this.runConsumed=0,this.flushAndEmitLegacyOrReject(s,o,u,0);t+=1,o+=1,l+=1}this.runConsumed=0,a+=1+(i>>1),c=n[a];continue}let l=c>>>14,u=e.charCodeAt(t);if(l!==0){if(!i&&(c&oy.FLAG13)===0&&(this.result=a,s+=o-1,o=1),u===sy.SEMI)return this.emitNamedEntityData(a,l,s+o);if(l===1)return this.flushAndEmitLegacyOrReject(s,o,u,l)}let d=gy(n,c,a+(l||1),u);if(d<0)return this.flushAndEmitLegacyOrReject(s,o,u,l);a=d,c=n[a],t+=1,o+=1}return!i&&c>>>14&&(c&oy.FLAG13)===0&&(this.result=a,s+=o-1,o=1),this.treeIndex=a,this.excess=o,this.consumed=s,-1}emitNotTerminatedNamedEntity(){let{result:e,decodeTree:t}=this,n=t[e]>>>14;return this.emitNamedEntityData(e,n,this.consumed),this.errors?.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&oy.VALUE_MASK:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){switch(this.state){case py.NamedEntity:return this.result!==0&&(this.decodeMode!==my.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case py.NumericDecimal:return this.emitNumericEntity(0,2);case py.NumericHex:return this.emitNumericEntity(0,3);case py.NumericStart:return this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed),0;default:return 0}}};function gy(e,t,n,r){let i=(t&oy.BRANCH_LENGTH)>>7,a=t&oy.JUMP_TABLE;if(a){if(i===0)return r===a?n:-1;let t=r-a;if(t>>>0>=i)return-1;let o=e[n+t];return o===0?-1:n+i+o-1&65535}if(i===0)return-1;let o=i+1>>1,s=n+o+i;for(let t=0;t<i;t++){let i=e[n+(t>>1)]>>((t&1)<<3)&255;if(i===r)return s+e[n+o+t]&65535;if(i>r)return-1}return-1}var K;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(K||={});var _y;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(_y||={});var vy;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(vy||={});var q;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(q||={});var J;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(J||={});var yy=new Map([[q.A,J.A],[q.ADDRESS,J.ADDRESS],[q.ANNOTATION_XML,J.ANNOTATION_XML],[q.APPLET,J.APPLET],[q.AREA,J.AREA],[q.ARTICLE,J.ARTICLE],[q.ASIDE,J.ASIDE],[q.B,J.B],[q.BASE,J.BASE],[q.BASEFONT,J.BASEFONT],[q.BGSOUND,J.BGSOUND],[q.BIG,J.BIG],[q.BLOCKQUOTE,J.BLOCKQUOTE],[q.BODY,J.BODY],[q.BR,J.BR],[q.BUTTON,J.BUTTON],[q.CAPTION,J.CAPTION],[q.CENTER,J.CENTER],[q.CODE,J.CODE],[q.COL,J.COL],[q.COLGROUP,J.COLGROUP],[q.DD,J.DD],[q.DESC,J.DESC],[q.DETAILS,J.DETAILS],[q.DIALOG,J.DIALOG],[q.DIR,J.DIR],[q.DIV,J.DIV],[q.DL,J.DL],[q.DT,J.DT],[q.EM,J.EM],[q.EMBED,J.EMBED],[q.FIELDSET,J.FIELDSET],[q.FIGCAPTION,J.FIGCAPTION],[q.FIGURE,J.FIGURE],[q.FONT,J.FONT],[q.FOOTER,J.FOOTER],[q.FOREIGN_OBJECT,J.FOREIGN_OBJECT],[q.FORM,J.FORM],[q.FRAME,J.FRAME],[q.FRAMESET,J.FRAMESET],[q.H1,J.H1],[q.H2,J.H2],[q.H3,J.H3],[q.H4,J.H4],[q.H5,J.H5],[q.H6,J.H6],[q.HEAD,J.HEAD],[q.HEADER,J.HEADER],[q.HGROUP,J.HGROUP],[q.HR,J.HR],[q.HTML,J.HTML],[q.I,J.I],[q.IMG,J.IMG],[q.IMAGE,J.IMAGE],[q.INPUT,J.INPUT],[q.IFRAME,J.IFRAME],[q.KEYGEN,J.KEYGEN],[q.LABEL,J.LABEL],[q.LI,J.LI],[q.LINK,J.LINK],[q.LISTING,J.LISTING],[q.MAIN,J.MAIN],[q.MALIGNMARK,J.MALIGNMARK],[q.MARQUEE,J.MARQUEE],[q.MATH,J.MATH],[q.MENU,J.MENU],[q.META,J.META],[q.MGLYPH,J.MGLYPH],[q.MI,J.MI],[q.MO,J.MO],[q.MN,J.MN],[q.MS,J.MS],[q.MTEXT,J.MTEXT],[q.NAV,J.NAV],[q.NOBR,J.NOBR],[q.NOFRAMES,J.NOFRAMES],[q.NOEMBED,J.NOEMBED],[q.NOSCRIPT,J.NOSCRIPT],[q.OBJECT,J.OBJECT],[q.OL,J.OL],[q.OPTGROUP,J.OPTGROUP],[q.OPTION,J.OPTION],[q.P,J.P],[q.PARAM,J.PARAM],[q.PLAINTEXT,J.PLAINTEXT],[q.PRE,J.PRE],[q.RB,J.RB],[q.RP,J.RP],[q.RT,J.RT],[q.RTC,J.RTC],[q.RUBY,J.RUBY],[q.S,J.S],[q.SCRIPT,J.SCRIPT],[q.SEARCH,J.SEARCH],[q.SECTION,J.SECTION],[q.SELECT,J.SELECT],[q.SOURCE,J.SOURCE],[q.SMALL,J.SMALL],[q.SPAN,J.SPAN],[q.STRIKE,J.STRIKE],[q.STRONG,J.STRONG],[q.STYLE,J.STYLE],[q.SUB,J.SUB],[q.SUMMARY,J.SUMMARY],[q.SUP,J.SUP],[q.TABLE,J.TABLE],[q.TBODY,J.TBODY],[q.TEMPLATE,J.TEMPLATE],[q.TEXTAREA,J.TEXTAREA],[q.TFOOT,J.TFOOT],[q.TD,J.TD],[q.TH,J.TH],[q.THEAD,J.THEAD],[q.TITLE,J.TITLE],[q.TR,J.TR],[q.TRACK,J.TRACK],[q.TT,J.TT],[q.U,J.U],[q.UL,J.UL],[q.SVG,J.SVG],[q.VAR,J.VAR],[q.WBR,J.WBR],[q.XMP,J.XMP]]);function by(e){return yy.get(e)??J.UNKNOWN}var Y=J,xy={[K.HTML]:new Set([Y.ADDRESS,Y.APPLET,Y.AREA,Y.ARTICLE,Y.ASIDE,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.BUTTON,Y.CAPTION,Y.CENTER,Y.COL,Y.COLGROUP,Y.DD,Y.DETAILS,Y.DIR,Y.DIV,Y.DL,Y.DT,Y.EMBED,Y.FIELDSET,Y.FIGCAPTION,Y.FIGURE,Y.FOOTER,Y.FORM,Y.FRAME,Y.FRAMESET,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HEADER,Y.HGROUP,Y.HR,Y.HTML,Y.IFRAME,Y.IMG,Y.INPUT,Y.LI,Y.LINK,Y.LISTING,Y.MAIN,Y.MARQUEE,Y.MENU,Y.META,Y.NAV,Y.NOEMBED,Y.NOFRAMES,Y.NOSCRIPT,Y.OBJECT,Y.OL,Y.P,Y.PARAM,Y.PLAINTEXT,Y.PRE,Y.SCRIPT,Y.SECTION,Y.SELECT,Y.SOURCE,Y.STYLE,Y.SUMMARY,Y.TABLE,Y.TBODY,Y.TD,Y.TEMPLATE,Y.TEXTAREA,Y.TFOOT,Y.TH,Y.THEAD,Y.TITLE,Y.TR,Y.TRACK,Y.UL,Y.WBR,Y.XMP]),[K.MATHML]:new Set([Y.MI,Y.MO,Y.MN,Y.MS,Y.MTEXT,Y.ANNOTATION_XML]),[K.SVG]:new Set([Y.TITLE,Y.FOREIGN_OBJECT,Y.DESC]),[K.XLINK]:new Set,[K.XML]:new Set,[K.XMLNS]:new Set},Sy=new Set([Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6]);q.STYLE,q.SCRIPT,q.XMP,q.IFRAME,q.NOEMBED,q.NOFRAMES,q.PLAINTEXT;var X;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(X||={});var Cy={DATA:X.DATA,RCDATA:X.RCDATA,RAWTEXT:X.RAWTEXT,SCRIPT_DATA:X.SCRIPT_DATA,PLAINTEXT:X.PLAINTEXT,CDATA_SECTION:X.CDATA_SECTION};function wy(e){return e>=W.DIGIT_0&&e<=W.DIGIT_9}function Ty(e){return e>=W.LATIN_CAPITAL_A&&e<=W.LATIN_CAPITAL_Z}function Ey(e){return e>=W.LATIN_SMALL_A&&e<=W.LATIN_SMALL_Z}function Dy(e){return Ey(e)||Ty(e)}function Oy(e){return Dy(e)||wy(e)}function ky(e){return e+32}function Ay(e){return e===W.SPACE||e===W.LINE_FEED||e===W.TABULATION||e===W.FORM_FEED}function jy(e){return Ay(e)||e===W.SOLIDUS||e===W.GREATER_THAN_SIGN}function My(e){return e===W.NULL?G.nullCharacterReference:e>1114111?G.characterReferenceOutsideUnicodeRange:Uv(e)?G.surrogateCharacterReference:qv(e)?G.noncharacterCharacterReference:Kv(e)||e===W.CARRIAGE_RETURN?G.controlCharacterReference:null}var Ny=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=X.DATA,this.returnState=X.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new Yv(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new hy(iy,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(G.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(G.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=My(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Xv.START_TAG,tagName:``,tagID:J.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Xv.END_TAG,tagName:``,tagID:J.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:Xv.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:Xv.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(Zv(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(G.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=by(e.tagName),e.type===Xv.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(G.endTagWithAttributes),e.selfClosing&&this._err(G.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case Xv.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Xv.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Xv.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:Xv.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){let t=Ay(e)?Xv.WHITESPACE_CHARACTER:e===W.NULL?Xv.NULL_CHARACTER:Xv.CHARACTER;this._appendCharToCurrentCharacterToken(t,e<65536?String.fromCharCode(e):String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(Xv.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=X.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?my.Attribute:my.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===X.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case X.DATA:this._stateData(e);break;case X.RCDATA:this._stateRcdata(e);break;case X.RAWTEXT:this._stateRawtext(e);break;case X.SCRIPT_DATA:this._stateScriptData(e);break;case X.PLAINTEXT:this._statePlaintext(e);break;case X.TAG_OPEN:this._stateTagOpen(e);break;case X.END_TAG_OPEN:this._stateEndTagOpen(e);break;case X.TAG_NAME:this._stateTagName(e);break;case X.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case X.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case X.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case X.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case X.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case X.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case X.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case X.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case X.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case X.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case X.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case X.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case X.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case X.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case X.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case X.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case X.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case X.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case X.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case X.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case X.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case X.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case X.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case X.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case X.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case X.BOGUS_COMMENT:this._stateBogusComment(e);break;case X.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case X.COMMENT_START:this._stateCommentStart(e);break;case X.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case X.COMMENT:this._stateComment(e);break;case X.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case X.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case X.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case X.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case X.COMMENT_END:this._stateCommentEnd(e);break;case X.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case X.DOCTYPE:this._stateDoctype(e);break;case X.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case X.DOCTYPE_NAME:this._stateDoctypeName(e);break;case X.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case X.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case X.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case X.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case X.CDATA_SECTION:this._stateCdataSection(e);break;case X.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case X.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case X.CHARACTER_REFERENCE:this._stateCharacterReference();break;case X.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case W.LESS_THAN_SIGN:this.state=X.TAG_OPEN;break;case W.AMPERSAND:this._startCharacterReference();break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitCodePoint(e);break;case W.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case W.AMPERSAND:this._startCharacterReference();break;case W.LESS_THAN_SIGN:this.state=X.RCDATA_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case W.LESS_THAN_SIGN:this.state=X.RAWTEXT_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Dy(e))this._createStartTagToken(),this.state=X.TAG_NAME,this._stateTagName(e);else switch(e){case W.EXCLAMATION_MARK:this.state=X.MARKUP_DECLARATION_OPEN;break;case W.SOLIDUS:this.state=X.END_TAG_OPEN;break;case W.QUESTION_MARK:this._err(G.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=X.BOGUS_COMMENT,this._stateBogusComment(e);break;case W.EOF:this._err(G.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(G.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=X.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Dy(e))this._createEndTagToken(),this.state=X.TAG_NAME,this._stateTagName(e);else switch(e){case W.GREATER_THAN_SIGN:this._err(G.missingEndTagName),this.state=X.DATA;break;case W.EOF:this._err(G.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(G.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=X.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.BEFORE_ATTRIBUTE_NAME;break;case W.SOLIDUS:this.state=X.SELF_CLOSING_START_TAG;break;case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentTagToken();break;case W.NULL:this._err(G.unexpectedNullCharacter),t.tagName+=`�`;break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Ty(e)?ky(e):e)}}_stateRcdataLessThanSign(e){e===W.SOLIDUS?this.state=X.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=X.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Dy(e)?(this.state=X.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=X.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=X.BEFORE_ATTRIBUTE_NAME,!1;case W.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=X.SELF_CLOSING_START_TAG,!1;case W.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=X.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=X.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===W.SOLIDUS?this.state=X.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=X.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Dy(e)?(this.state=X.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=X.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=X.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case W.SOLIDUS:this.state=X.SCRIPT_DATA_END_TAG_OPEN;break;case W.EXCLAMATION_MARK:this.state=X.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=X.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Dy(e)?(this.state=X.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=X.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=X.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===W.HYPHEN_MINUS?(this.state=X.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=X.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===W.HYPHEN_MINUS?(this.state=X.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=X.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case W.HYPHEN_MINUS:this.state=X.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case W.HYPHEN_MINUS:this.state=X.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case W.HYPHEN_MINUS:this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case W.GREATER_THAN_SIGN:this.state=X.SCRIPT_DATA,this._emitChars(`>`);break;case W.NULL:this._err(G.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===W.SOLIDUS?this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Dy(e)?(this._emitChars(`<`),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Dy(e)?(this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(Hv.SCRIPT,!1)&&jy(this.preprocessor.peek(Hv.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<Hv.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case W.HYPHEN_MINUS:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case W.NULL:this._err(G.unexpectedNullCharacter),this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case W.HYPHEN_MINUS:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case W.NULL:this._err(G.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case W.HYPHEN_MINUS:this._emitChars(`-`);break;case W.LESS_THAN_SIGN:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case W.GREATER_THAN_SIGN:this.state=X.SCRIPT_DATA,this._emitChars(`>`);break;case W.NULL:this._err(G.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case W.EOF:this._err(G.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===W.SOLIDUS?(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(Hv.SCRIPT,!1)&&jy(this.preprocessor.peek(Hv.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<Hv.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=X.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.SOLIDUS:case W.GREATER_THAN_SIGN:case W.EOF:this.state=X.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case W.EQUALS_SIGN:this._err(G.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=X.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=X.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:case W.SOLIDUS:case W.GREATER_THAN_SIGN:case W.EOF:this._leaveAttrName(),this.state=X.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case W.EQUALS_SIGN:this._leaveAttrName(),this.state=X.BEFORE_ATTRIBUTE_VALUE;break;case W.QUOTATION_MARK:case W.APOSTROPHE:case W.LESS_THAN_SIGN:this._err(G.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case W.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Ty(e)?ky(e):e)}}_stateAfterAttributeName(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.SOLIDUS:this.state=X.SELF_CLOSING_START_TAG;break;case W.EQUALS_SIGN:this.state=X.BEFORE_ATTRIBUTE_VALUE;break;case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentTagToken();break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=X.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.QUOTATION_MARK:this.state=X.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case W.APOSTROPHE:this.state=X.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case W.GREATER_THAN_SIGN:this._err(G.missingAttributeValue),this.state=X.DATA,this.emitCurrentTagToken();break;default:this.state=X.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case W.QUOTATION_MARK:this.state=X.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case W.AMPERSAND:this._startCharacterReference();break;case W.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case W.APOSTROPHE:this.state=X.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case W.AMPERSAND:this._startCharacterReference();break;case W.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this._leaveAttrValue(),this.state=X.BEFORE_ATTRIBUTE_NAME;break;case W.AMPERSAND:this._startCharacterReference();break;case W.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=X.DATA,this.emitCurrentTagToken();break;case W.NULL:this._err(G.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case W.QUOTATION_MARK:case W.APOSTROPHE:case W.LESS_THAN_SIGN:case W.EQUALS_SIGN:case W.GRAVE_ACCENT:this._err(G.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this._leaveAttrValue(),this.state=X.BEFORE_ATTRIBUTE_NAME;break;case W.SOLIDUS:this._leaveAttrValue(),this.state=X.SELF_CLOSING_START_TAG;break;case W.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=X.DATA,this.emitCurrentTagToken();break;case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._err(G.missingWhitespaceBetweenAttributes),this.state=X.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case W.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=X.DATA,this.emitCurrentTagToken();break}case W.EOF:this._err(G.eofInTag),this._emitEOFToken();break;default:this._err(G.unexpectedSolidusInTag),this.state=X.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentComment(t);break;case W.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case W.NULL:this._err(G.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(Hv.DASH_DASH,!0)?(this._createCommentToken(Hv.DASH_DASH.length+1),this.state=X.COMMENT_START):this._consumeSequenceIfMatch(Hv.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Hv.DOCTYPE.length+1),this.state=X.DOCTYPE):this._consumeSequenceIfMatch(Hv.CDATA_START,!0)?this.inForeignNode?this.state=X.CDATA_SECTION:(this._err(G.cdataInHtmlContent),this._createCommentToken(Hv.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=X.BOGUS_COMMENT):this._ensureHibernation()||(this._err(G.incorrectlyOpenedComment),this._createCommentToken(2),this.state=X.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case W.HYPHEN_MINUS:this.state=X.COMMENT_START_DASH;break;case W.GREATER_THAN_SIGN:{this._err(G.abruptClosingOfEmptyComment),this.state=X.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=X.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case W.HYPHEN_MINUS:this.state=X.COMMENT_END;break;case W.GREATER_THAN_SIGN:this._err(G.abruptClosingOfEmptyComment),this.state=X.DATA,this.emitCurrentComment(t);break;case W.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=X.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case W.HYPHEN_MINUS:this.state=X.COMMENT_END_DASH;break;case W.LESS_THAN_SIGN:t.data+=`<`,this.state=X.COMMENT_LESS_THAN_SIGN;break;case W.NULL:this._err(G.unexpectedNullCharacter),t.data+=`�`;break;case W.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case W.EXCLAMATION_MARK:t.data+=`!`,this.state=X.COMMENT_LESS_THAN_SIGN_BANG;break;case W.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=X.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===W.HYPHEN_MINUS?this.state=X.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=X.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===W.HYPHEN_MINUS?this.state=X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=X.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==W.GREATER_THAN_SIGN&&e!==W.EOF&&this._err(G.nestedComment),this.state=X.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case W.HYPHEN_MINUS:this.state=X.COMMENT_END;break;case W.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=X.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentComment(t);break;case W.EXCLAMATION_MARK:this.state=X.COMMENT_END_BANG;break;case W.HYPHEN_MINUS:t.data+=`-`;break;case W.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=X.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case W.HYPHEN_MINUS:t.data+=`--!`,this.state=X.COMMENT_END_DASH;break;case W.GREATER_THAN_SIGN:this._err(G.incorrectlyClosedComment),this.state=X.DATA,this.emitCurrentComment(t);break;case W.EOF:this._err(G.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=X.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.BEFORE_DOCTYPE_NAME;break;case W.GREATER_THAN_SIGN:this.state=X.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case W.EOF:{this._err(G.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(G.missingWhitespaceBeforeDoctypeName),this.state=X.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Ty(e))this._createDoctypeToken(String.fromCharCode(ky(e))),this.state=X.DOCTYPE_NAME;else switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.NULL:this._err(G.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=X.DOCTYPE_NAME;break;case W.GREATER_THAN_SIGN:{this._err(G.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=X.DATA;break}case W.EOF:{this._err(G.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=X.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.AFTER_DOCTYPE_NAME;break;case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.NULL:this._err(G.unexpectedNullCharacter),t.name+=`�`;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Ty(e)?ky(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(Hv.PUBLIC,!1)?this.state=X.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Hv.SYSTEM,!1)?this.state=X.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(G.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case W.QUOTATION_MARK:this._err(G.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:this._err(G.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case W.GREATER_THAN_SIGN:this._err(G.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.QUOTATION_MARK:t.publicId=``,this.state=X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:t.publicId=``,this.state=X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case W.GREATER_THAN_SIGN:this._err(G.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case W.QUOTATION_MARK:this.state=X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case W.NULL:this._err(G.unexpectedNullCharacter),t.publicId+=`�`;break;case W.GREATER_THAN_SIGN:this._err(G.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case W.APOSTROPHE:this.state=X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case W.NULL:this._err(G.unexpectedNullCharacter),t.publicId+=`�`;break;case W.GREATER_THAN_SIGN:this._err(G.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case W.GREATER_THAN_SIGN:this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.QUOTATION_MARK:this._err(G.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:this._err(G.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.QUOTATION_MARK:t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:this.state=X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case W.QUOTATION_MARK:this._err(G.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:this._err(G.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case W.GREATER_THAN_SIGN:this._err(G.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.QUOTATION_MARK:t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case W.APOSTROPHE:t.systemId=``,this.state=X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case W.GREATER_THAN_SIGN:this._err(G.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.DATA,this.emitCurrentDoctype(t);break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case W.QUOTATION_MARK:this.state=X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case W.NULL:this._err(G.unexpectedNullCharacter),t.systemId+=`�`;break;case W.GREATER_THAN_SIGN:this._err(G.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case W.APOSTROPHE:this.state=X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case W.NULL:this._err(G.unexpectedNullCharacter),t.systemId+=`�`;break;case W.GREATER_THAN_SIGN:this._err(G.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case W.SPACE:case W.LINE_FEED:case W.TABULATION:case W.FORM_FEED:break;case W.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.EOF:this._err(G.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(G.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=X.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case W.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=X.DATA;break;case W.NULL:this._err(G.unexpectedNullCharacter);break;case W.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case W.RIGHT_SQUARE_BRACKET:this.state=X.CDATA_SECTION_BRACKET;break;case W.EOF:this._err(G.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===W.RIGHT_SQUARE_BRACKET?this.state=X.CDATA_SECTION_END:(this._emitChars(`]`),this.state=X.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case W.GREATER_THAN_SIGN:this.state=X.DATA;break;case W.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=X.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(W.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Oy(this.preprocessor.peek(1))?X.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Oy(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===W.SEMICOLON&&this._err(G.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},Py=new Set([J.DD,J.DT,J.LI,J.OPTGROUP,J.OPTION,J.P,J.RB,J.RP,J.RT,J.RTC]),Fy=new Set([...Py,J.CAPTION,J.COLGROUP,J.TBODY,J.TD,J.TFOOT,J.TH,J.THEAD,J.TR]),Iy=new Set([J.APPLET,J.CAPTION,J.HTML,J.MARQUEE,J.OBJECT,J.TABLE,J.TD,J.TEMPLATE,J.TH]),Ly=new Set([...Iy,J.OL,J.UL]),Ry=new Set([...Iy,J.BUTTON]),zy=new Set([J.ANNOTATION_XML,J.MI,J.MN,J.MO,J.MS,J.MTEXT]),By=new Set([J.DESC,J.FOREIGN_OBJECT,J.TITLE]),Vy=new Set([J.TR,J.TEMPLATE,J.HTML]),Hy=new Set([J.TBODY,J.TFOOT,J.THEAD,J.TEMPLATE,J.HTML]),Uy=new Set([J.TABLE,J.TEMPLATE,J.HTML]),Wy=new Set([J.TD,J.TH]),Gy=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=J.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===J.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===K.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==K.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Sy,K.HTML)}popUntilTableCellPopped(){this.popUntilPopped(Wy,K.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(Uy,K.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Hy,K.HTML)}clearBackToTableRowContext(){this.clearBackTo(Vy,K.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===J.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===J.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case K.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case K.SVG:if(By.has(r))return!1;break;case K.MATHML:if(zy.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Iy)}hasInListItemScope(e){return this.hasInDynamicScope(e,Ly)}hasInButtonScope(e){return this.hasInDynamicScope(e,Ry)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case K.HTML:if(Sy.has(t))return!0;if(Iy.has(t))return!1;break;case K.SVG:if(By.has(t))return!1;break;case K.MATHML:if(zy.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===K.HTML)switch(this.tagIDs[t]){case e:return!0;case J.TABLE:case J.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===K.HTML)switch(this.tagIDs[e]){case J.TBODY:case J.THEAD:case J.TFOOT:return!0;case J.TABLE:case J.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===K.HTML)switch(this.tagIDs[t]){case e:return!0;case J.OPTION:case J.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Py.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Fy.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&Fy.has(this.currentTagId);)this.pop()}},Ky=3,qy;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(qy||={});var Jy={type:qy.Marker},Yy=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===qy.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<Ky)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<Ky)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=Ky&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(Jy)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:qy.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:qy.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(Jy);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===qy.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===qy.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===qy.Element&&t.element===e)}},Xy={createDocument(){return{nodeName:`#document`,mode:vy.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};Xy.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Xy.isTextNode(n)){n.value+=t;return}}Xy.appendChild(e,Xy.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Xy.isTextNode(r)?r.value+=t:Xy.insertBefore(e,Xy.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Zy=`html`,Qy=`about:legacy-compat`,$y=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,eb=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),tb=[...eb,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],nb=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),rb=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],ib=[...rb,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function ab(e,t){return t.some(t=>e.startsWith(t))}function ob(e){return e.name===Zy&&e.publicId===null&&(e.systemId===null||e.systemId===Qy)}function sb(e){if(e.name!==Zy)return vy.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===$y)return vy.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),nb.has(n))return vy.QUIRKS;let e=t===null?tb:eb;if(ab(n,e))return vy.QUIRKS;if(e=t===null?rb:ib,ab(n,e))return vy.LIMITED_QUIRKS}return vy.NO_QUIRKS}var cb={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},lb=`definitionurl`,ub=`definitionURL`,db=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),fb=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:K.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:K.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:K.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:K.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:K.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:K.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:K.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:K.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:K.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:K.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:K.XMLNS}]]),pb=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),mb=new Set([J.B,J.BIG,J.BLOCKQUOTE,J.BODY,J.BR,J.CENTER,J.CODE,J.DD,J.DIV,J.DL,J.DT,J.EM,J.EMBED,J.H1,J.H2,J.H3,J.H4,J.H5,J.H6,J.HEAD,J.HR,J.I,J.IMG,J.LI,J.LISTING,J.MENU,J.META,J.NOBR,J.OL,J.P,J.PRE,J.RUBY,J.S,J.SMALL,J.SPAN,J.STRONG,J.STRIKE,J.SUB,J.SUP,J.TABLE,J.TT,J.U,J.UL,J.VAR]);function hb(e){let t=e.tagID;return t===J.FONT&&e.attrs.some(({name:e})=>e===_y.COLOR||e===_y.SIZE||e===_y.FACE)||mb.has(t)}function gb(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===lb){e.attrs[t].name=ub;break}}function _b(e){for(let t=0;t<e.attrs.length;t++){let n=db.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function vb(e){for(let t=0;t<e.attrs.length;t++){let n=fb.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function yb(e){let t=pb.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=by(e.tagName))}function bb(e,t){return t===K.MATHML&&(e===J.MI||e===J.MO||e===J.MN||e===J.MS||e===J.MTEXT)}function xb(e,t,n){if(t===K.MATHML&&e===J.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===_y.ENCODING){let t=n[e].value.toLowerCase();return t===cb.TEXT_HTML||t===cb.APPLICATION_XML}}return t===K.SVG&&(e===J.FOREIGN_OBJECT||e===J.DESC||e===J.TITLE)}function Sb(e,t,n,r){return(!r||r===K.HTML)&&xb(e,t,n)||(!r||r===K.MATHML)&&bb(e,t)}var Cb=`hidden`,wb=8,Tb=3,Z;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Z||={});var Eb={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Db=new Set([J.TABLE,J.TBODY,J.TFOOT,J.THEAD,J.TR]),Ob={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Xy,onParseError:null},kb=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Z.INITIAL,this.originalInsertionMode=Z.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Ob,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Ny(this.options,this),this.activeFormattingElements=new Yy(this.treeAdapter),this.fragmentContextID=n?by(this.treeAdapter.getTagName(n)):J.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new Gy(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...Ob,...t};e??=n.treeAdapter.createElement(q.TEMPLATE,K.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,K.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===J.TEMPLATE&&i.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??Eb,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===K.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,K.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Z.TEXT}switchToPlaintextParsing(){this.insertionMode=Z.TEXT,this.originalInsertionMode=Z.IN_BODY,this.tokenizer.state=Cy.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===q.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==K.HTML))switch(this.fragmentContextID){case J.TITLE:case J.TEXTAREA:this.tokenizer.state=Cy.RCDATA;break;case J.STYLE:case J.XMP:case J.IFRAME:case J.NOEMBED:case J.NOFRAMES:case J.NOSCRIPT:this.tokenizer.state=Cy.RAWTEXT;break;case J.SCRIPT:this.tokenizer.state=Cy.SCRIPT_DATA;break;case J.PLAINTEXT:this.tokenizer.state=Cy.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,K.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,K.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(q.HTML,K.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,J.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===Xv.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===J.SVG&&this.treeAdapter.getTagName(t)===q.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===K.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===J.MGLYPH||e.tagID===J.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,K.HTML)}_processToken(e){switch(e.type){case Xv.CHARACTER:this.onCharacter(e);break;case Xv.NULL_CHARACTER:this.onNullCharacter(e);break;case Xv.COMMENT:this.onComment(e);break;case Xv.DOCTYPE:this.onDoctype(e);break;case Xv.START_TAG:this._processStartTag(e);break;case Xv.END_TAG:this.onEndTag(e);break;case Xv.EOF:this.onEof(e);break;case Xv.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return Sb(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===qy.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(J.P),this.openElements.popUntilTagNamePopped(J.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case J.TR:this.insertionMode=Z.IN_ROW;return;case J.TBODY:case J.THEAD:case J.TFOOT:this.insertionMode=Z.IN_TABLE_BODY;return;case J.CAPTION:this.insertionMode=Z.IN_CAPTION;return;case J.COLGROUP:this.insertionMode=Z.IN_COLUMN_GROUP;return;case J.TABLE:this.insertionMode=Z.IN_TABLE;return;case J.BODY:this.insertionMode=Z.IN_BODY;return;case J.FRAMESET:this.insertionMode=Z.IN_FRAMESET;return;case J.SELECT:this._resetInsertionModeForSelect(e);return;case J.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case J.HTML:this.insertionMode=this.headElement?Z.AFTER_HEAD:Z.BEFORE_HEAD;return;case J.TD:case J.TH:if(e>0){this.insertionMode=Z.IN_CELL;return}break;case J.HEAD:if(e>0){this.insertionMode=Z.IN_HEAD;return}}this.insertionMode=Z.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===J.TEMPLATE)break;if(e===J.TABLE){this.insertionMode=Z.IN_SELECT_IN_TABLE;return}}this.insertionMode=Z.IN_SELECT}_isElementCausesFosterParenting(e){return Db.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case J.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===K.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case J.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return xy[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){qS(this,e);return}switch(this.insertionMode){case Z.INITIAL:Hb(this,e);break;case Z.BEFORE_HTML:Gb(this,e);break;case Z.BEFORE_HEAD:Jb(this,e);break;case Z.IN_HEAD:Qb(this,e);break;case Z.IN_HEAD_NO_SCRIPT:tx(this,e);break;case Z.AFTER_HEAD:ix(this,e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:sx(this,e);break;case Z.TEXT:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:nS(this,e);break;case Z.IN_TABLE_TEXT:hS(this,e);break;case Z.IN_COLUMN_GROUP:SS(this,e);break;case Z.AFTER_BODY:RS(this,e);break;case Z.AFTER_AFTER_BODY:WS(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){KS(this,e);return}switch(this.insertionMode){case Z.INITIAL:Hb(this,e);break;case Z.BEFORE_HTML:Gb(this,e);break;case Z.BEFORE_HEAD:Jb(this,e);break;case Z.IN_HEAD:Qb(this,e);break;case Z.IN_HEAD_NO_SCRIPT:tx(this,e);break;case Z.AFTER_HEAD:ix(this,e);break;case Z.TEXT:this._insertCharacters(e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:nS(this,e);break;case Z.IN_COLUMN_GROUP:SS(this,e);break;case Z.AFTER_BODY:RS(this,e);break;case Z.AFTER_AFTER_BODY:WS(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Lb(this,e);return}switch(this.insertionMode){case Z.INITIAL:case Z.BEFORE_HTML:case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_TEMPLATE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:Lb(this,e);break;case Z.IN_TABLE_TEXT:gS(this,e);break;case Z.AFTER_BODY:Rb(this,e);break;case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:zb(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Z.INITIAL:Vb(this,e);break;case Z.BEFORE_HEAD:case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:this._err(e,G.misplacedDoctype);break;case Z.IN_TABLE_TEXT:gS(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,G.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?YS(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Hb(this,e);break;case Z.BEFORE_HTML:Ub(this,e);break;case Z.BEFORE_HEAD:Kb(this,e);break;case Z.IN_HEAD:Yb(this,e);break;case Z.IN_HEAD_NO_SCRIPT:$b(this,e);break;case Z.AFTER_HEAD:nx(this,e);break;case Z.IN_BODY:Bx(this,e);break;case Z.IN_TABLE:dS(this,e);break;case Z.IN_TABLE_TEXT:gS(this,e);break;case Z.IN_CAPTION:vS(this,e);break;case Z.IN_COLUMN_GROUP:bS(this,e);break;case Z.IN_TABLE_BODY:CS(this,e);break;case Z.IN_ROW:TS(this,e);break;case Z.IN_CELL:DS(this,e);break;case Z.IN_SELECT:kS(this,e);break;case Z.IN_SELECT_IN_TABLE:jS(this,e);break;case Z.IN_TEMPLATE:NS(this,e);break;case Z.AFTER_BODY:IS(this,e);break;case Z.IN_FRAMESET:zS(this,e);break;case Z.AFTER_FRAMESET:VS(this,e);break;case Z.AFTER_AFTER_BODY:US(this,e);break;case Z.AFTER_AFTER_FRAMESET:GS(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?XS(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Z.INITIAL:Hb(this,e);break;case Z.BEFORE_HTML:Wb(this,e);break;case Z.BEFORE_HEAD:qb(this,e);break;case Z.IN_HEAD:Xb(this,e);break;case Z.IN_HEAD_NO_SCRIPT:ex(this,e);break;case Z.AFTER_HEAD:rx(this,e);break;case Z.IN_BODY:Qx(this,e);break;case Z.TEXT:eS(this,e);break;case Z.IN_TABLE:fS(this,e);break;case Z.IN_TABLE_TEXT:gS(this,e);break;case Z.IN_CAPTION:yS(this,e);break;case Z.IN_COLUMN_GROUP:xS(this,e);break;case Z.IN_TABLE_BODY:wS(this,e);break;case Z.IN_ROW:ES(this,e);break;case Z.IN_CELL:OS(this,e);break;case Z.IN_SELECT:AS(this,e);break;case Z.IN_SELECT_IN_TABLE:MS(this,e);break;case Z.IN_TEMPLATE:PS(this,e);break;case Z.AFTER_BODY:LS(this,e);break;case Z.IN_FRAMESET:BS(this,e);break;case Z.AFTER_FRAMESET:HS(this,e);break;case Z.AFTER_AFTER_BODY:WS(this,e)}}onEof(e){switch(this.insertionMode){case Z.INITIAL:Hb(this,e);break;case Z.BEFORE_HTML:Gb(this,e);break;case Z.BEFORE_HEAD:Jb(this,e);break;case Z.IN_HEAD:Qb(this,e);break;case Z.IN_HEAD_NO_SCRIPT:tx(this,e);break;case Z.AFTER_HEAD:ix(this,e);break;case Z.IN_BODY:case Z.IN_TABLE:case Z.IN_CAPTION:case Z.IN_COLUMN_GROUP:case Z.IN_TABLE_BODY:case Z.IN_ROW:case Z.IN_CELL:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:$x(this,e);break;case Z.TEXT:tS(this,e);break;case Z.IN_TABLE_TEXT:gS(this,e);break;case Z.IN_TEMPLATE:FS(this,e);break;case Z.AFTER_BODY:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:Bb(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===W.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Z.IN_HEAD:case Z.IN_HEAD_NO_SCRIPT:case Z.AFTER_HEAD:case Z.TEXT:case Z.IN_COLUMN_GROUP:case Z.IN_SELECT:case Z.IN_SELECT_IN_TABLE:case Z.IN_FRAMESET:case Z.AFTER_FRAMESET:this._insertCharacters(e);break;case Z.IN_BODY:case Z.IN_CAPTION:case Z.IN_CELL:case Z.IN_TEMPLATE:case Z.AFTER_BODY:case Z.AFTER_AFTER_BODY:case Z.AFTER_AFTER_FRAMESET:ox(this,e);break;case Z.IN_TABLE:case Z.IN_TABLE_BODY:case Z.IN_ROW:nS(this,e);break;case Z.IN_TABLE_TEXT:mS(this,e)}}};function Ab(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Zx(e,t),n}function jb(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Mb(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Tb;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=Nb(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Nb(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Pb(e,t,n){let r=by(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===J.TEMPLATE&&i===K.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Fb(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function Ib(e,t){for(let n=0;n<wb;n++){let n=Ab(e,t);if(!n)break;let r=jb(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=Mb(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&Pb(e,a,i),Fb(e,r,n)}}function Lb(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Rb(e,t){e._appendCommentNode(t,e.openElements.items[0])}function zb(e,t){e._appendCommentNode(t,e.document)}function Bb(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function Vb(e,t){e._setDocumentType(t);let n=t.forceQuirks?vy.QUIRKS:sb(t);ob(t)||e._err(t,G.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Z.BEFORE_HTML}function Hb(e,t){e._err(t,G.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,vy.QUIRKS),e.insertionMode=Z.BEFORE_HTML,e._processToken(t)}function Ub(e,t){t.tagID===J.HTML?(e._insertElement(t,K.HTML),e.insertionMode=Z.BEFORE_HEAD):Gb(e,t)}function Wb(e,t){let n=t.tagID;(n===J.HTML||n===J.HEAD||n===J.BODY||n===J.BR)&&Gb(e,t)}function Gb(e,t){e._insertFakeRootElement(),e.insertionMode=Z.BEFORE_HEAD,e._processToken(t)}function Kb(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.HEAD:e._insertElement(t,K.HTML),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD;break;default:Jb(e,t)}}function qb(e,t){let n=t.tagID;n===J.HEAD||n===J.BODY||n===J.HTML||n===J.BR?Jb(e,t):e._err(t,G.endTagWithoutMatchingOpenElement)}function Jb(e,t){e._insertFakeElement(q.HEAD,J.HEAD),e.headElement=e.openElements.current,e.insertionMode=Z.IN_HEAD,e._processToken(t)}function Yb(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.BASE:case J.BASEFONT:case J.BGSOUND:case J.LINK:case J.META:e._appendElement(t,K.HTML),t.ackSelfClosing=!0;break;case J.TITLE:e._switchToTextParsing(t,Cy.RCDATA);break;case J.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,Cy.RAWTEXT):(e._insertElement(t,K.HTML),e.insertionMode=Z.IN_HEAD_NO_SCRIPT);break;case J.NOFRAMES:case J.STYLE:e._switchToTextParsing(t,Cy.RAWTEXT);break;case J.SCRIPT:e._switchToTextParsing(t,Cy.SCRIPT_DATA);break;case J.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Z.IN_TEMPLATE);break;case J.HEAD:e._err(t,G.misplacedStartTagForHeadElement);break;default:Qb(e,t)}}function Xb(e,t){switch(t.tagID){case J.HEAD:e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD;break;case J.BODY:case J.BR:case J.HTML:Qb(e,t);break;case J.TEMPLATE:Zb(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function Zb(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==J.TEMPLATE&&e._err(t,G.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(J.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,G.endTagWithoutMatchingOpenElement)}function Qb(e,t){e.openElements.pop(),e.insertionMode=Z.AFTER_HEAD,e._processToken(t)}function $b(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.BASEFONT:case J.BGSOUND:case J.HEAD:case J.LINK:case J.META:case J.NOFRAMES:case J.STYLE:Yb(e,t);break;case J.NOSCRIPT:e._err(t,G.nestedNoscriptInHead);break;default:tx(e,t)}}function ex(e,t){switch(t.tagID){case J.NOSCRIPT:e.openElements.pop(),e.insertionMode=Z.IN_HEAD;break;case J.BR:tx(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function tx(e,t){let n=t.type===Xv.EOF?G.openElementsLeftAfterEof:G.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Z.IN_HEAD,e._processToken(t)}function nx(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.BODY:e._insertElement(t,K.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_BODY;break;case J.FRAMESET:e._insertElement(t,K.HTML),e.insertionMode=Z.IN_FRAMESET;break;case J.BASE:case J.BASEFONT:case J.BGSOUND:case J.LINK:case J.META:case J.NOFRAMES:case J.SCRIPT:case J.STYLE:case J.TEMPLATE:case J.TITLE:e._err(t,G.abandonedHeadElementChild),e.openElements.push(e.headElement,J.HEAD),Yb(e,t),e.openElements.remove(e.headElement);break;case J.HEAD:e._err(t,G.misplacedStartTagForHeadElement);break;default:ix(e,t)}}function rx(e,t){switch(t.tagID){case J.BODY:case J.HTML:case J.BR:ix(e,t);break;case J.TEMPLATE:Zb(e,t);break;default:e._err(t,G.endTagWithoutMatchingOpenElement)}}function ix(e,t){e._insertFakeElement(q.BODY,J.BODY),e.insertionMode=Z.IN_BODY,ax(e,t)}function ax(e,t){switch(t.type){case Xv.CHARACTER:sx(e,t);break;case Xv.WHITESPACE_CHARACTER:ox(e,t);break;case Xv.COMMENT:Lb(e,t);break;case Xv.START_TAG:Bx(e,t);break;case Xv.END_TAG:Qx(e,t);break;case Xv.EOF:$x(e,t)}}function ox(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function sx(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function cx(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function lx(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function ux(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_FRAMESET)}function dx(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML)}function fx(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Sy.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,K.HTML)}function px(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function mx(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML),n||(e.formElement=e.openElements.current))}function hx(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===J.LI&&r===J.LI||(n===J.DD||n===J.DT)&&(r===J.DD||r===J.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==J.ADDRESS&&r!==J.DIV&&r!==J.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML)}function gx(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML),e.tokenizer.state=Cy.PLAINTEXT}function _x(e,t){e.openElements.hasInScope(J.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(J.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML),e.framesetOk=!1}function vx(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(q.A);n&&(Ib(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function yx(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bx(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(J.NOBR)&&(Ib(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,K.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function xx(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Sx(e,t){e.treeAdapter.getDocumentMode(e.document)!==vy.QUIRKS&&e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._insertElement(t,K.HTML),e.framesetOk=!1,e.insertionMode=Z.IN_TABLE}function Cx(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,K.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function wx(e){let t=Zv(e,_y.TYPE);return t!=null&&t.toLowerCase()===Cb}function Tx(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,K.HTML),wx(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Ex(e,t){e._appendElement(t,K.HTML),t.ackSelfClosing=!0}function Dx(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._appendElement(t,K.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Ox(e,t){t.tagName=q.IMG,t.tagID=J.IMG,Cx(e,t)}function kx(e,t){e._insertElement(t,K.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Cy.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Z.TEXT}function Ax(e,t){e.openElements.hasInButtonScope(J.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Cy.RAWTEXT)}function jx(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Cy.RAWTEXT)}function Mx(e,t){e._switchToTextParsing(t,Cy.RAWTEXT)}function Nx(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Z.IN_TABLE||e.insertionMode===Z.IN_CAPTION||e.insertionMode===Z.IN_TABLE_BODY||e.insertionMode===Z.IN_ROW||e.insertionMode===Z.IN_CELL?Z.IN_SELECT_IN_TABLE:Z.IN_SELECT}function Px(e,t){e.openElements.currentTagId===J.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML)}function Fx(e,t){e.openElements.hasInScope(J.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,K.HTML)}function Ix(e,t){e.openElements.hasInScope(J.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(J.RTC),e._insertElement(t,K.HTML)}function Lx(e,t){e._reconstructActiveFormattingElements(),gb(t),vb(t),t.selfClosing?e._appendElement(t,K.MATHML):e._insertElement(t,K.MATHML),t.ackSelfClosing=!0}function Rx(e,t){e._reconstructActiveFormattingElements(),_b(t),vb(t),t.selfClosing?e._appendElement(t,K.SVG):e._insertElement(t,K.SVG),t.ackSelfClosing=!0}function zx(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,K.HTML)}function Bx(e,t){switch(t.tagID){case J.I:case J.S:case J.B:case J.U:case J.EM:case J.TT:case J.BIG:case J.CODE:case J.FONT:case J.SMALL:case J.STRIKE:case J.STRONG:yx(e,t);break;case J.A:vx(e,t);break;case J.H1:case J.H2:case J.H3:case J.H4:case J.H5:case J.H6:fx(e,t);break;case J.P:case J.DL:case J.OL:case J.UL:case J.DIV:case J.DIR:case J.NAV:case J.MAIN:case J.MENU:case J.ASIDE:case J.CENTER:case J.FIGURE:case J.FOOTER:case J.HEADER:case J.HGROUP:case J.DIALOG:case J.DETAILS:case J.ADDRESS:case J.ARTICLE:case J.SEARCH:case J.SECTION:case J.SUMMARY:case J.FIELDSET:case J.BLOCKQUOTE:case J.FIGCAPTION:dx(e,t);break;case J.LI:case J.DD:case J.DT:hx(e,t);break;case J.BR:case J.IMG:case J.WBR:case J.AREA:case J.EMBED:case J.KEYGEN:Cx(e,t);break;case J.HR:Dx(e,t);break;case J.RB:case J.RTC:Fx(e,t);break;case J.RT:case J.RP:Ix(e,t);break;case J.PRE:case J.LISTING:px(e,t);break;case J.XMP:Ax(e,t);break;case J.SVG:Rx(e,t);break;case J.HTML:cx(e,t);break;case J.BASE:case J.LINK:case J.META:case J.STYLE:case J.TITLE:case J.SCRIPT:case J.BGSOUND:case J.BASEFONT:case J.TEMPLATE:Yb(e,t);break;case J.BODY:lx(e,t);break;case J.FORM:mx(e,t);break;case J.NOBR:bx(e,t);break;case J.MATH:Lx(e,t);break;case J.TABLE:Sx(e,t);break;case J.INPUT:Tx(e,t);break;case J.PARAM:case J.TRACK:case J.SOURCE:Ex(e,t);break;case J.IMAGE:Ox(e,t);break;case J.BUTTON:_x(e,t);break;case J.APPLET:case J.OBJECT:case J.MARQUEE:xx(e,t);break;case J.IFRAME:jx(e,t);break;case J.SELECT:Nx(e,t);break;case J.OPTION:case J.OPTGROUP:Px(e,t);break;case J.NOEMBED:case J.NOFRAMES:Mx(e,t);break;case J.FRAMESET:ux(e,t);break;case J.TEXTAREA:kx(e,t);break;case J.NOSCRIPT:e.options.scriptingEnabled?Mx(e,t):zx(e,t);break;case J.PLAINTEXT:gx(e,t);break;case J.COL:case J.TH:case J.TD:case J.TR:case J.HEAD:case J.FRAME:case J.TBODY:case J.TFOOT:case J.THEAD:case J.CAPTION:case J.COLGROUP:break;default:zx(e,t)}}function Vx(e,t){if(e.openElements.hasInScope(J.BODY)&&(e.insertionMode=Z.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Hx(e,t){e.openElements.hasInScope(J.BODY)&&(e.insertionMode=Z.AFTER_BODY,LS(e,t))}function Ux(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Wx(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(J.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(J.FORM):n&&e.openElements.remove(n))}function Gx(e){e.openElements.hasInButtonScope(J.P)||e._insertFakeElement(q.P,J.P),e._closePElement()}function Kx(e){e.openElements.hasInListItemScope(J.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(J.LI),e.openElements.popUntilTagNamePopped(J.LI))}function qx(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Jx(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Yx(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Xx(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(q.BR,J.BR),e.openElements.pop(),e.framesetOk=!1}function Zx(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==J.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function Qx(e,t){switch(t.tagID){case J.A:case J.B:case J.I:case J.S:case J.U:case J.EM:case J.TT:case J.BIG:case J.CODE:case J.FONT:case J.NOBR:case J.SMALL:case J.STRIKE:case J.STRONG:Ib(e,t);break;case J.P:Gx(e);break;case J.DL:case J.UL:case J.OL:case J.DIR:case J.DIV:case J.NAV:case J.PRE:case J.MAIN:case J.MENU:case J.ASIDE:case J.BUTTON:case J.CENTER:case J.FIGURE:case J.FOOTER:case J.HEADER:case J.HGROUP:case J.DIALOG:case J.ADDRESS:case J.ARTICLE:case J.DETAILS:case J.SEARCH:case J.SECTION:case J.SUMMARY:case J.LISTING:case J.FIELDSET:case J.BLOCKQUOTE:case J.FIGCAPTION:Ux(e,t);break;case J.LI:Kx(e);break;case J.DD:case J.DT:qx(e,t);break;case J.H1:case J.H2:case J.H3:case J.H4:case J.H5:case J.H6:Jx(e);break;case J.BR:Xx(e);break;case J.BODY:Vx(e,t);break;case J.HTML:Hx(e,t);break;case J.FORM:Wx(e);break;case J.APPLET:case J.OBJECT:case J.MARQUEE:Yx(e,t);break;case J.TEMPLATE:Zb(e,t);break;default:Zx(e,t)}}function $x(e,t){e.tmplInsertionModeStack.length>0?FS(e,t):Bb(e,t)}function eS(e,t){var n;t.tagID===J.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function tS(e,t){e._err(t,G.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function nS(e,t){if(e.openElements.currentTagId!==void 0&&Db.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Z.IN_TABLE_TEXT,t.type){case Xv.CHARACTER:hS(e,t);break;case Xv.WHITESPACE_CHARACTER:mS(e,t)}else pS(e,t)}function rS(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_CAPTION}function iS(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_COLUMN_GROUP}function aS(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(q.COLGROUP,J.COLGROUP),e.insertionMode=Z.IN_COLUMN_GROUP,bS(e,t)}function oS(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_TABLE_BODY}function sS(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(q.TBODY,J.TBODY),e.insertionMode=Z.IN_TABLE_BODY,CS(e,t)}function cS(e,t){e.openElements.hasInTableScope(J.TABLE)&&(e.openElements.popUntilTagNamePopped(J.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function lS(e,t){wx(t)?e._appendElement(t,K.HTML):pS(e,t),t.ackSelfClosing=!0}function uS(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,K.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function dS(e,t){switch(t.tagID){case J.TD:case J.TH:case J.TR:sS(e,t);break;case J.STYLE:case J.SCRIPT:case J.TEMPLATE:Yb(e,t);break;case J.COL:aS(e,t);break;case J.FORM:uS(e,t);break;case J.TABLE:cS(e,t);break;case J.TBODY:case J.TFOOT:case J.THEAD:oS(e,t);break;case J.INPUT:lS(e,t);break;case J.CAPTION:rS(e,t);break;case J.COLGROUP:iS(e,t);break;default:pS(e,t)}}function fS(e,t){switch(t.tagID){case J.TABLE:e.openElements.hasInTableScope(J.TABLE)&&(e.openElements.popUntilTagNamePopped(J.TABLE),e._resetInsertionMode());break;case J.TEMPLATE:Zb(e,t);break;case J.BODY:case J.CAPTION:case J.COL:case J.COLGROUP:case J.HTML:case J.TBODY:case J.TD:case J.TFOOT:case J.TH:case J.THEAD:case J.TR:break;default:pS(e,t)}}function pS(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,ax(e,t),e.fosterParentingEnabled=n}function mS(e,t){e.pendingCharacterTokens.push(t)}function hS(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function gS(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)pS(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var _S=new Set([J.CAPTION,J.COL,J.COLGROUP,J.TBODY,J.TD,J.TFOOT,J.TH,J.THEAD,J.TR]);function vS(e,t){let n=t.tagID;_S.has(n)?e.openElements.hasInTableScope(J.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(J.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,dS(e,t)):Bx(e,t)}function yS(e,t){let n=t.tagID;switch(n){case J.CAPTION:case J.TABLE:e.openElements.hasInTableScope(J.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(J.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_TABLE,n===J.TABLE&&fS(e,t));break;case J.BODY:case J.COL:case J.COLGROUP:case J.HTML:case J.TBODY:case J.TD:case J.TFOOT:case J.TH:case J.THEAD:case J.TR:break;default:Qx(e,t)}}function bS(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.COL:e._appendElement(t,K.HTML),t.ackSelfClosing=!0;break;case J.TEMPLATE:Yb(e,t);break;default:SS(e,t)}}function xS(e,t){switch(t.tagID){case J.COLGROUP:e.openElements.currentTagId===J.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case J.TEMPLATE:Zb(e,t);break;case J.COL:break;default:SS(e,t)}}function SS(e,t){e.openElements.currentTagId===J.COLGROUP&&(e.openElements.pop(),e.insertionMode=Z.IN_TABLE,e._processToken(t))}function CS(e,t){switch(t.tagID){case J.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_ROW;break;case J.TH:case J.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(q.TR,J.TR),e.insertionMode=Z.IN_ROW,TS(e,t);break;case J.CAPTION:case J.COL:case J.COLGROUP:case J.TBODY:case J.TFOOT:case J.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,dS(e,t));break;default:dS(e,t)}}function wS(e,t){let n=t.tagID;switch(t.tagID){case J.TBODY:case J.TFOOT:case J.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE);break;case J.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE,fS(e,t));break;case J.BODY:case J.CAPTION:case J.COL:case J.COLGROUP:case J.HTML:case J.TD:case J.TH:case J.TR:break;default:fS(e,t)}}function TS(e,t){switch(t.tagID){case J.TH:case J.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,K.HTML),e.insertionMode=Z.IN_CELL,e.activeFormattingElements.insertMarker();break;case J.CAPTION:case J.COL:case J.COLGROUP:case J.TBODY:case J.TFOOT:case J.THEAD:case J.TR:e.openElements.hasInTableScope(J.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,CS(e,t));break;default:dS(e,t)}}function ES(e,t){switch(t.tagID){case J.TR:e.openElements.hasInTableScope(J.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY);break;case J.TABLE:e.openElements.hasInTableScope(J.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,wS(e,t));break;case J.TBODY:case J.TFOOT:case J.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(J.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Z.IN_TABLE_BODY,wS(e,t));break;case J.BODY:case J.CAPTION:case J.COL:case J.COLGROUP:case J.HTML:case J.TD:case J.TH:break;default:fS(e,t)}}function DS(e,t){let n=t.tagID;_S.has(n)?(e.openElements.hasInTableScope(J.TD)||e.openElements.hasInTableScope(J.TH))&&(e._closeTableCell(),TS(e,t)):Bx(e,t)}function OS(e,t){let n=t.tagID;switch(n){case J.TD:case J.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Z.IN_ROW);break;case J.TABLE:case J.TBODY:case J.TFOOT:case J.THEAD:case J.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),ES(e,t));break;case J.BODY:case J.CAPTION:case J.COL:case J.COLGROUP:case J.HTML:break;default:Qx(e,t)}}function kS(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.OPTION:e.openElements.currentTagId===J.OPTION&&e.openElements.pop(),e._insertElement(t,K.HTML);break;case J.OPTGROUP:e.openElements.currentTagId===J.OPTION&&e.openElements.pop(),e.openElements.currentTagId===J.OPTGROUP&&e.openElements.pop(),e._insertElement(t,K.HTML);break;case J.HR:e.openElements.currentTagId===J.OPTION&&e.openElements.pop(),e.openElements.currentTagId===J.OPTGROUP&&e.openElements.pop(),e._appendElement(t,K.HTML),t.ackSelfClosing=!0;break;case J.INPUT:case J.KEYGEN:case J.TEXTAREA:case J.SELECT:e.openElements.hasInSelectScope(J.SELECT)&&(e.openElements.popUntilTagNamePopped(J.SELECT),e._resetInsertionMode(),t.tagID!==J.SELECT&&e._processStartTag(t));break;case J.SCRIPT:case J.TEMPLATE:Yb(e,t)}}function AS(e,t){switch(t.tagID){case J.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===J.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===J.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===J.OPTGROUP&&e.openElements.pop();break;case J.OPTION:e.openElements.currentTagId===J.OPTION&&e.openElements.pop();break;case J.SELECT:e.openElements.hasInSelectScope(J.SELECT)&&(e.openElements.popUntilTagNamePopped(J.SELECT),e._resetInsertionMode());break;case J.TEMPLATE:Zb(e,t)}}function jS(e,t){let n=t.tagID;n===J.CAPTION||n===J.TABLE||n===J.TBODY||n===J.TFOOT||n===J.THEAD||n===J.TR||n===J.TD||n===J.TH?(e.openElements.popUntilTagNamePopped(J.SELECT),e._resetInsertionMode(),e._processStartTag(t)):kS(e,t)}function MS(e,t){let n=t.tagID;n===J.CAPTION||n===J.TABLE||n===J.TBODY||n===J.TFOOT||n===J.THEAD||n===J.TR||n===J.TD||n===J.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(J.SELECT),e._resetInsertionMode(),e.onEndTag(t)):AS(e,t)}function NS(e,t){switch(t.tagID){case J.BASE:case J.BASEFONT:case J.BGSOUND:case J.LINK:case J.META:case J.NOFRAMES:case J.SCRIPT:case J.STYLE:case J.TEMPLATE:case J.TITLE:Yb(e,t);break;case J.CAPTION:case J.COLGROUP:case J.TBODY:case J.TFOOT:case J.THEAD:e.tmplInsertionModeStack[0]=Z.IN_TABLE,e.insertionMode=Z.IN_TABLE,dS(e,t);break;case J.COL:e.tmplInsertionModeStack[0]=Z.IN_COLUMN_GROUP,e.insertionMode=Z.IN_COLUMN_GROUP,bS(e,t);break;case J.TR:e.tmplInsertionModeStack[0]=Z.IN_TABLE_BODY,e.insertionMode=Z.IN_TABLE_BODY,CS(e,t);break;case J.TD:case J.TH:e.tmplInsertionModeStack[0]=Z.IN_ROW,e.insertionMode=Z.IN_ROW,TS(e,t);break;default:e.tmplInsertionModeStack[0]=Z.IN_BODY,e.insertionMode=Z.IN_BODY,Bx(e,t)}}function PS(e,t){t.tagID===J.TEMPLATE&&Zb(e,t)}function FS(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(J.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Bb(e,t)}function IS(e,t){t.tagID===J.HTML?Bx(e,t):RS(e,t)}function LS(e,t){if(t.tagID===J.HTML){if(e.fragmentContext||(e.insertionMode=Z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===J.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else RS(e,t)}function RS(e,t){e.insertionMode=Z.IN_BODY,ax(e,t)}function zS(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.FRAMESET:e._insertElement(t,K.HTML);break;case J.FRAME:e._appendElement(t,K.HTML),t.ackSelfClosing=!0;break;case J.NOFRAMES:Yb(e,t)}}function BS(e,t){t.tagID===J.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==J.FRAMESET&&(e.insertionMode=Z.AFTER_FRAMESET))}function VS(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.NOFRAMES:Yb(e,t)}}function HS(e,t){t.tagID===J.HTML&&(e.insertionMode=Z.AFTER_AFTER_FRAMESET)}function US(e,t){t.tagID===J.HTML?Bx(e,t):WS(e,t)}function WS(e,t){e.insertionMode=Z.IN_BODY,ax(e,t)}function GS(e,t){switch(t.tagID){case J.HTML:Bx(e,t);break;case J.NOFRAMES:Yb(e,t)}}function KS(e,t){t.chars=`�`,e._insertCharacters(t)}function qS(e,t){e._insertCharacters(t),e.framesetOk=!1}function JS(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==K.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function YS(e,t){if(hb(t))JS(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===K.MATHML?gb(t):r===K.SVG&&(yb(t),_b(t)),vb(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function XS(e,t){if(t.tagID===J.P||t.tagID===J.BR){JS(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===K.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}q.AREA,q.BASE,q.BASEFONT,q.BGSOUND,q.BR,q.COL,q.EMBED,q.FRAME,q.HR,q.IMG,q.INPUT,q.KEYGEN,q.LINK,q.META,q.PARAM,q.SOURCE,q.TRACK,q.WBR;function ZS(e,t){return kb.parse(e,t)}async function QS(e){if(!e)return!1;if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}try{if(typeof document>`u`||!document.body)return!1;let t=document.activeElement,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null,r=n?.selectionStart??null,i=n?.selectionEnd??null,a=document.getSelection(),o=a?.rangeCount?a.getRangeAt(0).cloneRange():null,s=document.createElement(`textarea`);s.value=e,s.style.position=`fixed`,s.style.left=`-999999px`,s.style.top=`-999999px`,s.style.opacity=`0`,document.body.appendChild(s),s.focus(),s.select();try{return document.execCommand(`copy`)}finally{s.remove(),t&&t.isConnected&&(t.focus({preventScroll:!0}),n&&r!==null&&i!==null&&n.setSelectionRange(r,i)),a&&o&&(a.removeAllRanges(),a.addRange(o))}}catch{return!1}}function $S(e){if(!e)return``;let t=ZS(e),n=e=>`tagName`in e,r=t.childNodes.find(e=>n(e)&&e.tagName===`html`),i=r&&n(r)?r.childNodes.find(e=>n(e)&&e.tagName===`body`):null;if(!i||!n(i))return``;let a=new Set([`address`,`article`,`blockquote`,`div`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`pre`,`section`,`tr`]),o=``,s=()=>{o&&!o.endsWith(`
39
- `)&&(o+=`
40
- `)},c=e=>{if(`value`in e){o+=e.value;return}if(!n(e)||[`script`,`style`,`template`].includes(e.tagName))return;if(e.tagName===`br`){s();return}let t=a.has(e.tagName);t&&s(),e.childNodes.forEach(c),t&&s()};return i.childNodes.forEach(c),o.replace(/^\n+|\n+$/g,``)}async function eC(){if(typeof navigator>`u`||!navigator.clipboard)throw Error(`Clipboard unavailable`);try{let e=await navigator.clipboard.readText();if(e)return e}catch{}if(!navigator.clipboard.read)throw Error(`Clipboard text unavailable`);let e=await navigator.clipboard.read();for(let t of e){if(t.types.includes(`text/plain`)){let e=await(await t.getType(`text/plain`)).text();if(e)return e}if(t.types.includes(`text/html`)){let e=$S(await(await t.getType(`text/html`)).text());if(e)return e}}return``}var tC=e=>e===`antigravity`?`Antigravity`:e===`claude`?`Claude Code`:e===`codex`?`OpenAI Codex`:`GitHub Copilot`,nC=e=>e===`claude`?`warning`:e===`codex`?`success`:e===`antigravity`?`accent`:`info`,rC=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;case`cursor`:return`cursor-agent --resume ${t}`;default:return`agy --conversation ${t}`}};function iC({activeSession:e,transcript:t,transcriptLoading:n,setActiveSession:r,workspaces:i,workspace:a,handleOpenDesktopSession:o,showToast:s}){let c=Et(),l=Rt(),u=c.data?.find(e=>e.id===`codex-desktop`),d=u?.available===!0,f=c.isLoading?`Checking whether Codex Desktop is available…`:c.isError?`Could not check whether Codex Desktop is available.`:u?.unavailableReason??`Codex Desktop is not available on this computer.`,p=(0,V.useRef)(!1),m=(0,V.useRef)(!1),h=(0,V.useRef)(null),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(!1),b=(0,V.useMemo)(()=>{let n=t.reduce((e,t)=>e+(t.usage?.totalTokens??(t.usage?.inputTokens??0)+(t.usage?.outputTokens??0)),0);return n>0?n:e?.usage?e.usage.totalTokens??(e.usage.inputTokens??0)+(e.usage.outputTokens??0):0},[t,e?.usage]);(0,V.useEffect)(()=>{!n&&t.length>0&&h.current?.scrollIntoView({behavior:`auto`})},[n,t]);let x=()=>a??Gn(i,e.workspacePath),S=async()=>{if(!d||p.current)return;let t=x();if(!t){s(`Could not match this session to a workspace — it may have been removed.`,`error`);return}p.current=!0,_(!0);try{await o(t,e.id,e.assistant)&&r(null)}finally{p.current=!1,_(!1)}},C=async()=>{if(m.current)return;let t=x();if(!t){s(`Could not match this session to a workspace.`,`error`);return}m.current=!0,y(!0);try{await l.mutateAsync({workspaceId:t.branchName,assistant:e.assistant,sessionId:e.id,cwd:e.workspacePath}),s(`Opened ${tC(e.assistant)} inside ContextSpace.`,`success`),r(null)}catch{let t=rC(e.assistant,e.id);await QS(t)?s(`Could not open terminal automatically. Copied command to clipboard:\n\n${t}`,`info`):s(`Could not open terminal automatically. Run manually:\n\n${t}`,`error`)}finally{y(!1),m.current=!1}};return(0,H.jsx)(Ov,{open:!0,onOpenChange:e=>!e&&r(null),children:(0,H.jsxs)(Mv,{className:`h-[80vh] max-w-4xl`,children:[(0,H.jsx)(Nv,{children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,H.jsx)(Bv,{tone:nC(e.assistant),children:tC(e.assistant)}),(0,H.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted/60 text-muted-foreground px-1.5 py-0.5 rounded`,children:[`Read-Only Transcript · `,t.length,` turns`,b>0?` · ${b.toLocaleString()} tokens`:``]}),(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[`ID: `,e.id.slice(0,8)]})]}),(0,H.jsx)(Fv,{className:`max-w-xl truncate text-sm`,title:e.title,children:e.title}),(0,H.jsxs)(Iv,{className:`sr-only`,children:[`Read-only transcript log and resume options for session `,e.id]})]})}),(0,H.jsxs)(Lv,{className:`space-y-4`,children:[n?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2`,children:[(0,H.jsx)(Rv,{className:`size-6 text-primary`}),(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Loading conversation history...`})]}):t.length===0?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-xs text-muted-foreground`,children:`No messages found in this transcript.`}):t.map((t,n)=>(0,H.jsxs)(`div`,{className:`flex flex-col ${t.role===`user`?`items-end`:`items-start`}`,children:[(0,H.jsxs)(`div`,{className:`mb-1 px-1 text-[10px] text-muted-foreground`,children:[t.role===`user`?`Developer`:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`,t.timestamp&&` • ${new Date(t.timestamp).toLocaleTimeString()}`]}),(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-xl border px-4 py-3 text-xs leading-relaxed ${t.role===`user`?`rounded-tr-none border-primary/30 bg-primary/10 text-foreground dark:border-primary/40 dark:bg-primary/20`:`rounded-tl-none border-border bg-card text-foreground shadow-xs dark:bg-muted/30`}`,children:[(0,H.jsx)(Dv,{content:t.content}),t.usage&&(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 border-t border-border/40 pt-1.5 text-[10px] text-muted-foreground font-mono`,children:[(0,H.jsxs)(`span`,{children:[(t.usage.inputTokens??0).toLocaleString(),` in`]}),(0,H.jsx)(`span`,{children:`/`}),(0,H.jsxs)(`span`,{children:[(t.usage.outputTokens??0).toLocaleString(),` out`]}),typeof t.usage.cachedInputTokens==`number`&&t.usage.cachedInputTokens>0&&(0,H.jsxs)(`span`,{children:[`(`,t.usage.cachedInputTokens.toLocaleString(),` cached)`]}),typeof t.usage.costUsdEstimate==`number`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`•`}),(0,H.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`~$`,t.usage.costUsdEstimate.toFixed(3)]})]})]})]})]},n)),(0,H.jsx)(`div`,{ref:h})]}),(0,H.jsxs)(Pv,{className:`sm:justify-between`,children:[(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Read-only transcript. Interactive coding happens in your terminal or IDE.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsxs)(yn,{variant:`outline`,size:`sm`,onClick:async()=>{let t=rC(e.assistant,e.id);await QS(t),s(`Copied run command to clipboard:\n\n${t}`,`success`)},children:[(0,H.jsx)(Mr,{size:13}),` Copy CLI Command`]}),(0,H.jsxs)(yn,{size:`sm`,variant:`default`,disabled:v,onClick:()=>void C(),children:[v?(0,H.jsx)(Rv,{className:`size-3`}):(0,H.jsx)(xi,{size:12}),`Resume in Terminal`]}),e.assistant===`codex`&&(0,H.jsxs)(yn,{variant:`outline`,size:`sm`,disabled:!d||g,title:d?`Open this exact thread in Codex Desktop`:f,"aria-label":d?`Open in Codex Desktop`:`Codex Desktop unavailable: ${f}`,onClick:()=>void S(),children:[g?(0,H.jsx)(Rv,{className:`size-3`}):(0,H.jsx)(Bn,{size:12}),g?`Opening…`:`Open in Codex Desktop`]})]})]})]})})}function aC({files:e,renderFile:t,label:n,revealPath:r,revealKey:i}){let a=(0,V.useRef)(null),o=(0,V.useMemo)(()=>{let t={directories:new Map,files:[]};for(let n of e){let e=n.file.split(`/`),r=t;for(let t of e.slice(0,-1))r.directories.has(t)||r.directories.set(t,{directories:new Map,files:[]}),r=r.directories.get(t);r.files.push(n)}return t},[e]);(0,V.useEffect)(()=>{if(r)for(let e of a.current?.querySelectorAll(`details[data-path]`)??[])r.startsWith(`${e.dataset.path}/`)&&(e.open=!0)},[r,i]);let s=(e,n=``)=>(0,H.jsxs)(`ul`,{className:`min-w-0 space-y-0.5`,children:[[...e.directories].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`details`,{open:!0,"data-path":n?`${n}/${e}`:e,className:`min-w-0`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded px-2 py-1 text-xs hover:bg-accent focus-visible:outline focus-visible:outline-primary`,children:[(0,H.jsx)(Lr,{className:`mr-1 inline size-3.5`,"aria-hidden":`true`}),e]}),(0,H.jsx)(`div`,{className:`ml-3 border-l border-border pl-2`,children:s(t,n?`${n}/${e}`:e)})]})},`dir:${e}`)),[...e.files].sort((e,t)=>e.file.localeCompare(t.file)).map(e=>(0,H.jsx)(`li`,{children:t(e)},`file:${e.file}`))]});return(0,H.jsx)(`nav`,{ref:a,"aria-label":n,children:s(o)})}var oC=class extends V.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[DiffErrorBoundary] Caught error in diff viewer:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,H.jsxs)(`div`,{className:`p-4 rounded-lg border border-destructive/40 bg-destructive/10 text-foreground space-y-3 my-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-xs text-destructive`,children:[(0,H.jsx)(Si,{className:`size-4 shrink-0`}),(0,H.jsxs)(`span`,{children:[`Failed to render diff editor for `,this.props.filePath||`file`]})]}),(0,H.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground break-all bg-background/80 p-2 rounded border border-border/60`,children:this.state.error?.message||`Unknown diff rendering error`}),(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:this.handleReset,className:`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded border border-border bg-card hover:bg-accent text-foreground cursor-pointer transition-colors font-mono`,children:[(0,H.jsx)(li,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Retry Render`})]})}),this.props.fallbackContent&&(0,H.jsxs)(`div`,{className:`mt-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase font-mono tracking-wider text-muted-foreground mb-1`,children:`Raw Diff Content`}),(0,H.jsx)(`pre`,{className:`font-mono text-[11px] bg-background/90 text-foreground p-3 rounded border border-border max-h-72 overflow-auto whitespace-pre`,children:this.props.fallbackContent})]})]}):this.props.children}};function sC(e){if(!e||!e.trim())return{originalContent:``,modifiedContent:``,hunks:[],isNewFile:!1,isDeletedFile:!1};let t=e.split(/\r?\n/),n=[],r=[],i=[],a=!1,o=!1,s=null,c=0;for(let e=0;e<t.length;e++){let l=t[e];if(l.startsWith(`--- /dev/null`)){a=!0;continue}if(l.startsWith(`+++ /dev/null`)){o=!0;continue}let u=l.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(u){s&&n.push(s),c++;let e=parseInt(u[1],10),t=u[2]===void 0?1:parseInt(u[2],10),r=parseInt(u[3],10),i=u[4]===void 0?1:parseInt(u[4],10);s={id:`hunk-${c}`,hunkIndex:c-1,type:`accept`,startLineOriginal:e,lineCountOriginal:t,startLineModified:r,lineCountModified:i,patchHeader:l,enclosingDeclaration:u[5]?.trim()||void 0,lines:[]};continue}if(s){if(s.lines.push(l),l.startsWith(` `)){let e=l.slice(1);r.push(e),i.push(e)}else if(l.startsWith(`-`))r.push(l.slice(1));else if(l.startsWith(`+`))i.push(l.slice(1));else if(l.startsWith(`\\`))continue}}return s&&n.push(s),{originalContent:r.join(`
41
- `),modifiedContent:i.join(`
42
- `),hunks:n,isNewFile:a,isDeletedFile:o}}function cC(e,t){let n=1;for(let r of t){let t=r.startLineModified;for(let i of r.lines||[])if(!(i.startsWith(`-`)||i.startsWith(`\\`))){if(t===e)return n;n++,t++}}return null}var lC=({patchText:e,targetLine:t,jumpNonce:n})=>{let r=(0,V.useRef)(null),i=(0,V.useRef)(void 0);(0,V.useEffect)(()=>{!r.current||!t||t<=0||i.current!==n&&(i.current=n,(r.current.querySelector(`[data-mod-line="${t}"]`)||r.current.querySelector(`[data-is-target="true"]`))?.scrollIntoView({behavior:`smooth`,block:`center`}))},[t,n]);let a=(0,V.useMemo)(()=>{if(!e||!e.trim())return[];let n=e.split(/\r?\n/),r=0;return n.map((e,n)=>{let i=``,a=`text-muted-foreground`,o;if(e.startsWith(`@@`)){i=`bg-sky-500/15`,a=`text-sky-400 font-bold italic`;let t=e.match(/\+(\d+)/);t&&t[1]&&(r=parseInt(t[1],10)-1)}else e.startsWith(`+`)&&!e.startsWith(`+++`)?(i=`bg-emerald-500/15`,a=`text-emerald-400 font-semibold`,r++,o=r):e.startsWith(`-`)&&!e.startsWith(`---`)?(i=`bg-rose-500/15`,a=`text-rose-400 font-semibold`):e.startsWith(` `)&&(r++,o=r);return{idx:n,line:e,lineModNum:o,isTarget:t!==void 0&&o===t,bgClass:i,textClass:a}})},[e,t]);return!e||!e.trim()?(0,H.jsx)(`div`,{className:`p-4 font-mono text-xs italic text-muted-foreground`,children:`No diff changes recorded.`}):(0,H.jsx)(`div`,{ref:r,className:`custom-scrollbar h-full min-h-0 overflow-auto rounded-lg border border-border/80 bg-muted/20 font-mono text-xs leading-relaxed select-text`,children:a.map(e=>(0,H.jsxs)(`div`,{"data-mod-line":e.lineModNum,"data-is-target":e.isTarget?`true`:void 0,className:`flex px-3 py-0.5 hover:bg-accent/40 ${e.isTarget?`bg-primary/25 border-l-2 border-primary font-bold`:e.bgClass}`,children:[(0,H.jsx)(`span`,{className:`w-10 select-none text-right pr-3 text-[10px] text-muted-foreground/60`,children:e.lineModNum??e.idx+1}),(0,H.jsx)(`span`,{className:`whitespace-pre flex-1 ${e.textClass}`,children:e.line})]},e.idx))})};function uC(e){switch(e){case`code-insiders`:case`vscode-insiders`:return`VS Code Insiders`;case`cursor`:return`Cursor`;case`windsurf`:return`Windsurf`;case`antigravity`:return`Antigravity`;default:return`VS Code`}}function dC(e){switch(e){case`code-insiders`:case`vscode-insiders`:return`code-insiders`;case`cursor`:return`cursor`;case`windsurf`:return`windsurf`;case`antigravity`:return`antigravity`;default:return`code`}}function fC(e){switch(e){case`code-insiders`:case`vscode-insiders`:return`vscode-insiders`;case`cursor`:return`cursor`;case`windsurf`:return`windsurf`;case`antigravity`:return`antigravity`;default:return`vscode`}}function pC(e,t,n=1,r=1,i){let a=e.replace(/\\/g,`/`).replace(/\/+$/,``),o=t.replace(/\\/g,`/`),s;if(/^[a-zA-Z]:\//.test(o)||o.startsWith(`/`))s=o;else{let e=o.replace(/^\/+/,``);s=a?`${a}/${e}`:e}let c=s.replace(/^\/+/,``);return`${fC(i)}://file/${encodeURI(c)}:${n}:${r}`}async function mC(e,t,n){let r=dC(n),i=uC(n);try{let n=await fetch(`/api/open-editor`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({workspacePath:e,command:r,filePath:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Failed to launch ${i}`)}return!0}catch(e){return console.error(`Failed to launch external diff tool:`,e),!1}}function hC(e,t,n=1,r=1,i){let a=pC(e,t,n,r,i);typeof window<`u`&&window.open&&window.open(a,`_blank`)}function gC(e){if(e?.editor)return e;if(typeof window<`u`&&window.monaco?.editor)return window.monaco}function _C(e){return e.replace(/\\/g,`/`).replace(/^\//,``)}function vC(e){return e.replace(/\\/g,`/`).replace(/^\//,``).replace(/\/$/,``)}function yC(e,t,n){let r=vC(e),i=_C(t),a=`file:///${r}/${i}`,o=gC(n);if(o?.Uri?.parse)return o.Uri.parse(a);let s=`/${r}/${i}`;return{scheme:`file`,authority:``,path:s,query:``,fragment:``,fsPath:s,with:()=>({}),toString:()=>a,toJSON:()=>a}}function bC(e,t,n){let r=vC(e),i=_C(t),a=`diff-original:///${r}/${i}`,o=gC(n);if(o?.Uri?.parse)return o.Uri.parse(a);let s=`/${r}/${i}`;return{scheme:`diff-original`,authority:``,path:s,query:``,fragment:``,fsPath:s,with:()=>({}),toString:()=>a,toJSON:()=>a}}function xC(e,t,n,r){let i=gC(r);if(!i?.editor)return null;try{let r=i.editor.getModel(e);return!r||r.isDisposed()?r=i.editor.createModel(t,n,e):r.getValue()!==t&&r.setValue(t),r}catch(r){console.warn(`[changesetModelStore] Error in getOrCreateTextModel:`,r);try{return i.editor.getModel(e)||i.editor.createModel(t,n)}catch{return null}}}function SC(e,t){let n=gC(t);if(!n?.editor?.registerEditorOpener)return{dispose:()=>{}};try{return n.editor.registerEditorOpener({openCodeEditor(t,n,r){if(!n||n.scheme!==`file`)return!1;let i=n.path.replace(/^\//,``),a=i.indexOf(`/`);if(a===-1)return!1;let o=i.substring(0,a),s=i.substring(a+1),c;return r&&(`lineNumber`in r&&typeof r.lineNumber==`number`?c=r.lineNumber:`startLineNumber`in r&&typeof r.startLineNumber==`number`&&(c=r.startLineNumber)),e(o,s,c),!0}})}catch(e){return console.warn(`[changesetModelStore] Failed to register editor opener:`,e),{dispose:()=>{}}}}var CC={File:0,Module:1,Namespace:2,Package:3,Class:4,Method:5,Property:6,Field:7,Constructor:8,Enum:9,Interface:10,Function:11,Variable:12,Constant:13,String:14,Number:15,Boolean:16,Array:17,Object:18,Key:19,Null:20,EnumMember:21,Struct:22,Event:23,Operator:24,TypeParameter:25};function wC(e){switch(e.split(`.`).pop()?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`mjs`:case`cjs`:return`ts`;case`py`:return`python`;case`go`:return`go`;case`rs`:return`rust`;case`cs`:return`csharp`;default:return`other`}}var TC=[{regex:/^\s*(?:(?:public|private|protected|internal|sealed|abstract|static|partial)\s+)*class\s+([A-Za-z0-9_]+)/,kind:CC.Class,label:`class`},{regex:/^\s*(?:(?:public|private|protected|internal|partial)\s+)*interface\s+([A-Za-z0-9_]+)/,kind:CC.Interface,label:`interface`},{regex:/^\s*(?:(?:public|private|protected|internal|sealed|abstract|static|partial|readonly)\s+)*record(?:\s+(?:class|struct))?\s+([A-Za-z0-9_]+)/,kind:CC.Class,label:`class`},{regex:/^\s*(?:(?:public|private|protected|internal|readonly|ref|partial)\s+)*struct\s+([A-Za-z0-9_]+)/,kind:CC.Struct,label:`class`},{regex:/^\s*(?:(?:public|private|protected|internal)\s+)*enum\s+([A-Za-z0-9_]+)/,kind:CC.Enum,label:`enum`},{regex:/^\s*(?:(?:public|private|protected|internal)\s+)+([A-Z][A-Za-z0-9_]*)\s*\(/,kind:CC.Constructor,label:`constructor`},{regex:/^\s*(?:(?:public|private|protected|internal|static|async|virtual|override|abstract|sealed|new)\s+)+(?:void|[A-Za-z0-9_<>?[\]\s,]+)\s+([A-Za-z0-9_]+)\s*(?:<[^>]+>)?\s*\(/,kind:CC.Method,label:`method`},{regex:/^\s*(?:(?:async|static)\s+)?(?:void|Task(?:<[^>]+>)?|IActionResult|ActionResult(?:<[^>]+>)?)\s+([A-Za-z0-9_]+)\s*(?:<[^>]+>)?\s*\(/,kind:CC.Method,label:`method`},{regex:/^\s*(?:(?:public|private|protected|internal|virtual|override|abstract|required|static)\s+)+[A-Za-z0-9_<>?[\]\s,]+\s+([A-Za-z0-9_]+)\s*\{\s*(?:get|set|init)/,kind:CC.Property,label:`property`},{regex:/^\s*(?:(?:public|private|protected|internal|virtual|override|abstract|static)\s+)+[A-Za-z0-9_<>?[\]\s,]+\s+([A-Za-z0-9_]+)\s*=>/,kind:CC.Property,label:`property`}],EC=[{regex:/^\s*(?:export\s+(?:default\s+)?)?(?:async\s+)?function\s*(?:\*\s*)?([A-Za-z0-9_$]+)/,kind:CC.Function,label:`function`},{regex:/^\s*(?:(?:public|private|protected)\s+)?(constructor)\s*\(/,kind:CC.Constructor,label:`constructor`},{regex:/^\s*(?:(?:public|private|protected|static|abstract|override|async)\s+)+([A-Za-z0-9_$]+)\s*(?:<[^>]+>)?\s*\(/,kind:CC.Method,label:`method`},{regex:/^\s*(?:export\s+)?(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*(?::\s*[^=]+)?\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z0-9_$]+|\()(?:\s*:\s*[^=]+)?\s*(?:=>)?/,kind:CC.Function,label:`function`},{regex:/^\s*(?:export\s+)?(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*(?::\s*[^=]+)?\s*=\s*(?:async\s*)?function/,kind:CC.Function,label:`function`},{regex:/^\s*(?:export\s+(?:default\s+)?)?(?:abstract\s+)?class\s+([A-Za-z0-9_$]+)/,kind:CC.Class,label:`class`},{regex:/^\s*(?:export\s+)?interface\s+([A-Za-z0-9_$]+)/,kind:CC.Interface,label:`interface`},{regex:/^\s*(?:export\s+)?type\s+([A-Za-z0-9_$]+)\s*(?:<[^>]*>)?\s*=/,kind:CC.TypeParameter,label:`type`},{regex:/^\s*(?:export\s+)?(?:const\s+)?enum\s+([A-Za-z0-9_$]+)/,kind:CC.Enum,label:`enum`},{regex:/^\s*(?:export\s+)?(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*(?::\s*[^=]+)?\s*=/,kind:CC.Variable,label:`variable`}],DC=[{regex:/^\s*(?:async\s+)?def\s+([A-Za-z0-9_]+)\s*\(/,kind:CC.Function,label:`function`},{regex:/^\s*class\s+([A-Za-z0-9_]+)(?:\s*\([^)]*\))?\s*:/,kind:CC.Class,label:`class`}],OC=[{regex:/^\s*func\s+(?:\([^)]+\)\s+)?([A-Za-z0-9_]+)\s*\(/,kind:CC.Function,label:`function`},{regex:/^\s*type\s+([A-Za-z0-9_]+)\s+(?:struct|interface)/,kind:CC.Class,label:`type`}],kC=[{regex:/^\s*(?:pub(?:\([^)]+\))?\s+)?(?:async\s+)?(?:unsafe\s+)?fn\s+([A-Za-z0-9_]+)/,kind:CC.Function,label:`function`},{regex:/^\s*(?:pub(?:\([^)]+\))?\s+)?struct\s+([A-Za-z0-9_]+)/,kind:CC.Class,label:`class`},{regex:/^\s*(?:pub(?:\([^)]+\))?\s+)?enum\s+([A-Za-z0-9_]+)/,kind:CC.Enum,label:`enum`},{regex:/^\s*(?:pub(?:\([^)]+\))?\s+)?trait\s+([A-Za-z0-9_]+)/,kind:CC.Interface,label:`interface`}],AC=new class{symbols=[];symbolMap=new Map;listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}onIndexUpdated(e){return this.subscribe(e)}notify(){for(let e of this.listeners)try{e()}catch(e){console.error(`Error in changeset symbol index listener:`,e)}}clear(){this.symbols=[],this.symbolMap.clear(),this.notify()}removeFile(e,t){let n=t.replace(/\\/g,`/`).replace(/^\//,``);this.symbols=this.symbols.filter(t=>t.repoName!==e||t.filePath!==n),this.rebuildMap(),this.notify()}indexFile(e,t,n,r=[],i,a){let o=t.replace(/\\/g,`/`).replace(/^\//,``),s=e.replace(/\\/g,`/`).replace(/^\//,``).replace(/\/$/,``),c=`file:///${s}/${o}`,l=this.symbols.filter(t=>t.repoName!==e||t.filePath!==o),u=wC(o),d=EC;u===`python`?d=DC:u===`go`?d=OC:u===`rust`?d=kC:u===`csharp`?d=TC:u===`other`&&(d=[]);let f=[];if(r&&r.length>0)for(let e of r){let t=0;for(let n of e.lines||[]){if(n.startsWith(`-`)||n.startsWith(`\\`))continue;let r=n.startsWith(`+`);f.push({lineNum:e.startLineModified+t,hunk:e,isAdded:r}),t++}}let p=n.split(/\r?\n/),m=f.length>0&&p.length===f.length,h=[];if(a&&a.length>0)for(let t of a){let n=t.lineNumber,a,l=!1,u=t.lineNumber,d=t.endLineNumber||t.lineNumber;if(m){let e=f.find(e=>e.lineNum>=u&&e.lineNum<=d);e?(n=e.lineNum,a=e.hunk,l=e.isAdded):a=r.find(e=>{let t=e.startLineModified,n=e.startLineModified+Math.max(e.lineCountModified,1)-1;return t<=d&&n>=u})}else a=r.find(e=>{let t=e.startLineModified,n=e.startLineModified+Math.max(e.lineCountModified,1)-1;return t<=d&&n>=u});let p=`context`;if(a){if(m)p=l?`added`:`modified`;else{p=`modified`;let e=a.startLineModified,n=e+Math.max(a.lineCountModified,1)-1;(t.lineNumber>=e&&t.lineNumber<=n&&a.lines&&a.lines.some(e=>e.startsWith(`+`)&&e.includes(t.name))||a.lines&&a.lines.length>0&&a.lines.every(e=>!e.startsWith(`-`)&&!e.startsWith(` `)))&&(p=`added`)}}let g={id:`${s}:${o}:${n}:${t.name}`,name:t.name,kind:t.kind,kindLabel:t.kindLabel,repoName:e,repoPath:i||(s.includes(`/`)||s.includes(`\\`)?s:void 0),filePath:o,uriString:c,lineNumber:n,endLineNumber:t.endLineNumber,column:t.column||1,containerName:t.containerName,isModifiedInChangeset:!!a,changeType:a?p:`context`,hunkIndex:a?.hunkIndex,hunkId:a?.id};h.push(g)}else if(p.forEach((t,n)=>{let a,l,u=!1;if(m){let e=f[n];a=e.lineNum,l=e.hunk,u=e.isAdded}else a=n+1,l=r.find(e=>{let t=e.startLineModified,n=e.startLineModified+Math.max(e.lineCountModified,1)-1;return a>=t&&a<=n});for(let n of d){let r=t.match(n.regex);if(r&&r[1]){let d=r[1],f=t.indexOf(d)+1,p=`context`;l&&(m?p=u?`added`:`modified`:(p=`modified`,l.lines&&l.lines.some(e=>e.startsWith(`+`)&&e.includes(d))&&(p=`added`)));let g={id:`${s}:${o}:${a}:${d}`,name:d,kind:n.kind,kindLabel:n.label,repoName:e,repoPath:i||(s.includes(`/`)||s.includes(`\\`)?s:void 0),filePath:o,uriString:c,lineNumber:a,column:f>0?f:1,isModifiedInChangeset:!!l,changeType:l?p:`context`,hunkIndex:l?.hunkIndex,hunkId:l?.id};h.push(g);break}}}),r&&r.length>0){for(let t of r)if(t.enclosingDeclaration)for(let n of d){let r=t.enclosingDeclaration.match(n.regex);if(r&&r[1]){let a=r[1];h.some(e=>e.name===a)||h.push({id:`${s}:${o}:${t.startLineModified}:${a}`,name:a,kind:n.kind,kindLabel:n.label,repoName:e,repoPath:i||(s.includes(`/`)||s.includes(`\\`)?s:void 0),filePath:o,uriString:c,lineNumber:t.startLineModified,column:1,isModifiedInChangeset:!0,changeType:`modified`,hunkIndex:t.hunkIndex,hunkId:t.id});break}}}if(r&&r.length>0){for(let e of r)if(e.enclosingDeclaration)for(let t of h)e.enclosingDeclaration.includes(t.name)&&!t.isModifiedInChangeset&&(t.isModifiedInChangeset=!0,t.changeType=`modified`,t.hunkIndex=e.hunkIndex,t.hunkId=e.id)}return this.symbols=[...l,...h],this.rebuildMap(),this.notify(),h}rebuildMap(){this.symbolMap.clear();for(let e of this.symbols){let t=this.symbolMap.get(e.name)||[];t.push(e),this.symbolMap.set(e.name,t)}}getAllSymbols(){return this.symbols}getModifiedSymbols(){return this.symbols.filter(e=>e.isModifiedInChangeset)}findDefinitions(e){return this.symbolMap.get(e)||[]}findSymbolsInFile(e){let t=e.replace(/\\/g,`/`).replace(/^\//,``);return this.symbols.filter(e=>e.filePath===t)}};function jC(e=AC){return(0,V.useSyncExternalStore)(t=>e.subscribe(t),()=>e.getAllSymbols(),()=>[])}function MC(e,t){let n=[];for(let r of e){if(r.uri.scheme!==`file`)continue;let e=r.findMatches(t,!0,!1,!0,` \`~!@#%^&*()-=+[{]}\\|;:'",.<>/?`,!1);for(let t of e)n.push({uri:r.uri,range:t.range})}return n}var NC=!1;function PC(e){let t=e||(typeof window<`u`?window.monaco:void 0);if(!t||NC)return{dispose:()=>{}};let n=[`typescript`,`javascript`,`python`,`rust`,`go`,`csharp`],r=[];for(let e of n)r.push(t.languages.registerDefinitionProvider(e,{provideDefinition(e,n){let r=e.getWordAtPosition(n);if(!r)return null;let i=r.word,a=AC.findDefinitions(i);return a.length===0?null:a.map(e=>({uri:yC(e.repoName,e.filePath,t),range:{startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column+e.name.length}}))}})),r.push(t.languages.registerReferenceProvider(e,{provideReferences(e,n){let r=e.getWordAtPosition(n);return r?MC(t.editor.getModels(),r.word):null}})),r.push(t.languages.registerDocumentSymbolProvider(e,{provideDocumentSymbols(e){let t=e.uri.toString();return AC.getAllSymbols().filter(e=>e.uriString===t).map(e=>({name:e.name,detail:e.kindLabel,kind:e.kind,tags:[],range:{startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column+e.name.length},selectionRange:{startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column+e.name.length}}))}}));return NC=!0,{dispose(){r.forEach(e=>e.dispose()),NC=!1}}}var FC=[{id:`all`,label:`All`,short:`All`},{id:`modified`,label:`Modified Only`,short:`Mod`},{id:`function`,label:`Functions`,short:`fn`},{id:`method`,label:`Methods`,short:`meth`},{id:`constructor`,label:`Constructors`,short:`ctor`},{id:`class`,label:`Classes`,short:`cls`},{id:`interface`,label:`Interfaces`,short:`iface`},{id:`type`,label:`Types`,short:`type`},{id:`enum`,label:`Enums`,short:`enum`},{id:`property`,label:`Properties`,short:`prop`},{id:`variable`,label:`Variables`,short:`var`}],IC=e=>e.kind===CC.Constructor||e.kindLabel===`constructor`?`constructor`:e.kind===CC.Method||e.kindLabel===`method`?`method`:e.kind===CC.Property||e.kindLabel===`property`?`property`:e.kindLabel,LC=e=>{let t=IC(e);switch(t){case`constructor`:return`[CTOR]`;case`method`:return`[METH]`;case`function`:return`[FUNC]`;case`class`:return`[CLAS]`;case`interface`:return`[IFAC]`;case`type`:return`[TYPE]`;case`enum`:return`[ENUM]`;case`property`:return`[PROP]`;case`variable`:return`[VAR]`;default:return`[${String(t).slice(0,4).toUpperCase()}]`}},RC=e=>{switch(IC(e)){case`constructor`:return`border-orange-500/40 bg-orange-500/15 text-orange-400`;case`method`:return`border-cyan-500/40 bg-cyan-500/15 text-cyan-400`;case`function`:return`border-emerald-500/40 bg-emerald-500/15 text-emerald-400`;case`class`:return`border-purple-500/40 bg-purple-500/15 text-purple-400`;case`interface`:return`border-sky-500/40 bg-sky-500/15 text-sky-400`;case`type`:return`border-amber-500/40 bg-amber-500/15 text-amber-400`;case`enum`:return`border-pink-500/40 bg-pink-500/15 text-pink-400`;case`property`:return`border-teal-500/40 bg-teal-500/15 text-teal-400`;case`variable`:return`border-slate-500/40 bg-slate-500/15 text-slate-400`;default:return`border-border bg-muted text-muted-foreground`}},zC=({symbols:e,activeFilePath:t,activeLine:n,editorLabel:r=`VS Code`,onSelectSymbol:i,onOpenInVsCode:a,onClose:o,className:s})=>{let[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(`all`),f=(0,V.useMemo)(()=>{let t=e;if(u===`modified`?t=t.filter(e=>e.isModifiedInChangeset):u!==`all`&&(t=t.filter(e=>IC(e)===u)),c.trim()){let e=c.toLowerCase();t=t.filter(t=>t.name.toLowerCase().includes(e)||t.filePath.toLowerCase().includes(e)||t.kindLabel.toLowerCase().includes(e)||IC(t).toLowerCase().includes(e))}return t.sort((e,t)=>e.isModifiedInChangeset===t.isModifiedInChangeset?e.filePath===t.filePath?e.lineNumber-t.lineNumber:e.filePath.localeCompare(t.filePath):e.isModifiedInChangeset?-1:1)},[e,u,c]),p=(0,V.useMemo)(()=>{let t={all:e.length,modified:e.filter(e=>e.isModifiedInChangeset).length};for(let n of e){let e=IC(n);t[e]=(t[e]||0)+1}return t},[e]);return(0,H.jsxs)(`div`,{className:B(`flex flex-col rounded-xl border border-border/90 bg-card/95 backdrop-blur-md shadow-lg overflow-hidden text-xs`,s),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2.5 border-b border-border/70 bg-muted/25`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(Ar,{size:14,className:`text-primary shrink-0`}),(0,H.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:`Changeset Symbols`}),(0,H.jsxs)(`span`,{className:`rounded-full bg-primary/10 border border-primary/20 px-1.5 py-0.2 font-mono text-[10px] text-primary font-semibold`,children:[f.length,` / `,e.length]})]}),o&&(0,H.jsx)(`button`,{type:`button`,onClick:o,className:`p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors cursor-pointer`,title:`Close Symbol Navigator`,children:(0,H.jsx)(Ei,{size:13})})]}),(0,H.jsxs)(`div`,{className:`p-2 space-y-2 border-b border-border/60 bg-background/50`,children:[(0,H.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,H.jsx)(Ct,{size:13,className:`absolute left-2.5 text-muted-foreground pointer-events-none`}),(0,H.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:`Search functions, classes, types, files...`,className:`w-full rounded-lg border border-border bg-background/90 pl-8 pr-7 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-primary`}),c&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(``),className:`absolute right-2 text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(Ei,{size:12})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 overflow-x-auto pb-0.5 scrollbar-none select-none`,children:[(0,H.jsx)(Rr,{size:11,className:`text-muted-foreground shrink-0 ml-0.5 mr-0.5`}),FC.map(e=>{let t=p[e.id]||0,n=u===e.id;return e.id!==`all`&&e.id!==`modified`&&t===0?null:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),className:B(`inline-flex items-center gap-1 px-2 py-0.5 rounded-md font-mono text-[10px] transition-colors cursor-pointer shrink-0 border`,n?`border-primary/50 bg-primary/15 text-primary font-bold`:`border-border/60 bg-card hover:bg-accent text-muted-foreground hover:text-foreground`),children:[(0,H.jsx)(`span`,{children:e.label}),(0,H.jsxs)(`span`,{className:`text-[9px] opacity-70`,children:[`(`,t,`)`]})]},e.id)})]})]}),(0,H.jsx)(`div`,{className:`max-h-64 overflow-y-auto divide-y divide-border/40 scrollbar-thin`,children:e.length===0?(0,H.jsxs)(`div`,{className:`py-8 px-4 text-center text-muted-foreground`,children:[(0,H.jsx)(`p`,{className:`font-mono text-xs font-semibold text-foreground`,children:`No code symbols detected in this changeset`}),(0,H.jsx)(`p`,{className:`text-[11px] mt-1.5 max-w-sm mx-auto text-muted-foreground/80 leading-relaxed`,children:`Symbols (functions, classes, interfaces, types, enums, variables) are automatically extracted from modified code files in supported languages (TypeScript, JavaScript, Python, Go, Rust).`})]}):f.length===0?(0,H.jsxs)(`div`,{className:`py-8 text-center text-muted-foreground`,children:[(0,H.jsxs)(`p`,{className:`font-mono text-xs`,children:[`No symbols match "`,c||u,`"`]}),(0,H.jsx)(`p`,{className:`text-[10px] mt-1 text-muted-foreground/70`,children:`Try searching by name or selecting "All"`})]}):f.map(e=>{let o=t&&e.filePath.endsWith(t)&&n===e.lineNumber;return(0,H.jsxs)(`div`,{onClick:()=>i(e),className:B(`group flex items-center justify-between gap-2 px-3 py-2 cursor-pointer transition-colors`,o?`bg-primary/15 border-l-2 border-l-primary`:`hover:bg-accent/50`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:B(`px-1.5 py-0.2 rounded font-mono text-[9px] font-bold border uppercase shrink-0`,RC(e)),children:LC(e)}),(0,H.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground truncate group-hover:text-primary transition-colors`,children:e.name}),e.isModifiedInChangeset&&(0,H.jsx)(`span`,{className:B(`px-1 py-0.2 rounded font-mono text-[9px] font-bold border shrink-0`,e.changeType===`added`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`:`border-amber-500/30 bg-amber-500/10 text-amber-400`),title:e.changeType===`added`?`Added in this changeset`:`Modified in this changeset`,children:e.changeType===`added`?`+add`:`~mod`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 font-mono text-[10px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[150px] text-muted-foreground/80`,title:e.filePath,children:e.filePath.split(`/`).pop()}),(0,H.jsxs)(`span`,{className:`text-foreground/70`,children:[`:`,e.lineNumber]}),e.hunkIndex!==void 0&&(0,H.jsxs)(`span`,{className:`bg-muted px-1 rounded text-[9px] border border-border/40`,children:[`H#`,e.hunkIndex+1]}),o&&(0,H.jsx)(Or,{size:12,className:`text-primary shrink-0`}),a&&(0,H.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a(e)},className:`p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent opacity-0 group-hover:opacity-100 transition-opacity`,title:`Open symbol definition in desktop ${r}`,children:(0,H.jsx)(Bn,{size:11})})]})]},e.id)})})]})},BC=(0,V.lazy)(()=>Kn(()=>import(`./MonacoDiffAdapter-DHYIkG2a.js`).then(e=>({default:e.MonacoDiffAdapter})),__vite__mapDeps([0,1,2,3,4]))),VC=({filePath:e,repoName:t,repoPath:n=``,patchText:r,fullFileContent:i,fullOriginalContent:a,defaultEditor:o,viewMode:s,initialTargetLine:c,changesetSymbols:l,preExtractedSymbols:u,onToggleViewMode:d,showToast:f,onHunkAction:p,onRequestRefine:m,onOpenFile:h,onSelectSymbol:g,onNextFile:_,onPrevFile:v,fillContainer:y=!1})=>{let[b,x]=(0,V.useState)(`side-by-side`),S=s??b,[C,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(`monaco`),[D,ee]=(0,V.useState)(0),[O,k]=(0,V.useState)({}),[A,te]=(0,V.useState)(!1),[j,M]=(0,V.useState)(``),[N,ne]=(0,V.useState)(!1),[re,ie]=(0,V.useState)(c),[P,F]=(0,V.useState)(0),I=uC(o),L=(0,V.useMemo)(()=>sC(r),[r]),ae=L.hunks,R=ae[D]||null,[oe,z]=(0,V.useState)([]);(0,V.useEffect)(()=>{let r=i||L.modifiedContent;z(AC.indexFile(t,e,r,ae,n,u))},[t,e,i,L.modifiedContent,ae,n,u]);let se=(0,V.useRef)(``);(0,V.useEffect)(()=>{if(c&&c>0){let t=`${e}:${c}`;if(se.current===t)return;se.current=t;let n=c;if(!i){let e=cC(c,ae);e!==null&&(n=e)}ie(n),F(e=>e+1);let r=ae.findIndex(e=>c>=e.startLineModified&&c<=e.startLineModified+Math.max(e.lineCountModified,1)-1);r!==-1&&ee(r)}},[c,e,ae,i]);let ce=()=>{d?d():x(e=>e===`side-by-side`?`unified`:`side-by-side`)},le=(0,V.useRef)(null),ue=(0,V.useCallback)(e=>{e>=0&&e<ae.length&&ae[e]&&(ee(e),ie(Math.max(1,ae[e].startLineModified)),F(e=>e+1))},[ae]),de=(0,V.useCallback)(()=>{D<ae.length-1?ue(D+1):_&&_()},[D,ae.length,ue,_]),fe=(0,V.useCallback)(()=>{D>0?ue(D-1):v&&v()},[D,ue,v]),pe=(0,V.useCallback)(async()=>{!R||!p||(await p({...R,type:`accept`}),k(e=>({...e,[R.id]:`accepted`})),f?.(`Accepted hunk #${D+1}`,`success`),de())},[R,D,f,p,de]),me=(0,V.useCallback)(async()=>{!R||!p||(await p({...R,type:`reject`}),k(e=>({...e,[R.id]:`rejected`})),f?.(`Rejected hunk #${D+1}`,`info`),de())},[R,D,f,p,de]),he=()=>{M(``),te(!0)},ge=async()=>{if(!(!R||!j.trim()||!m))try{await m({...R,type:`refine`},j.trim()),te(!1)}catch(e){f?.(e instanceof Error?e.message:`Could not open refinement in chat.`,`error`)}},_e=t=>{let r=e.replace(/\\/g,`/`).replace(/^\//,``);if(t.filePath===r){let r=t.lineNumber;if(!i){let i=cC(t.lineNumber,ae);if(i!==null)r=i;else{f?.(`"${t.name}" is outside diff hunks (line ${t.lineNumber})`,`info`),hC(n,e,t.lineNumber,t.column,o);return}}ie(r),F(e=>e+1);let a=ae.findIndex(e=>t.lineNumber>=e.startLineModified&&t.lineNumber<=e.startLineModified+Math.max(e.lineCountModified,1)-1);a!==-1&&ee(a)}else g?.(t),h?.(t.repoName,t.filePath,t.lineNumber)},ve=(0,V.useCallback)(e=>{let t=ae.findIndex(t=>e>=t.startLineModified&&e<=t.startLineModified+Math.max(t.lineCountModified,1)-1);t!==-1&&t!==D&&ee(t)},[ae,D]);(0,V.useEffect)(()=>{le.current&&le.current.querySelector(`[data-active-tab="true"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})},[D]),(0,V.useEffect)(()=>{let e=e=>{let t=e.target;t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.key===`j`||e.key===`n`?de():e.key===`k`||e.key===`p`?fe():e.key===`a`?pe():e.key===`r`&&me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[de,fe,pe,me]);let ye=l&&l.length>0?l:oe;return(0,H.jsxs)(`div`,{className:B(`flex flex-col overflow-hidden`,y?`h-full w-full min-h-0 bg-background border-0 rounded-none shadow-none my-0`:`rounded-xl border border-border/80 bg-card/60 backdrop-blur-md shadow-sm my-2`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-muted/20 text-xs shrink-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(Ir,{size:13,className:`text-primary shrink-0`}),(0,H.jsx)(`span`,{className:`font-mono text-xs font-semibold text-foreground truncate`,title:e,children:e}),(0,H.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground bg-muted px-1.5 py-0.2 rounded border border-border/40`,children:t}),ae.length>0&&(0,H.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground/80`,children:[ae.length,` `,ae.length===1?`hunk`:`hunks`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>ne(e=>!e),className:B(`inline-flex items-center gap-1 font-mono text-[11px] px-2 py-1 rounded border transition-colors cursor-pointer`,N?`border-primary/50 bg-primary/15 text-primary font-semibold`:`border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground`),title:`Toggle Changeset Symbol Navigator`,children:[(0,H.jsx)(Gr,{size:12}),(0,H.jsx)(`span`,{children:`Symbols`}),ye.length>0&&(0,H.jsxs)(`span`,{className:`text-[10px] opacity-75`,children:[`(`,ye.length,`)`]})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:ce,className:`inline-flex items-center gap-1 font-mono text-[11px] px-2 py-1 rounded border border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Toggle between Side-by-Side and Unified Diff view`,children:[(0,H.jsx)(jr,{size:12}),(0,H.jsx)(`span`,{children:S===`side-by-side`?`Split`:`Unified`})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>!e),className:B(`font-mono text-[11px] px-2 py-1 rounded border transition-colors cursor-pointer`,C?`border-primary/40 bg-primary/10 text-primary font-semibold`:`border-border bg-card/60 text-muted-foreground hover:bg-accent hover:text-foreground`),title:`Ignore whitespace changes in diff comparison`,children:[`Trim WS: `,C?`ON`:`OFF`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>e===`monaco`?`fallback`:`monaco`),className:`inline-flex items-center gap-1 font-mono text-[11px] px-2 py-1 rounded border border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Toggle between Monaco Diff Editor and Lightweight Fallback`,children:[(0,H.jsx)(Ar,{size:12}),(0,H.jsx)(`span`,{children:T===`monaco`?`Monaco`:`Fallback`})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:async()=>{await mC(n,e,o)?f?.(`Opened ${e} in ${I} diff`,`success`):(hC(n,e,1,1,o),f?.(`Opened ${e} in ${I}`,`info`))},className:`inline-flex items-center gap-1 font-mono text-[11px] px-2 py-1 rounded border border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Open file in desktop ${I} Diff`,children:[(0,H.jsx)(Bn,{size:12}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:I})]})]})]}),ae.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1.5 px-3 py-1.5 border-b border-border/60 bg-muted/15 text-xs select-none`,children:[(0,H.jsxs)(`div`,{ref:le,role:`tablist`,"aria-label":`Change sections`,className:`flex items-center gap-1 min-w-[130px] flex-1 overflow-x-auto py-0.5`,children:[(0,H.jsxs)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mr-1 shrink-0`,children:[`Changes (`,ae.length,`):`]}),ae.map((e,t)=>{let n=e.lines?e.lines.filter(e=>e.startsWith(`+`)&&!e.startsWith(`+++`)).length:0,r=e.lines?e.lines.filter(e=>e.startsWith(`-`)&&!e.startsWith(`---`)).length:0,i=t===D;return(0,H.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i,"data-active-tab":i?`true`:void 0,onClick:()=>ue(t),className:B(`px-2 py-0.5 rounded text-[11px] font-mono transition-colors cursor-pointer border whitespace-nowrap shrink-0`,i?`bg-primary text-primary-foreground border-primary font-semibold shadow-xs`:`bg-card/70 text-muted-foreground hover:text-foreground hover:bg-accent border-border/60`),title:`Jump to change section #${t+1}: line ${e.startLineModified}${e.enclosingDeclaration?` (${e.enclosingDeclaration})`:``}`,children:[(0,H.jsxs)(`span`,{children:[`Section `,t+1]}),(n>0||r>0)&&(0,H.jsxs)(`span`,{className:`ml-1 text-[9px] opacity-80`,children:[n>0&&(0,H.jsxs)(`span`,{className:`text-emerald-300`,children:[`+`,n]}),r>0&&(0,H.jsxs)(`span`,{className:`text-rose-300`,children:[`-`,r]})]})]},e.id)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 ml-auto`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:D<=0&&!v,onClick:fe,className:`inline-flex items-center gap-0.5 px-2 py-0.5 rounded text-[11px] font-mono border border-border bg-card/60 hover:bg-accent disabled:opacity-35 transition-colors cursor-pointer`,title:D<=0&&v?`Previous file`:`Previous change section (k / p)`,"aria-label":D<=0&&v?`Previous file`:`Previous section`,children:[(0,H.jsx)(Tr,{size:12}),(0,H.jsx)(`span`,{children:D<=0&&v?`Prev File`:`Prev`})]}),(0,H.jsxs)(`button`,{type:`button`,disabled:D>=ae.length-1&&!_,onClick:de,className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded text-[11px] font-mono font-medium border border-primary/50 bg-primary/15 text-primary hover:bg-primary/25 disabled:opacity-35 transition-colors cursor-pointer shadow-2xs`,title:D>=ae.length-1&&_?`Next file`:`Next change section (j / n)`,"aria-label":D>=ae.length-1&&_?`Next file`:`Next section`,children:[(0,H.jsx)(`span`,{children:D>=ae.length-1&&_?`Next File`:`Next Section`}),(0,H.jsx)(Er,{size:12})]})]})]}),N&&(0,H.jsx)(`div`,{className:`p-3 border-b border-border/70 bg-muted/20 shrink-0`,children:(0,H.jsx)(zC,{symbols:ye,activeFilePath:e,activeLine:re||(R?R.startLineModified:void 0),editorLabel:I,onSelectSymbol:_e,onOpenInVsCode:e=>{hC(n,e.filePath,e.lineNumber,e.column,o),f?.(`Opened ${e.filePath}:${e.lineNumber} in ${I}`,`success`)},onClose:()=>ne(!1)})}),(0,H.jsx)(`div`,{className:B(`bg-background/50`,y?`flex-1 min-h-0 p-1 flex flex-col`:`p-2`),children:T===`monaco`?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`div`,{role:`status`,className:`p-4 text-xs text-muted-foreground`,children:`Loading diff editor…`}),children:(0,H.jsx)(BC,{filePath:e,repoName:t,repoPath:n,originalContent:a||L.originalContent,modifiedContent:i||L.modifiedContent,patchText:r,viewMode:S,ignoreWhitespace:C,height:y?`100%`:460,targetLine:re,jumpNonce:P,onOpenFile:h,onLineSelect:ve})}):(0,H.jsx)(lC,{filePath:e,repoPath:n,originalContent:a||L.originalContent,modifiedContent:i||L.modifiedContent,patchText:r,viewMode:S,ignoreWhitespace:C,targetLine:re,jumpNonce:P})}),ae.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 py-2 border-t border-border/60 bg-muted/15 text-xs select-none`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-[11px]`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:D<=0,onClick:fe,className:`p-1 rounded border border-border bg-card/60 hover:bg-accent disabled:opacity-35 transition-colors cursor-pointer`,title:`Previous hunk (Shortcut: k)`,children:(0,H.jsx)(Tr,{size:13})}),(0,H.jsxs)(`span`,{className:`px-1.5 text-muted-foreground`,children:[`Hunk `,(0,H.jsx)(`strong`,{className:`text-foreground`,children:D+1}),` of `,ae.length,R&&(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70 ml-1`,children:[`(Orig L`,R.startLineOriginal,` → Mod L`,R.startLineModified,`)`]})]}),(0,H.jsx)(`button`,{type:`button`,disabled:D>=ae.length-1,onClick:de,className:`p-1 rounded border border-border bg-card/60 hover:bg-accent disabled:opacity-35 transition-colors cursor-pointer`,title:`Next hunk (Shortcut: j)`,children:(0,H.jsx)(Er,{size:13})}),R&&O[R.id]&&(0,H.jsx)(`span`,{className:B(`font-mono text-[9px] px-1.5 py-0.5 rounded font-bold uppercase ml-1 border`,O[R.id]===`accepted`?`border-emerald-500/30 bg-emerald-500/15 text-emerald-400`:O[R.id]===`rejected`?`border-rose-500/30 bg-rose-500/15 text-rose-400`:`border-amber-500/30 bg-amber-500/15 text-amber-400`),children:O[R.id]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[R&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{hC(n,e,R.startLineModified,1,o),f?.(`Opened ${e}:${R.startLineModified} in ${I}`,`success`)},className:`inline-flex items-center gap-1 font-mono text-[10px] px-2 py-1 rounded border border-border bg-card/60 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:`Open in desktop ${I} at modified line ${R.startLineModified}`,children:[(0,H.jsx)(Bn,{size:11}),(0,H.jsxs)(`span`,{children:[I,` :L`,R.startLineModified]})]}),p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void pe(),className:`inline-flex items-center gap-1 px-2.5 py-1 rounded text-xs font-semibold bg-emerald-500/15 hover:bg-emerald-500/25 text-emerald-400 border border-emerald-500/30 transition-colors cursor-pointer shadow-2xs`,title:`Accept this hunk (Shortcut: a)`,children:[(0,H.jsx)(wr,{size:12}),(0,H.jsx)(`span`,{children:`Accept (a)`})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>void me(),className:`inline-flex items-center gap-1 px-2.5 py-1 rounded text-xs font-semibold bg-rose-500/15 hover:bg-rose-500/25 text-rose-400 border border-rose-500/30 transition-colors cursor-pointer shadow-2xs`,title:`Reject this hunk (Shortcut: r)`,children:[(0,H.jsx)(Ei,{size:12}),(0,H.jsx)(`span`,{children:`Reject (r)`})]})]}),m&&(0,H.jsxs)(`button`,{type:`button`,onClick:he,className:`inline-flex items-center gap-1 px-2.5 py-1 rounded text-xs font-semibold bg-amber-500/15 hover:bg-amber-500/25 text-amber-400 border border-amber-500/30 transition-colors cursor-pointer shadow-2xs`,title:`Prepare refinement instructions in AI chat`,children:[(0,H.jsx)(li,{size:11}),(0,H.jsx)(`span`,{children:`Refine`})]})]})]}),A&&(0,H.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs p-4 animate-in fade-in`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-card p-4 shadow-2xl space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Xr,{size:16,className:`text-primary`}),(0,H.jsxs)(`h3`,{className:`text-xs font-bold text-foreground`,children:[`Request Refinement for Hunk #`,D+1]})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>te(!1),className:`p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent`,children:(0,H.jsx)(Ei,{size:14})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Add instructions for this hunk. They will open as a draft in AI chat for you to send:`}),(0,H.jsx)(`textarea`,{value:j,onChange:e=>M(e.target.value),placeholder:`e.g. Ensure null safety when calculating vacation debt...`,rows:3,autoFocus:!0,className:`w-full rounded-lg border border-border bg-background px-3 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-primary resize-none`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-2 border-t border-border/60`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>te(!1),className:`px-3 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg`,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,disabled:!j.trim(),onClick:()=>void ge(),className:`px-3 py-1 text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 disabled:opacity-50 rounded-lg transition-colors`,children:`Open in AI chat`})]})]})})]})};function HC(e,t){let n=e.replaceAll(`\\`,`/`).replace(/^\.\//,``),r=n.startsWith(`/`)||/^[a-z]:\//i.test(n),i=/^[a-z]:\//i.test(n)||n.startsWith(`//`),a=[];for(let e of t)for(let t of e.files){let o=t.file.replaceAll(`\\`,`/`),s=`${e.repoName}/${o}`,c=`${e.repoPath.replaceAll(`\\`,`/`).replace(/\/$/,``)}/${o}`;(r?i?c.toLowerCase()===n.toLowerCase():c===n:n===o||n===s||o.endsWith(`/${n}`))&&a.push({repoName:e.repoName,repoPath:e.repoPath,file:t.file})}return a.length===1?{file:a[0]}:{error:a.length?`“${e}” matches more than one workspace file. Select it from the Files tree.`:`“${e}” is not in this workspace's file tree.`}}function UC({workspace:e,active:t,openReference:n,onClose:r}){let[i,a]=(0,V.useState)(`changes`),[o,s]=(0,V.useState)([]),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(``),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(0),[S,C]=(0,V.useState)(!1),w=(0,V.useRef)(0),T=(0,V.useRef)(null),E=(0,V.useRef)(``),D=`/api/workspace/${encodeURIComponent(e)}`;(0,V.useEffect)(()=>{n&&n.id!==w.current&&a(`files`)},[n]),(0,V.useEffect)(()=>{if(!t)return;let e=window.setInterval(()=>x(e=>e+1),1e4);return()=>window.clearInterval(e)},[t]),(0,V.useEffect)(()=>{if(!t)return;let e=!1;return y(!0),p(``),sr(`${D}/changes${i===`files`?`?include=all`:``}`).then(t=>{if(!e){if(s(e=>JSON.stringify(e)===JSON.stringify(t.changes)?e:t.changes),i===`files`&&n&&n.id!==w.current){w.current=n.id;let e=HC(n.path,t.changes);_(e.error??``),d(null),E.current=``,l(e.file?{...e.file,line:n.line}:null)}else l(e=>e&&t.changes.some(t=>t.repoName===e.repoName&&t.files.some(t=>t.file===e.file))?e:null)}}).catch(t=>{e||p(t.message)}).finally(()=>{e||y(!1)}),()=>{e=!0}},[D,i,b,t,n]),(0,V.useEffect)(()=>{if(!t||!c){d(null);return}let e=!1;h(``);let n=new URLSearchParams({repo:c.repoName,file:c.file});return sr(`${D}/changes/diff?${n}`).then(t=>{e||d(e=>e&&e.diff===t.diff&&e.fileContent===t.fileContent&&e.originalContent===t.originalContent?e:t)}).catch(t=>{e||h(t.message)}),()=>{e=!0}},[D,c,b,t]),(0,V.useEffect)(()=>{if(!c?.line||!u||u.diff||!T.current)return;let e=`${c.repoName}/${c.file}:${c.line}`;if(E.current===e)return;E.current=e;let t=Number.parseFloat(getComputedStyle(T.current).lineHeight)||16;T.current.parentElement?.scrollTo({top:Math.max(0,(c.line-1)*t-32)})},[c,u]);let ee=(0,V.useMemo)(()=>o.flatMap(e=>e.files.map(t=>({repoName:e.repoName,repoPath:e.repoPath,file:t.file}))),[o]),O=(0,V.useMemo)(()=>c?ee.findIndex(e=>e.repoName===c.repoName&&e.file===c.file):-1,[ee,c]),k=(0,V.useCallback)(()=>{if(O>=0&&O<ee.length-1){let e=ee[O+1];e&&(_(``),d(null),E.current=``,l(e))}},[O,ee]),A=(0,V.useCallback)(()=>{if(O>0){let e=ee[O-1];e&&(_(``),d(null),E.current=``,l(e))}},[O,ee]);return(0,H.jsxs)(`section`,{"aria-label":`Workspace code`,className:`flex h-full min-h-0 min-w-0 flex-col bg-background overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border p-2 bg-muted/20 shrink-0`,children:[(0,H.jsx)(`span`,{className:`mr-1 text-[11px] font-semibold text-foreground shrink-0`,children:`ContextSpace code`}),(0,H.jsx)(yn,{size:`xs`,variant:i===`changes`?`secondary`:`ghost`,"aria-pressed":i===`changes`,onClick:()=>a(`changes`),children:`Changes`}),(0,H.jsx)(yn,{size:`xs`,variant:i===`files`?`secondary`:`ghost`,"aria-pressed":i===`files`,onClick:()=>a(`files`),children:`Files`}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,"aria-label":`Refresh code`,onClick:()=>x(e=>e+1),disabled:v,children:(0,H.jsx)(li,{className:B(`size-3`,v&&`animate-spin`)})}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,className:`p-1 size-6 shrink-0`,title:S?`Show file tree sidebar`:`Hide file tree sidebar`,"aria-label":S?`Show file tree sidebar`:`Hide file tree sidebar`,onClick:()=>C(e=>!e),children:S?(0,H.jsx)(ri,{className:`size-3.5 text-muted-foreground`}):(0,H.jsx)(ti,{className:`size-3.5 text-muted-foreground`})}),(0,H.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-mono shrink-0`,children:v?`Refreshing…`:`${o.reduce((e,t)=>e+t.files.length,0)} files`}),r&&(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,className:`p-1 size-6 shrink-0 ml-1`,title:`Close code panel`,onClick:r,children:(0,H.jsx)(Ei,{className:`size-3.5 text-muted-foreground`})})]}),f&&(0,H.jsxs)(`p`,{role:`alert`,className:`p-2 text-xs text-destructive shrink-0 border-b border-border`,children:[f,` `,(0,H.jsx)(`button`,{className:`underline`,onClick:()=>x(e=>e+1),children:`Retry`})]}),g&&(0,H.jsx)(`p`,{role:`alert`,className:`p-2 text-xs text-destructive shrink-0 border-b border-border`,children:g}),(0,H.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 flex flex-row overflow-hidden`,children:[(0,H.jsx)(`aside`,{className:B(`flex flex-col border-r border-border shrink-0 bg-muted/10 overflow-hidden select-text`,S?`w-0 border-r-0`:`w-[32%] min-w-[115px] max-w-[240px] transition-[width] duration-150`),children:(0,H.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-2`,children:[o.map(e=>(0,H.jsxs)(`details`,{open:!0,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer py-1 text-xs font-semibold select-none`,children:e.repoName}),e.error?(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:e.error}):(0,H.jsx)(aC,{label:`${e.repoName} ${i}`,files:e.files,revealPath:c?.repoName===e.repoName?c.file:void 0,renderFile:t=>(0,H.jsxs)(`button`,{className:B(`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-accent transition-colors cursor-pointer`,c?.repoName===e.repoName&&c.file===t.file&&`bg-accent font-medium text-foreground`),"aria-pressed":c?.repoName===e.repoName&&c.file===t.file,title:t.file,onClick:()=>{c?.repoName===e.repoName&&c.file===t.file&&!c.line||(_(``),d(null),E.current=``,l({repoName:e.repoName,repoPath:e.repoPath,file:t.file}))},children:[(0,H.jsx)(Fr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate`,children:t.file.split(`/`).at(-1)}),t.type!==`unchanged`&&(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] text-muted-foreground font-mono`,children:t.type})]})})]},e.repoName)),!v&&!f&&!o.some(e=>e.files.length||e.error)&&(0,H.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:i===`changes`?`No uncommitted changes.`:`No repository files.`})]})}),(0,H.jsxs)(`main`,{className:`flex-1 min-w-0 min-h-0 flex flex-col bg-background overflow-hidden select-text`,children:[c?(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/10 px-2 py-1 shrink-0`,children:[(0,H.jsxs)(`p`,{className:`break-all font-mono text-xs font-semibold text-foreground`,children:[c.repoName,`/`,c.file,c.line?`:${c.line}`:``]}),i===`changes`&&ee.length>1&&(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 ml-2`,children:[(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,disabled:O<=0,onClick:A,title:`Previous changed file`,className:`h-5 px-1 text-[10px]`,children:(0,H.jsx)(Tr,{className:`size-3`})}),(0,H.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[O+1,`/`,ee.length]}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,disabled:O>=ee.length-1,onClick:k,title:`Next changed file`,className:`h-5 px-1 text-[10px]`,children:(0,H.jsx)(Er,{className:`size-3`})})]})]}):(0,H.jsx)(`div`,{className:`border-b border-border bg-muted/10 p-2 shrink-0`,children:(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Select a file`})}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden`,children:c?m?(0,H.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-destructive`,children:[m,` `,(0,H.jsx)(`button`,{className:`underline`,onClick:()=>x(e=>e+1),children:`Retry`})]}):u?u.diff?(0,H.jsx)(oC,{children:(0,H.jsx)(VC,{filePath:c.file,repoName:c.repoName,repoPath:c.repoPath,patchText:u.diff,fullFileContent:u.fileContent,fullOriginalContent:u.originalContent,initialTargetLine:c.line,viewMode:`unified`,fillContainer:!0,onNextFile:k,onPrevFile:A})},`${e}/${c.repoName}/${c.file}`):(0,H.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`px-3 py-1 border-b border-border/40 bg-muted/10 text-[11px] text-muted-foreground flex items-center justify-between shrink-0`,children:[(0,H.jsx)(`span`,{children:`Clean file (no uncommitted diff)`}),c.line&&(0,H.jsxs)(`span`,{className:`font-mono text-primary font-medium`,children:[`Line `,c.line]})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,H.jsx)(`pre`,{ref:T,className:`p-3 font-mono text-xs whitespace-pre leading-relaxed select-text`,children:u.fileContent||`Empty file or no text content.`})})]}):(0,H.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-muted-foreground`,children:`Loading file…`}):(0,H.jsxs)(`div`,{className:`h-full flex flex-col items-center justify-center p-6 text-center text-muted-foreground gap-2`,children:[(0,H.jsx)(Fr,{className:`size-8 opacity-35`}),(0,H.jsx)(`p`,{className:`p-3 text-xs text-muted-foreground`,children:`Select a file to inspect its code and changes alongside the CLI chat.`})]})})]})]})]})}var WC=Object.defineProperty,GC=Object.getOwnPropertyDescriptor,KC=(e,t)=>{for(var n in t)WC(e,n,{get:t[n],enumerable:!0})},qC=(e,t,n,r)=>{for(var i=r>1?void 0:r?GC(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&WC(t,n,i),i},JC=(e,t)=>(n,r)=>t(n,r,e),YC=`Terminal input`,XC={get:()=>YC,set:e=>YC=e},ZC=`Too much output to announce, navigate to rows manually to read`,QC={get:()=>ZC,set:e=>ZC=e};function $C(e){return e.replace(/\r?\n/g,`\r`)}function ew(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function tw(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function nw(e,t,n,r){e.stopPropagation(),e.clipboardData&&rw(e.clipboardData.getData(`text/plain`),t,n,r)}function rw(e,t,n,r){e=$C(e),e=ew(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function iw(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function aw(e,t,n,r,i){iw(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ow(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function sw(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var cw=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},lw=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},uw=``,dw=` `,fw=class e{constructor(){this.fg=0,this.bg=0,this.extended=new pw}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},pw=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},mw=class e extends fw{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pw,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ow(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},hw=`di$target`,gw=`di$dependencies`,_w=new Map;function vw(e){return e[gw]||[]}function yw(e){if(_w.has(e))return _w.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);bw(t,e,r)};return t._id=e,_w.set(e,t),t}function bw(e,t,n){t[hw]===t?t[gw].push({id:e,index:n}):(t[gw]=[{id:e,index:n}],t[hw]=t)}var xw=yw(`BufferService`),Sw=yw(`CoreMouseService`),Cw=yw(`CoreService`),ww=yw(`CharsetService`),Tw=yw(`InstantiationService`),Ew=yw(`LogService`),Dw=yw(`OptionsService`),Ow=yw(`OscLinkService`),kw=yw(`UnicodeService`),Aw=yw(`DecorationService`),jw=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new mw,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Mw(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};jw=qC([JC(0,xw),JC(1,Dw),JC(2,Ow)],jw);function Mw(e,t){if(confirm(`Do you want to navigate to ${t}?
43
-
44
- WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Nw=yw(`CharSizeService`),Pw=yw(`CoreBrowserService`),Fw=yw(`MouseService`),Iw=yw(`RenderService`),Lw=yw(`SelectionService`),Rw=yw(`CharacterJoinerService`),zw=yw(`ThemeService`),Bw=yw(`LinkProviderService`),Vw=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?qw.isErrorNoTelemetry(e)?new qw(e.message+`
45
-
46
- `+e.stack):Error(e.message+`
47
-
48
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Hw(e){Ww(e)||Vw.onUnexpectedError(e)}var Uw=`Canceled`;function Ww(e){return e instanceof Gw||e instanceof Error&&e.name===Uw&&e.message===Uw}var Gw=class extends Error{constructor(){super(Uw),this.name=this.message}};function Kw(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var qw=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Jw=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Yw(e,t=0){return e[e.length-(1+t)]}var Xw;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Xw||={});var Zw=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Xw.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Zw.empty=new Zw(e=>{});function Qw(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var $w;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})($w||={});var eT=null;function tT(e){return eT?.trackDisposable(e),e}function nT(e){eT?.markAsDisposed(e)}function rT(e,t){eT?.setParent(e,t)}function iT(e){return eT?.markAsSingleton(e),e}function aT(e){if($w.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function oT(...e){return sT(()=>aT(e))}function sT(e){let t=tT({dispose:Qw(()=>{nT(t),e()})});return t}var cT=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,tT(this)}dispose(){this._isDisposed||(nT(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{aT(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return rT(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),rT(e,null))}};cT.DISABLE_DISPOSED_WARNING=!1;var lT=cT,uT=class{constructor(){this._store=new lT,tT(this),rT(this._store,this)}dispose(){nT(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};uT.None=Object.freeze({dispose(){}});var dT=class{constructor(){this._isDisposed=!1,tT(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&rT(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,nT(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&rT(e,null),e}},fT=typeof window==`object`?window:globalThis,pT=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};pT.Undefined=new pT(void 0);var mT=pT,hT=class{constructor(){this._first=mT.Undefined,this._last=mT.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===mT.Undefined}clear(){let e=this._first;for(;e!==mT.Undefined;){let t=e.next;e.prev=mT.Undefined,e.next=mT.Undefined,e=t}this._first=mT.Undefined,this._last=mT.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new mT(e);if(this._first===mT.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==mT.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mT.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mT.Undefined&&e.next!==mT.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mT.Undefined&&e.next===mT.Undefined?(this._first=mT.Undefined,this._last=mT.Undefined):e.next===mT.Undefined?(this._last=this._last.prev,this._last.next=mT.Undefined):e.prev===mT.Undefined&&(this._first=this._first.next,this._first.prev=mT.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==mT.Undefined;)yield e.element,e=e.next}},gT=globalThis.performance&&typeof globalThis.performance.now==`function`,_T=class e{static create(t){return new e(t)}constructor(e){this._now=gT&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},vT;(e=>{e.None=()=>uT.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(oT(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Q({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Q({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Q(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof lT?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(vT||={});var yT=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new _T,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yT.all=new Set,yT._idPool=0;var bT=yT,xT=-1,ST=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new TT(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};ST._idPool=1;var CT=ST,wT=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
49
- `).slice(2).join(`
50
- `))}},TT=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},ET=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},DT=0,OT=class{constructor(e){this.value=e,this.id=DT++}},kT=2,Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=xT>0||this._options?.leakWarningThreshold?new CT(e?.onListenerError??Hw,this._options?.leakWarningThreshold??xT):void 0,this._perfMon=this._options?._profName?new bT(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new ET(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Hw)(n),uT.None}if(this._disposed)return uT.None;t&&(e=e.bind(t));let r=new OT(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=wT.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof OT?(this._deliveryQueue??=new AT,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=sT(()=>{i?.(),this._removeListener(r)});return n instanceof lT?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*kT<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Hw;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof OT)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},AT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},jT=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};jT.INSTANCE=new jT;var MT=jT;function NT(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}MT.INSTANCE.onDidChangeZoomLevel;function PT(e){return MT.INSTANCE.getZoomFactor(e)}MT.INSTANCE.onDidChangeFullscreen;var FT=typeof navigator==`object`?navigator.userAgent:``,IT=FT.indexOf(`Firefox`)>=0,LT=FT.indexOf(`AppleWebKit`)>=0,RT=FT.indexOf(`Chrome`)>=0,zT=!RT&&FT.indexOf(`Safari`)>=0;FT.indexOf(`Electron/`),FT.indexOf(`Android`);var BT=!1;if(typeof fT.matchMedia==`function`){let e=fT.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=fT.matchMedia(`(display-mode: fullscreen)`);BT=e.matches,NT(fT,e,({matches:e})=>{BT&&t.matches||(BT=e)})}function VT(){return BT}var HT=`en`,UT=!1,WT=!1,GT=!1,KT=!1,qT=!1,JT=HT,YT,XT=globalThis,ZT;typeof XT.vscode<`u`&&typeof XT.vscode.process<`u`?ZT=XT.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(ZT=process);var QT=typeof ZT?.versions?.electron==`string`&&ZT?.type===`renderer`;if(typeof ZT==`object`){UT=ZT.platform===`win32`,WT=ZT.platform===`darwin`,GT=ZT.platform===`linux`,GT&&ZT.env.SNAP&&ZT.env.SNAP_REVISION,ZT.env.CI||ZT.env.BUILD_ARTIFACTSTAGINGDIRECTORY,JT=HT;let e=ZT.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,JT=t.resolvedLanguage||HT,t.languagePack?.translationsConfigFile}catch{}KT=!0}else typeof navigator==`object`&&!QT?(YT=navigator.userAgent,UT=YT.indexOf(`Windows`)>=0,WT=YT.indexOf(`Macintosh`)>=0,(YT.indexOf(`Macintosh`)>=0||YT.indexOf(`iPad`)>=0||YT.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,GT=YT.indexOf(`Linux`)>=0,YT?.indexOf(`Mobi`),qT=!0,JT=globalThis._VSCODE_NLS_LANGUAGE||HT,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var $T=UT,eE=WT,tE=GT,nE=KT;qT&&typeof XT.importScripts==`function`&&XT.origin;var rE=YT,iE=JT,aE;(e=>{function t(){return iE}e.value=t;function n(){return iE.length===2?iE===`en`:iE.length>=3&&iE[0]===`e`&&iE[1]===`n`&&iE[2]===`-`}e.isDefaultVariant=n;function r(){return iE===`en`}e.isDefault=r})(aE||={});var oE=typeof XT.postMessage==`function`&&!XT.importScripts;(()=>{if(oE){let e=[];XT.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),XT.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var sE=!!(rE&&rE.indexOf(`Chrome`)>=0);rE&&rE.indexOf(`Firefox`),!sE&&rE&&rE.indexOf(`Safari`),rE&&rE.indexOf(`Edg/`),rE&&rE.indexOf(`Android`);var cE=typeof navigator==`object`?navigator:{};nE||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||cE&&cE.clipboard&&cE.clipboard.writeText,nE||cE&&cE.clipboard&&cE.clipboard.readText,nE||VT()||cE.keyboard,`ontouchstart`in fT||cE.maxTouchPoints,fT.PointerEvent&&(`ontouchstart`in fT||navigator.maxTouchPoints);var lE=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},uE=new lE,dE=new lE,fE=new lE,pE=Array(230),mE;(e=>{function t(e){return uE.keyCodeToStr(e)}e.toString=t;function n(e){return uE.strToKeyCode(e)}e.fromString=n;function r(e){return dE.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return fE.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return dE.strToKeyCode(e)||fE.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return uE.keyCodeToStr(e)}e.toElectronAccelerator=o})(mE||={});var hE=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new gE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},gE=class{constructor(e){if(e.length===0)throw Kw(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function _E(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return mE.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(IT)switch(t){case 59:return 85;case 60:if(tE)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(eE)return 57}else if(LT&&(eE&&t===93||!eE&&t===92))return 57;return pE[t]||0}var vE=eE?256:2048,yE=512,bE=1024,xE=eE?2048:256,SE=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=_E(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=vE),this.altKey&&(t|=yE),this.shiftKey&&(t|=bE),this.metaKey&&(t|=xE),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new hE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},CE=new WeakMap;function wE(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var TE=class{static getSameOriginWindowChain(e){let t=CE.get(e);if(!t){t=[],CE.set(e,t);let n=e,r;do r=wE(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},EE=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=TE.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},DE=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(RT){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?IT&&!eE?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=zT&&$T?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?IT&&!eE?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},OE=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kE;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof AE?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vT.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OE})})(kE||={});var AE=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?OE:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},jE=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Jw(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Jw(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},ME=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Jw(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=sT(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var NE;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(NE||={});var PE=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await vT.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};PE.EMPTY=PE.fromArray([]);function FE(e){return IE(e,0)}function IE(e,t){switch(typeof e){case`object`:return e===null?LE(349,t):Array.isArray(e)?BE(e,t):VE(e,t);case`string`:return zE(e,t);case`boolean`:return RE(e,t);case`number`:return LE(e,t);case`undefined`:return LE(937,t);default:return LE(617,t)}}function LE(e,t){return(t<<5)-t+e|0}function RE(e,t){return LE(e?433:863,t)}function zE(e,t){t=LE(149417,t);for(let n=0,r=e.length;n<r;n++)t=LE(e.charCodeAt(n),t);return t}function BE(e,t){return t=LE(104579,t),e.reduce((e,t)=>IE(t,e),t)}function VE(e,t){return t=LE(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=zE(n,t),IE(e[n],t)),t)}var{registerWindow:HE,getWindow:UE,getDocument:WE,getWindows:GE,getWindowsCount:KE,getWindowId:qE,getWindowById:JE,hasWindow:YE,onDidRegisterWindow:XE,onWillUnregisterWindow:ZE,onDidUnregisterWindow:QE}=function(){let e=new Map,t={window:fT,disposables:new lT};e.set(fT.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return uT.None;let a=new lT,o={window:t,disposables:a.add(new lT)};return e.set(t.vscodeWindowId,o),a.add(sT(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(eD(t,lD.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:fT},getDocument(e){return UE(e).document}}}(),$E=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function eD(e,t,n,r){return new $E(e,t,n,r)}function tD(e,t){return function(n){return t(new EE(e,n))}}function nD(e){return function(t){return e(new SE(t))}}var rD=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=tD(UE(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=nD(n)),eD(e,t,i,r)},iD,aD=class extends ME{constructor(e){super(),this.defaultTarget=e&&UE(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},oD=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Hw(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(oD.sort),a.shift().execute();r.set(i,!1)};iD=(t,r,a=0)=>{let o=qE(t),s=new oD(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var sD=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};sD.None=new sD(0,0);function cD(e){let t=e.getBoundingClientRect(),n=UE(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=FE(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(sT(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var lD={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:LT?`webkitAnimationStart`:`animationstart`,ANIMATION_END:LT?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:LT?`webkitAnimationIteration`:`animationiteration`},uD=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=dD(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=dD(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=dD(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=dD(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=dD(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=dD(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=dD(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=dD(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=dD(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=dD(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=dD(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=dD(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=dD(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=dD(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function dD(e){return typeof e==`number`?`${e}px`:e}function fD(e){return new uD(e)}var pD=class{constructor(){this._hooks=new lT,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(sT(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=UE(e)}this._hooks.add(eD(a,lD.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(eD(a,lD.POINTER_UP,e=>this.stopMonitoring(!0)))}};function mD(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var hD;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(hD||={});var gD=class e extends uT{constructor(){super(),this.dispatched=!1,this.targets=new hT,this.ignoreTargets=new hT,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(vT.runAndSubscribe(XE,({window:e,disposables:t})=>{t.add(eD(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(eD(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(eD(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:fT,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=iT(new e),sT(e.INSTANCE.targets.push(t))):uT.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=iT(new e),sT(e.INSTANCE.ignoreTargets.push(t))):uT.None}static isTouchDevice(){return`ontouchstart`in fT||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(hD.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Yw(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yw(s.rollingPageY))<30){let e=this.newGestureEvent(hD.Tap,s.initialTarget);e.pageX=Yw(s.rollingPageX),e.pageY=Yw(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Yw(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yw(s.rollingPageY))<30){let e=this.newGestureEvent(hD.Contextmenu,s.initialTarget);e.pageX=Yw(s.rollingPageX),e.pageY=Yw(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Yw(s.rollingPageX),n=Yw(s.rollingPageY),i=Yw(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(hD.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===hD.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===hD.Change||t.type===hD.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=iD(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(hD.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(hD.Change,i.initialTarget);a.translationX=r.pageX-Yw(i.rollingPageX),a.translationY=r.pageY-Yw(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};gD.SCROLL_FRICTION=-.005,gD.HOLD_DELAY=700,gD.CLEAR_TAP_COUNT_TIME=400,qC([mD],gD,`isTouchDevice`,1);var _D=gD,vD=class extends uT{onclick(e,t){this._register(eD(e,lD.CLICK,n=>t(new EE(UE(e),n))))}onmousedown(e,t){this._register(eD(e,lD.MOUSE_DOWN,n=>t(new EE(UE(e),n))))}onmouseover(e,t){this._register(eD(e,lD.MOUSE_OVER,n=>t(new EE(UE(e),n))))}onmouseleave(e,t){this._register(eD(e,lD.MOUSE_LEAVE,n=>t(new EE(UE(e),n))))}onkeydown(e,t){this._register(eD(e,lD.KEY_DOWN,e=>t(new SE(e))))}onkeyup(e,t){this._register(eD(e,lD.KEY_UP,e=>t(new SE(e))))}oninput(e,t){this._register(eD(e,lD.INPUT,t))}onblur(e,t){this._register(eD(e,lD.BLUR,t))}onfocus(e,t){this._register(eD(e,lD.FOCUS,t))}onchange(e,t){this._register(eD(e,lD.CHANGE,t))}ignoreGesture(e){return _D.ignoreTarget(e)}},yD=11,bD=class extends vD{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=yD+`px`,this.domNode.style.height=yD+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new pD),this._register(rD(this.bgDomNode,lD.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(rD(this.domNode,lD.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new aD),this._pointerdownScheduleRepeatTimer=this._register(new jE)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,UE(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},xD=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},SD=class extends uT{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new xD(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new ED(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=ED.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},CD=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function wD(e,t){let n=t-e;return function(t){return e+n*OD(t)}}function TD(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var ED=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),TD(wD(e,r),wD(i,t),.33)}return wD(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new CD(this.scrollLeft(t),this.scrollTop(t),!1):new CD(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function DD(e){return e**3}function OD(e){return 1-DD(1-e)}var kD=class extends uT{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new jE)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},AD=140,jD=class extends vD{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new kD(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new pD),this._shouldRender=!0,this.domNode=fD(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(eD(this.domNode.domNode,lD.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new bD(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=fD(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(eD(this.slider.domNode,lD.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=cD(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if($T&&a>AD){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},MD=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},ND=class extends jD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new MD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},PD=class extends jD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new MD(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},FD=500,ID=50,LD=!0,RD=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},zD=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(RT){let t=PT(UE(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new RD(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};zD.INSTANCE=new zD;var BD=zD,VD=class extends vD{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=UD(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new PD(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new ND(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=fD(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=fD(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=fD(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new jE),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=aT(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,eE&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new DE(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=aT(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(eD(this._listenOnDomNode,lD.MOUSE_WHEEL,e=>{this._onMouseWheel(new DE(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=BD.INSTANCE;LD&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!eE&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=ID*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=ID*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(LD&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),FD)}},HD=class extends VD{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function UD(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,eE&&(t.className+=` mac`),t}var WD=class extends uT{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new SD({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>iD(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new HD(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(vT.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(sT(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(sT(()=>this._styleElement.remove())),this._register(vT.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
51
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};WD=qC([JC(2,xw),JC(3,Pw),JC(4,Sw),JC(5,zw),JC(6,Dw),JC(7,Iw)],WD);var GD=class extends uT{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(sT(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};GD=qC([JC(1,xw),JC(2,Pw),JC(3,Aw),JC(4,Iw)],GD);var KD=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},qD={full:0,left:0,center:0,right:0},JD={full:0,left:0,center:0,right:0},YD={full:0,left:0,center:0,right:0},XD=class extends uT{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new KD,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(sT(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);JD.full=this._canvas.width,JD.left=e,JD.center=t,JD.right=e,this._refreshDrawHeightConstants(),YD.full=1,YD.left=1,YD.center=1+JD.left,YD.right=1+JD.left+JD.center}_refreshDrawHeightConstants(){qD.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);qD.left=t,qD.center=t,qD.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qD.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qD.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qD.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*qD.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(YD[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-qD[e.position||`full`]/2),JD[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+qD[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};XD=qC([JC(2,xw),JC(3,Aw),JC(4,Iw),JC(5,Dw),JC(6,zw),JC(7,Pw)],XD);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
52
- `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var ZD;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(ZD||={});var QD;(e=>e.ST=`${$.ESC}\\`)(QD||={});var $D=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};$D=qC([JC(2,xw),JC(3,Dw),JC(4,Cw),JC(5,Iw)],$D);var eO=0,tO=0,nO=0,rO=0,iO={css:`#00000000`,rgba:0},aO;(e=>{function t(e,t,n,r){return r===void 0?`#${uO(e)}${uO(t)}${uO(n)}`:`#${uO(e)}${uO(t)}${uO(n)}${uO(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(aO||={});var oO;(e=>{function t(e,t){if(rO=(t.rgba&255)/255,rO===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return eO=a+Math.round((n-a)*rO),tO=o+Math.round((r-o)*rO),nO=s+Math.round((i-s)*rO),{css:aO.toCss(eO,tO,nO),rgba:aO.toRgba(eO,tO,nO)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=lO.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return aO.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[eO,tO,nO]=lO.toChannels(t),{css:aO.toCss(eO,tO,nO),rgba:t}}e.opaque=i;function a(e,t){return rO=Math.round(t*255),[eO,tO,nO]=lO.toChannels(e.rgba),{css:aO.toCss(eO,tO,nO,rO),rgba:aO.toRgba(eO,tO,nO,rO)}}e.opacity=a;function o(e,t){return rO=e.rgba&255,a(e,rO*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(oO||={});var sO;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return eO=parseInt(e.slice(1,2).repeat(2),16),tO=parseInt(e.slice(2,3).repeat(2),16),nO=parseInt(e.slice(3,4).repeat(2),16),aO.toColor(eO,tO,nO);case 5:return eO=parseInt(e.slice(1,2).repeat(2),16),tO=parseInt(e.slice(2,3).repeat(2),16),nO=parseInt(e.slice(3,4).repeat(2),16),rO=parseInt(e.slice(4,5).repeat(2),16),aO.toColor(eO,tO,nO,rO);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return eO=parseInt(r[1]),tO=parseInt(r[2]),nO=parseInt(r[3]),rO=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),aO.toColor(eO,tO,nO,rO);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[eO,tO,nO,rO]=t.getImageData(0,0,1,1).data,rO!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:aO.toRgba(eO,tO,nO,rO),css:e}}e.toColor=r})(sO||={});var cO;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(cO||={});var lO;(e=>{function t(e,t){if(rO=(t&255)/255,rO===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return eO=a+Math.round((n-a)*rO),tO=o+Math.round((r-o)*rO),nO=s+Math.round((i-s)*rO),aO.toRgba(eO,tO,nO)}e.blend=t;function n(e,t,n){let a=cO.relativeLuminance(e>>8),o=cO.relativeLuminance(t>>8);if(dO(a,o)<n){if(o<a){let o=r(e,t,n),s=dO(a,cO.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>dO(a,cO.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=dO(a,cO.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>dO(a,cO.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=dO(cO.relativeLuminance2(o,s,c),cO.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=dO(cO.relativeLuminance2(o,s,c),cO.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=dO(cO.relativeLuminance2(o,s,c),cO.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=dO(cO.relativeLuminance2(o,s,c),cO.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(lO||={});function uO(e){let t=e.toString(16);return t.length<2?`0`+t:t}function dO(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var fO=class extends fw{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pO=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new mw}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||dw.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)pO._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||dw.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};pO=qC([JC(0,xw)],pO);function mO(e){return 57508<=e&&e<=57558}function hO(e){return 9472<=e&&e<=9631}function gO(e){return mO(e)||hO(e)}function _O(){return{css:{canvas:vO(),cell:vO()},device:{canvas:vO(),cell:vO(),char:{width:0,height:0,left:0,top:0}}}}function vO(){return{width:0,height:0}}var yO=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new mw,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],ee=l!==-1&&u!==-1;for(let O=0;O<m;O++){e.loadCell(O,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let k=!1,A=O>=E,te=O,j=this._workCell;if(f.length>0&&O===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(k=!0,j=new fO(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),te=r[1]-1,m=j.getWidth()):E=r[1]}let M=this._isCellInSelection(O,t),N=n&&O===a,ne=ee&&O>=l&&O<=u,re=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{re=!0});let ie=j.getChars()||dw;if(ie===` `&&(j.isUnderline()||j.isOverline())&&(ie=`\xA0`),T=m*s-c.get(ie,j.isBold(),j.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(M&&w||!M&&!w&&j.bg===y)&&(M&&w&&p.selectionForeground||j.fg===b)&&j.extended.ext===x&&ne===S&&T===C&&!N&&!k&&!re&&A){j.isInvisible()?_+=dw:_+=ie,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=j.bg,b=j.fg,x=j.extended.ext,S=ne,C=T,w=M,k&&a>=O&&a<=te&&(a=O),!this._coreService.isCursorHidden&&N&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(j.isBold()&&D.push(`xterm-bold`),j.isItalic()&&D.push(`xterm-italic`),j.isDim()&&D.push(`xterm-dim`),_=j.isInvisible()?dw:j.getChars()||dw,j.isUnderline()&&(D.push(`xterm-underline-${j.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!j.isUnderlineColorDefault())){if(j.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${fw.toColorRGB(j.getUnderlineColor()).join(`,`)})`;else{let e=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}j.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),j.isStrikethrough()&&D.push(`xterm-strikethrough`),ne&&(h.style.textDecoration=`underline`);let P=j.getFgColor(),F=j.getFgColorMode(),I=j.getBgColor(),L=j.getBgColorMode(),ae=!!j.isInverse();if(ae){let e=P;P=I,I=e;let t=F;F=L,L=t}let R,oe,z=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{e.options.layer!==`top`&&z||(e.backgroundColorRGB&&(L=50331648,I=e.backgroundColorRGB.rgba>>8&16777215,R=e.backgroundColorRGB),e.foregroundColorRGB&&(F=50331648,P=e.foregroundColorRGB.rgba>>8&16777215,oe=e.foregroundColorRGB),z=e.options.layer===`top`)}),!z&&M&&(R=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,I=R.rgba>>8&16777215,L=50331648,z=!0,p.selectionForeground&&(F=50331648,P=p.selectionForeground.rgba>>8&16777215,oe=p.selectionForeground)),z&&D.push(`xterm-decoration-top`);let se;switch(L){case 16777216:case 33554432:se=p.ansi[I],D.push(`xterm-bg-${I}`);break;case 50331648:se=aO.toColor(I>>16,I>>8&255,I&255),this._addStyle(h,`background-color:#${bO((I>>>0).toString(16),`0`,6)}`);break;default:ae?(se=p.foreground,D.push(`xterm-bg-257`)):se=p.background}switch(R||j.isDim()&&(R=oO.multiplyOpacity(se,.5)),F){case 16777216:case 33554432:j.isBold()&&P<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(P+=8),this._applyMinimumContrast(h,se,p.ansi[P],j,R,void 0)||D.push(`xterm-fg-${P}`);break;case 50331648:let e=aO.toColor(P>>16&255,P>>8&255,P&255);this._applyMinimumContrast(h,se,e,j,R,oe)||this._addStyle(h,`color:#${bO(P.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,se,p.foreground,j,R,oe)||ae&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!N&&!k&&!re&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),O=te}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||gO(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=oO.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};yO=qC([JC(1,Rw),JC(2,Dw),JC(3,Pw),JC(4,Cw),JC(5,Aw),JC(6,zw)],yO);function bO(e,t,n){for(;e.length<n;)e=t+e;return e}var xO=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},SO=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function CO(){return new SO}var wO=`xterm-dom-renderer-owner-`,TO=`xterm-rows`,EO=`xterm-fg-`,DO=`xterm-bg-`,OO=`xterm-focus`,kO=`xterm-selection`,AO=1,jO=class extends uT{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=AO++,this._rowElements=[],this._selectionRenderModel=CO(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(TO),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(kO),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=_O(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(yO,document),this._element.classList.add(wO+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(sT(()=>{this._element.classList.remove(wO+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new xO(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${TO} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${TO} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${TO} .xterm-dim { color: ${oO.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${TO}.${OO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${TO}.${OO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${TO}.${OO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${TO} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${TO} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${TO} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${TO} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${TO} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${kO} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${kO} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${kO} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${EO}${n} { color: ${r.css}; }${this._terminalSelector} .${EO}${n}.xterm-dim { color: ${oO.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${DO}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${EO}257 { color: ${oO.opaque(e.background).css}; }${this._terminalSelector} .${EO}257.xterm-dim { color: ${oO.multiplyOpacity(oO.opaque(e.background),.5).css}; }${this._terminalSelector} .${DO}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(OO),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(OO),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${wO}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};jO=qC([JC(7,Tw),JC(8,Nw),JC(9,Dw),JC(10,xw),JC(11,Cw),JC(12,Pw),JC(13,zw)],jO);var MO=class extends uT{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new FO(this._optionsService))}catch{this._measureStrategy=this._register(new PO(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};MO=qC([JC(2,Dw)],MO);var NO=class extends uT{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},PO=class extends NO{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},FO=class extends NO{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},IO=class extends uT{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new LO(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(vT.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(eD(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(eD(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},LO=class extends uT{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new dT),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(sT(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=eD(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},RO=class extends uT{constructor(){super(),this.linkProviders=[],this._register(sT(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function zO(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function BO(e,t,n,r,i,a,o,s,c){if(!a)return;let l=zO(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var VO=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return BO(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=zO(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};VO=qC([JC(0,Iw),JC(1,Nw)],VO);var HO=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},UO={};KC(UO,{getSafariVersion:()=>XO,isChromeOS:()=>nk,isFirefox:()=>qO,isIpad:()=>QO,isIphone:()=>$O,isLegacyEdge:()=>JO,isLinux:()=>tk,isMac:()=>ZO,isNode:()=>WO,isSafari:()=>YO,isWindows:()=>ek});var WO=typeof process<`u`&&`title`in process,GO=WO?`node`:navigator.userAgent,KO=WO?`node`:navigator.platform,qO=GO.includes(`Firefox`),JO=GO.includes(`Edge`),YO=/^((?!chrome|android).)*safari/i.test(GO);function XO(){if(!YO)return 0;let e=GO.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ZO=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(KO),QO=KO===`iPad`,$O=KO===`iPhone`,ek=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(KO),tk=KO.indexOf(`Linux`)>=0,nk=/\bCrOS\b/.test(GO),rk=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},ik=class extends rk{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},ak=class extends rk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ok=!WO&&`requestIdleCallback`in window?ak:ik,sk=class{constructor(){this._queue=new ok}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ck=class extends uT{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new dT),this._pausedResizeTask=new sk,this._observerDisposable=this._register(new dT),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new HO((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new lk(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(sT(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=sT(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ck=qC([JC(2,Dw),JC(3,Nw),JC(4,Cw),JC(5,Aw),JC(6,xw),JC(7,Pw),JC(8,zw)],ck);var lk=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function uk(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return pk(i,a,e,t,n,r)+mk(a,t,n,r)+hk(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Sk(Math.abs(i-e),xk(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Sk(fk(a>t?e:i,n)+(s-1)*n.cols+1+dk(a>t?i:e,n),xk(o,r))}function dk(e,t){return e-1}function fk(e,t){return t.cols-e}function pk(e,t,n,r,i,a){return mk(t,r,i,a).length===0?``:Sk(bk(e,t,e,t-_k(t,i),!1,i).length,xk(`D`,a))}function mk(e,t,n,r){let i=e-_k(e,n),a=t-_k(t,n);return Sk(Math.abs(i-a)-gk(e,t,n),xk(yk(e,t),r))}function hk(e,t,n,r,i,a){let o;o=mk(t,r,i,a).length>0?r-_k(r,i):t;let s=r,c=vk(e,t,n,r,i,a);return Sk(bk(e,o,n,s,c===`C`,i).length,xk(c,a))}function gk(e,t,n){let r=0,i=e-_k(e,n),a=t-_k(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=yk(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function _k(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function vk(e,t,n,r,i,a){let o;return o=mk(n,r,i,a).length>0?r-_k(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function yk(e,t){return e>t?`A`:`B`}function bk(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function xk(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function Sk(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var Ck=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function wk(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Tk=50,Ek=15,Dk=50,Ok=500,kk=RegExp(`\xA0`,`g`),Ak=class extends uT{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new mw,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new Ck(this._bufferService),this._activeSelectionMode=0,this._register(sT(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(kk,` `)).join(ek?`\r
53
- `:`
54
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),tk&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=wk(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=zO(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Tk),Tk),t/=Tk,t/Math.abs(t)+Math.round(t*(Ek-1)))}shouldForceSelection(e){return ZO?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Dk)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(ZO&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Ok&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=uk(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=wk(n,this._bufferService.cols)}};Ak=qC([JC(3,xw),JC(4,Cw),JC(5,Fw),JC(6,Dw),JC(7,Iw),JC(8,Pw)],Ak);var jk=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Mk=class{constructor(){this._color=new jk,this._css=new jk}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Nk=Object.freeze((()=>{let e=[sO.toColor(`#2e3436`),sO.toColor(`#cc0000`),sO.toColor(`#4e9a06`),sO.toColor(`#c4a000`),sO.toColor(`#3465a4`),sO.toColor(`#75507b`),sO.toColor(`#06989a`),sO.toColor(`#d3d7cf`),sO.toColor(`#555753`),sO.toColor(`#ef2929`),sO.toColor(`#8ae234`),sO.toColor(`#fce94f`),sO.toColor(`#729fcf`),sO.toColor(`#ad7fa8`),sO.toColor(`#34e2e2`),sO.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:aO.toCss(r,i,a),rgba:aO.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:aO.toCss(n,n,n),rgba:aO.toRgba(n,n,n)})}return e})()),Pk=sO.toColor(`#ffffff`),Fk=sO.toColor(`#000000`),Ik=sO.toColor(`#ffffff`),Lk=Fk,Rk={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},zk=Pk,Bk=class extends uT{constructor(e){super(),this._optionsService=e,this._contrastCache=new Mk,this._halfContrastCache=new Mk,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pk,background:Fk,cursor:Ik,cursorAccent:Lk,selectionForeground:void 0,selectionBackgroundTransparent:Rk,selectionBackgroundOpaque:oO.blend(Fk,Rk),selectionInactiveBackgroundTransparent:Rk,selectionInactiveBackgroundOpaque:oO.blend(Fk,Rk),scrollbarSliderBackground:oO.opacity(Pk,.2),scrollbarSliderHoverBackground:oO.opacity(Pk,.4),scrollbarSliderActiveBackground:oO.opacity(Pk,.5),overviewRulerBorder:Pk,ansi:Nk.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Vk(e.foreground,Pk),t.background=Vk(e.background,Fk),t.cursor=oO.blend(t.background,Vk(e.cursor,Ik)),t.cursorAccent=oO.blend(t.background,Vk(e.cursorAccent,Lk)),t.selectionBackgroundTransparent=Vk(e.selectionBackground,Rk),t.selectionBackgroundOpaque=oO.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Vk(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=oO.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Vk(e.selectionForeground,iO):void 0,t.selectionForeground===iO&&(t.selectionForeground=void 0),oO.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=oO.opacity(t.selectionBackgroundTransparent,.3)),oO.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=oO.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Vk(e.scrollbarSliderBackground,oO.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Vk(e.scrollbarSliderHoverBackground,oO.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Vk(e.scrollbarSliderActiveBackground,oO.opacity(t.foreground,.5)),t.overviewRulerBorder=Vk(e.overviewRulerBorder,zk),t.ansi=Nk.slice(),t.ansi[0]=Vk(e.black,Nk[0]),t.ansi[1]=Vk(e.red,Nk[1]),t.ansi[2]=Vk(e.green,Nk[2]),t.ansi[3]=Vk(e.yellow,Nk[3]),t.ansi[4]=Vk(e.blue,Nk[4]),t.ansi[5]=Vk(e.magenta,Nk[5]),t.ansi[6]=Vk(e.cyan,Nk[6]),t.ansi[7]=Vk(e.white,Nk[7]),t.ansi[8]=Vk(e.brightBlack,Nk[8]),t.ansi[9]=Vk(e.brightRed,Nk[9]),t.ansi[10]=Vk(e.brightGreen,Nk[10]),t.ansi[11]=Vk(e.brightYellow,Nk[11]),t.ansi[12]=Vk(e.brightBlue,Nk[12]),t.ansi[13]=Vk(e.brightMagenta,Nk[13]),t.ansi[14]=Vk(e.brightCyan,Nk[14]),t.ansi[15]=Vk(e.brightWhite,Nk[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Vk(e.extendedAnsi[r],Nk[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Bk=qC([JC(0,Dw)],Bk);function Vk(e,t){if(e!==void 0)try{return sO.toColor(e)}catch{}return t}var Hk=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Uk=class{constructor(){this._services=new Hk,this._services.set(Tw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=vw(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Wk={trace:0,debug:1,info:2,warn:3,error:4,off:5},Gk=`xterm.js: `,Kk=class extends uT{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),qk=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Wk[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Gk)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Kk=qC([JC(0,Dw)],Kk);var qk,Jk=class extends uT{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Yk=3,Xk=Object.freeze(new fw),Zk=0,Qk=2,$k=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Yk);let r=t||mw.fromCharData([0,uw,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Yk+0],n=t&2097151;return[this._data[e*Yk+1],t&2097152?this._combined[e]:n?ow(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Yk+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Yk+0]=e|2097152|t[2]<<22):this._data[e*Yk+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Yk+0]>>22}hasWidth(e){return this._data[e*Yk+0]&12582912}getFg(e){return this._data[e*Yk+1]}getBg(e){return this._data[e*Yk+2]}hasContent(e){return this._data[e*Yk+0]&4194303}getCodePoint(e){let t=this._data[e*Yk+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Yk+0]&2097152}getString(e){let t=this._data[e*Yk+0];return t&2097152?this._combined[e]:t&2097151?ow(t&2097151):``}isProtected(e){return this._data[e*Yk+2]&536870912}loadCell(e,t){return Zk=e*Yk,t.content=this._data[Zk+0],t.fg=this._data[Zk+1],t.bg=this._data[Zk+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*Yk+0]=t.content,this._data[e*Yk+1]=t.fg,this._data[e*Yk+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Yk+0]=t|n<<22,this._data[e*Yk+1]=r.fg,this._data[e*Yk+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Yk+0];r&2097152?this._combined[e]+=ow(t):r&2097151?(this._combined[e]=ow(r&2097151)+ow(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Yk+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new mw;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new mw;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*Qk<this._data.buffer.byteLength;let n=e*Yk;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*Qk<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Qk<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Yk+0]&4194303)return e+(this._data[e*Yk+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Yk+0]&4194303||this._data[e*Yk+2]&50331648)return e+(this._data[e*Yk+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<Yk;e++)this._data[(n+i)*Yk+e]=a[(t+i)*Yk+e];a[(t+i)*Yk+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Yk;e++)this._data[(n+i)*Yk+e]=a[(t+i)*Yk+e];a[(t+i)*Yk+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*Yk+0],n=e&2097151,a=e&2097152?this._combined[t]:n?ow(n):dw;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function eA(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=iA(u,d,t),p=1,m=0;for(;p<u.length;){let e=iA(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function tA(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function nA(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function rA(e,t,n){let r=[],i=e.map((n,r)=>iA(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=iA(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function iA(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var aA=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),aT(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};aA._nextId=1;var oA=aA,sA={},cA=sA.B;sA[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},sA.A={"#":`£`},sA.B=void 0,sA[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},sA.C=sA[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},sA.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},sA.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},sA.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},sA.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},sA.E=sA[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},sA.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},sA.H=sA[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},sA[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var lA=4294967295,uA=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Xk.clone(),this.savedCharset=cA,this.markers=[],this._nullCell=mw.fromCharData([0,uw,1,0]),this._whitespaceCell=mw.fromCharData([0,dw,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ok,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Jk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new pw),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new pw),this._whitespaceCell}getBlankLine(e,t){return new $k(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>lA?lA:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Xk);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Jk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Xk),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new $k(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new $k(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=eA(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Xk),n);if(r.length>0){let n=tA(this.lines,r);nA(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Xk),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new $k(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Xk),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=rA(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(Xk,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=iA(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new oA(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},dA=class extends uT{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new uA(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new uA(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},fA=2,pA=1,mA=class extends uT{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,fA),this.rows=Math.max(e.rawOptions.rows||0,pA),this.buffers=this._register(new dA(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};mA=qC([JC(0,Dw)],mA);var hA={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ZO,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},gA=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],_A=class extends uT{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...hA};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(sT(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in hA))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in hA))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=hA[e],!vA(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=hA[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=gA.includes(t)?t:hA[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function vA(e){return e===`block`||e===`underline`||e===`bar`}function yA(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&yA(e[r],t-1);return n}var bA=Object.freeze({insertMode:!1}),xA=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),SA=class extends uT{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=yA(bA),this.decPrivateModes=yA(xA)}reset(){this.modes=yA(bA),this.decPrivateModes=yA(xA)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};SA=qC([JC(0,xw),JC(1,Ew),JC(2,Dw)],SA);var CA={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function wA(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var TA=String.fromCharCode,EA={DEFAULT:e=>{let t=[wA(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${TA(t[0])}${TA(t[1])}${TA(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${wA(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${wA(e,!0)};${e.x};${e.y}${t}`}},DA=class extends uT{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(CA))this.addProtocol(e,CA[e]);for(let e of Object.keys(EA))this.addEncoding(e,EA[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};DA=qC([JC(0,xw),JC(1,Cw),JC(2,Dw)],DA);var OA=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],kA=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],AA;function jA(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var MA=class{constructor(){if(this.version=`6`,!AA){AA=new Uint8Array(65536),AA.fill(1),AA[0]=0,AA.fill(0,1,32),AA.fill(0,127,160),AA.fill(2,4352,4448),AA[9001]=2,AA[9002]=2,AA.fill(2,11904,42192),AA[12351]=1,AA.fill(2,44032,55204),AA.fill(2,63744,64256),AA.fill(2,65040,65050),AA.fill(2,65072,65136),AA.fill(2,65280,65377),AA.fill(2,65504,65511);for(let e=0;e<OA.length;++e)AA.fill(0,OA[e][0],OA[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?AA[e]:jA(e,kA)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=NA.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return NA.createPropertyValue(0,n,r)}},NA=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new MA;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},PA=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function FA(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var IA=2147483647,LA=256,RA=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>LA)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>IA?IA:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>IA?IA:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,IA):e}},zA=[],BA=class{constructor(){this._state=0,this._active=zA,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zA}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=zA,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||zA,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,sw(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=zA,this._id=-1,this._state=0}}},VA=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=sw(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},HA=[],UA=class{constructor(){this._handlers=Object.create(null),this._active=HA,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=HA}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=HA,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||HA,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,sw(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=HA,this._ident=0}},WA=new RA;WA.addParam(0);var GA=class{constructor(e){this._handler=e,this._data=``,this._params=WA,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():WA,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=sw(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=WA,this._data=``,this._hitLimit=!1,e));return this._params=WA,this._data=``,this._hitLimit=!1,t}},KA=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},qA=160,JA=function(){let e=new KA(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(qA,0,2,0),e.add(qA,8,5,8),e.add(qA,6,0,6),e.add(qA,11,0,11),e.add(qA,13,13,13),e}(),YA=class extends uT{constructor(e=JA){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new RA,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(sT(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new BA),this._dcsParser=this._register(new UA),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:qA)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<qA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<qA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<qA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<qA){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<qA){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<qA){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},XA=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,ZA=/^[\da-f]+$/;function QA(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=XA.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),ZA.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function $A(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function ej(e,t=16){let[n,r,i]=e;return`rgb:${$A(n,t)}/${$A(r,t)}/${$A(i,t)}`}var tj={"(":0,")":1,"*":2,"+":3,"-":1,".":2},nj=131072,rj=10;function ij(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var aj=5e3,oj=0,sj=class extends uT{constructor(e,t,n,r,i,a,o,s,c=new YA){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new cw,this._utf8Decoder=new lw,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Xk.clone(),this._eraseAttrDataInternal=Xk.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new cj(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ZD.IND,()=>this.index()),this._parser.setExecuteHandler(ZD.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ZD.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new VA(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new VA(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new VA(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new VA(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new VA(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new VA(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new VA(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new VA(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new VA(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new VA(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new VA(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new VA(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in sA)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new GA((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),aj))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${aj} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>nj&&(a=this._parseStack.position+nj)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<nj&&(this._parseBuffer=new Uint32Array(Math.min(e.length,nj))),o||this._dirtyRowTracker.clearRange(),e.length>nj)for(let t=a;t<e.length;t+=nj){let a=t+nj<e.length?t+nj:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=NA.extractWidth(t);let n=NA.extractShouldJoin(t),m=n?NA.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(ow(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof $k&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!ij(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new GA(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new VA(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Xk));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=NA.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,cA),this._charsetService.setgCharset(1,cA),this._charsetService.setgCharset(2,cA),this._charsetService.setgCharset(3,cA);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=fw.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Xk.fg,e.bg=Xk.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Xk.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Xk.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Xk.fg&16777215,r.bg&=-67108864,r.bg|=Xk.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Xk.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ij(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>rj&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>rj&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(lj(n)){if(r===`?`)t.push({type:0,index:n});else{let e=QA(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=QA(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);lj(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,cA),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(tj[e[0]],sA[e[1]]||cA),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Xk.clone(),this._eraseAttrDataInternal=Xk.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new mw;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},cj=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(oj=e,e=t,t=oj),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};cj=qC([JC(0,xw)],cj);function lj(e){return 0<=e&&e<256}var uj=5e7,dj=12,fj=50,pj=class extends uT{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>uj)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=dj?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=dj)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fj&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},mj=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mj=qC([JC(0,xw)],mj);var hj=!1,gj=class extends uT{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new dT),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new Uk,this.optionsService=this._register(new _A(e)),this._instantiationService.setService(Dw,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(mA)),this._instantiationService.setService(xw,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Kk)),this._instantiationService.setService(Ew,this._logService),this.coreService=this._register(this._instantiationService.createInstance(SA)),this._instantiationService.setService(Cw,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(DA)),this._instantiationService.setService(Sw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(NA)),this._instantiationService.setService(kw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(PA),this._instantiationService.setService(ww,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mj),this._instantiationService.setService(Ow,this._oscLinkService),this._inputHandler=this._register(new sj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(vT.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(vT.forward(this._bufferService.onResize,this._onResize)),this._register(vT.forward(this.coreService.onData,this._onData)),this._register(vT.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new pj((e,t)=>this._inputHandler.parse(e,t))),this._register(vT.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!hj&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),hj=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,fA),t=Math.max(t,pA),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(FA.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(FA(this._bufferService),!1))),this._windowsWrappingHeuristics.value=sT(()=>{for(let t of e)t.dispose()})}}},_j={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function vj(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=_j[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var yj=0,bj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ok,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ok,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(yj=this._search(t),yj===-1)||this._getKey(this._array[yj])!==t)return!1;do if(this._array[yj]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(yj),!0;while(++yj<this._array.length&&this._getKey(this._array[yj])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(yj=this._search(e),!(yj<0||yj>=this._array.length)&&this._getKey(this._array[yj])===e))do yield this._array[yj];while(++yj<this._array.length&&this._getKey(this._array[yj])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(yj=this._search(e),!(yj<0||yj>=this._array.length)&&this._getKey(this._array[yj])===e))do t(this._array[yj]);while(++yj<this._array.length&&this._getKey(this._array[yj])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},xj=0,Sj=0,Cj=class extends uT{constructor(){super(),this._decorations=new bj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(sT(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new wj(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{xj=t.options.x??0,Sj=xj+(t.options.width??1),e>=xj&&e<Sj&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},wj=class extends lT{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?sO.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?sO.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Tj=1e3,Ej=class{constructor(e,t=Tj){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Dj=20,Oj=class extends uT{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Ej(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
55
- `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(eD(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(sT(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Dj+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
56
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Dj+1&&(this._liveRegion.textContent+=QC.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Oj=qC([JC(1,Tw),JC(2,Pw),JC(3,Iw)],Oj);var kj=class extends uT{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(sT(()=>{aT(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(eD(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(eD(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(eD(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(eD(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Aj(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,aT(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};kj=qC([JC(1,Fw),JC(2,Iw),JC(3,xw),JC(4,Bw)],kj);function Aj(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var jj=class extends gj{constructor(e={}){super(e),this._linkifier=this._register(new dT),this.browser=UO,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new dT),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(Cj),this._instantiationService.setService(Aw,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(RO),this._instantiationService.setService(Bw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(jw)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(vT.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(vT.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(vT.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(vT.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(sT(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=oO.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${ej(r)}${QD.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=aO.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=aO.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Oj,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(eD(this.element,`copy`,e=>{this.hasSelection()&&tw(e,this._selectionService)}));let e=e=>nw(e,this.textarea,this.coreService,this.optionsService);this._register(eD(this.textarea,`paste`,e)),this._register(eD(this.element,`paste`,e)),qO?this._register(eD(this.element,`mousedown`,e=>{e.button===2&&aw(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(eD(this.element,`contextmenu`,e=>{aw(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),tk&&this._register(eD(this.element,`auxclick`,e=>{e.button===1&&iw(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(eD(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(eD(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(eD(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(eD(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(eD(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(eD(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(eD(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(eD(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,XC.get()),nk||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(IO,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Pw,this._coreBrowserService),this._register(eD(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(eD(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(MO,this._document,this._helperContainer),this._instantiationService.setService(Nw,this._charSizeService),this._themeService=this._instantiationService.createInstance(Bk),this._instantiationService.setService(zw,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(pO),this._instantiationService.setService(Rw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ck,this.rows,this.screenElement)),this._instantiationService.setService(Iw,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance($D,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(VO),this._instantiationService.setService(Fw,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(kj,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(WD,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ak,this.element,this.screenElement,r)),this._instantiationService.setService(Lw,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(vT.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(GD,this.screenElement)),this._register(eD(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Oj,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(XD,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(XD,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(jO,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(eD(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(eD(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){rw(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=vj(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Mj(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Xk));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent($.ESC+`[I`):this.coreService.triggerDataEvent($.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${r};${n}t`)}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Mj(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Nj=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Pj=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new mw)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Fj=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Pj(t)}getNullCell(){return new mw}},Ij=class extends uT{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new Fj(this._core.buffers.normal,`normal`),this._alternate=new Fj(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Lj=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Rj=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},zj=[`cols`,`rows`],Bj=0,Vj=class extends uT{constructor(e){super(),this._core=this._register(new jj(e)),this._addonManager=this._register(new Nj),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(zj.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new Lj(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Rj(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new Ij(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
57
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return XC.get()},set promptLabel(e){XC.set(e)},get tooMuchOutput(){return QC.get()},set tooMuchOutput(e){QC.set(e)}}}_verifyIntegers(...e){for(Bj of e)if(Bj===1/0||isNaN(Bj)||Bj%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Bj of e)if(Bj&&(Bj===1/0||isNaN(Bj)||Bj%1!=0||Bj<0))throw Error(`This API only accepts positive integers`)}},Hj=2,Uj=1,Wj=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Hj,Math.floor(u/e.css.cell.width)),rows:Math.max(Uj,Math.floor(l/e.css.cell.height))}}},Gj=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Xj.isErrorNoTelemetry(e)?new Xj(e.message+`
58
-
59
- `+e.stack):Error(e.message+`
60
-
61
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Kj(e){Jj(e)||Gj.onUnexpectedError(e)}var qj=`Canceled`;function Jj(e){return e instanceof Yj||e instanceof Error&&e.name===qj&&e.message===qj}var Yj=class extends Error{constructor(){super(qj),this.name=this.message}},Xj=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Zj;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zj||={});var Qj=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Zj.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Qj.empty=new Qj(e=>{});function $j(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var eM;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(eM||={});var tM=null;function nM(e){return tM?.trackDisposable(e),e}function rM(e){tM?.markAsDisposed(e)}function iM(e,t){tM?.setParent(e,t)}function aM(e){if(eM.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function oM(...e){return sM(()=>aM(e))}function sM(e){let t=nM({dispose:$j(()=>{rM(t),e()})});return t}var cM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,nM(this)}dispose(){this._isDisposed||(rM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{aM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return iM(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),iM(e,null))}};cM.DISABLE_DISPOSED_WARNING=!1;var lM=cM,uM=class{constructor(){this._store=new lM,nM(this),iM(this._store,this)}dispose(){rM(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};uM.None=Object.freeze({dispose(){}});var dM=class{constructor(){this._isDisposed=!1,nM(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&iM(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,rM(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&iM(e,null),e}},fM=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};fM.Undefined=new fM(void 0);var pM=globalThis.performance&&typeof globalThis.performance.now==`function`,mM=class e{static create(t){return new e(t)}constructor(e){this._now=pM&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},hM;(e=>{e.None=()=>uM.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(oM(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new DM({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new DM({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new DM({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new DM({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new DM({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new DM;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new DM(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof lM?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(hM||={});var gM=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new mM,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gM.all=new Set,gM._idPool=0;var _M=gM,vM=-1,yM=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new SM(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};yM._idPool=1;var bM=yM,xM=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
62
- `).slice(2).join(`
63
- `))}},SM=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},CM=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},wM=0,TM=class{constructor(e){this.value=e,this.id=wM++}},EM=2,DM=class{constructor(e){this._size=0,this._options=e,this._leakageMon=vM>0||this._options?.leakWarningThreshold?new bM(e?.onListenerError??Kj,this._options?.leakWarningThreshold??vM):void 0,this._perfMon=this._options?._profName?new _M(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new CM(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Kj)(n),uM.None}if(this._disposed)return uM.None;t&&(e=e.bind(t));let r=new TM(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=xM.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof TM?(this._deliveryQueue??=new OM,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=sM(()=>{i?.(),this._removeListener(r)});return n instanceof lM?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*EM<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Kj;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof TM)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},OM=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},kM=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),AM;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof jM?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:hM.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kM})})(AM||={});var jM=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?kM:(this._emitter||=new DM,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},MM=`en`,NM=!1,PM=!1,FM=MM,IM,LM=globalThis,RM;typeof LM.vscode<`u`&&typeof LM.vscode.process<`u`?RM=LM.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(RM=process);var zM=typeof RM?.versions?.electron==`string`&&RM?.type===`renderer`;if(typeof RM==`object`){RM.platform,RM.platform,NM=RM.platform===`linux`,NM&&RM.env.SNAP&&RM.env.SNAP_REVISION,RM.env.CI||RM.env.BUILD_ARTIFACTSTAGINGDIRECTORY,FM=MM;let e=RM.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,FM=t.resolvedLanguage||MM,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!zM?(IM=navigator.userAgent,IM.indexOf(`Windows`),IM.indexOf(`Macintosh`),(IM.indexOf(`Macintosh`)>=0||IM.indexOf(`iPad`)>=0||IM.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,NM=IM.indexOf(`Linux`)>=0,IM?.indexOf(`Mobi`),PM=!0,FM=globalThis._VSCODE_NLS_LANGUAGE||MM,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);PM&&typeof LM.importScripts==`function`&&LM.origin;var BM=IM,VM=FM,HM;(e=>{function t(){return VM}e.value=t;function n(){return VM.length===2?VM===`en`:VM.length>=3&&VM[0]===`e`&&VM[1]===`n`&&VM[2]===`-`}e.isDefaultVariant=n;function r(){return VM===`en`}e.isDefault=r})(HM||={});var UM=typeof LM.postMessage==`function`&&!LM.importScripts;(()=>{if(UM){let e=[];LM.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),LM.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var WM=!!(BM&&BM.indexOf(`Chrome`)>=0);BM&&BM.indexOf(`Firefox`),!WM&&BM&&BM.indexOf(`Safari`),BM&&BM.indexOf(`Edg/`),BM&&BM.indexOf(`Android`);function GM(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=sM(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var KM;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(KM||={});var qM=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new DM,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await hM.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};qM.EMPTY=qM.fromArray([]);var JM=class extends uM{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new dM),this._linesCacheDisposables=this._register(new dM),this._register(sM(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=oM(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=GM(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},YM=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},XM=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},ZM=class extends uM{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(sM(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){aM(n)}}}clearHighlightDecorations(){aM(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>aM(e))),s.push(i)}}return s.length===0?void 0:s}},QM=class extends uM{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new DM)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},$M=class extends uM{constructor(e){super(),this._highlightTimeout=this._register(new dM),this._lineCache=this._register(new dM),this._state=new YM,this._resultTracker=this._register(new QM),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new JM(e),this._engine=new XM(e,this._lineCache.value),this._decorationManager=new ZM(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(sM(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=GM(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},eN=e=>({codex:`Codex`,antigravity:`Antigravity (agy)`,claude:`Claude Code`,copilot:`GitHub Copilot`,cursor:`Cursor Agent`,pi:`Pi`,shell:`Shell`})[e]??e;function tN({harness:e,className:t=`size-4`}){if(e===`antigravity`)return(0,H.jsx)(Vn,{className:t,alt:``,"aria-hidden":`true`});let n={codex:Hn,claude:zn,copilot:Wn,cursor:Un,pi:ai}[e]??_i;return(0,H.jsx)(n,{className:t,"aria-hidden":`true`})}function nN(e){let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function rN(e){return e.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function iN({session:e}){let t=nN(e.updatedAt),n=nN(e.createdAt);return(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap gap-x-2 gap-y-0.5`,children:[(0,H.jsx)(`span`,{title:t?`Latest recorded activity: ${t.toLocaleString()} (${Intl.DateTimeFormat().resolvedOptions().timeZone}). May include tool or provider events.`:`This harness history has no valid activity timestamp.`,children:t?(0,H.jsxs)(H.Fragment,{children:[`Last activity `,(0,H.jsx)(`time`,{dateTime:t.toISOString(),children:rN(t)})]}):`Last activity unknown`}),n&&(0,H.jsxs)(`span`,{className:`text-muted-foreground`,title:`First recorded activity: ${n.toLocaleString()}`,children:[`Started `,(0,H.jsx)(`time`,{dateTime:n.toISOString(),children:rN(n)})]})]})}function aN({session:e}){let t=e.threadKind===`subagent`,n=t?zr:Xr;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground`,title:t?`A delegated agent task. Resume its main conversation to continue your work.`:e.threadKind===`main`?`The main conversation you work in. It may delegate tasks to subagents.`:`The harness has not provided a main/subagent classification.`,children:[(0,H.jsx)(n,{className:`size-3`,"aria-hidden":`true`}),t?`Subagent`:e.threadKind===`main`?`Main thread`:`Conversation`]})}function oN(e,t){let n=e,r=new Set;for(;n?.threadKind===`subagent`;){if(!n.parentSessionId||r.has(n.id))return;r.add(n.id);let i=n.parentSessionId;n=t.find(t=>t.assistant===e.assistant&&t.id===i)}return n}function sN({workspace:e,active:t,busy:n,status:r,onResume:i}){let[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(!1),l=on({queryKey:[`terminal-resume-sessions`,e],queryFn:()=>sr(`/api/workspace/${encodeURIComponent(e)}/sessions`),enabled:t,staleTime:15e3}),u=l.data?.sessions??[],d=u.filter(e=>e.threadKind===`subagent`).length,f=u.filter(e=>(s||e.threadKind!==`subagent`)&&`${e.title} ${eN(e.assistant)} ${e.id}`.toLowerCase().includes(a.toLowerCase()));return(0,H.jsxs)(`section`,{"aria-label":`Resume a conversation`,className:`min-h-0 overflow-auto border-b border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,H.jsx)(ui,{className:`size-4`}),`Resume a conversation`]}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,"aria-label":`Refresh saved sessions`,onClick:()=>void l.refetch(),children:(0,H.jsx)(li,{className:`size-3`})})]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Pick up a session from the Sessions tab. It opens with the harness that created it.`}),(0,H.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`The main thread is your conversation. Subagents handle delegated tasks and report back to it. Older histories may not identify the thread type.`}),(0,H.jsxs)(`div`,{className:`my-2 flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`input`,{"aria-label":`Search saved sessions`,placeholder:`Search conversations or harnesses`,className:`min-w-40 flex-1 rounded border border-border bg-background px-2 py-1 text-xs`,value:a,onChange:e=>o(e.target.value)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),`Include subagent sessions`,d>0?` (${d})`:``]})]}),l.isLoading&&(0,H.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Loading saved conversations…`}),l.error&&(0,H.jsx)(`p`,{role:`alert`,className:`py-3 text-xs text-destructive`,children:`Could not load sessions. Use Refresh to try again.`}),!l.isLoading&&!l.error&&f.length===0&&(0,H.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:a?`No matching conversations.`:d&&!s?`Only subagent sessions were found. Include them to inspect their parent links.`:`No saved conversations found for this workspace. Choose a harness above to start one.`}),(0,H.jsx)(`div`,{className:`max-h-72 divide-y divide-border`,children:f.map(e=>{let t=oN(e,u),a=!!r?.available&&!!r.targets.find(t=>t.id===e.assistant)?.available;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,"data-testid":`resume-session-row`,children:[(0,H.jsx)(tN,{harness:e.assistant,className:`size-5 shrink-0`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-xs font-medium`,title:e.title,children:e.title}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:eN(e.assistant)}),(0,H.jsx)(aN,{session:e}),(0,H.jsx)(iN,{session:e}),(0,H.jsxs)(`span`,{children:[e.messageCount,` messages`]}),(0,H.jsx)(`span`,{className:`font-mono`,children:e.id.slice(0,8)})]})]}),(0,H.jsxs)(yn,{size:`xs`,variant:`outline`,disabled:n||!a||!t,title:t?a?`Resume ${t.title} in ${eN(t.assistant)}`:`Install this harness, then refresh the harness list`:`Resume the main conversation from the harness`,onClick:()=>t&&i(t),children:[(0,H.jsx)(yr,{className:`size-3`}),e.threadKind===`subagent`?`Main thread`:`Resume`]})]},`${e.assistant}:${e.id}`)})})]})}var cN=``,lN,uN=0;async function dN(){return Date.now()>=uN&&(lN=void 0),lN||=(uN=Date.now()+24e4,fetch(`${cN}/api/terminals/bootstrap`,{method:`POST`,credentials:`include`,headers:{"x-contextspace-terminal":`bootstrap`}}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||`Could not connect to the local terminal service.`);return uN=Math.min(uN,Number(t.expiresAt)-5e3),t.token}).catch(e=>{throw lN=void 0,e})),lN}async function fN(e,t,n={}){for(let r=0;r<2;r++){let i=await dN(),a=await fetch(`${cN}/api/terminals/${encodeURIComponent(e)}/${t}`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,"x-contextspace-terminal":i},body:JSON.stringify(n)}),o=await a.json();if(a.status===403&&r===0){lN=void 0,uN=0;continue}if(!a.ok)throw Error(o.error||`Terminal request failed.`);return o}throw Error(`Terminal authorization expired. Reconnect.`)}function pN(){let e=new URL(`/ws/terminal`,window.location.origin);return e.protocol=e.protocol===`https:`?`wss:`:`ws:`,e.toString()}function mN(e){let t=[];for(let n=0;n<e.length;){if(/\s/.test(e[n])){n++;continue}let r=n,i=null;for(;n<e.length;){let t=e[n];if(i&&t===i)i=null;else if(!i&&(t===`"`||t===`'`||t==="`")&&/^[([{]*$/.test(e.slice(r,n)))i=t;else if(/\s/.test(t)&&!i)break;n++}let a=e.slice(r,n),o=a.match(/^[('"`[{]*/)?.[0].length??0,s=a.slice(o);for(;/[,'"`\]};.!?)]$/.test(s)&&!/\(\d+(?:,\d+)?\)$/.test(s);)s=s.slice(0,-1);let c=s.match(/:(\d+)(?::\d+)?$/)??s.match(/\((\d+)(?:,\d+)?\)$/),l=Number(c?.[1]),u=Number.isSafeInteger(l)&&l>0?l:void 0,d=(c?s.slice(0,-c[0].length):s).replace(/['"`]$/,``);if(!d||/^(?:[a-z][a-z\d+.-]*:\/\/|mailto:)/i.test(d)||!/[/\\]/.test(d)&&!/^[^.:]+\.[a-z\d]{1,12}$/i.test(d)||/^(?:\.\.?[/\\])?$/.test(d))continue;let f=r+o;t.push({text:s,path:d,line:u,start:f,end:f+s.length})}return t}function hN({workspace:e,active:t,launch:n,consumeLaunch:r,onOpenFileReference:i,codeVisible:a,onStatusChange:o,onBackgroundOutput:s}){let c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useRef)(null),d=(0,V.useRef)(null),f=(0,V.useRef)(null),[p,m]=(0,V.useState)(null),{harnesses:h,setHarness:g}=Mt(),_=h[e]??``,v=(0,V.useCallback)(t=>g(e,t),[e,g]),[y,b]=(0,V.useState)(!0);(0,V.useEffect)(()=>{a&&b(!1)},[a]);let[x,S]=(0,V.useState)(null);(0,V.useEffect)(()=>{x&&b(!1)},[x]);let[C,w]=(0,V.useState)(`Choose a harness or shell`),[T,E]=(0,V.useState)(``),[D,ee]=(0,V.useState)(!1),[O,k]=(0,V.useState)(0),[A,te]=(0,V.useState)(``),[j,M]=(0,V.useState)(!1),[N,ne]=(0,V.useState)(null),re=(0,V.useRef)(``),ie=(0,V.useRef)(``),P=(0,V.useRef)(void 0),[F,I]=(0,V.useState)(void 0),L=(0,V.useRef)(t),ae=(0,V.useRef)(i),R=(0,V.useRef)(o),oe=(0,V.useRef)(s);(0,V.useEffect)(()=>{L.current=t},[t]),(0,V.useEffect)(()=>{ae.current=i},[i]),(0,V.useEffect)(()=>{R.current=o,oe.current=s},[o,s]),(0,V.useEffect)(()=>{let e=C.startsWith(`Connected`)?`running`:C.startsWith(`Exited`)?`exited`:C.startsWith(`Disconnected`)?`disconnected`:`idle`;R.current?.(e)},[C]);let z=(0,V.useCallback)(e=>{f.current?.readyState===WebSocket.OPEN&&f.current.send(JSON.stringify(e))},[]),se=(0,V.useCallback)(async()=>{try{let t=await fN(e,`status`);m(t),S(e=>e??t.sessions.find(e=>e.state===`running`)??null),t.available||E(t.reason||`Native terminal support is unavailable.`)}catch(e){E(e.message)}},[e]);(0,V.useEffect)(()=>{se()},[se]),(0,V.useEffect)(()=>{x&&!_&&v(x.target)},[x,_,v]),(0,V.useEffect)(()=>{let e=window.setInterval(()=>{dN().catch(()=>{})},24e4);return()=>window.clearInterval(e)},[]),(0,V.useEffect)(()=>{if(!c.current)return;let e=new Vj({cursorBlink:!0,fontFamily:`"JetBrains Mono", monospace`,fontSize:13,scrollback:5e3,allowProposedApi:!1,theme:{background:`#111b18`,foreground:`#e1e9e4`,cursor:`#a3dbae`}}),t=new Wj,n=new $M;e.loadAddon(t),e.loadAddon(n),e.open(c.current);let r=c.current,i=e=>{(e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()===`v`&&e.stopPropagation()};r.addEventListener(`keydown`,i,!0);let a=t=>{let n=t.clipboardData;if(!n||n.getData(`text/plain`))return;let r=$S(n.getData(`text/html`));r.trim()?(t.preventDefault(),t.stopPropagation(),e.options.disableStdin||e.paste(r)):([...n.items].some(e=>e.type.startsWith(`image/`))||[...n.files].some(e=>e.type.startsWith(`image/`)))&&(t.preventDefault(),t.stopPropagation(),E(`The clipboard contains an image but no text. Use Chat to attach the image, or copy text and paste again.`))};r.addEventListener(`paste`,a,!0),e.attachCustomKeyEventHandler(t=>t.type===`keydown`?(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&(t.shiftKey||e.hasSelection())?(t.preventDefault(),QS(e.getSelection()).then(e=>{E(e?``:`Select terminal output before copying, or check clipboard permissions.`)}),!1):!((t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`v`):!0);let o=e.registerLinkProvider({provideLinks(t,n){let r=e.buffer.active,i=t-1;for(;i>0&&r.getLine(i)?.isWrapped&&t-i<=20;)i--;if(r.getLine(i)?.isWrapped){n([]);return}let a=t-1;for(;r.getLine(a+1)?.isWrapped&&a-i<20;)a++;if(r.getLine(a+1)?.isWrapped){n([]);return}let o=[];for(let e=i;e<=a;e++){let t=r.getLine(e);if(!t){n([]);return}o.push({line:t,text:t.translateToString(e===a)})}let s=(t,n)=>{let r=0;for(let a=0;a<o.length;a++){let s=o[a].text.length;if(t<r+s||n&&t===r+s||a===o.length-1){let s=Math.max(0,t-r),c=0;for(;c<e.cols&&o[a].line.translateToString(!1,0,c).length<s;)c++;return{x:c+ +!n,y:i+a+1}}r+=s}return{x:1,y:i+1}};n(mN(o.map(e=>e.text).join(``)).map(e=>({text:e.text,range:{start:s(e.start,!1),end:s(e.end,!0)},activate:()=>ae.current?.({path:e.path,line:e.line})})))}});l.current=e,u.current=t,d.current=n;let s=e.onData(t=>{if(!e.options.disableStdin)for(let e=0;e<t.length;){let n=Math.min(e+8192,t.length);n<t.length&&/[\uD800-\uDBFF]/.test(t[n-1])&&n--,z({type:`input`,data:t.slice(e,n)}),e=n}});e.options.disableStdin=!0;let f=e.onResize(({cols:t,rows:n})=>{e.options.disableStdin||z({type:`resize`,cols:Math.min(t,500),rows:Math.min(n,300)})}),p=new ResizeObserver(()=>{c.current?.clientWidth&&c.current?.clientHeight&&t.fit()});return p.observe(c.current),()=>{r.removeEventListener(`keydown`,i,!0),r.removeEventListener(`paste`,a,!0),p.disconnect(),o.dispose(),s.dispose(),f.dispose(),e.dispose(),l.current=null}},[z]),(0,V.useEffect)(()=>{if(!t||!x)return;let e=requestAnimationFrame(()=>{!L.current||!c.current?.getClientRects().length||(u.current?.fit(),l.current?.focus())});return()=>cancelAnimationFrame(e)},[t,x]),(0,V.useEffect)(()=>{l.current&&(l.current.options.screenReaderMode=j)},[j]),(0,V.useEffect)(()=>{if(!x)return;let t=!1,n,r=x.state===`exited`,i=!1,a=l.current;if(a)return a.reset(),a.options.disableStdin=!0,w(`Connecting…`),dN().then(o=>{t||(n=new WebSocket(pN()),f.current=n,n.onopen=()=>n.send(JSON.stringify({type:`attach`,token:o,workspace:e,id:x.id})),n.onmessage=e=>{if(t)return;let o=JSON.parse(String(e.data));o.type===`ready`?(r=o.terminal.state===`exited`,E(o.truncated?`Earlier output was trimmed. This is a partial screen replay; use the harness redraw command if needed.`:``),w(`Restoring terminal…`)):o.type===`output`&&typeof o.data==`string`?(i&&!L.current&&oe.current?.(),a.write(o.data,()=>{!t&&n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:`ack`,count:o.data.length}))})):o.type===`replayed`?(i=!0,a.write(``,()=>{t||(a.options.disableStdin=r,w(r?`Exited`:`Connected`),r||(u.current?.fit(),z({type:`resize`,cols:Math.min(a.cols,500),rows:Math.min(a.rows,300)}),L.current&&a.focus()))})):o.type===`exit`?(r=!0,a.options.disableStdin=!0,w(`Exited${o.exitCode==null?``:` (${o.exitCode})`}`),m(e=>e&&{...e,sessions:e.sessions.map(e=>e.id===x.id?{...e,state:`exited`}:e)})):o.type===`error`&&(E(o.message),a.options.disableStdin=!0)},n.onclose=()=>{t||(a.options.disableStdin=!0,w(r?`Exited`:`Disconnected · input paused`))},n.onerror=()=>{t||E(`Connection failed. Reconnect to the existing terminal; it may still be running.`)})}).catch(e=>{t||(E(e.message),w(`Disconnected · input paused`))}),()=>{t=!0,a.options.disableStdin=!0,n?.close(),f.current===n&&(f.current=null)}},[x?.id,O,e,z]);let ce=(0,V.useCallback)(async t=>{P.current=t,I(t),ee(!0),E(``),v(t.target);try{let{terminal:n}=await fN(e,`create`,{launchId:t.id,target:t.target,sessionId:t.sessionId,cwd:t.cwd});S(n),b(!1),await se()}catch(e){E(e.message)}finally{ee(!1)}},[e,se,v]);(0,V.useEffect)(()=>{!n||ie.current===n.id||(ie.current=n.id,ce(n).finally(()=>r(n.id)))},[n,ce,r]);let le=async()=>{if(!(!x||!window.confirm(`End this terminal and its running commands?`)))try{await fN(e,`${x.id}/stop`),await se()}catch(e){E(e.message)}},ue=async e=>{try{let t=e||l.current?.getSelection()||``;if(!t){E(`Select terminal output before copying.`);return}await QS(t)?E(``):E(`Could not copy terminal output. Check browser clipboard permissions.`)}finally{requestAnimationFrame(()=>l.current?.focus())}},de=async()=>{ne(null);try{let e=await eC();if(!e)throw Error(`Clipboard has no text`);if(!l.current||l.current.options.disableStdin)throw Error(`Reconnect the terminal before pasting.`);l.current.paste(e),l.current.focus(),E(``)}catch{E(`No clipboard text was available. Focus the terminal and press Ctrl+V (or Cmd+V); attach image-only content in Chat.`)}},fe=async()=>{E(``);try{let t=P.current;await sr(`/api/workspace/${encodeURIComponent(e)}/terminal`,{method:`POST`,body:JSON.stringify({..._===`shell`?{}:{assistant:_},...t?.target===_?{sessionId:t.sessionId,cwd:t.cwd}:{}})})}catch(e){E(e.message)}};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`terminal-pane`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border px-3 py-2`,children:[(0,H.jsxs)(jc,{value:_||null,onValueChange:e=>{typeof e==`string`&&v(e)},children:[(0,H.jsx)(Nc,{"aria-label":`CLI harness`,size:`sm`,className:`w-auto min-w-40 text-xs`,children:_?(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(tN,{harness:_}),eN(_)]}):`Choose a harness`}),(0,H.jsx)(Fc,{children:(p?.targets??[]).map(e=>(0,H.jsx)(Ic,{value:e.id,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(tN,{harness:e.id}),eN(e.id),!e.available&&(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`· Not installed`})]})},e.id))})]}),(0,H.jsxs)(yn,{size:`xs`,onClick:()=>void ce({id:crypto.randomUUID(),target:_}),disabled:D||!p?.available||!_||!p.targets.find(e=>e.id===_)?.available,children:[(0,H.jsx)(ci,{className:`size-3`}),D?`Starting…`:`Start session`]}),(0,H.jsxs)(yn,{size:`xs`,variant:y?`secondary`:`ghost`,"aria-pressed":y,onClick:()=>b(e=>!e),children:[(0,H.jsx)(ui,{className:`size-3`}),`Resume session`]}),(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,title:`Refresh installed harnesses`,onClick:()=>void se(),children:[(0,H.jsx)(li,{className:`size-3`}),`Refresh`]}),(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,disabled:!_,onClick:()=>void fe(),children:[(0,H.jsx)(Bn,{className:`size-3`}),`External terminal`]}),x&&(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,onClick:()=>void le(),children:[(0,H.jsx)(vi,{className:`size-3`}),`End session`]})]}),y&&(0,H.jsx)(sN,{workspace:e,active:t,busy:D,status:p,onResume:e=>void ce({id:crypto.randomUUID(),target:e.assistant,sessionId:e.id,cwd:e.workspacePath})}),!!p?.sessions.length&&(0,H.jsx)(`div`,{className:`px-3 py-1 border-b border-border`,children:(0,H.jsxs)(`select`,{"aria-label":`Terminal sessions`,className:`max-w-full bg-card text-xs`,value:x?.id??``,onChange:e=>{let t=p.sessions.find(t=>t.id===e.target.value)??null;S(t),t&&v(t.target)},children:[(0,H.jsx)(`option`,{value:``,disabled:!0,children:`Select a terminal`}),p.sessions.map(e=>(0,H.jsxs)(`option`,{value:e.id,children:[e.label,` · `,e.state,` · `,e.id.slice(0,8)]},e.id))]})}),T&&(0,H.jsxs)(`div`,{role:`alert`,className:`border-b border-border px-3 py-2 text-xs text-amber-600 break-words`,children:[T,F&&(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,disabled:D,onClick:()=>void ce(F),children:`Retry launch`})]}),x&&C.startsWith(`Disconnected`)&&(0,H.jsxs)(`div`,{"data-testid":`terminal-disconnected`,role:`alert`,className:`flex flex-wrap items-center gap-2 border-b border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs text-foreground`,children:[(0,H.jsx)(wi,{className:`size-4 shrink-0 text-amber-600`,"aria-hidden":`true`}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`strong`,{children:`CLI chat disconnected.`}),` Input is paused; the session may still be running.`]}),(0,H.jsxs)(yn,{size:`xs`,variant:`outline`,onClick:()=>k(e=>e+1),children:[(0,H.jsx)(si,{className:`size-3`}),`Reconnect CLI`]})]}),!x&&(0,H.jsx)(`div`,{className:`flex-1 px-3 py-3 text-xs text-muted-foreground`,children:`Choose a harness for a new session, or resume a saved conversation above. The harness keeps its own login and permissions. Shell opens PowerShell or your Unix shell. Existing API conversations remain under Chat.`}),(0,H.jsxs)(`div`,{className:`relative min-h-0 flex-1 bg-[#111b18] p-2 ${x?``:`hidden`}`,onPointerDownCapture:e=>{e.button===2&&(re.current=l.current?.getSelection()??``)},onContextMenu:e=>{e.preventDefault();let t=e.currentTarget.getBoundingClientRect();ne({x:Math.min(e.clientX-t.left,Math.max(0,t.width-150)),y:Math.min(e.clientY-t.top,Math.max(0,t.height-80))})},children:[(0,H.jsx)(`div`,{ref:c,className:`h-full overflow-hidden`,"aria-label":`Interactive CLI terminal`}),N&&(0,H.jsxs)(`div`,{className:`absolute z-20 min-w-36 rounded border border-border bg-card p-1 shadow-lg`,style:{left:N.x,top:N.y},role:`menu`,onKeyDown:e=>{e.key===`Escape`&&ne(null)},children:[(0,H.jsx)(`button`,{role:`menuitem`,className:`block w-full rounded px-2 py-1 text-left text-xs hover:bg-accent`,onClick:()=>{ne(null),ue(re.current),re.current=``},children:`Copy selection`}),(0,H.jsx)(`button`,{role:`menuitem`,className:`block w-full rounded px-2 py-1 text-left text-xs hover:bg-accent`,onClick:()=>void de(),children:`Paste`})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-border px-3 py-1 text-xs`,children:[(0,H.jsx)(`span`,{role:`status`,children:C}),x&&(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,onClick:()=>k(e=>e+1),children:[(0,H.jsx)(si,{className:`size-3`}),`Reconnect`]}),(0,H.jsx)(`input`,{"aria-label":`Search terminal output`,placeholder:`Search output`,className:`w-28 rounded border border-border bg-card px-1`,value:A,onChange:e=>te(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d.current?.findNext(A)}}),(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,onClick:()=>d.current?.findNext(A),children:[(0,H.jsx)(Ct,{className:`size-3`}),`Find`]}),(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,onClick:()=>void ue(),children:[(0,H.jsx)(Mr,{className:`size-3`}),`Copy selection`]}),(0,H.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:j,onChange:e=>M(e.target.checked)}),`Screen reader`]})]}),(0,H.jsxs)(`div`,{className:`truncate px-3 pb-1 text-[10px] text-muted-foreground`,title:x?.cwd,children:[`Local user permissions · `,x?.cwd??e,` · Hide keeps running; End session stops it.`]})]})}var gN=(0,V.lazy)(()=>Kn(()=>import(`./DocumentPreview-CtylgIF0.js`).then(e=>e.n).then(e=>({default:e.DocumentPreview})),__vite__mapDeps([5,1,2])));function _N({workspace:e,openDocument:t}){let{isMaximized:n,toggleMaximize:r}=Mt(),i=(0,V.useRef)(0),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)([]),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(``),[_,v]=(0,V.useState)(0),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(``),C=`/api/workspace/${encodeURIComponent(e)}`;(0,V.useEffect)(()=>{let e=new AbortController;return S(``),sr(`${C}/documents`,{signal:e.signal}).then(e=>o(e.documents)).catch(t=>{e.signal.aborted||S(t instanceof Error?t.message:`Could not load workspace files.`)}),sr(`${C}/work`,{signal:e.signal}).then(e=>c([...e.guidance.documents,...e.sharedDocuments??[]])).catch(t=>{e.signal.aborted||S(t instanceof Error?t.message:`Could not load source documents.`)}),()=>e.abort()},[C,_]),(0,V.useEffect)(()=>{t&&t.id!==i.current&&a.some(e=>e.name===t.name)&&(i.current=t.id,u({type:`file`,id:t.name}))},[a,t]),(0,V.useEffect)(()=>{let e=new AbortController;return f(null),m(null),b(!1),S(``),l&&(l.type===`file`?sr(`${C}/documents/preview?name=${encodeURIComponent(l.id)}`,{signal:e.signal}).then(f):sr(`${C}/work/documents/${encodeURIComponent(l.id)}`,{signal:e.signal}).then(m)).catch(t=>{e.signal.aborted||S(t instanceof Error?t.message:`Could not open document.`)}),()=>e.abort()},[C,l,_]);let w=(0,V.useMemo)(()=>a.filter(e=>e.name.toLowerCase().includes(h.toLowerCase())),[a,h]),T=(0,V.useMemo)(()=>s.filter(e=>`${e.title} ${e.role} ${e.status}`.toLowerCase().includes(h.toLowerCase())),[s,h]),E=l?.type===`file`?`${C}/documents/file?name=${encodeURIComponent(l.id)}`:``;return(0,H.jsxs)(`section`,{"aria-label":`Workspace documents`,className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border p-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Documents`}),!n&&(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,onClick:r,children:`Expand chat`}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,"aria-label":`Refresh documents`,onClick:()=>v(e=>e+1),children:(0,H.jsx)(li,{className:`size-3`})})]}),(0,H.jsxs)(`div`,{className:`max-h-[38%] min-h-32 space-y-2 overflow-auto border-b border-border p-2`,children:[(0,H.jsx)(Ye,{"aria-label":`Find a document`,placeholder:`Find a document…`,value:h,onChange:e=>g(e.target.value)}),(0,H.jsx)(`p`,{className:`text-[11px] font-semibold text-muted-foreground`,children:`Workspace files`}),w.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":l?.type===`file`&&l.id===e.name,className:`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-accent aria-pressed:bg-accent`,onClick:()=>u({type:`file`,id:e.name}),children:[(0,H.jsx)(Ir,{className:`size-3 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name})]},e.name)),!w.length&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matching files.`}),(0,H.jsx)(`p`,{className:`pt-2 text-[11px] font-semibold text-muted-foreground`,children:`Source documents`}),T.map(e=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":l?.type===`source`&&l.id===e.id,className:`flex w-full items-center justify-between gap-2 rounded px-2 py-1 text-left text-xs hover:bg-accent aria-pressed:bg-accent`,onClick:()=>u({type:`source`,id:e.id}),children:[(0,H.jsx)(`span`,{className:`truncate`,children:e.title}),(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:e.status})]},e.id)),!T.length&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No matching sources.`})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[!l&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Select a file or source to read beside the CLI session.`}),l&&(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`h3`,{className:`break-all text-xs font-semibold`,children:l.type===`file`?l.id:s.find(e=>e.id===l.id)?.title}),(0,H.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(p?.content!==void 0||d&&(d.kind===`html`||d.kind===`markdown`))&&(0,H.jsx)(yn,{size:`xs`,variant:`outline`,onClick:()=>b(e=>!e),children:y?`Rendered`:`Raw`}),l.type===`file`&&(0,H.jsx)(`a`,{className:`text-primary underline`,href:`${E}&download=1`,download:l.id,children:`Download`})]})]}),x&&(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:x}),d&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`p`,{role:`status`,className:`text-xs`,children:`Opening viewer…`}),children:(0,H.jsx)(gN,{preview:d,fileUrl:E,raw:y})}),p?.content!==void 0&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`p`,{role:`status`,className:`text-xs`,children:`Opening viewer…`}),children:(0,H.jsx)(gN,{preview:{name:l?.id??`Source document`,kind:`markdown`,content:p.content},fileUrl:``,raw:y})}),p?.content===void 0&&p?.location&&(0,H.jsx)(`a`,{className:`text-xs text-primary underline`,href:p.location,target:`_blank`,rel:`noopener noreferrer`,children:`Open source document`})]})]})}function vN({workspace:e,active:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(0),[c,l]=(0,V.useState)(``);return(0,V.useEffect)(()=>{if(!t)return;let n=new AbortController;return l(``),sr(`/api/workspace/${encodeURIComponent(e)}/work`,{signal:n.signal}).then(e=>r(e.guidance.assignment)).catch(e=>{n.signal.aborted||l(e instanceof Error?e.message:`Could not load the work brief.`)}),()=>n.abort()},[e,t,o]),!n&&!c?null:(0,H.jsxs)(`div`,{className:`border-b border-border bg-muted/20 px-3 py-1.5 text-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 truncate text-left hover:text-primary`,title:n?.objective,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-semibold capitalize`,children:n.stage}),` · `,n.objective||`No current objective set`]}):`Work brief unavailable`}),(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,"aria-label":`Refresh work brief`,onClick:()=>s(e=>e+1),children:(0,H.jsx)(li,{className:`size-3`})})]}),i&&(0,H.jsxs)(`div`,{className:`space-y-1 pt-2 text-muted-foreground`,children:[c&&(0,H.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:c}),n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Objective:`}),` `,n.objective||`Not set`]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Expected output:`}),` `,n.expectedOutput||`Not set`]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Stop when:`}),` `,n.stopCondition||`Not set`]})]})]})]})}function yN({workspacePath:e,...t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(50),[f,p]=(0,V.useState)(!1),m=(0,V.useRef)(null),h=(0,V.useRef)(0),g=(0,V.useCallback)(e=>{if(e.button!==0)return;let t=m.current;if(!t)return;let n=e.currentTarget;n.setPointerCapture(e.pointerId),p(!0);let r=e=>{let n=t.getBoundingClientRect();if(n.width<=0)return;let r=(e.clientX-n.left)/n.width*100;d(Math.round(Math.max(20,Math.min(85,100-r)))),l(!1)},i=e=>{p(!1),n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i)},[]),_=async n=>{let i=++h.current,o=n.path.replaceAll(`\\`,`/`).replace(/^\.\//,``),c=e.replaceAll(`\\`,`/`).replace(/\/$/,``),l=o.startsWith(`${c}/`)?o.slice(c.length+1):o;if(!l.includes(`/`))try{let e=await sr(`/api/workspace/${encodeURIComponent(t.workspace)}/documents`);if(i!==h.current)return;if(e.documents.some(e=>e.name===l)){s(e=>({name:l,id:(e?.id??0)+1})),r(`documents`);return}}catch{}i===h.current&&(a(e=>({...n,id:(e?.id??0)+1})),r(`code`))};return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border bg-muted/10 px-2 py-1`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:`CLI chat`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n&&(0,H.jsxs)(yn,{size:`xs`,variant:c?`secondary`:`ghost`,onClick:()=>l(e=>!e),"aria-label":c?`Split view`:`Expand ${n} panel`,title:c?`Restore split view`:`Expand ${n} panel`,children:[c?(0,H.jsx)(Qr,{className:`size-3`}):(0,H.jsx)(Jr,{className:`size-3`}),c?`Split view`:`Expand`]}),(0,H.jsxs)(yn,{size:`xs`,variant:n===`code`?`secondary`:`ghost`,"aria-pressed":n===`code`,onClick:()=>r(e=>e===`code`?null:`code`),children:[(0,H.jsx)(Gr,{className:`size-3`}),n===`code`?`Hide code`:`Show code`]}),(0,H.jsxs)(yn,{size:`xs`,variant:n===`documents`?`secondary`:`ghost`,"aria-pressed":n===`documents`,onClick:()=>r(e=>e===`documents`?null:`documents`),children:[(0,H.jsx)(Ir,{className:`size-3`}),`Documents`]})]})]}),(0,H.jsx)(vN,{workspace:t.workspace,active:t.active}),(0,H.jsxs)(`div`,{ref:m,className:`relative flex min-h-0 flex-1 flex-row`,children:[(0,H.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:(0,H.jsx)(hN,{...t,codeVisible:n!==null,onOpenFileReference:e=>{_(e)}})}),n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`vertical`,"aria-valuenow":c?85:u,"aria-valuemin":20,"aria-valuemax":85,"aria-label":n===`code`?`Resize code panel`:`Resize documents panel`,onPointerDown:g,onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),d(t=>Math.max(20,Math.min(85,t+(e.key===`ArrowLeft`?5:-5)))),l(!1))},className:`group z-20 -mx-1 flex w-2 cursor-col-resize select-none items-center justify-center bg-border/60 transition-colors hover:w-2.5 hover:bg-primary/50 focus-visible:bg-primary/70 focus-visible:outline-hidden ${f?`w-2.5 bg-primary/60`:``}`,title:`Drag or use Left/Right arrow keys to resize the inspector`,children:(0,H.jsx)(`div`,{className:`h-6 w-0.5 rounded bg-muted-foreground/30 group-hover:bg-primary`})}),(0,H.jsx)(`div`,{style:{width:c?`85%`:`${u}%`},className:`h-full min-h-0 min-w-0 border-l border-border ${f?``:`transition-[width] duration-150`}`,children:n===`code`?(0,H.jsx)(UC,{workspace:t.workspace,active:t.active,openReference:i,onClose:()=>r(null)}):(0,H.jsx)(_N,{workspace:t.workspace,openDocument:o})})]})]})]})}function bN({className:e,size:t=`default`,unstyled:n=!1,...r}){return(0,H.jsx)(`span`,{className:B(!n&&`relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]`,e)||void 0,"data-size":t,"data-slot":`textarea-control`,children:(0,H.jsx)(it,{render:e=>(0,H.jsx)(`textarea`,{className:B(`field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5 border-none bg-transparent resize-none h-full`,t===`sm`&&`min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5`,t===`lg`&&`min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5`),"data-slot":`textarea`,...gn(e,r)})})})}function xN(e){return e===`review`||e===`workspace-write`}var SN=e=>`${nr}${e}`,CN=e=>`${tr}${e}`,wN=()=>({v:4,sessions:{},providerId:null,profilesByProvider:{"claude-cli":`review`,"codex-cli":`review`},modelsByProvider:{},effortsByProvider:{},messages:[]});function TN(e){try{let t=localStorage.getItem(SN(e))||localStorage.getItem(CN(e));if(!t)return wN();let n=JSON.parse(t);if(Array.isArray(n))return{...wN(),messages:n.filter(e=>e&&typeof e.content==`string`&&(e.role===`user`||e.role===`assistant`)).map(e=>({role:e.role,content:e.content,...e.usage?{usage:e.usage}:{}}))};if(n&&n.v===4&&n.sessions&&Array.isArray(n.messages)){let e=Object.fromEntries(Object.entries(n.profilesByProvider??{}).filter(e=>xN(e[1]))),t=typeof n.modelsByProvider==`object`&&n.modelsByProvider!==null?Object.fromEntries(Object.entries(n.modelsByProvider).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`)):{},r=typeof n.effortsByProvider==`object`&&n.effortsByProvider!==null?Object.fromEntries(Object.entries(n.effortsByProvider).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`)):{};return{...wN(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:{...wN().profilesByProvider,...e},modelsByProvider:t,effortsByProvider:r,messages:n.messages}}if(n&&n.v===3&&n.sessions&&Array.isArray(n.messages))return{...wN(),sessions:n.sessions,providerId:typeof n.providerId==`string`?n.providerId:null,messages:n.messages};if(n&&n.v===2&&Array.isArray(n.messages)){let e={};return typeof n.sessionId==`string`&&n.sessionId&&(e[`claude-cli`]={id:n.sessionId,started:!!n.sessionStarted}),{v:4,sessions:e,providerId:typeof n.providerId==`string`?n.providerId:null,profilesByProvider:wN().profilesByProvider,messages:n.messages}}return wN()}catch{return wN()}}var EN=500;async function DN(e){try{let t=await fetch(`/api/chat/thread/${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(n&&n.thread){let e=n.thread;return{v:4,sessions:e.sessions||{},providerId:e.providerId||null,profilesByProvider:{...wN().profilesByProvider,...e.profilesByProvider||{}},modelsByProvider:e.modelsByProvider||{},effortsByProvider:e.effortsByProvider||{},messages:Array.isArray(e.messages)?e.messages:[],isBusy:!!n.isBusy}}return null}catch{return null}}async function ON(e,t){try{let n=t.messages.length>EN?{...t,messages:t.messages.slice(-500)}:t;await fetch(`/api/chat/thread/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})}catch{}}async function kN(e){try{await fetch(`/api/chat/thread/${encodeURIComponent(e)}`,{method:`DELETE`})}catch{}}function AN(e,t){let n=t.messages.length>EN?{...t,messages:t.messages.slice(-500)}:t;try{localStorage.setItem(SN(e),JSON.stringify(n))}catch(t){try{let t={...n,messages:n.messages.map(e=>{let t={...e};return delete t.images,t})};localStorage.removeItem(SN(e)),localStorage.setItem(SN(e),JSON.stringify(t))}catch{console.error(`Failed to save chat to localStorage`,t)}}ON(e,n)}function jN(e){try{localStorage.removeItem(SN(e)),kN(e),localStorage.removeItem(CN(e))}catch{}}var MN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,NN=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[a-zA-Z0-9_\-.]{1,128})$/i,PN=new Set([`claude-cli`,`codex-cli`,`antigravity-cli`,`copilot-cli`]);function FN(e){return e===`claude`?`claude-cli`:e===`codex`?`codex-cli`:e===`antigravity`?`antigravity-cli`:e===`copilot`?`copilot-cli`:null}function IN(e){if(!e||typeof e!=`object`)return null;let t=e.chatLaunch;if(!t||typeof t!=`object`)return null;let n=t;return!MN.test(n.nonce??``)||!n.providerId||!PN.has(n.providerId)||!xN(n.executionProfile)||n.kickoff!==void 0&&(typeof n.kickoff!=`string`||n.kickoff.length>2e3)||n.model!==void 0&&(typeof n.model!=`string`||n.model.length>100)||n.assistant!==void 0&&FN(n.assistant)!==n.providerId||n.sessionId!==void 0&&(!NN.test(n.sessionId)||!n.assistant)?null:n}function LN({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance p-6 text-center md:p-12`,e),"data-slot":`empty`,...t})}function RN({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`flex max-w-sm flex-col items-center text-center`,e),"data-slot":`empty-header`,...t})}var zN=hn(`flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent`,icon:`relative flex size-9 shrink-0 items-center justify-center rounded-md border bg-card not-dark:bg-clip-padding text-foreground shadow-sm/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='size-'])]:size-4.5`}}});function BN({className:e,variant:t=`default`,...n}){return(0,H.jsxs)(`div`,{className:B(`relative mb-6`,e),"data-slot":`empty-media`,"data-variant":t,...n,children:[t===`icon`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:B(zN({className:e,variant:t}),`-translate-x-0.5 -rotate-10 pointer-events-none absolute bottom-px origin-bottom-left scale-84 shadow-none`)}),(0,H.jsx)(`div`,{"aria-hidden":`true`,className:B(zN({className:e,variant:t}),`pointer-events-none absolute bottom-px origin-bottom-right translate-x-0.5 rotate-10 scale-84 shadow-none`)})]}),(0,H.jsx)(`div`,{className:B(zN({className:e,variant:t})),...n})]})}function VN({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`font-heading font-semibold text-xl`,e),"data-slot":`empty-title`,...t})}function HN({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`text-muted-foreground text-sm [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-slot=empty-title]+&]:mt-1`,e),"data-slot":`empty-description`,...t})}function UN({className:e,...t}){return(0,H.jsx)(`div`,{className:B(`animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]`,e),"data-slot":`skeleton`,...t})}function WN({open:e,onClose:t,ws:n,onPick:r,error:i,pending:a=!1}){let[o,s]=(0,V.useState)([]),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null);(0,V.useEffect)(()=>{e&&(l(!0),d(null),fetch(`/api/workspace/${encodeURIComponent(n.branchName)}/sessions`).then(e=>e.json()).then(e=>{let t=(e.sessions||[]).filter(e=>e.assistant===`claude`||e.assistant===`codex`||e.assistant===`antigravity`||e.assistant===`copilot`);s(t)}).catch(()=>d(`Failed to load sessions.`)).finally(()=>l(!1)))},[e,n.branchName]);let f=e=>{switch(e){case`codex`:return`Codex`;case`antigravity`:return`Antigravity`;case`copilot`:return`Copilot`;default:return`Claude`}};return(0,H.jsx)(Ov,{open:e,onOpenChange:e=>!e&&t(),children:(0,H.jsxs)(Mv,{className:`max-w-lg`,children:[(0,H.jsx)(Nv,{children:(0,H.jsx)(Fv,{children:`Resume a past session`})}),(0,H.jsxs)(Lv,{className:`flex max-h-[60vh] flex-col gap-2`,children:[(i||u)&&(0,H.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:i||u}),c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(UN,{className:`h-14`}),(0,H.jsx)(UN,{className:`h-14`}),(0,H.jsx)(UN,{className:`h-14`})]}):o.length===0?(0,H.jsx)(LN,{children:(0,H.jsxs)(RN,{children:[(0,H.jsx)(BN,{variant:`icon`,children:(0,H.jsx)(ui,{})}),(0,H.jsx)(VN,{children:`No resumable sessions found`}),(0,H.jsx)(HN,{children:`Past conversations for this workspace will show up here.`})]})}):o.map(e=>(0,H.jsxs)(`button`,{onClick:()=>r(e),disabled:a,className:`cursor-pointer rounded-lg border border-border bg-card p-3 text-left transition-colors hover:border-foreground/15 hover:bg-accent/50 disabled:cursor-wait disabled:opacity-60`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground`,children:f(e.assistant)}),(0,H.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:a?`Loading transcript…`:new Date(e.updatedAt).toLocaleString()}),(0,H.jsx)(`span`,{children:`·`}),(0,H.jsx)(Xr,{size:11}),(0,H.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var GN=n(((e,t)=>{var n=[[{color:`0, 0, 0`,class:`ansi-black`},{color:`187, 0, 0`,class:`ansi-red`},{color:`0, 187, 0`,class:`ansi-green`},{color:`187, 187, 0`,class:`ansi-yellow`},{color:`0, 0, 187`,class:`ansi-blue`},{color:`187, 0, 187`,class:`ansi-magenta`},{color:`0, 187, 187`,class:`ansi-cyan`},{color:`255,255,255`,class:`ansi-white`}],[{color:`85, 85, 85`,class:`ansi-bright-black`},{color:`255, 85, 85`,class:`ansi-bright-red`},{color:`0, 255, 0`,class:`ansi-bright-green`},{color:`255, 255, 85`,class:`ansi-bright-yellow`},{color:`85, 85, 255`,class:`ansi-bright-blue`},{color:`255, 85, 255`,class:`ansi-bright-magenta`},{color:`85, 255, 255`,class:`ansi-bright-cyan`},{color:`255, 255, 255`,class:`ansi-bright-white`}]],r=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;t.exports=class e{static escapeForHtml(t){return new e().escapeForHtml(t)}static linkify(t){return new e().linkify(t)}static ansiToHtml(t,n){return new e().ansiToHtml(t,n)}static ansiToJson(t,n){return new e().ansiToJson(t,n)}static ansiToText(t){return new e().ansiToText(t)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let e=0;e<2;++e)for(let t=0;t<8;++t)this.PALETTE_COLORS.push(n[e][t].color);let e=[0,95,135,175,215,255],t=(t,n,r)=>e[t]+`, `+e[n]+`, `+e[r];for(let e=0;e<6;++e)for(let n=0;n<6;++n)for(let r=0;r<6;++r)this.PALETTE_COLORS.push(t(e,n,r));let r=8;for(let e=0;e<24;++e,r+=10)this.PALETTE_COLORS.push(r+`, `+r+`, `+r)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,e=>e==`&`?`&amp;`:e==`"`?`&quot;`:e==`<`?`&lt;`:e==`>`?`&gt;`:``)}linkify(e){return e.replace(r,e=>`<a href="${e}">${e}</a>`)}ansiToHtml(e,t){return this.process(e,t,!0)}ansiToJson(e,t){return t||={},t.json=!0,t.clearLine=!1,this.process(e,t,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,t,n){let r=this,i=e.split(/\033\[/),a=i.shift();t??={},t.clearLine=/\r/.test(e);let o=i.map(e=>this.processChunk(e,t,n));if(t&&t.json){let e=r.processChunkJson(``);return e.content=a,e.clearLine=t.clearLine,o.unshift(e),t.remove_empty&&(o=o.filter(e=>!e.isEmpty())),o}return o.unshift(a),o.join(``)}processChunkJson(e,t,r){t=t===void 0?{}:t;let i=t.use_classes=t.use_classes!==void 0&&t.use_classes,a=t.key=i?`class`:`color`,o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:t.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},s=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!s)return o;o.content=s[4];let c=s[2].split(`;`);if(s[1]!==``||s[3]!==`m`||!r)return o;let l=this;for(;c.length>0;){let e=c.shift(),t=parseInt(e);if(isNaN(t)||t===0)l.fg=l.bg=null,l.decorations=[];else if(t===1)l.decorations.push(`bold`);else if(t===2)l.decorations.push(`dim`);else if(t===3)l.decorations.push(`italic`);else if(t===4)l.decorations.push(`underline`);else if(t===5)l.decorations.push(`blink`);else if(t===7)l.decorations.push(`reverse`);else if(t===8)l.decorations.push(`hidden`);else if(t===9)l.decorations.push(`strikethrough`);else if(t===21)l.removeDecoration(`bold`);else if(t===22)l.removeDecoration(`bold`),l.removeDecoration(`dim`);else if(t===23)l.removeDecoration(`italic`);else if(t===24)l.removeDecoration(`underline`);else if(t===25)l.removeDecoration(`blink`);else if(t===27)l.removeDecoration(`reverse`);else if(t===28)l.removeDecoration(`hidden`);else if(t===29)l.removeDecoration(`strikethrough`);else if(t===39)l.fg=null;else if(t===49)l.bg=null;else if(t>=30&&t<38)l.fg=n[0][t%10][a];else if(t>=90&&t<98)l.fg=n[1][t%10][a];else if(t>=40&&t<48)l.bg=n[0][t%10][a];else if(t>=100&&t<108)l.bg=n[1][t%10][a];else if(t===38||t===48){let e=t===38;if(c.length>=1){let t=c.shift();if(t===`5`&&c.length>=1){let t=parseInt(c.shift());if(t>=0&&t<=255){if(!i)this.PALETTE_COLORS||l.setupPalette(),e?l.fg=this.PALETTE_COLORS[t]:l.bg=this.PALETTE_COLORS[t];else{let r=t>=16?`ansi-palette-`+t:n[+(t>7)][t%8].class;e?l.fg=r:l.bg=r}}}else if(t===`2`&&c.length>=3){let t=parseInt(c.shift()),n=parseInt(c.shift()),r=parseInt(c.shift());if(t>=0&&t<=255&&n>=0&&n<=255&&r>=0&&r<=255){let a=t+`, `+n+`, `+r;i?e?(l.fg=`ansi-truecolor`,l.fg_truecolor=a):(l.bg=`ansi-truecolor`,l.bg_truecolor=a):e?l.fg=a:l.bg=a}}}}}return l.fg===null&&l.bg===null&&l.decorations.length===0?o:(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decorations=l.decorations,o.decoration=l.decorations.slice(-1).pop()||null,o.was_processed=!0,o)}processChunk(e,t,r){t||={};let i=this.processChunkJson(e,t,r),a=t.use_classes;if(i.decorations=i.decorations.filter(e=>{if(e===`reverse`){i.fg||=n[0][7][a?`class`:`color`],i.bg||=n[0][0][a?`class`:`color`];let e=i.fg;i.fg=i.bg,i.bg=e;let t=i.fg_truecolor;return i.fg_truecolor=i.bg_truecolor,i.bg_truecolor=t,i.isInverted=!0,!1}return!0}),t.json)return i;if(i.isEmpty())return``;if(!i.was_processed)return i.content;let o=[],s=[],c=[],l={},u=e=>{let t=[],n;for(n in e)e.hasOwnProperty(n)&&t.push(`data-`+n+`="`+this.escapeForHtml(e[n])+`"`);return t.length>0?` `+t.join(` `):``};return i.isInverted&&(l[`ansi-is-inverted`]=`true`),i.fg&&(a?(o.push(i.fg+`-fg`),i.fg_truecolor!==null&&(l[`ansi-truecolor-fg`]=i.fg_truecolor,i.fg_truecolor=null)):o.push(`color:rgb(`+i.fg+`)`)),i.bg&&(a?(o.push(i.bg+`-bg`),i.bg_truecolor!==null&&(l[`ansi-truecolor-bg`]=i.bg_truecolor,i.bg_truecolor=null)):o.push(`background-color:rgb(`+i.bg+`)`)),i.decorations.forEach(e=>{if(a){s.push(`ansi-`+e);return}e===`bold`?s.push(`font-weight:bold`):e===`dim`?s.push(`opacity:0.5`):e===`italic`?s.push(`font-style:italic`):e===`hidden`?s.push(`visibility:hidden`):e===`strikethrough`?c.push(`line-through`):c.push(e)}),c.length&&s.push(`text-decoration:`+c.join(` `)),a?`<span class="`+o.concat(s).join(` `)+`"`+u(l)+`>`+i.content+`</span>`:`<span style="`+o.concat(s).join(`;`)+`"`+u(l)+`>`+i.content+`</span>`}removeDecoration(e){let t=this.decorations.indexOf(e);t>=0&&this.decorations.splice(t,1)}}})),KN=n(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
64
- `);/\r./.test(e);)e=e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,t,n){return n+t.slice(n.length)});return e}function r(e){for(var t=0,n=0;n<e.length;n++)e[t].length<=e[n].length&&(t=n);return t}function i(e){if(!/\r/.test(e))return e;for(var t=e.split(`\r`),n=[];t.length>0;){var i=r(t);n.push(t[i]),t=t.slice(i+1)}return n.join(`\r`)}function a(e){if(!e)return``;if(!/\r/.test(e))return e;if(!/\n/.test(e))return i(e);e=e.replace(/\r+\n/gm,`
65
- `);var t=e.lastIndexOf(`
66
- `);return n(e.slice(0,t))+`
67
- `+i(e.slice(t+1))}t.exports=n,t.exports.escapeCarriageReturn=n,t.exports.escapeCarriageReturnSafe=a})),qN=n((e=>{e.Any=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,e.Cc=/[\0-\x1F\x7F-\x9F]/,e.Cf=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,e.P=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,e.S=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,e.Z=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),JN=n(((e,t)=>{var n=qN();function r(e){let t={};e||={},t.src_Any=n.Any.source,t.src_Cc=n.Cc.source,t.src_Z=n.Z.source,t.src_P=n.P.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let r=`[><|]`;return t.src_pseudo_letter=`(?:(?!${r}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|${r}|${t.src_ZPCc})(?!${e[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${r}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${r}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function i(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function a(e){return Object.prototype.toString.call(e)}function o(e){return a(e)===`[object String]`}function s(e){return a(e)===`[object Object]`}function c(e){return a(e)===`[object RegExp]`}function l(e){return a(e)===`[object Function]`}function u(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var d={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function f(e){return Object.keys(e||{}).reduce(function(e,t){return e||d.hasOwnProperty(t)},!1)}var p={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},m=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,h=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function g(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function _(){return function(e,t){t.normalize(e)}}function v(e){let t=e.re=r(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(m),n.push(t.src_xn),t.src_tlds=n.join(`|`);function i(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(i(t.tpl_email_fuzzy),`i`),t.email_fuzzy_global=RegExp(i(t.tpl_email_fuzzy),`ig`),t.link_fuzzy=RegExp(i(t.tpl_link_fuzzy),`i`),t.link_fuzzy_global=RegExp(i(t.tpl_link_fuzzy),`ig`),t.link_no_ip_fuzzy=RegExp(i(t.tpl_link_no_ip_fuzzy),`i`),t.link_no_ip_fuzzy_global=RegExp(i(t.tpl_link_no_ip_fuzzy),`ig`),t.host_fuzzy_test=RegExp(i(t.tpl_host_fuzzy_test),`i`);let a=[];e.__compiled__={};function d(e,t){throw Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,s(n)){c(n.validate)?r.validate=g(n.validate):l(n.validate)?r.validate=n.validate:d(t,n),l(n.normalize)?r.normalize=n.normalize:n.normalize?d(t,n):r.normalize=_();return}if(o(n)){a.push(t);return}d(t,n)}),a.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:_()};let f=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(u).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${f})`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${f})`,`ig`),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,`i`),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,`i`)}function y(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function b(e,t){if(!(this instanceof b))return new b(e,t);t||f(e)&&(t=e,e={}),this.__opts__=i({},d,t),this.__schemas__=i({},p,e),this.__compiled__={},this.__tlds__=h,this.__tlds_replaced__=!1,this.re={},v(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,v(this),this},b.prototype.set=function(e){return this.__opts__=i(this.__opts__,e),this},b.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e)){for(n=this.re.schema_search,n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&e.indexOf(`@`)>=0&&e.match(this.re.email_fuzzy)!==null)},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){let t=[],n=[],r=[],i=[],a,o,s;function c(e,t){return e?t?e.index===t.index?e.lastIndex>=t.lastIndex?e:t:e.index<t.index?e:t:e:t}if(!e.length)return null;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;(a=s.exec(e))!==null;)o=this.testSchemaAt(e,a[2],s.lastIndex),o&&n.push({schema:a[2],index:a.index+a[1].length,lastIndex:a.index+a[0].length+o});if(this.__opts__.fuzzyLink&&this.__compiled__[`http:`])for(s=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)r.push({schema:``,index:a.index+a[1].length,lastIndex:a.index+a[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`])for(s=this.re.email_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)i.push({schema:`mailto:`,index:a.index+a[1].length,lastIndex:a.index+a[0].length});let l=[0,0,0],u=0;for(;;){let a=[n[l[0]],i[l[1]],r[l[2]]],o=c(c(a[0],a[1]),a[2]);if(!o)break;if(o===a[0]?l[0]++:o===a[1]?l[1]++:l[2]++,o.index<u)continue;let s=new y(e,o.schema,o.index,o.lastIndex);this.__compiled__[s.schema].normalize(s,this),t.push(s),u=o.lastIndex}return t.length?t:null},b.prototype.matchAtStart=function(e){if(!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new y(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__compiled__[r.schema].normalize(r,this),r},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),v(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,v(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)},b.prototype.onCompile=function(){},t.exports=b})),YN=t(n((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),a=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=g;var o=a(GN()),s=KN(),c=a(JN()),l=i(r());function u(e,t=!1){return e=(0,s.escapeCarriageReturn)(_(e)),o.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function d(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function f(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`}return t}function p(e,t,n,r){let i=t?null:f(n),a=t?d(n):null;return e?e===`fuzzy`?h(n,r,i,a):m(n,r,i,a):l.createElement(`span`,{style:i,key:r,className:a},n.content)}function m(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let c=n.startsWith(`www.`)?`http://${n}`:n;i.push(l.createElement(`a`,{key:o,href:c,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),l.createElement(`span`,{style:n,key:t,className:r},i)}function h(e,t,n,r){let i=(0,c.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return l.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return l.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(l.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),l.createElement(`span`,{style:n,key:t,className:r},o)}function g(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return l.createElement(`code`,{className:t},u(r??``,n??!1).map(p.bind(null,i??!1,n??!1)))}function _(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),XN=YN.default.default||YN.default;function ZN(e){return e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:e.toLocaleString()}function QN(e){return e?e.planType===`plan-included`?`Plan: Included`:e.contextWindow?.utilizationPercent===void 0?e.tokens?.remaining===void 0?e.requests?.remaining===void 0?e.label?e.label:`Quota: OK`:`Quota: ${e.requests.remaining} req`:`Quota: ${ZN(e.tokens.remaining)}`:`Context: ${e.contextWindow.utilizationPercent.toFixed(1)}%`:`Quota: Unmonitored`}var $N=[{id:``,label:`Auto Effort`,description:`Model/provider default reasoning depth`},{id:`low`,label:`Low Effort`,description:`Fast responses with lightweight reasoning`},{id:`medium`,label:`Medium Effort`,description:`Balanced reasoning depth and latency`},{id:`high`,label:`High Effort`,description:`Deep multi-step reasoning and verification`},{id:`max`,label:`Max Effort`,description:`Maximum thinking budget for complex tasks`}];function eP(e){return e?e.charAt(0).toUpperCase()+e.slice(1):`Auto`}var tP={"claude-cli":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"claude-sdk":new Set([`npm install -g @anthropic-ai/claude-code`,`claude auth login`,`claude auth status --json`]),"codex-cli":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`]),"codex-sdk":new Set([`npm install -g @openai/codex`,`codex login`,`codex login status`]),"antigravity-cli":new Set([`agy`]),"copilot-cli":new Set([`copilot login`,`copilot help`])},nP=new Set([`native-api`,`cli-print`,`acp`,`sdk`]),rP=new Set([`none`,`client-assigned`,`provider-assigned`]),iP=new Set([`read-only`,`workspace-write`,`harness-managed`]),aP=new Set([`uuid`,`opaque`]),oP=new Set([`missing-cli`,`signed-out`,`probe-failed`]);function sP(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function cP(e){return e===void 0||typeof e==`string`}function lP(e){return!sP(e)||typeof e.transport!=`string`||!nP.has(e.transport)||typeof e.sessionIdentity!=`string`||!rP.has(e.sessionIdentity)||typeof e.workspaceAccess!=`string`||!iP.has(e.workspaceAccess)||e.sessionIdFormat!==void 0&&(typeof e.sessionIdFormat!=`string`||!aP.has(e.sessionIdFormat))?null:{transport:e.transport,sessionIdentity:e.sessionIdentity,workspaceAccess:e.workspaceAccess,...e.sessionIdFormat===void 0?{}:{sessionIdFormat:e.sessionIdFormat}}}function uP(e){if(!sP(e)||typeof e.id!=`string`||typeof e.name!=`string`||typeof e.isConfigured!=`boolean`||!cP(e.icon)||!cP(e.accessLabel)||!cP(e.message)||!cP(e.recoveryCommand)||!cP(e.recoveryLabel)||e.setupIssue!==void 0&&(typeof e.setupIssue!=`string`||!oP.has(e.setupIssue)))return null;let t=lP(e.capabilities);if(!t)return null;let n;if(e.executionProfiles!==void 0){if(!Array.isArray(e.executionProfiles)||e.executionProfiles.length===0)return null;n=[];let t=new Set;for(let r of e.executionProfiles){if(!sP(r)||!xN(r.id)||typeof r.label!=`string`||typeof r.description!=`string`||t.has(r.id))return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description})}}if(e.defaultExecutionProfile!==void 0&&(!xN(e.defaultExecutionProfile)||!n?.some(t=>t.id===e.defaultExecutionProfile))||n&&e.defaultExecutionProfile===void 0||!n&&e.defaultExecutionProfile!==void 0)return null;let r;if(e.models!==void 0){if(!Array.isArray(e.models)||e.models.length===0)return null;r=[];let t=new Set;for(let n of e.models){if(!sP(n)||typeof n.id!=`string`||n.id.length>100||typeof n.label!=`string`||n.label.length===0||n.label.length>100||typeof n.description!=`string`||n.description.length>300||t.has(n.id))return null;t.add(n.id),r.push({id:n.id,label:n.label,description:n.description})}}let i=e.setupIssue!==void 0||e.recoveryCommand!==void 0||e.recoveryLabel!==void 0,a=e.setupIssue!==void 0&&e.recoveryCommand!==void 0&&e.recoveryLabel!==void 0;return i&&!a||e.isConfigured&&i?null:{id:e.id,name:e.name,isConfigured:e.isConfigured,capabilities:t,...e.icon===void 0?{}:{icon:e.icon},...e.accessLabel===void 0?{}:{accessLabel:e.accessLabel},...e.message===void 0?{}:{message:e.message},...e.setupIssue===void 0?{}:{setupIssue:e.setupIssue},...e.recoveryCommand===void 0?{}:{recoveryCommand:e.recoveryCommand},...e.recoveryLabel===void 0?{}:{recoveryLabel:e.recoveryLabel},...n===void 0?{}:{executionProfiles:n},...e.defaultExecutionProfile===void 0?{}:{defaultExecutionProfile:e.defaultExecutionProfile},...r===void 0?{}:{models:r}}}function dP(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=uP(n);if(!e)return null;t.push(e)}return t}function fP(e){return!e.recoveryCommand||!tP[e.id]?.has(e.recoveryCommand)?null:{command:e.recoveryCommand,label:e.recoveryLabel??`Copy recovery command`}}function pP(e){return!e||e.toLowerCase().includes(`review`)?`Review`:e.toLowerCase().includes(`edit`)||e.toLowerCase().includes(`write`)?`Edit`:e}function mP(e,t){if(!t)return`Auto`;let n=e.models?.find(e=>e.id===t);return n?n.label:t}function hP(e,t){let n=!1,r={...e};for(let i of t){let t=e[i.id];t&&i.models&&!i.models.some(e=>e.id===t)&&(delete r[i.id],n=!0)}return n?r:e}var gP=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,_P=(0,V.memo)(function({msg:e,idx:t,copied:n,onCopy:r}){if(e.role===`system`)return(0,H.jsx)(`div`,{className:`flex justify-center`,children:(0,H.jsx)(`span`,{className:B(`rounded-full border px-3 py-1 text-center text-[11px]`,e.kind===`error`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-border bg-muted text-muted-foreground`),children:e.content})});let i=e.role===`user`,a=!i&&e.content.includes(`\x1B`);return(0,H.jsxs)(`div`,{className:`flex flex-col ${i?`items-end`:`items-start`}`,children:[(0,H.jsx)(`div`,{className:`group relative max-w-[85%] rounded-lg p-3 ${i?`bg-primary text-primary-foreground`:`border border-border bg-card text-foreground`}`,children:i?(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.images&&e.images.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.images.map((e,t)=>(0,H.jsx)(`img`,{src:e,alt:`Attached`,className:`max-h-48 max-w-full rounded-lg border border-white/20 object-contain shadow-xs cursor-pointer hover:opacity-95`,onClick:()=>window.open(e,`_blank`)},t))}),e.content&&(0,H.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.content})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,H.jsx)(`div`,{className:`overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-2 font-mono text-xs text-foreground`,children:(0,H.jsx)(XN,{children:e.content})}):(0,H.jsx)(Dv,{content:e.content}),e.filesChanged&&e.filesChanged.length>0&&(0,H.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5 rounded-md border border-border/70 bg-muted/30 p-2 text-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium text-muted-foreground`,children:[(0,H.jsx)(Fr,{size:13,className:`text-primary`}),(0,H.jsxs)(`span`,{children:[e.filesChanged.length,` file`,e.filesChanged.length>1?`s`:``,` modified`]})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.filesChanged.map((e,t)=>(0,H.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground border border-border/50`,children:e},t))})]}),e.usage&&(0,H.jsx)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground font-mono`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 bg-muted/60 px-1.5 py-0.5 rounded border border-border/40`,children:[(0,H.jsx)(Di,{size:10,className:`text-amber-500 shrink-0`}),(0,H.jsxs)(`span`,{children:[e.usage.inputTokens.toLocaleString(),` in`]}),typeof e.usage.cachedInputTokens==`number`&&e.usage.cachedInputTokens>0&&(0,H.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[`(`,e.usage.cachedInputTokens.toLocaleString(),` cached)`]}),(0,H.jsx)(`span`,{children:`·`}),(0,H.jsxs)(`span`,{children:[e.usage.outputTokens.toLocaleString(),` out`]}),e.usage.costUsdEstimate!==void 0&&e.usage.costUsdEstimate>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`·`}),(0,H.jsxs)(`span`,{children:[`~$`,e.usage.costUsdEstimate<.01?e.usage.costUsdEstimate.toFixed(4):e.usage.costUsdEstimate.toFixed(3)]})]})]})}),(0,H.jsx)(`button`,{onClick:()=>r(t,e.content),className:`absolute -right-2.5 -top-2.5 hidden h-6 w-6 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground group-hover:grid`,title:`Copy message`,children:n?(0,H.jsx)(wr,{size:12,className:`text-success-foreground`}):(0,H.jsx)(Mr,{size:12})})]})}),i&&e.executionProfile&&(0,H.jsx)(`span`,{className:`mt-1 rounded border border-border px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.executionProfile===`workspace-write`?`Edit`:`Review`}),e.ts&&(0,H.jsx)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:gP(e.ts)})]})});function vP({ws:e,draft:t,onDraftConsumed:n}){let r=Ft(),i=Lt(),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(!1),[l]=(0,V.useState)(()=>TN(e.branchName)),[u,d]=(0,V.useState)(l.messages),[f,p]=(0,V.useState)(``),m=(0,V.useRef)(null);(0,V.useEffect)(()=>{!t||m.current===t.id||(m.current=t.id,p(e=>e?`${e}\n\n${t.text}`:t.text),n?.(t.id))},[t,n]);let[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(l.profilesByProvider),[T,E]=(0,V.useState)(l.modelsByProvider??{}),[D,ee]=(0,V.useState)(l.effortsByProvider??{}),[O,k]=(0,V.useState)(null),[A,te]=(0,V.useState)(!1),[j,M]=(0,V.useState)(l.sessions),[N,ne]=(0,V.useState)(0),[re,ie]=(0,V.useState)(!1),[P,F]=(0,V.useState)(null),[I,L]=(0,V.useState)(null),[ae,R]=(0,V.useState)(null),[oe,z]=(0,V.useState)(!1),[se,ce]=(0,V.useState)(null),[le,ue]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(null),[pe,me]=(0,V.useState)(null),[he,ge]=(0,V.useState)([]),[_e,ve]=(0,V.useState)(!1),ye=(0,V.useRef)(null),be=(0,V.useRef)(!1),xe=(0,V.useCallback)((e,t)=>{d(n=>[...n,{role:`system`,content:e,kind:t,ts:Date.now()}])},[]),Se=(0,V.useCallback)(e=>{let t=Array.from(e),n=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),r=t.filter(e=>!n.has(e.type));r.length>0&&xe(`${r.length} unsupported file(s) ignored. Attach PNG, JPEG, GIF, or WebP images.`,`note`);let i=t.filter(e=>n.has(e.type));if(i.length!==0)for(let e of i){if(e.size>20971520){xe(`Image "${e.name}" exceeds the 20MB limit and was not attached.`,`error`);continue}let t=new FileReader;t.onload=t=>{let n=t.target?.result;typeof n==`string`&&n.startsWith(`data:image/`)?ge(t=>[...t,{id:crypto.randomUUID(),name:e.name||`pasted-image-${Date.now()}.png`,dataUrl:n,file:e}]):xe(`Image "${e.name||`pasted image`}" could not be read.`,`error`)},t.onerror=()=>xe(`Image "${e.name||`pasted image`}" could not be read.`,`error`),t.readAsDataURL(e)}},[xe]),Ce=(0,V.useCallback)(e=>{M(t=>{let n=e(t);return Oe.current=n,n}),ne(e=>e+1)},[]),we=(0,V.useRef)(null),Te=(0,V.useRef)(null),Ee=(0,V.useRef)(null),De=(0,V.useRef)(!0),Oe=(0,V.useRef)(l.sessions),ke=(0,V.useRef)([]),Ae=(0,V.useRef)(!1),je=(0,V.useRef)(!1),Me=(0,V.useRef)({messages:u,agentName:x,profilesByProvider:C,modelsByProvider:T,effortsByProvider:D}),Ne=(0,V.useRef)(C),Pe=(0,V.useRef)(null),Fe=(0,V.useRef)(null),Ie=(0,V.useRef)(!0),Le=(0,V.useRef)(0),Re=(0,V.useRef)(null),ze=(0,V.useRef)(!1),Be=(0,V.useRef)({id:0,controller:null}),Ve=(0,V.useMemo)(()=>IN(r.state),[r.state]),[He,Ue]=(0,V.useState)([]),We=(0,V.useRef)(new Set),Ge=(0,V.useRef)(!1),Ke=(0,V.useRef)(!1),qe=(0,V.useRef)(null);(0,V.useEffect)(()=>{Ge.current=_},[_]);let Je=(0,V.useCallback)((e,t)=>{let n=we.current;n&&n.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:`approval_response`,requestId:e,decision:t})),Ue(t=>t.filter(t=>t.requestId!==e))},[]);(0,V.useEffect)(()=>{Me.current={messages:u,agentName:x,profilesByProvider:C,modelsByProvider:T,effortsByProvider:D},Ne.current=C},[u,x,C,T,D]);let Ye=(0,V.useCallback)(()=>{Pe.current=null,AN(e.branchName,{v:4,sessions:Oe.current,providerId:Me.current.agentName||l.providerId,profilesByProvider:Me.current.profilesByProvider,modelsByProvider:Me.current.modelsByProvider,effortsByProvider:Me.current.effortsByProvider,messages:Me.current.messages})},[e.branchName,l.providerId]);(0,V.useEffect)(()=>{let e=u[u.length-1];(De.current||e?.role===`user`)&&Ee.current?.scrollIntoView({behavior:e?.role===`user`?`smooth`:`auto`}),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(Ye,400)},[u,x,C,T,N,Ye]),(0,V.useEffect)(()=>{let e=()=>Ye();return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),Pe.current&&clearTimeout(Pe.current),Ye()}},[Ye]),(0,V.useEffect)(()=>{let t=!0;return DN(e.branchName).then(e=>{if(!(!t||!e)&&(d(t=>{if(t.length===0&&e.messages.length>0)return e.messages;let n=new Map(e.messages.filter(e=>e.images?.length).map(e=>[`${e.role}:${e.ts??``}:${e.content}`,e.images])),r=!1,i=t.map(e=>{if(e.images?.length)return e;let t=n.get(`${e.role}:${e.ts??``}:${e.content}`);return t?(r=!0,{...e,images:t}):e});return r?i:t}),e.sessions&&Object.keys(e.sessions).length>0&&Ce(t=>({...e.sessions,...t})),e.isBusy&&!we.current)){let t=e.providerId||x;t&&qe.current&&qe.current(t,{firstMessage:null})}}),()=>{t=!1}},[e.branchName,Ce,x]),(0,V.useEffect)(()=>{let t=++Le.current,n=new AbortController,r=!0;return fetch(`/api/adapters/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,signal:n.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(n=>{if(!r||t!==Le.current)return;let i=dP(n);if(!i)throw Error(`Invalid provider status response`);o(i),E(e=>hP(e,i)),w(e=>{let t=!1,n={...e};for(let r of i)!r.executionProfiles?.length||!r.defaultExecutionProfile||r.executionProfiles.some(t=>t.id===e[r.id])||(n[r.id]=r.defaultExecutionProfile,t=!0);return t?n:e});let a=e.assistants?.[0]?FN(e.assistants[0]):void 0,s=l.providerId?i.find(e=>e.id===l.providerId):void 0,c=a?i.find(e=>e.id===a&&e.isConfigured):void 0,u=s||c||i.find(e=>e.isConfigured)||i[0];u&&S(e=>e||u.id)}).catch(e=>{r&&e?.name!==`AbortError`&&console.error(`Failed to fetch agent data`,e)}).finally(()=>{r&&t===Le.current&&c(!0)}),()=>{r=!1,n.abort()}},[l.providerId,e.assistants]),(0,V.useEffect)(()=>(Ie.current=!0,()=>{Ie.current=!1,Be.current.id+=1,Be.current.controller?.abort(),we.current&&we.current.close()}),[e.branchName,e.workspacePath]);let Xe=O??x,Ze=a.find(e=>e.id===Xe),Qe=Ze?.executionProfiles?.find(e=>e.id===C[Ze.id])??Ze?.executionProfiles?.find(e=>e.id===Ze.defaultExecutionProfile),$e=!!x&&!!Ze?.isConfigured&&(!Ze?.executionProfiles||!!Qe)&&!A&&!re,et=(0,V.useCallback)(e=>{_||A||re||(we.current&&=(we.current.close(),null),g(!1),k(null),R(null),S(e),Me.current.agentName=e,Pe.current&&clearTimeout(Pe.current),Ye())},[_,A,re,Ye]),tt=(0,V.useCallback)((e,t)=>{let n=t??a.find(t=>t.id===e);if(!n?.executionProfiles?.length)return;let r=Ne.current[e];return r&&n.executionProfiles.some(e=>e.id===r)?r:n.defaultExecutionProfile??`review`},[a]),nt=(0,V.useCallback)(()=>{Ae.current=!1,b(!1)},[]),rt=(0,V.useCallback)(async(t,n,r,i)=>{if(be.current)return;be.current=!0;let a=i??he;try{let i=crypto.randomUUID(),o=[],s=[],c=!1;if(a.length>0){let t=await Promise.all(a.map(async t=>{try{let n=await fetch(`/api/chat/upload-attachment`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dataUrl:t.dataUrl,filename:t.name,workspacePath:e.workspacePath})});if(n.ok){let e=await n.json();if(typeof e.path==`string`&&e.path)return{dataUrl:t.dataUrl,path:e.path};throw Error(`Invalid upload response`)}let r=await n.json().catch(()=>({error:`Upload failed`}));c=!0,xe(`Image "${t.name}" could not be uploaded: ${r.error||n.statusText}`,`error`)}catch(e){console.error(`Failed to upload image attachment`,e),c=!0,xe(`Image "${t.name}" failed to upload.`,`error`)}return{dataUrl:t.dataUrl,path:null}}));if(c){xe(`The message was kept in the composer. Fix or remove the failed image, then try again.`,`note`);return}o=t.map(e=>e.path).filter(e=>!!e),s=t.map(e=>e.dataUrl)}let l=n;if(o.length>0){let e=o.map(e=>`[Attached image: ${e}]`).join(`
68
- `);l=l?`${l}\n\n${e}`:e}let u={role:`user`,content:n,ts:Date.now(),...r?{executionProfile:r}:{},...s.length>0?{images:s}:{}};if(t.readyState!==WebSocket.OPEN||we.current!==t){xe(`The agent disconnected while images were uploading. Your draft and attachments were kept.`,`error`);return}ke.current.push({turnId:i,text:l,message:u});let f=D[x];try{t.send(JSON.stringify({type:`input`,input:l,turnId:i,...r?{executionProfile:r}:{},command:x,cwd:e.workspacePath,...f?{effort:f}:{}}))}catch{ke.current=ke.current.filter(e=>e.turnId!==i),xe(`Failed to send message to the agent. Your draft and attachments were kept.`,`error`);return}d(e=>[...e,u]),p(e=>e.trim()===n?``:e);let m=new Set(a.map(e=>e.id));ge(e=>e.filter(e=>!m.has(e.id))),v(!0),nt()}finally{be.current=!1}},[x,xe,he,nt,D,e.workspacePath]),it=(0,V.useCallback)(()=>{je.current||(je.current=!0,xe(`Session ended`,`note`))},[xe]),at=(0,V.useCallback)(()=>{Ke.current=!0;let e=we.current;if(e){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify({type:`stop`}))}catch{}we.current=null,Re.current=null,k(null),te(!1),e.close(),g(!1),v(!1),nt(),it()}},[nt,it]),ot=(0,V.useCallback)((t=x,n={})=>{if(Ke.current=!1,we.current)return n.onFailure?.(),!1;let r=n.provider??a.find(e=>e.id===t);if(S(t),!r?.isConfigured)return xe(r?.message??`The ${t} provider is unavailable. Check its local CLI installation and login.`,`error`),n.onFailure?.(),!1;let i=n.executionProfile??tt(t,r),o=i!==void 0&&r.executionProfiles?.some(e=>e.id===i)===!0;if((n.executionProfile!==void 0||r.executionProfiles?.length)&&!o)return xe(`Select a supported execution profile before starting this local CLI.`,`error`),n.onFailure?.(),!1;let s=n.model??T[t];if(s&&r.models&&!r.models.some(e=>e.id===s))return xe(`Select a model advertised by this provider before starting the harness.`,`error`),n.onFailure?.(),!1;let c=``;c=c.startsWith(`http`)?c.replace(`http`,`ws`):window.location.origin.replace(`http`,`ws`),c+=`/ws`,je.current=!1;let l=!1,u=!1,m,h=()=>{u||l||!Ie.current||(u=!0,v(!1),te(!1),g(!1),xe(`Could not open the local agent connection. Your current chat was preserved; retry explicitly when ready.`,`error`),n.onFailure?.())};try{m=new WebSocket(c)}catch{return h(),!1}return m.onopen=()=>{if(!Ie.current||we.current!==m){m.close();return}let a={type:`start`,command:t,cwd:e.workspacePath};s&&(a.model=s);let o=D[t];o&&(a.effort=o);let c={...Oe.current};if(n.resetSession&&delete c[t],n.session&&(c[t]=n.session),r.capabilities.sessionIdentity===`client-assigned`){let e=c[t]??{id:crypto.randomUUID(),started:!1};c[t]=e,a.sessionId=e.id,a.resume=e.started}else if(r.capabilities.sessionIdentity===`provider-assigned`){let e=c[t];e?.started&&(a.sessionId=e.id,a.resume=!0)}let u=n.firstMessage===null?``:(n.firstMessage??f).trim(),_;try{if(m.send(JSON.stringify(a)),u){let e=crypto.randomUUID();_={turnId:e,text:u,message:{role:`user`,content:u,ts:Date.now(),...i?{executionProfile:i}:{}}},ke.current.push(_),m.send(JSON.stringify({type:`input`,input:u,turnId:e,...i?{executionProfile:i}:{}}))}}catch{_&&(ke.current=ke.current.filter(e=>e.turnId!==_?.turnId)),h(),we.current=null,Re.current=null,k(null),te(!1),m.close();return}Ce(()=>c),l=!0,te(!1),g(!0),n.resetMessagesOnDispatch&&d([]),u&&(d(e=>[...n.resetMessagesOnDispatch?[]:e,_?.message??{role:`user`,content:u,ts:Date.now(),...i?{executionProfile:i}:{}}]),p(``),v(!0),nt()),n.onDispatched?.()},m.onmessage=e=>{if(we.current===m)try{let n=JSON.parse(e.data);if(n.type===`stream`){let e=Ae.current;Ae.current=!0,b(!0),d(t=>{let r=t[t.length-1];if(e&&r?.role===`assistant`){let e=[...t];return e[e.length-1]={...r,content:r.content+n.text},e}return[...t,{role:`assistant`,content:n.text,ts:Date.now()}]})}else if(n.type===`session`&&typeof n.id==`string`)/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n.id)&&Ce(e=>({...e,[t]:{id:n.id,started:!0}}));else if(n.type===`approval_request`&&typeof n.requestId==`string`)Ue(e=>[...e.filter(e=>e.requestId!==n.requestId),{requestId:n.requestId,tool:typeof n.tool==`string`?n.tool:`Tool`,input:n.input&&typeof n.input==`object`?n.input:{},description:typeof n.description==`string`?n.description:void 0}]);else if(n.type===`accepted`&&typeof n.turnId==`string`)ke.current=ke.current.filter(e=>e.turnId!==n.turnId);else if(n.type===`file_changed`){if(Array.isArray(n.paths))for(let e of n.paths)typeof e==`string`&&e.trim()&&We.current.add(e.trim())}else if(n.type===`usage`){let e=n.usage,t=n.cumulative,r=n.quota;t&&F(t),r&&L(r),e&&d(t=>{for(let n=t.length-1;n>=0;n--)if(t[n].role===`assistant`){let r=[...t];return r[n]={...r[n],usage:e},r}return t})}else if(n.type===`usage_summary`)n.cumulative&&F(n.cumulative),n.quota&&L(n.quota);else if(n.type===`quota`)n.quota&&L(n.quota);else if(n.type===`status`){if(v(n.state===`busy`),n.state!==`busy`){let e=Array.from(We.current);We.current.clear(),e.length>0&&d(t=>{for(let n=t.length-1;n>=0;n--)if(t[n].role===`assistant`){let r=[...t],i=r[n].filesChanged||[],a=Array.from(new Set([...i,...e]));return r[n]={...r[n],filesChanged:a},r}return t}),nt(),Ue([])}}else if(n.type===`system`)xe(n.message,`note`);else if(n.type===`rejected`&&n.reason===`busy`){let e=ke.current.findIndex(e=>e.turnId===n.turnId),t=e===-1?void 0:ke.current.splice(e,1)[0];t&&(d(e=>e.filter(e=>e!==t.message)),p(e=>e?`${t.text}\n\n${e}`:t.text)),xe(typeof n.message==`string`?n.message:`The agent is still processing the current turn.`,`error`)}else n.type===`error`?(ke.current=[],Ue([]),We.current.clear(),typeof n.message==`string`&&n.message.toLowerCase().includes(`session`)&&Ce(e=>{let n={...e};return delete n[t],n}),xe(n.message,`error`),v(!1),te(!1),nt()):n.type===`close`&&(ke.current=[],Ue([]),We.current.clear(),g(!1),te(!1),v(!1),nt(),it(),m.close(),we.current=null)}catch(e){console.error(`Failed to parse WS message`,e)}},m.onclose=()=>{if(we.current!==m)return;l||h();let e=Ge.current,n=Ke.current;if(g(!1),te(!1),v(!1),nt(),we.current=null,Re.current=null,k(null),e&&Ie.current&&!n){xe(`Connection interrupted. Resuming turn...`,`note`),setTimeout(()=>{Ie.current&&!Ke.current&&!we.current&&qe.current?.(t,{firstMessage:null})},1200);return}l&&it()},m.onerror=()=>{we.current===m&&(h(),v(!1),te(!1),l||(we.current=null,Re.current=null,k(null),g(!1),m.close()))},we.current=m,Re.current=t,k(t),te(!0),!0},[x,xe,nt,D,f,T,it,tt,a,Ce,e.workspacePath]);(0,V.useEffect)(()=>{qe.current=ot},[ot]);let st=(0,V.useCallback)(()=>{let e=f.trim();if(!e&&he.length===0||_||ze.current||be.current)return;let t=we.current,n=Re.current||x;if(!h||!t||t.readyState!==WebSocket.OPEN){if(t){try{t.close()}catch{}we.current=null}if(he.length>0){let t=a.find(e=>e.id===n),r=tt(n,t);if(t?.executionProfiles?.length&&!r)return;let i=e,o=he;ot(n,{firstMessage:null,onDispatched:()=>{let e=we.current;if(!e||e.readyState!==WebSocket.OPEN){xe(`The agent connected, but the pasted message could not be sent. Your draft and attachments were kept.`,`error`);return}rt(e,i,r,o)}})}else ot(n,{firstMessage:e});return}let r=a.find(e=>e.id===n),i=tt(n,r);r?.executionProfiles?.length&&!i||rt(t,e,i,he)},[x,xe,he,_,h,f,tt,a,rt,ot]),ct=(0,V.useCallback)((e,t)=>{QS(t).then(t=>{if(!t){xe(`Could not copy this message. Check browser clipboard permissions or copy it manually.`,`error`);return}me(e),setTimeout(()=>me(t=>t===e?null:t),1500)})},[xe]),ut=(0,V.useCallback)(e=>{Be.current.id===e&&(Be.current.controller=null,ze.current=!1,Ie.current&&ie(!1))},[]),dt=(0,V.useCallback)(async(e,t=!1)=>{let n=Be.current.id+1;Be.current.controller?.abort();let r=new AbortController;Be.current={id:n,controller:r},ze.current=!0,ie(!0),fe(null);let i=FN(e.assistant);if(!i)return xe(`This session cannot resume in embedded chat.`,`error`),ut(n),!1;let o=a.find(e=>e.id===i);if(!o?.isConfigured)return xe(o?.message??`The ${i} provider is unavailable. Check its local CLI installation and login.`,`error`),ut(n),!1;let s=()=>Ie.current&&Be.current.id===n&&!r.signal.aborted;try{let a=await fetch(`/api/session/${encodeURIComponent(e.assistant)}/${encodeURIComponent(e.id)}/transcript`,{signal:r.signal});if(!a.ok)throw Error(`HTTP ${a.status}`);let o=await a.json();if(!s())return!1;let c=(Array.isArray(o.messages)?o.messages:[]).filter(e=>(e.role===`user`||e.role===`assistant`)&&typeof e.content==`string`&&e.content.trim()).map(e=>({role:e.role,content:e.content,ts:e.timestamp&&Date.parse(e.timestamp)||void 0}));if(we.current&&!window.confirm(`Stop the current chat and resume this session?`))return ut(n),!1;we.current&&at(),S(i);let l=()=>{s()&&(w(e=>({...e,[i]:`review`})),d([...c,{role:`system`,kind:`note`,content:`Loaded session — your next message resumes it.`,ts:Date.now()}]),p(``),ue(!1),ut(n))};return t?ot(i,{firstMessage:null,session:{id:e.id,started:!0},onDispatched:l,onFailure:()=>{s()&&(fe(`Failed to connect to the selected session.`),ut(n))}}):(Ce(t=>({...t,[i]:{id:e.id,started:!0}})),l(),!0)}catch(e){return!s()||e instanceof DOMException&&e.name===`AbortError`?!1:(fe(`Failed to load the session transcript.`),xe(`Failed to load the session transcript. Your current chat was preserved.`,`error`),ut(n),!1)}},[xe,ut,a,ot,at,Ce]),ft=(0,V.useCallback)(e=>{dt(e)},[dt]),pt=(0,V.useCallback)(async(e,t=!1,n=!1)=>{R(e);let r;if(t){z(!0);try{let t=await fetch(`/api/adapters/status/refresh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e.providerId})});if(!t.ok)throw Error(`HTTP ${t.status}`);let i=dP(await t.json());if(!i)throw Error(`Invalid provider status response`);if(!Ie.current)return!1;o(i),E(e=>hP(e,i)),r=i.find(t=>t.id===e.providerId);let a=n&&(r?.setupIssue===`signed-out`||r?.setupIssue===`probe-failed`);if(!r||!r.isConfigured&&!a)return xe(r?.message??`The selected local CLI is still unavailable. Install it and sign in, then retry.`,`error`),!1}catch{return Ie.current&&xe(`Could not refresh the local CLI status. The task handoff was not dispatched.`,`error`),!1}finally{Ie.current&&z(!1)}}return ot(e.providerId,{firstMessage:e.kickoff,executionProfile:e.executionProfile,provider:r&&n&&(r.setupIssue===`signed-out`||r.setupIssue===`probe-failed`)?{...r,isConfigured:!0}:r,resetSession:!0,resetMessagesOnDispatch:!0,onDispatched:()=>{Ie.current&&R(null)},onFailure:()=>{Ie.current&&R(e)}})},[xe,ot]);(0,V.useEffect)(()=>{if(!s||!Ve)return;let e=Fe.current===Ve.nonce;try{e=e||sessionStorage.getItem(er)===Ve.nonce||sessionStorage.getItem(Xn)===Ve.nonce,sessionStorage.setItem(er,Ve.nonce)}catch{}Fe.current=Ve.nonce;let t=r.state&&typeof r.state==`object`?{...r.state}:{};if(delete t.chatLaunch,i(`${r.pathname}${r.search}`,{replace:!0,state:Object.keys(t).length>0?t:null}),e)return;let n=a.find(e=>e.id===Ve.providerId);if(S(Ve.providerId),w(e=>({...e,[Ve.providerId]:Ve.executionProfile})),Ve.model&&E(e=>({...e,[Ve.providerId]:Ve.model})),!n?.isConfigured){xe(n?.message??`The selected local CLI is unavailable. Install it and sign in, then try again.`,`error`),Ve.kickoff&&R({providerId:Ve.providerId,kickoff:Ve.kickoff,executionProfile:Ve.executionProfile});return}if(Ve.sessionId&&Ve.assistant){dt({id:Ve.sessionId,assistant:Ve.assistant,title:``,createdAt:``,updatedAt:``,messageCount:0},!0);return}we.current&&!window.confirm(`Stop the current chat and continue with the selected local CLI?`)||(we.current&&at(),Ve.kickoff?pt({providerId:Ve.providerId,kickoff:Ve.kickoff,executionProfile:Ve.executionProfile}):ot(Ve.providerId,{firstMessage:null}))},[xe,pt,Ve,dt,r.pathname,r.search,r.state,i,a,s,ot,at]);let mt=()=>{window.confirm(`Are you sure you want to clear this chat history? This also starts a new agent session.`)&&(we.current&&at(),Ce(e=>{let t={...e};return delete t[x],t}),je.current=!1,d([]),jN(e.branchName))},ht=_&&!y,gt=Ze?fP(Ze):null,_t=()=>{if(!Ze||!gt)return;let e=()=>xe(`Could not copy the recovery command. Copy the command shown above manually.`,`error`);QS(gt.command).then(t=>{if(!t){e();return}ce(Ze.id),setTimeout(()=>{Ie.current&&ce(e=>e===Ze.id?null:e)},1500)})},[vt,yt]=(0,V.useState)(!1),bt=j[x]?.id,xt=e=>{QS(e).then(()=>{yt(!0),setTimeout(()=>{Ie.current&&yt(!1)},1500)})};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col bg-card`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border bg-card px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,H.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Chat`}),(0,H.jsx)(Bv,{tone:h?`running`:`idle`,dot:!0,children:h?`${Ze?.name||`Connected`}${Ze&&T[Ze.id]?` (${mP(Ze,T[Ze.id])})`:``}`:`Disconnected`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 flex-wrap justify-end`,children:[P&&(P.inputTokens>0||P.outputTokens>0)&&(0,H.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-mono bg-muted/60 border border-border/60 text-muted-foreground shrink-0`,title:`Session Total: ${P.inputTokens.toLocaleString()} in${P.cachedInputTokens?` (${P.cachedInputTokens.toLocaleString()} cached)`:``} · ${P.outputTokens.toLocaleString()} out${P.costUsdEstimate===void 0?``:` · ~$${P.costUsdEstimate.toFixed(3)}`}`,children:[(0,H.jsx)(Di,{size:11,className:`text-amber-500 shrink-0`}),(0,H.jsx)(`span`,{children:ZN(P.totalTokens??P.inputTokens+P.outputTokens)})]}),I&&(0,H.jsx)(`div`,{className:B(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-mono border shrink-0`,I.tokens?.status===`exceeded`||I.requests?.status===`exceeded`?`bg-destructive/10 border-destructive/30 text-destructive-foreground`:I.tokens?.status===`approaching_limit`||I.requests?.status===`approaching_limit`?`bg-amber-500/10 border-amber-500/30 text-amber-500`:`bg-muted/60 border-border/60 text-muted-foreground`),title:I.warningMessage||(I.tokens?.resetsAt?`Resets at ${new Date(I.tokens.resetsAt).toLocaleTimeString()}`:I.label),children:(0,H.jsx)(`span`,{children:QN(I)})}),bt&&(0,H.jsxs)(`button`,{onClick:()=>xt(bt),className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-mono bg-muted/60 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer border border-border/60`,title:`Session ID: ${bt} (Click to copy)`,children:[(0,H.jsx)(Vr,{size:11,className:`opacity-60`}),(0,H.jsxs)(`span`,{children:[bt.slice(0,8),`...`]}),vt?(0,H.jsx)(wr,{size:11,className:`text-emerald-500`}):(0,H.jsx)(Mr,{size:11,className:`opacity-60`})]}),u.length>0&&(0,H.jsx)(`button`,{onClick:mt,className:`cursor-pointer text-xs text-muted-foreground transition-colors hover:text-destructive-foreground`,children:`Clear`}),(0,H.jsx)(`button`,{onClick:()=>{fe(null),ue(!0)},className:`grid h-7 w-7 cursor-pointer place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Resume a past session`,children:(0,H.jsx)(ui,{size:14})}),(h||_||A)&&(0,H.jsxs)(yn,{size:`sm`,variant:`outline`,onClick:at,children:[(0,H.jsx)(vi,{size:14,className:`text-destructive-foreground`}),`Stop`]})]})]}),(0,H.jsx)(WN,{open:le,onClose:()=>ue(!1),ws:e,onPick:ft,error:de,pending:re}),(0,H.jsxs)(`div`,{ref:Te,onScroll:()=>{let e=Te.current;e&&(De.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},className:`flex-1 space-y-4 overflow-y-auto p-4`,children:[u.length===0&&!ht&&(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`No messages yet. Start the agent and say hello.`}),u.map((e,t)=>(0,H.jsx)(_P,{msg:e,idx:t,copied:pe===t,onCopy:ct},t)),ht&&(0,H.jsx)(`div`,{className:`flex justify-start`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-lg border border-border bg-muted/30 px-4 py-2.5 text-xs text-muted-foreground shadow-xs animate-pulse`,children:[(0,H.jsx)(li,{size:13,className:`animate-spin text-primary`}),(0,H.jsxs)(`span`,{children:[Ze?.name||`Agent`,` is thinking and executing...`]})]})}),(0,H.jsx)(`div`,{ref:Ee})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border bg-card p-3`,children:[Ze&&!Ze.isConfigured&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`shrink-0 font-semibold`,children:[Ze.name,` provider status:`]}),(0,H.jsx)(`span`,{children:Ze.message})]}),gt&&(0,H.jsx)(`code`,{className:`w-fit rounded bg-background/70 px-2 py-1 font-mono text-[11px] text-foreground`,children:gt.command})]}),gt&&(0,H.jsxs)(yn,{size:`sm`,variant:`outline`,onClick:_t,className:`shrink-0`,children:[se===Ze.id?(0,H.jsx)(wr,{size:12}):(0,H.jsx)(Mr,{size:12}),se===Ze.id?`Copied`:gt.label]})]}),ae&&!A&&!h&&(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-foreground`,children:[(0,H.jsxs)(`span`,{children:[`The workspace kickoff was not dispatched (`,ae.executionProfile===`workspace-write`?`Edit workspace`:`Review only`,`).`]}),(0,H.jsx)(yn,{size:`sm`,variant:`outline`,onClick:()=>void pt(ae,!0),disabled:re||oe,children:oe?`Checking CLI…`:`Recheck & retry`}),Ze?.setupIssue&&Ze.setupIssue!==`missing-cli`&&(0,H.jsx)(yn,{size:`sm`,variant:`outline`,onClick:()=>void pt(ae,!0,!0),disabled:re||oe,children:`Try with existing CLI auth`})]}),He.map(e=>(0,H.jsxs)(`div`,{role:`alert`,"aria-live":`polite`,className:`flex flex-col gap-2 rounded-xl border border-amber-500/40 bg-amber-500/10 p-3 text-xs shadow-xs animate-fade-in`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 font-semibold text-amber-500`,children:[(0,H.jsx)(mi,{size:14,className:`animate-pulse shrink-0`}),(0,H.jsx)(`span`,{children:`Tool Approval Required`}),(0,H.jsx)(lt,{variant:`outline`,className:`text-[10px] uppercase font-mono border-amber-500/40 text-amber-600 dark:text-amber-400`,children:e.tool}),e.description&&(0,H.jsxs)(`span`,{className:`text-[11px] font-normal text-muted-foreground italic`,children:[`(`,e.description,`)`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,H.jsxs)(yn,{size:`sm`,variant:`default`,onClick:()=>Je(e.requestId,`allow`),className:`h-7 text-xs bg-emerald-600 hover:bg-emerald-700 text-white gap-1 cursor-pointer`,children:[(0,H.jsx)(wr,{size:12}),(0,H.jsx)(`span`,{children:`Approve`})]}),(0,H.jsxs)(yn,{size:`sm`,variant:`outline`,onClick:()=>Je(e.requestId,`deny`),className:`h-7 text-xs text-destructive hover:bg-destructive/10 border-border/80 gap-1 cursor-pointer`,children:[(0,H.jsx)(Ei,{size:12}),(0,H.jsx)(`span`,{children:`Deny`})]})]})]}),e.input&&(0,H.jsx)(`div`,{className:`rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground overflow-x-auto max-h-24 select-text`,children:typeof e.input.command==`string`?`Command: ${e.input.command}`:typeof e.input.path==`string`?`File: ${e.input.path}`:JSON.stringify(e.input,null,2)})]},e.requestId)),(0,H.jsxs)(`div`,{className:`flex w-full flex-col rounded-xl border border-border bg-card shadow-sm`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1.5 border-b border-border/50 bg-muted/20 px-3 py-2 text-xs`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{"aria-label":`Select Provider`,disabled:_||A||re,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-border/60 bg-background/90 px-2.5 py-1 text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-accent hover:border-border disabled:pointer-events-none disabled:opacity-50`,children:[Ze?.icon===`Bot`?(0,H.jsx)(Sr,{size:13,className:`text-primary`}):(0,H.jsx)(Nr,{size:13,className:`text-primary`}),(0,H.jsx)(`span`,{children:Ze?.name??`Select Agent`}),(0,H.jsx)(bn,{size:11,className:`opacity-50 ml-0.5`})]}),(0,H.jsx)(Ya,{align:`start`,side:`top`,children:a.filter(e=>e.isConfigured||e.setupIssue!==`missing-cli`).map(e=>(0,H.jsxs)(Xa,{onClick:()=>et(e.id),className:B(`flex items-center gap-2 text-xs cursor-pointer`,e.id===Xe&&`font-semibold text-primary`),children:[e.icon===`Bot`?(0,H.jsx)(Sr,{size:14}):(0,H.jsx)(Nr,{size:14}),(0,H.jsx)(`span`,{className:`flex-1`,children:e.name}),e.id===Xe&&(0,H.jsx)(wr,{size:12,className:`text-primary ml-auto`})]},e.id))})]}),Ze?.models?.length&&(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{"aria-label":`Select model`,disabled:h||A||_||re||!!ae,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-border/60 bg-background/90 px-2.5 py-1 text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-accent hover:border-border disabled:pointer-events-none disabled:opacity-50`,children:[(0,H.jsx)(hi,{size:12,className:`text-amber-500 shrink-0`}),(0,H.jsx)(`span`,{className:`max-w-44 truncate`,children:mP(Ze,T[Ze.id]??``)}),(0,H.jsx)(bn,{size:11,className:`opacity-50 ml-0.5`})]}),(0,H.jsx)(Ya,{align:`start`,side:`top`,className:`max-w-80`,children:Ze.models.map(e=>(0,H.jsx)(Xa,{onClick:()=>E(t=>({...t,[Ze.id]:e.id})),children:(0,H.jsxs)(`span`,{className:`flex flex-col`,children:[(0,H.jsxs)(`span`,{className:`font-medium flex items-center gap-1.5`,children:[(0,H.jsx)(hi,{size:11,className:`text-amber-500`}),e.label]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]}),Ze?.executionProfiles?.length&&Qe&&(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{"aria-label":`Select execution profile`,disabled:A||_||re||!!ae,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-border/60 bg-background/90 px-2.5 py-1 text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-accent hover:border-border disabled:pointer-events-none disabled:opacity-50`,title:Qe.description,children:[(0,H.jsx)(mi,{size:12,className:Qe.id===`workspace-write`?`text-amber-500 shrink-0`:`text-emerald-500 shrink-0`}),(0,H.jsx)(`span`,{children:pP(Qe.label)}),(0,H.jsx)(bn,{size:11,className:`opacity-50 ml-0.5`})]}),(0,H.jsx)(Ya,{align:`start`,side:`top`,className:`max-w-80`,children:Ze.executionProfiles.map(e=>(0,H.jsx)(Xa,{onClick:()=>w(t=>({...t,[Ze.id]:e.id})),children:(0,H.jsxs)(`span`,{className:`flex flex-col`,children:[(0,H.jsxs)(`span`,{className:`font-medium flex items-center gap-1.5`,children:[(0,H.jsx)(mi,{size:12,className:e.id===`workspace-write`?`text-amber-500`:`text-emerald-500`}),e.label]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]}),Ze&&(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{"aria-label":`Select reasoning effort`,disabled:h||A||_||re||!!ae,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-border/60 bg-background/90 px-2.5 py-1 text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-accent hover:border-border disabled:pointer-events-none disabled:opacity-50`,children:[(0,H.jsx)(Di,{size:12,className:D[Ze.id]?`text-amber-500 fill-amber-500/20 shrink-0`:`text-muted-foreground shrink-0`}),(0,H.jsx)(`span`,{children:eP(D[Ze.id]??``)}),(0,H.jsx)(bn,{size:11,className:`opacity-50 ml-0.5`})]}),(0,H.jsx)(Ya,{align:`start`,side:`top`,className:`max-w-72`,children:$N.map(e=>(0,H.jsx)(Xa,{onClick:()=>ee(t=>({...t,[Ze.id]:e.id})),children:(0,H.jsxs)(`span`,{className:`flex flex-col`,children:[(0,H.jsxs)(`span`,{className:`font-medium flex items-center gap-1.5`,children:[e.id&&(0,H.jsx)(Di,{size:12,className:`text-amber-500`}),e.label]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]})},e.id))})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,H.jsx)(`input`,{type:`file`,ref:ye,accept:`image/png,image/jpeg,image/gif,image/webp`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files?.length&&Se(e.target.files),e.target.value=``}}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>ye.current?.click(),disabled:_||re,className:`flex cursor-pointer items-center justify-center rounded-md border border-border/60 bg-background/90 p-1.5 text-muted-foreground shadow-2xs transition-colors hover:bg-accent hover:text-foreground hover:border-border disabled:pointer-events-none disabled:opacity-50`,title:`Attach image (or paste / drop into chat)`,children:(0,H.jsx)(Hr,{size:14,className:`text-primary`})})]})]}),he.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 border-b border-border/40 px-3 py-2 bg-muted/20`,children:he.map(e=>(0,H.jsxs)(`div`,{className:`group relative flex items-center rounded-lg border border-border/80 bg-card p-1 shadow-xs`,children:[(0,H.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`h-14 w-14 rounded-md object-cover`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>ge(t=>t.filter(t=>t.id!==e.id)),className:`absolute -top-1.5 -right-1.5 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 transition-colors`,title:`Remove image`,children:(0,H.jsx)(Ei,{size:10})})]},e.id))}),(0,H.jsxs)(`div`,{className:B(`flex items-end gap-2 p-2`,_e&&`ring-2 ring-primary ring-inset rounded-b-xl bg-accent/30`),onDragOver:e=>{e.preventDefault(),ve(!0)},onDragLeave:()=>ve(!1),onDrop:e=>{e.preventDefault(),ve(!1),e.dataTransfer?.files?.length&&Se(e.dataTransfer.files)},children:[(0,H.jsx)(bN,{value:f,disabled:re,onPaste:e=>{if(e.clipboardData?.getData(`text/plain`))return;let t=$S(e.clipboardData?.getData(`text/html`)??``);if(t.trim()){e.preventDefault();let n=e.currentTarget,r=n.selectionStart,i=n.selectionEnd;p(e=>`${e.slice(0,r)}${t}${e.slice(i)}`),requestAnimationFrame(()=>{n.focus();let e=r+t.length;n.setSelectionRange(e,e)});return}let n=e.clipboardData?.items,r=[];if(n){for(let e=0;e<n.length;e++)if(n[e].type.startsWith(`image/`)){let t=n[e].getAsFile();t&&r.push(t)}}if(r.length===0&&e.clipboardData?.files?.length)for(let t of Array.from(e.clipboardData.files))t.type.startsWith(`image/`)&&r.push(t);r.length>0&&(e.preventDefault(),Se(r))},onChange:e=>{p(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`},onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),_||A||ze.current)return;h?st():$e&&(f.trim()||he.length?st():ot());let t=e.currentTarget;t.style.height=`auto`}},placeholder:h?`Message the agent... (Shift+Enter for new line)`:`Start the agent or press Enter...`,unstyled:!0,className:`flex-1 [&_[data-slot=textarea]]:max-h-[200px] [&_[data-slot=textarea]]:min-h-11 [&_[data-slot=textarea]]:resize-none [&_[data-slot=textarea]]:text-sm`,rows:1}),h?(0,H.jsxs)(yn,{className:`h-11 shrink-0 rounded-lg`,onClick:st,disabled:!f.trim()&&he.length===0||_||re,children:[_?(0,H.jsx)(li,{size:14,className:`animate-spin`}):(0,H.jsx)(fi,{size:14}),`Send`]}):(0,H.jsxs)(yn,{className:`h-11 shrink-0 rounded-lg`,onClick:()=>{f.trim()||he.length?st():ot()},disabled:!$e,children:[(0,H.jsx)(gi,{size:14}),`Start`]})]})]})]})]})}function yP({workspace:e,active:t}){let n=jt(t?e:null),r=Yt(e);if(!n.data?.services.length)return null;let i=n.data.runningState.length;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[i?(0,H.jsxs)(`span`,{className:`text-[10px] text-emerald-600`,title:`${i} running service${i===1?``:`s`}`,children:[i,` running`]}):(0,H.jsxs)(yn,{size:`xs`,variant:`ghost`,disabled:r.isPending,onClick:()=>r.mutate({action:`start`}),children:[(0,H.jsx)(oi,{className:`size-3`}),`Start services`]}),r.isError&&(0,H.jsx)(`span`,{role:`alert`,className:`max-w-32 truncate text-[10px] text-destructive`,title:r.error.message,children:`Could not start services`})]})}function bP({visible:e,...t}){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>{e&&r(!0)},[e]),(0,H.jsx)(`div`,{className:B(`min-h-0 flex-1`,!e&&`hidden`),children:(n||e)&&(0,H.jsx)(vP,{...t})})}function xP({workspaces:e}){let t=Lt(),{isOpen:n,isMinimized:r,isMaximized:i,openTabs:a,activeTab:o,splitTab:s,splitRatio:c,position:l,size:u,close:d,minimize:f,restore:p,toggleMaximize:m,addTab:h,removeTab:g,setActiveTab:_,setSplitTab:v,setSplitRatio:y,setPosition:b,setSize:x,drafts:S,consumeDraft:C,modes:w,setMode:T,terminalLaunches:E,consumeTerminalLaunch:D,harnesses:ee}=Mt(),[O,k]=(0,V.useState)(``),[A,te]=(0,V.useState)({}),[j,M]=(0,V.useState)({}),N=(0,V.useRef)(null),ne=(0,V.useRef)(null),re=(0,V.useRef)(null),ie=(0,V.useRef)(null),P=(0,V.useRef)(!1),[F,I]=(0,V.useState)(()=>window.innerWidth>=900);(0,V.useEffect)(()=>{let e=()=>I(window.innerWidth>=900);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let L=!!(s&&o&&s!==o&&F&&i);(0,V.useEffect)(()=>{if(!n||r)return;let e=[o,L?s:null].filter(e=>!!e);M(t=>{if(!e.some(e=>t[e]&&w[e]!==`chat`))return t;let n={...t};for(let t of e)w[t]!==`chat`&&(n[t]=!1);return n})},[n,r,o,s,L,w]);let ae=(0,V.useCallback)(e=>{if(!P.current||!ie.current)return;let t=ie.current.getBoundingClientRect();y((e.clientX-t.left)/t.width*100)},[y]),R=(0,V.useMemo)(()=>new Map(e.map(e=>[e.branchName,e])),[e]),oe=o?R.get(o):void 0,z=(0,V.useMemo)(()=>{let t=O.trim().toLowerCase();return t?e.filter(e=>e.branchName.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)):e},[e,O]),se=(0,V.useCallback)(e=>{if(e.button!==0||i)return;let t=e.target;if(t.closest(`button`)||t.closest(`[role="tab"]`)||t.closest(`[data-no-drag]`))return;let n=l||{x:Math.max(20,window.innerWidth-u.width-24),y:Math.max(20,window.innerHeight-u.height-24)};N.current={startX:e.clientX,startY:e.clientY,startPosX:n.x,startPosY:n.y},e.currentTarget.setPointerCapture(e.pointerId)},[i,l,u]),ce=(0,V.useCallback)(e=>{if(!N.current)return;let t=e.clientX-N.current.startX,n=e.clientY-N.current.startY,r=Math.max(0,window.innerWidth-u.width-20),i=Math.max(0,window.innerHeight-u.height-20),a=Math.min(Math.max(10,N.current.startPosX+t),r),o=Math.min(Math.max(10,N.current.startPosY+n),i);b({x:a,y:o})},[u,b]),le=(0,V.useCallback)(e=>{if(N.current){N.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),ue=(0,V.useCallback)(e=>{e.button!==0||i||(e.stopPropagation(),e.preventDefault(),ne.current={startX:e.clientX,startY:e.clientY,startW:u.width,startH:u.height},e.currentTarget.setPointerCapture(e.pointerId))},[i,u]),de=(0,V.useCallback)(e=>{if(!ne.current)return;let t=e.clientX-ne.current.startX,n=e.clientY-ne.current.startY,r=Math.max(380,Math.min(ne.current.startW+t,window.innerWidth-40)),i=Math.max(420,Math.min(ne.current.startH+n,window.innerHeight-40));x({width:r,height:i})},[x]),fe=(0,V.useCallback)(e=>{if(ne.current){ne.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}},[]),pe=(0,V.useMemo)(()=>{if(!i)return l?{left:`${l.x}px`,top:`${l.y}px`,width:`${u.width}px`,height:`${u.height}px`}:{right:`24px`,bottom:`24px`,width:`${u.width}px`,height:`${u.height}px`}},[i,l,u]);return(0,H.jsxs)(H.Fragment,{children:[n&&r&&(0,H.jsx)(`div`,{className:`fixed bottom-5 right-6 z-50 animate-fade-in`,children:(0,H.jsxs)(`button`,{onClick:p,className:`flex items-center gap-2.5 px-4 py-2.5 rounded-full bg-card/95 backdrop-blur-md border border-border shadow-xl hover:border-primary/50 text-foreground transition-all duration-200 cursor-pointer group`,title:`Restore floating workspace chat`,children:[(0,H.jsx)(`div`,{className:`size-7 rounded-full bg-primary/10 grid place-items-center text-primary group-hover:scale-105 transition-transform`,children:(0,H.jsx)(Zr,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`flex flex-col items-start text-left`,children:[(0,H.jsxs)(`span`,{className:`text-xs font-semibold leading-tight flex items-center gap-1.5`,children:[`Workspace Chat`,a.length>0&&(0,H.jsx)(`span`,{className:`px-1.5 py-0.2 rounded-full bg-primary/20 text-primary text-[10px] font-bold`,children:a.length})]}),(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground leading-tight max-w-[140px] truncate`,children:oe?.branchName||`No active tab`})]}),(0,H.jsx)(Jr,{className:`size-3.5 text-muted-foreground group-hover:text-foreground ml-1`})]})}),(0,H.jsxs)(`div`,{ref:re,style:{...pe,display:!n||r?`none`:void 0},role:`region`,"aria-label":`Workspace Chat`,className:B(`fixed z-50 flex flex-col overflow-hidden bg-card/98 backdrop-blur-xl border border-border/80 shadow-2xl rounded-2xl transition-[border-color] duration-150`,i&&`inset-0 w-auto h-auto rounded-none`),children:[(0,H.jsxs)(`div`,{onPointerDown:se,onPointerMove:ce,onPointerUp:le,className:B(`flex items-center justify-between px-3 py-2 border-b border-border/80 bg-muted/40 select-none shrink-0`,!i&&`cursor-grab active:cursor-grabbing`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 pr-2`,children:[!i&&(0,H.jsx)(Br,{className:`size-4 text-muted-foreground/50 shrink-0`}),(0,H.jsx)(`div`,{className:`size-5 rounded-md bg-primary/15 grid place-items-center text-primary shrink-0`,children:(0,H.jsx)(Zr,{className:`size-3.5`})}),(0,H.jsx)(`span`,{className:`text-xs font-bold text-foreground shrink-0`,children:`ContextSpace`}),(0,H.jsx)(`span`,{className:`text-muted-foreground/70`,"aria-hidden":`true`,children:`/`}),(0,H.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-xs font-semibold text-primary shrink-0`,children:`Chat & CLI`}),oe&&(0,H.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,title:oe.branchName,children:oe.branchName})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,"data-no-drag":!0,children:[(0,H.jsx)(`button`,{onClick:f,className:`p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors cursor-pointer`,title:`Minimize`,"aria-label":`Minimize floating chat`,children:(0,H.jsx)($r,{className:`size-3.5`})}),(0,H.jsx)(`button`,{onClick:m,className:`p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors cursor-pointer`,title:i?`Restore down`:`Maximize`,"aria-label":i?`Restore down floating chat`:`Maximize floating chat`,children:i?(0,H.jsx)(Qr,{className:`size-3.5`}):(0,H.jsx)(Jr,{className:`size-3.5`})}),(0,H.jsx)(`button`,{onClick:d,className:`p-1.5 rounded-lg text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors cursor-pointer`,title:`Close`,"aria-label":`Close floating chat`,children:(0,H.jsx)(Ei,{className:`size-3.5`})})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 px-2.5 py-1.5 border-b border-border/60 bg-muted/20 overflow-x-auto no-scrollbar shrink-0`,"data-no-drag":!0,children:[a.map(e=>{let t=e===o;return(0,H.jsxs)(`div`,{className:B(`group flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium transition-all duration-150 cursor-pointer border shrink-0 max-w-[170px]`,t||s===e?`bg-card border-border shadow-xs text-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50`),children:[(0,H.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t||s===e,"aria-label":`Show ${e} in the left pane`,title:e,className:`flex min-w-0 items-center gap-1.5`,onClick:()=>_(e),children:[(0,H.jsx)(Ut,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate`,children:e}),w[e]!==`chat`&&ee[e]&&(0,H.jsx)(`span`,{title:eN(ee[e]),children:(0,H.jsx)(tN,{harness:ee[e],className:`size-3`})}),A[e]&&A[e]!==`idle`&&(0,H.jsx)(`span`,{title:`Terminal ${A[e]}`,className:B(`size-1.5 shrink-0 rounded-full`,A[e]===`running`?`bg-emerald-500`:A[e]===`disconnected`?`bg-amber-500`:`bg-muted-foreground`)}),j[e]&&(0,H.jsx)(`span`,{title:`New terminal output`,className:`size-1.5 shrink-0 rounded-full bg-primary`})]}),(0,H.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e)},className:`size-3.5 rounded grid place-items-center text-muted-foreground/60 hover:text-destructive hover:bg-destructive/10 opacity-70 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity ml-0.5`,title:`Close ${e} tab`,"aria-label":`Close ${e} tab`,children:(0,H.jsx)(Ei,{className:`size-2.5`})})]},e)}),(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{className:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 border border-dashed border-border/70 hover:border-border transition-colors cursor-pointer shrink-0`,children:[(0,H.jsx)(ci,{className:`size-3`}),(0,H.jsx)(`span`,{children:`Add Workspace`})]}),(0,H.jsxs)(Ya,{align:`start`,className:`w-64 p-1.5`,children:[(0,H.jsxs)(Xa,{onClick:()=>{f(),t(`/new?from=chat`)},className:`flex items-center gap-2 px-2 py-1.5 text-xs font-semibold`,children:[(0,H.jsx)(ci,{className:`size-3`}),`New workspace`]}),(0,H.jsx)(`p`,{className:`border-t border-border px-2 pt-2 text-[10px] text-muted-foreground`,children:`Open existing`}),(0,H.jsx)(`div`,{className:`px-2 py-1 mb-1`,children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ct,{className:`size-3.5 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(`input`,{type:`text`,placeholder:`Search workspaces...`,value:O,onChange:e=>k(e.target.value),className:`w-full pl-7 pr-2 py-1 text-xs rounded-md bg-muted/50 border border-border focus:outline-hidden focus:border-primary/50 text-foreground placeholder:text-muted-foreground`,autoFocus:!0})]})}),(0,H.jsx)(`div`,{className:`max-h-56 overflow-y-auto space-y-0.5`,children:z.length===0?(0,H.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:`No workspaces found`}):z.map(e=>{let t=a.includes(e.branchName);return(0,H.jsxs)(Xa,{onClick:()=>{t?_(e.branchName):h(e.branchName),k(``)},className:B(`flex items-center gap-2 px-2 py-1.5 text-xs rounded-md cursor-pointer`,e.branchName===o&&`bg-accent/70 font-semibold`),children:[(0,H.jsx)(Ut,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:e.branchName}),e.description&&(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.description})]}),t&&(0,H.jsx)(`span`,{className:`text-[10px] text-primary font-medium px-1.5 py-0.5 rounded bg-primary/10`,children:`Open`})]},e.branchName)})})]})]}),o&&(0,H.jsxs)(qa,{children:[(0,H.jsxs)(Ja,{className:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 border border-border/70 cursor-pointer shrink-0`,children:[(0,H.jsx)(jr,{className:`size-3`}),(0,H.jsx)(`span`,{children:s?`Split view`:`Split right`})]}),(0,H.jsxs)(Ya,{align:`start`,className:`w-56 max-h-72 overflow-y-auto p-1.5`,children:[s&&(0,H.jsx)(Xa,{onClick:()=>v(null),className:`text-xs`,children:`Close split`}),e.filter(e=>e.branchName!==o).map(e=>(0,H.jsxs)(Xa,{onClick:()=>v(e.branchName),className:`flex items-center gap-2 text-xs`,children:[(0,H.jsx)(Ut,{className:`size-3`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.branchName}),s===e.branchName&&(0,H.jsx)(`span`,{className:`ml-auto text-primary`,children:`Right`})]},e.branchName)),e.length<2&&(0,H.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Open another workspace to split the view.`})]})]})]}),s&&(!F||!i)&&(0,H.jsx)(`p`,{className:`border-b border-border px-3 py-1 text-xs text-muted-foreground`,children:`Split view is paused. Maximize the window on a wide screen to resume it.`}),(0,H.jsxs)(`div`,{ref:ie,className:`flex flex-1 min-h-0 relative overflow-hidden bg-card`,"data-no-drag":!0,children:[a.length===0?(0,H.jsxs)(`div`,{className:`h-full w-full flex flex-col items-center justify-center p-6 text-center text-muted-foreground gap-3`,children:[(0,H.jsx)(`div`,{className:`size-12 rounded-2xl bg-muted/50 border border-border grid place-items-center text-muted-foreground`,children:(0,H.jsx)(Xr,{className:`size-6 text-primary`})}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`No Workspace Tab Open`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs`,children:`Select a workspace to run a CLI harness or open your existing chat.`})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-1.5 mt-2 max-w-sm`,children:[e.slice(0,5).map(e=>(0,H.jsxs)(yn,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),className:`text-xs h-7 gap-1.5`,children:[(0,H.jsx)(Ut,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:e.branchName})]},e.branchName)),(0,H.jsxs)(yn,{variant:`outline`,size:`sm`,onClick:()=>{f(),t(`/new?from=chat`)},className:`text-xs h-7 gap-1.5`,children:[(0,H.jsx)(ci,{className:`size-3`}),`New workspace`]})]})]}):a.map(e=>{let t=R.get(e),i=e===o,a=L&&e===s,l=i||a;return(0,H.jsxs)(`div`,{className:B(`h-full min-w-0 flex-col`,l?`flex`:`hidden`,a&&`border-l border-border`),style:l?{order:i?1:3,flex:L?i?`0 0 ${c}%`:`1 1 0%`:`1 1 100%`}:void 0,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-1`,"data-no-drag":!0,children:[(0,H.jsx)(`span`,{className:`max-w-[32%] truncate text-[10px] font-semibold`,title:e,children:e}),(0,H.jsxs)(yn,{size:`xs`,variant:(w[e]??`cli`)===`cli`?`secondary`:`ghost`,"aria-pressed":(w[e]??`cli`)===`cli`,onClick:()=>T(e,`cli`),children:[(0,H.jsx)(_i,{className:`size-3`}),`CLI`]}),(0,H.jsxs)(yn,{size:`xs`,variant:w[e]===`chat`?`secondary`:`ghost`,"aria-pressed":w[e]===`chat`,onClick:()=>T(e,`chat`),children:[(0,H.jsx)(Xr,{className:`size-3`}),`Chat`]}),t&&(0,H.jsx)(yP,{workspace:e,active:l&&n&&!r}),a&&(0,H.jsx)(yn,{size:`xs`,variant:`ghost`,"aria-label":`Close split view`,onClick:()=>v(null),children:(0,H.jsx)(Ei,{className:`size-3`})})]}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:B(`flex-1 min-h-0`,w[e]===`chat`&&`hidden`),children:(0,H.jsx)(yN,{workspace:e,workspacePath:t.workspacePath,active:n&&!r&&l&&w[e]!==`chat`,launch:E[e],consumeLaunch:t=>D(e,t),onStatusChange:t=>te(n=>n[e]===t?n:{...n,[e]:t}),onBackgroundOutput:()=>M(t=>t[e]?t:{...t,[e]:!0})})}),(0,H.jsx)(bP,{visible:w[e]===`chat`,ws:t,draft:S[e],onDraftConsumed:t=>C(e,t)})]}):(0,H.jsxs)(`div`,{role:`status`,className:`space-y-2 p-4 text-xs text-muted-foreground`,children:[(0,H.jsx)(`p`,{children:`This workspace is unavailable. It may have been removed or is still loading.`}),(0,H.jsx)(yn,{size:`xs`,variant:`outline`,onClick:()=>g(e),children:`Close unavailable tab`})]})]},e)}),L&&(0,H.jsx)(`div`,{role:`separator`,"aria-label":`Resize workspace panes`,"aria-orientation":`vertical`,"aria-valuemin":25,"aria-valuemax":75,"aria-valuenow":Math.round(c),tabIndex:0,className:`order-2 z-10 w-1.5 shrink-0 cursor-col-resize bg-border/70 hover:bg-primary/40 focus-visible:bg-primary/40`,onPointerDown:e=>{P.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:ae,onPointerUp:e=>{P.current=!1,e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{P.current=!1},onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),y(c+(e.key===`ArrowRight`?5:-5)))}})]}),!i&&(0,H.jsx)(`div`,{onPointerDown:ue,onPointerMove:de,onPointerUp:fe,className:`absolute bottom-0 right-0 size-4 cursor-nwse-resize z-10 grid place-items-center opacity-30 hover:opacity-100 transition-opacity`,title:`Drag to resize`,children:(0,H.jsx)(`div`,{className:`size-2 border-r-2 border-b-2 border-muted-foreground rounded-br-xs`})})]})]})}function SP(){let{isOpen:e,isMinimized:t,openTabs:n,open:r}=Mt();return e&&!t||t?null:(0,H.jsx)(`div`,{className:`fixed bottom-6 right-6 z-40 animate-fade-in`,children:(0,H.jsxs)(`button`,{onClick:()=>r(),className:B(`group relative flex items-center justify-center gap-2 h-11 px-4 rounded-full`,`bg-primary text-primary-foreground shadow-lg shadow-primary/25`,`hover:scale-105 hover:shadow-xl hover:shadow-primary/35 active:scale-95`,`transition-all duration-200 cursor-pointer border border-primary/20`),title:`Open Floating Workspace Chat`,"aria-label":`Open Floating Workspace Chat`,children:[(0,H.jsx)(Zr,{className:`size-4`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`text-xs font-medium`,children:`Chat & CLI`}),n.length>0&&(0,H.jsx)(`span`,{className:`absolute -top-1 -right-1 size-5 rounded-full bg-emerald-500 text-white text-[10px] font-bold grid place-items-center shadow-md border-2 border-background`,children:n.length})]})})}function CP({workspaceName:e,open:t,onClose:n,onConfirm:r,loading:i=!1}){let[a,o]=(0,V.useState)(``);if(!e)return null;let s=a.trim()===e.trim(),c=()=>{o(``),n()},l=async()=>{!s||i||(await r(e),o(``))};return(0,H.jsx)(Ov,{open:t,onOpenChange:e=>!e&&c(),children:(0,H.jsxs)(Mv,{className:`max-w-md`,children:[(0,H.jsxs)(Nv,{children:[(0,H.jsx)(Fv,{className:`text-destructive`,children:`Delete workspace`}),(0,H.jsxs)(Iv,{children:[`This action cannot be undone. This will force-remove all git worktrees and delete the entire folder for`,` `,(0,H.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e}),`.`]})]}),(0,H.jsx)(Lv,{className:`space-y-4`,children:(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsxs)(`span`,{className:`mb-1 block text-xs text-muted-foreground`,children:[`Please type `,(0,H.jsx)(`strong`,{className:`font-mono text-foreground`,children:e}),` to confirm:`]}),(0,H.jsx)(Ye,{value:a,onChange:e=>o(e.target.value),placeholder:e,autoFocus:!0,className:`font-mono text-sm`,onKeyDown:e=>{e.key===`Enter`&&s&&!i&&l()}})]})}),(0,H.jsxs)(Pv,{children:[(0,H.jsx)(yn,{variant:`outline`,onClick:c,disabled:i,children:`Cancel`}),(0,H.jsx)(yn,{variant:`destructive`,onClick:()=>void l(),disabled:!s||i,children:i?`Deleting…`:`Delete workspace`})]})]})})}var wP=(0,V.lazy)(()=>Kn(()=>import(`./DashboardPage-BwwB7uTm.js`).then(e=>({default:e.DashboardPage})),__vite__mapDeps([6,1,2,7,8,3,4,9,10,11,12]))),TP=(0,V.lazy)(()=>Kn(()=>import(`./ProjectsPage-CNZF11wO.js`).then(e=>({default:e.ProjectsPage})),__vite__mapDeps([13,1,2,14,8,7,3,4,9,10,15,16,17,18,19]))),EP=(0,V.lazy)(()=>Kn(()=>import(`./SettingsPage-S68Q-rBG.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([20,1,2,14,8,16,17,12,21,22]))),DP=(0,V.lazy)(()=>Kn(()=>import(`./SkillsPage-B97Al8vk.js`).then(e=>({default:e.SkillsPage})),__vite__mapDeps([23,1,2,14,8,7,3,4,9,10,24,25,26,18,12,21]))),OP=(0,V.lazy)(()=>Kn(()=>import(`./AgentsPage-B9ejJYsf.js`).then(e=>({default:e.AgentsPage})),__vite__mapDeps([27,1,2,14,8,7,3,4,9,10,18,19,12,21]))),kP=(0,V.lazy)(()=>Kn(()=>import(`./WorkroomsPage-uCiHE87E.js`).then(e=>({default:e.WorkroomsPage})),__vite__mapDeps([28,1,2,14,8,26,18,29,30,16,9,10,12,21,22]))),AP=(0,V.lazy)(()=>Kn(()=>import(`./StartWorkPage-Dq0Ke4hS.js`).then(e=>({default:e.StartWorkPage})),__vite__mapDeps([31,1,2,14,8,7,3,4,9,10,24,11,15,16,17,32]))),jP=(0,V.lazy)(()=>Kn(()=>import(`./StrategiesPage-INv0HW7D.js`).then(e=>({default:e.StrategiesPage})),__vite__mapDeps([33,1,2,14,8,34,18,12,21]))),MP=(0,V.lazy)(()=>Kn(()=>import(`./WorkspacesPage-CAHQrIgk.js`).then(e=>({default:e.WorkspacesPage})),__vite__mapDeps([35,1,2,14,8,7,3,4,9,10,24,30,16,25,11,26,32,18,29,5,12,21]))),NP=(0,V.lazy)(()=>Kn(()=>import(`./GettingStartedPage-BM8m5uir.js`).then(e=>({default:e.GettingStartedPage})),__vite__mapDeps([36,2,1,8,34,9]))),PP=new URLSearchParams(window.location.search).get(`env`)===`vscode`,FP=typeof window<`u`?window.contextspaceBridge?.updates||window.nexusBridge?.updates:void 0,IP=0;function LP(){let e=Lt(),t=Ft(),[n,r]=(0,V.useState)([]),i=(e,t=`info`,n=5e3)=>{let i=`toast-${++IP}`;r(r=>[...r,{id:i,message:e,type:t,duration:n}]),setTimeout(()=>{r(e=>e.filter(e=>e.id!==i))},n)},[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!0),[l,u]=(0,V.useState)(!0),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)([]),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(null),T=Tt(),E=Qt(),D=Kt(),ee=At(),O=T.data??[],k=E.data??[],A=D.data??[],te=ee.data??[],[j,M]=(0,V.useState)(!1),[N,ne]=(0,V.useState)(`idle`),[re,ie]=(0,V.useState)(null),[P,F]=(0,V.useState)(null),[I,L]=(0,V.useState)(!1),[ae,R]=(0,V.useState)(``),[oe,z]=(0,V.useState)(``),[se,ce]=(0,V.useState)(null),[le,ue]=(0,V.useState)(!1),[de,fe]=(0,V.useState)(!1),[pe,me]=(0,V.useState)(!1),[he,ge]=(0,V.useState)(`antigravity`),_e=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if(_e.current||!E.data)return;let e=E.data.find(e=>e.detected&&e.command);e&&(_e.current=!0,ge(e.name))},[E.data]);let[ve,ye]=(0,V.useState)(null),[be,xe]=(0,V.useState)(``),Se=[`/`,`/overview`,`/dashboard`].includes(t.pathname)||t.pathname.startsWith(`/workspaces`),Ce=cn(),we=wt(),Te=Nt({enabled:l&&!s,intervalMs:Se?15e3:!1}),Ee=we.data??[],De=we.isLoading,Oe=Te.data??{},[ke,Ae]=(0,V.useState)(null),[je,Me]=(0,V.useState)(`overview`),[Ne,Pe]=(0,V.useState)([]),[Fe,Ie]=(0,V.useState)(!1),[Le,Re]=(0,V.useState)(null),[ze,Be]=(0,V.useState)([]),[Ve,He]=(0,V.useState)(!1),[Ue,We]=(0,V.useState)([]),[Ge,Ke]=(0,V.useState)(!1),[qe,Je]=(0,V.useState)(``),[Ye,Xe]=(0,V.useState)(!1),[Ze,Qe]=(0,V.useState)(null),[$e,et]=(0,V.useState)(!1),[tt,nt]=(0,V.useState)(``),[rt,it]=(0,V.useState)(!1),[at,ot]=(0,V.useState)(null),[st,ct]=(0,V.useState)(``),[lt,ut]=(0,V.useState)(!1),[dt,ft]=(0,V.useState)(null),pt=(0,V.useRef)(null),mt=(0,V.useRef)(0),ht=(0,V.useRef)(0),gt=(0,V.useRef)(0),_t=(0,V.useRef)(``),vt=(0,V.useRef)(!1),[yt,bt]=(0,V.useState)(!1),[xt,St]=(0,V.useState)(null),[Ct,Et]=(0,V.useState)(``),[Dt,kt]=(0,V.useState)(!1),[jt,Mt]=(0,V.useState)(!1),[Pt,Rt]=(0,V.useState)(null),[zt,Bt]=(0,V.useState)(null),[Vt,Ht]=(0,V.useState)(!1),Ut=e=>{_t.current=e,nt(e)},Wt=e=>{vt.current=e,et(e)},[Gt,qt]=(0,V.useState)([]),[Jt,Yt]=(0,V.useState)(!1),[Xt,Zt]=(0,V.useState)(null),$t=!(!a||!a.devDir||a.devDir.trim()===``||!a.workspacesDir||a.workspacesDir.trim()===``),en=e=>{let t=[`available`,`downloading`,`downloaded`,`error`].includes(e.status)&&!!e.version;g({currentVersion:e.currentVersion,latestVersion:e.version||e.currentVersion,updateAvailable:t,releaseNotes:e.releaseNotes,nativeStatus:e.status,progress:e.progress,error:e.error,releaseUrl:$n}),v(e.currentVersion),e.status===`error`?w(e.error||`${rr} could not check or download the update.`):e.status!==`checking`&&w(null),M(e.status===`checking`||e.status===`downloading`),ne(e.status===`checking`?`checking`:e.status===`downloading`?`downloading`:e.status===`downloaded`?`downloaded`:e.status===`error`?`error`:`idle`),e.status===`available`&&S(!1)},tn=async(e=!0)=>{try{if(FP){let t=await FP.getStatus();en(t),e&&t.status!==`unsupported`&&en(await FP.check());return}let t=await fetch(`/api/update-status`);if(t.ok){let e=await t.json();g(e),w(null),e.currentVersion&&v(e.currentVersion)}else throw Error(`Update check failed with HTTP ${t.status}.`)}catch(e){w(e instanceof Error?e.message:`${rr} could not check for updates.`),console.error(`Failed to fetch update status:`,e)}},rn=async()=>{w(null),h?.nativeStatus===`downloaded`&&S(!1),await tn(!0)},an=async()=>{if(!FP){i(`Native installation is available in the ${rr} desktop app. Open the release page to install it.`,`info`);return}M(!0),ne(`downloading`);try{let e=await FP.download();en(e),e.status===`downloaded`?i(`Update downloaded. Restart ${rr} when you are ready to install it.`,`success`):i(`Update failed: ${e.error||`The download did not complete.`}`,`error`)}catch(e){console.error(`Update failed:`,e),ne(`error`),M(!1),i(`Update failed: ${e instanceof Error?e.message:`Unknown error`}`,`error`)}},on=async()=>{if(FP)try{en(await FP.restart())}catch(e){let t=e instanceof Error?e.message:`Unknown error`;g(e=>e&&{...e,nativeStatus:`error`,error:t,updateAvailable:!!e.latestVersion}),w(t),ne(`error`),i(`Could not restart for update: ${t}`,`error`),M(!1)}},sn=async()=>{try{let e=await(await fetch(`/api/adapters`)).json();e.adapters&&m(e.adapters)}catch(e){console.error(`Failed to fetch adapters:`,e)}},ln=async()=>{sn();try{let e=await(await fetch(`/api/config`)).json();o(e.config),u(e.exists),e.exists&&e.config.devDir||(b({devDir:e.config.devDir||``,workspacesDir:e.config.workspacesDir||``}),o({version:`1.0.0`,devDir:``,workspacesDir:``,defaultAssistant:null,scanDepth:2}))}catch(e){console.error(e)}finally{c(!1)}},un=async e=>{try{(await fetch(`/api/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})).ok?(f(`success`),o(e),u(!0),Ce.invalidateQueries({queryKey:[`repos`]}),dn()):f(`error`)}catch{f(`error`)}setTimeout(()=>f(null),3e3)},dn=async()=>{await Promise.all([Ce.invalidateQueries({queryKey:[`workspaces`]}),Ce.invalidateQueries({queryKey:[`workspaces-status`]})])},fn=async()=>{if(!ae.trim()||!oe.trim()){i(`Name and content are required.`,`error`);return}fe(!0);try{let e=await fetch(`/api/workflows/templates`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:P,name:ae,content:oe})});if(e.ok){let t=await e.json();i(`Strategy template saved successfully!`,`success`),await Ce.invalidateQueries({queryKey:[`workflow-templates`]}),F(t.template.id),L(!1),ce(null)}else{let t=await e.json();i(t.error||`Failed to save template`,`error`)}}catch(e){i(e.message||`Error saving template`,`error`)}finally{fe(!1)}},pn=async e=>{if(window.confirm(`Are you sure you want to delete this custom strategy template?`)){me(!0);try{let t=await fetch(`/api/workflows/templates/${encodeURIComponent(e)}`,{method:`DELETE`});if(t.ok)i(`Strategy template deleted successfully!`,`success`),await Ce.invalidateQueries({queryKey:[`workflow-templates`]}),F(null),ce(null);else{let e=await t.json();i(e.error||`Failed to delete template`,`error`)}}catch(e){i(e.message||`Error deleting template`,`error`)}finally{me(!1)}}},mn=async(e,t,n)=>{ue(!0),ce(null),ye(null);try{let r=await fetch(`/api/workflows/templates/${encodeURIComponent(e)}/analyze`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:t,assistant:n,comment:be})});if(r.ok){let e=await r.json();ce(e.analysis),ye(e.suggestedImprovement||null),i(`Strategy analysis completed successfully!`,`success`)}else{let e=await r.json();i(e.error||`Failed to analyze template using the selected assistant harness.`,`error`)}}catch(e){i(e.message||`Error analyzing template`,`error`)}finally{ue(!1)}},hn=async e=>{Ke(!0);try{let t=await(await fetch(`/api/workspace/${encodeURIComponent(e)}/changes`)).json();We(t.changes||[])}catch(e){console.error(e)}finally{Ke(!1)}},gn=async e=>{Ie(!0);try{let t=await(await fetch(`/api/workspace/${encodeURIComponent(e)}/sessions`)).json();Pe(t.sessions||[])}catch(e){console.error(e)}finally{Ie(!1)}},_n=async(e,t)=>{He(!0);try{let n=await(await fetch(`/api/session/${e}/${t}/transcript`)).json();Be(n.messages||[])}catch(e){console.error(e)}finally{He(!1)}},vn=async e=>{let t=++mt.current,n=()=>pt.current===e&&mt.current===t;Xe(!0),Qe(null);try{let t=await fetch(`/api/workspace/${encodeURIComponent(e)}/knowledge`);if(!t.ok)throw Error(`knowledge request failed`);let r=await t.json();if(!r||typeof r!=`object`||typeof r.content!=`string`)throw Error(`knowledge response was malformed`);if(!n())return;let i=r.content;Je(i),vt.current||(_t.current=i,nt(i)),Qe(null)}catch(e){if(!n())return;console.error(`Failed to load workspace knowledge:`,e),Qe(`Could not load Knowledge. Existing content and your draft were kept. Retry when ready.`)}finally{n()&&Xe(!1)}},yn=async e=>{let t=++gt.current,n=_t.current,r=()=>pt.current===e&&gt.current===t;it(!0),ot(null);try{let t=await fetch(`/api/workspace/${encodeURIComponent(e)}/knowledge`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})});if(!t.ok)throw Error(`knowledge save request failed`);let i=await t.json();if(!i||typeof i!=`object`||i.success!==!0)throw Error(`knowledge save response was not confirmed`);if(!r())return;mt.current+=1,Xe(!1),Je(n),Qe(null),ot(null),vt.current&&_t.current===n&&Wt(!1)}catch(e){if(!r())return;console.error(`Failed to save workspace knowledge:`,e),ot(`Could not save Knowledge. Your draft is still open. Retry the save.`)}finally{r()&&it(!1)}},bn=async e=>{let t=++ht.current,n=()=>pt.current===e&&ht.current===t;ut(!0),ft(null);try{let t=await fetch(`/api/workspace/${encodeURIComponent(e)}/plan`);if(!t.ok)throw Error(`plan request failed`);let r=await t.json();if(!r||typeof r!=`object`||typeof r.content!=`string`)throw Error(`plan response was malformed`);if(!n())return;ct(r.content),ft(null)}catch(e){if(!n())return;console.error(`Failed to load workspace plan:`,e),ft(`Could not load Plan. Existing content was kept. Retry when ready.`)}finally{n()&&ut(!1)}},xn=async e=>{bt(!0),St(null);try{let t=await(await fetch(`/api/workspace/${encodeURIComponent(e)}/sync`,{method:`POST`})).json();St(t.results||[]),hn(e)}catch(e){console.error(e)}finally{bt(!1)}},Sn=async e=>{if(Ct.trim()){Mt(!0),Rt(null);try{let t=await(await fetch(`/api/workspace/${encodeURIComponent(e)}/commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:Ct})})).json();Rt(t.results||[]),Et(``),kt(!1),hn(e)}catch(e){console.error(e)}finally{Mt(!1)}}},Cn=async(e,t,n)=>{if(n!==`codex`){let e=n===`claude`?`claude --resume ${t}`:`agy --conversation ${t}`;return await QS(e),i(`Copied ${n} resume command to clipboard:\n\n${e}`,`info`),!0}try{return await sr(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:`codex-desktop`,action:`resume`,sessionId:t})}),i(`Sent the existing session to Codex Desktop.`,`success`),!0}catch(e){return i(e instanceof Error?e.message:String(e),`error`),!1}},wn=async e=>{if(!ke)return;let t=Ee.find(e=>e.branchName===ke);if(t){if(PP){window.parent.postMessage({type:`executeTerminalCommand`,command:e,cwd:t.workspacePath},`*`);return}try{await sr(`/api/workspace/${encodeURIComponent(t.branchName)}/terminal`,{method:`POST`,body:JSON.stringify({command:e})})}catch(e){i(`Terminal error: ${e instanceof Error?e.message:String(e)}`,`error`)}}};(0,V.useEffect)(()=>{ln(),tn();let t=new URLSearchParams(window.location.search).get(`workspaceId`);t&&e(`/workspaces/${encodeURIComponent(t)}`)},[]),(0,V.useEffect)(()=>{if(FP)return FP.onEvent(en)},[]),(0,V.useEffect)(()=>{let e=t.pathname;if(e.startsWith(`/workspaces`)){let t=e.split(`/`).filter(Boolean);Ae(t[1]?decodeURIComponent(t[1]):null);let n=t[2];Me(n&&[`overview`,`plan`,`documents`,`changes`,`services`,`sessions`,`knowledge`,`skills`].includes(n)?n:`overview`)}else Ae(null)},[t.pathname]);let Tn=async(e=!1)=>{Yt(!0);try{let t=await fetch(`/api/updates/tools${e?`?force=true`:``}`);t.ok&&qt(await t.json())}catch(e){console.error(`Failed to fetch tools status:`,e)}finally{Yt(!1)}},En=async e=>{Zt(e);try{let t=await fetch(`/api/updates/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({toolId:e})}),n=await t.json();t.ok&&n.success?(i(`${e} updated successfully!\n\nOutput:\n${n.output}`,`success`),Tn(!0),tn()):i(`Error: ${n.error||`Failed to update tool`}`,`error`)}catch(e){console.error(e),i(`Network error when updating tool.`,`error`)}finally{Zt(null)}};(0,V.useEffect)(()=>{t.pathname.startsWith(`/settings`)&&Tn()},[t.pathname]),(0,V.useEffect)(()=>{pt.current=ke,mt.current+=1,ht.current+=1,gt.current+=1,Pe([]),We([]),Je(``),Qe(null),Xe(!1),ot(null),it(!1),_t.current=``,vt.current=!1,nt(``),et(!1),ct(``),ft(null),ut(!1)},[ke]),(0,V.useEffect)(()=>{ke&&(je===`changes`||je===`overview`)&&hn(ke)},[ke,je]),(0,V.useEffect)(()=>{ke&&(je===`sessions`||je===`overview`)&&gn(ke)},[ke,je]),(0,V.useEffect)(()=>{ke&&je===`knowledge`&&vn(ke)},[ke,je]),(0,V.useEffect)(()=>{ke&&(je===`overview`||je===`plan`)&&bn(ke)},[ke,je]);let Dn=async e=>{let t=e.repos.map(e=>e.split(/[\\/]/).pop()).join(`, `);await QS(`You are an AI assistant helping with feature development.
69
- We are working in a multi-repository workspace.
70
-
71
- Workspace Metadata:
72
- - Feature Branch: ${e.branchName}
73
- - Purpose & Context: ${e.description}
74
- - Mapped Repositories: ${t}
75
-
76
- Core Instructions:
77
- 1. Read "AGENTS.md" at the workspace root first — it names the repos, how they depend on each other, which to change first, and how to verify each.
78
- 2. Search "${ir}" for decisions and gotchas from earlier sessions rather than reading it whole, and record new ones with \`${Qn} knowledge add\`. "${ar}" carries the phase order when a change spans repos.
79
- 3. Follow all project-specific rules in "CLAUDE.md", ".cursorrules", or "AGENTS.md" inside sub-repositories.
80
- `)?i(`AI context prompt copied to clipboard!`,`success`):i(`Could not copy prompt to clipboard. Please check browser permissions.`,`error`)},On=async e=>{ie(e)},kn=async t=>{Bt(t);try{let n=await fetch(`/api/workspace/${encodeURIComponent(t)}`,{method:`DELETE`}),r=await n.json();n.ok&&r.success?(ke===t&&e(`/workspaces`),await dn(),i(`Workspace ${t} successfully deleted.`,`success`),ie(null)):i(`Failed to delete workspace: ${r.error||`Unknown error`}`,`error`)}catch(e){console.error(e),i(`Network error while deleting workspace.`,`error`)}finally{Bt(null)}},An=async(e,t)=>{Ht(!0);try{let n=await fetch(`/api/workspace/${encodeURIComponent(e)}/repo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({repoPath:t})}),r=await n.json();n.ok&&r.success?(await dn(),Ce.invalidateQueries({queryKey:[`workspace-services`,e]}),ke===e&&(hn(e),gn(e)),i(`Repository successfully added and configurations updated.`,`success`)):i(`Failed to add repository: ${r.error||`Unknown error`}`,`error`)}catch(e){console.error(e),i(`Network error while adding repository.`,`error`)}finally{Ht(!1)}};if(!l&&a)return(0,H.jsx)(Lc,{config:a,setConfig:o,defaultPaths:y,adapters:p,saveAppConfig:un});if(PP)return(0,H.jsx)(Ns,{activeWsId:ke,setActiveWsId:Ae,appVersion:_,workspaces:Ee,executeTerminal:wn});let jn=a?(0,H.jsx)(wP,{workspaces:Ee,workspaceStatuses:Oe,workspacesLoading:De,onOpenWorkspace:t=>e(`/workspaces/${encodeURIComponent(t)}`),onNewWorkspace:()=>e(`/new`),showToast:i}):null,Mn=a?(0,H.jsx)(NP,{config:a,onCreateWorkspace:()=>e(`/new`),onModifySettings:()=>e(`/settings`)}):null,Nn=a?(0,H.jsx)(AP,{}):null,Pn=a?(0,H.jsx)(TP,{}):null,Fn=(0,H.jsx)(MP,{workspaces:Ee,workspaceStatuses:Oe,workspacesLoading:De,fetchWorkspaces:dn,selectedId:ke,subTab:je,onSelect:t=>e(`/workspaces/${encodeURIComponent(t)}`),onSelectTab:(t,n)=>e(`/workspaces/${encodeURIComponent(t)}/${n}`),handleCopyPrompt:Dn,handleDeleteWorkspace:On,deleteWsLoading:zt,repos:O,addRepoLoading:Vt,handleAddRepo:An,sessionProps:{sessions:Ne,sessionsLoading:Fe,setActiveSession:Re,setTranscript:Be,fetchSessionTranscript:_n,handleOpenDesktopSession:Cn,showToast:i},changesProps:{gitChanges:Ue,gitChangesLoading:Ge,syncLoading:yt,syncResults:xt,commitMessage:Ct,showCommitModal:Dt,commitLoading:jt,commitResults:Pt,setSyncResults:St,setCommitResults:Rt,setCommitMessage:Et,setShowCommitModal:kt,fetchGitChanges:hn,handleSyncAll:xn,handleCommitAll:Sn},knowledgeProps:{knowledgeContent:qe,knowledgeLoading:Ye,knowledgeError:Ze,isEditingKnowledge:$e,editedKnowledge:tt,saveKnowledgeLoading:rt,saveKnowledgeError:at,setEditedKnowledge:Ut,setIsEditingKnowledge:Wt,handleSaveKnowledge:yn,handleRetryKnowledge:vn},planProps:{planContent:st,planLoading:lt,planError:dt,handleRetryPlan:bn},showToast:i}),In=(0,H.jsx)(jP,{workflowTemplates:te,isEditingTemplate:I,setIsEditingTemplate:L,mgtTemplateName:ae,setMgtTemplateName:R,mgtTemplateContent:oe,setMgtTemplateContent:z,selectedMgtTemplateId:P,setSelectedMgtTemplateId:F,analysisResult:se,setAnalysisResult:ce,showToast:i,handleAnalyzeTemplate:mn,handleSaveTemplate:fn,handleDeleteTemplate:pn,aiAssistants:k,analyzingTemplate:le,mgtAnalysisComment:be,setMgtAnalysisComment:xe,suggestedImprovement:ve,setSuggestedImprovement:ye,savingTemplate:de,deletingTemplate:pe,selectedInspectAssistant:he,setSelectedInspectAssistant:ge}),Ln=(0,H.jsx)(DP,{showToast:i}),Rn=(0,H.jsx)(OP,{showToast:i}),zn=(0,H.jsx)(kP,{workspaces:Ee,showToast:i}),Bn=a?(0,H.jsx)(EP,{config:a,setConfig:o,saveStatus:d,editors:A,adapters:p,saveAppConfig:un,isSettingsFormValid:$t,toolsStatus:Gt,toolsLoading:Jt,updatingToolId:Xt,fetchToolsStatus:Tn,handleUpdateTool:En}):null,Vn=ke||(Ee.length>0?Ee[0].branchName:null),Hn=t.pathname.startsWith(`/workspaces`);return(0,H.jsxs)(`div`,{className:`flex min-h-screen bg-transparent text-foreground max-md:pt-12`,children:[(0,H.jsx)(ks,{appVersion:_,workspaces:Ee,workspaceStatuses:Oe,workspacesLoading:De,activeWsId:ke,onSelectWorkspace:t=>e(`/workspaces/${encodeURIComponent(t)}`)}),(0,H.jsx)(`main`,{className:B(`flex-1 min-w-0 h-[calc(100dvh-3rem)] md:h-screen`,Hn?`overflow-hidden flex flex-col`:`overflow-y-auto p-3 sm:p-5 lg:p-6`),children:s?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-40 gap-4 text-muted-foreground`,children:[(0,H.jsx)(li,{className:`animate-spin text-primary`,size:32}),(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:`Loading config settings...`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mb-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 rounded-lg border border-border bg-card/50 px-3 py-2.5 text-xs`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Desktop updates`}),C?(0,H.jsx)(`p`,{className:`mt-0.5 truncate text-red-300`,role:`alert`,children:C}):(0,H.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:`Updates are optional and never install without your confirmation.`})]}),(0,H.jsx)(`button`,{onClick:rn,disabled:[`checking`,`downloading`].includes(h?.nativeStatus??``),className:`shrink-0 rounded-md border border-border px-3 py-1.5 font-semibold text-muted-foreground hover:text-foreground disabled:opacity-50`,children:C?`Check again`:`Check for updates`})]}),h&&h.updateAvailable&&!x&&(0,H.jsxs)(`div`,{className:`mb-6 p-4 bg-gradient-to-r from-amber-500/10 to-orange-600/10 border border-amber-500/30 rounded-xl shadow-lg flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 backdrop-blur-sm`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-amber-500/10 border border-amber-500/20 flex items-center justify-center text-amber-400 shrink-0`,children:j?(0,H.jsx)(li,{size:20,className:`animate-spin text-amber-400`}):(0,H.jsx)(hi,{size:20})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h4`,{className:`text-sm font-bold text-amber-300`,children:N===`error`?`${rr} update needs attention`:N===`downloaded`?`Update ready to install`:N===`downloading`?`Downloading update…`:`A new version of ${rr} is available!`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:N===`error`?h.error||`The update could not be completed. You can retry or use the release page.`:N===`downloaded`?`Restart ${rr} when convenient to install it.`:N===`downloading`?`Downloading from GitHub Releases… ${Math.round(h.progress||0)}%`:`Upgrade from v${h.currentVersion} to v${h.latestVersion} to get the latest features and bug fixes.`}),N===`downloading`&&(0,H.jsx)(`div`,{className:`mt-2 h-1.5 w-full max-w-xs overflow-hidden rounded-full bg-amber-950/50`,"aria-label":`Update download progress`,children:(0,H.jsx)(`div`,{className:`h-full bg-amber-400 transition-all`,style:{width:`${Math.max(0,Math.min(100,h.progress||0))}%`}})}),h.releaseNotes&&(0,H.jsxs)(`details`,{className:`mt-2 max-w-xl text-xs text-muted-foreground`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer font-semibold text-amber-200`,children:`Release notes`}),(0,H.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:h.releaseNotes})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[FP&&N===`downloaded`&&(0,H.jsx)(`button`,{onClick:on,className:`px-4 py-2 bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs rounded-lg transition-all shadow-md cursor-pointer`,children:`Restart & Install`}),FP&&N!==`downloaded`&&(0,H.jsx)(`button`,{onClick:an,disabled:j,className:`px-4 py-2 bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs rounded-lg transition-all shadow-md disabled:opacity-50 cursor-pointer flex items-center gap-1.5`,children:N===`error`?`Retry download`:j?`Downloading…`:`Download update`}),(0,H.jsx)(`a`,{href:h.releaseUrl||$n,target:`_blank`,rel:`noreferrer`,className:`px-3 py-2 border border-amber-500/30 text-amber-200 hover:bg-amber-500/10 font-semibold text-xs rounded-lg transition-colors`,children:`View release`}),(0,H.jsx)(`button`,{onClick:()=>S(!0),disabled:j,className:`px-3 py-2 border border-border text-muted-foreground hover:text-foreground font-semibold text-xs rounded-lg transition-colors disabled:opacity-50`,children:`Later`})]})]}),!a&&(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-40 gap-6`,children:[(0,H.jsx)(`div`,{className:`bg-red-500/10 p-6 rounded-full`,children:(0,H.jsx)(Si,{className:`text-red-400`,size:48})}),(0,H.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,H.jsx)(`h2`,{className:`text-2xl font-bold text-white mb-2`,children:`Backend Unreachable`}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-6`,children:[`The `,rr,` GUI could not connect to the local server. Make sure you started the GUI correctly via `,(0,H.jsxs)(`code`,{children:[Qn,` ui`]}),` or that the backend is running.`]}),(0,H.jsxs)(`button`,{onClick:()=>{c(!0),ln(),Ce.invalidateQueries()},className:`px-4 py-2 bg-primary hover:bg-primary/90 text-white font-medium text-sm rounded-md transition-colors cursor-pointer inline-flex items-center gap-2`,children:[(0,H.jsx)(li,{size:16}),` Try Again`]})]})]}),(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,H.jsx)(Rv,{className:`size-6`})}),children:(0,H.jsxs)(It,{children:[(0,H.jsx)(Ot,{path:`/`,element:jn}),(0,H.jsx)(Ot,{path:`/overview`,element:jn}),(0,H.jsx)(Ot,{path:`/dashboard`,element:jn}),(0,H.jsx)(Ot,{path:`/guide`,element:Mn}),(0,H.jsx)(Ot,{path:`/create`,element:Nn}),(0,H.jsx)(Ot,{path:`/new`,element:Nn}),(0,H.jsx)(Ot,{path:`/projects`,element:Pn}),(0,H.jsx)(Ot,{path:`/workspaces`,element:Vn?(0,H.jsx)(nn,{to:`/workspaces/${encodeURIComponent(Vn)}`,replace:!0}):(0,H.jsx)(nn,{to:`/new`,replace:!0})}),(0,H.jsx)(Ot,{path:`/workspaces/:workspaceId`,element:Fn}),(0,H.jsx)(Ot,{path:`/workspaces/:workspaceId/:tab`,element:Fn}),(0,H.jsx)(Ot,{path:`/skills`,element:Ln}),(0,H.jsx)(Ot,{path:`/agents`,element:Rn}),(0,H.jsx)(Ot,{path:`/workrooms`,element:zn}),(0,H.jsx)(Ot,{path:`/settings`,element:Bn}),(0,H.jsx)(Ot,{path:`/workflows`,element:In}),(0,H.jsx)(Ot,{path:`/strategies`,element:In}),(0,H.jsx)(Ot,{path:`*`,element:(0,H.jsx)(nn,{to:`/overview`,replace:!0})})]})})]})}),Le&&(0,H.jsx)(iC,{activeSession:Le,transcript:ze,transcriptLoading:Ve,setActiveSession:Re,workspaces:Ee,workspace:Ee.find(e=>e.branchName===ke),handleOpenDesktopSession:Cn,showToast:i}),(0,H.jsx)(CP,{workspaceName:re,open:re!==null,onClose:()=>ie(null),onConfirm:kn,loading:zt!==null}),(0,H.jsx)(xP,{workspaces:Ee}),(0,H.jsx)(SP,{}),(0,H.jsx)(As,{toasts:n,onDismiss:e=>r(t=>t.filter(t=>t.id!==e))})]})}function RP(){return(0,H.jsx)(Pt,{children:(0,H.jsx)(LP,{})})}var zP=new hr;(0,gr.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(cs,{children:(0,H.jsx)(zt,{client:zP,children:(0,H.jsx)(RP,{})})})}));export{so as $,Er as $t,Ov as A,pi as At,Fc as B,Jr as Bt,hC as C,Ti as Ct,QS as D,bi as Dt,aC as E,xi as Et,Mv as F,oi as Ft,Es as G,Ir as Gt,Pc as H,Gr as Ht,Fv as I,ii as It,Go as J,jr as Jt,Ts as K,Nr as Kt,Dv as L,Qr as Lt,Pv as M,di as Mt,Nv as N,li as Nt,Bv as O,vi as Ot,Lv as P,ci as Pt,ho as Q,Dr as Qt,jc as R,Zr as Rt,uC as S,Ei as St,oC as T,Si as Tt,Ms as U,Wr as Ut,Nc as V,qr as Vt,ws as W,zr as Wt,vo as X,kr as Xt,bo as Y,Ar as Yt,_o as Z,Or as Zt,jC as _,Ki as _t,RN as a,yr as an,Xa as at,bC as b,Wi as bt,bN as c,Ja as ct,iN as d,Ra as dt,wr as en,oo as et,tN as f,ka as ft,PC as g,ta as gt,AC as h,ua as ht,HN as i,br as in,qa as it,Iv as j,fi as jt,Rv as k,hi as kt,aN as l,Ka as lt,zC as m,pa as mt,QN as n,Sr as nn,to as nt,BN as o,vr as on,Ya as ot,VC as p,xa as pt,ys as q,Mr as qt,LN as r,xr as rn,eo as rt,VN as s,_r as sn,Za as st,ZN as t,Cr as tn,no as tt,oN as u,Va as ut,yC as v,qi as vt,sC as w,Ci as wt,SC as x,Di as xt,xC as y,$i as yt,Ic as z,Xr as zt};