@gbasin/agentboard-darwin-x64 0.2.3 → 0.2.4

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.
@@ -22,7 +22,7 @@ var Ww=Object.defineProperty;var Vw=(e,t,r)=>t in e?Ww(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(O,R){var P=O.length;O.push(R);e:for(;0<P;){var B=P-1>>>1,j=O[B];if(0<s(j,R))O[B]=R,O[P]=j,P=B;else break e}}function r(O){return O.length===0?null:O[0]}function n(O){if(O.length===0)return null;var R=O[0],P=O.pop();if(P!==R){O[0]=P;e:for(var B=0,j=O.length,W=j>>>1;B<W;){var K=2*(B+1)-1,ee=O[K],Z=K+1,z=O[Z];if(0>s(ee,P))Z<j&&0>s(z,ee)?(O[B]=z,O[Z]=P,B=Z):(O[B]=ee,O[K]=P,B=K);else if(Z<j&&0>s(z,P))O[B]=z,O[Z]=P,B=Z;else break e}}return R}function s(O,R){var P=O.sortIndex-R.sortIndex;return P!==0?P:O.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,i=l.now();e.unstable_now=function(){return l.now()-i}}var o=[],c=[],g=1,u=null,p=3,_=!1,y=!1,v=!1,h=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(O){for(var R=r(c);R!==null;){if(R.callback===null)n(c);else if(R.startTime<=O)n(c),R.sortIndex=R.expirationTime,t(o,R);else break;R=r(c)}}function w(O){if(v=!1,m(O),!y)if(r(o)!==null)y=!0,F(b);else{var R=r(c);R!==null&&$(w,R.startTime-O)}}function b(O,R){y=!1,v&&(v=!1,f(S),S=-1),_=!0;var P=p;try{for(m(R),u=r(o);u!==null&&(!(u.expirationTime>R)||O&&!A());){var B=u.callback;if(typeof B=="function"){u.callback=null,p=u.priorityLevel;var j=B(u.expirationTime<=R);R=e.unstable_now(),typeof j=="function"?u.callback=j:u===r(o)&&n(o),m(R)}else n(o);u=r(o)}if(u!==null)var W=!0;else{var K=r(c);K!==null&&$(w,K.startTime-R),W=!1}return W}finally{u=null,p=P,_=!1}}var x=!1,C=null,S=-1,E=5,L=-1;function A(){return!(e.unstable_now()-L<E)}function M(){if(C!==null){var O=e.unstable_now();L=O;var R=!0;try{R=C(!0,O)}finally{R?D():(x=!1,C=null)}}else x=!1}var D;if(typeof d=="function")D=function(){d(M)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,H=N.port2;N.port1.onmessage=M,D=function(){H.postMessage(null)}}else D=function(){h(M,0)};function F(O){C=O,x||(x=!0,D())}function $(O,R){S=h(function(){O(e.unstable_now())},R)}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(O){O.callback=null},e.unstable_continueExecution=function(){y||_||(y=!0,F(b))},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return r(o)},e.unstable_next=function(O){switch(p){case 1:case 2:case 3:var R=3;break;default:R=p}var P=p;p=R;try{return O()}finally{p=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(O,R){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var P=p;p=O;try{return R()}finally{p=P}},e.unstable_scheduleCallback=function(O,R,P){var B=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?B+P:B):P=B,O){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=P+j,O={id:g++,callback:R,priorityLevel:O,startTime:P,expirationTime:j,sortIndex:-1},P>B?(O.sortIndex=P,t(c,O),r(o)===null&&O===r(c)&&(v?(f(S),S=-1):v=!0,$(w,P-B))):(O.sortIndex=j,t(o,O),y||_||(y=!0,F(b))),O},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(O){var R=p;return function(){var P=p;p=R;try{return O.apply(this,arguments)}finally{p=P}}}})(Mv);Dv.exports=Mv;var mS=Dv.exports;/**
25
+ */(function(e){function t(N,R){var P=N.length;N.push(R);e:for(;0<P;){var B=P-1>>>1,j=N[B];if(0<s(j,R))N[B]=R,N[P]=j,P=B;else break e}}function r(N){return N.length===0?null:N[0]}function n(N){if(N.length===0)return null;var R=N[0],P=N.pop();if(P!==R){N[0]=P;e:for(var B=0,j=N.length,W=j>>>1;B<W;){var K=2*(B+1)-1,Z=N[K],ee=K+1,z=N[ee];if(0>s(Z,P))ee<j&&0>s(z,Z)?(N[B]=z,N[ee]=P,B=ee):(N[B]=Z,N[K]=P,B=K);else if(ee<j&&0>s(z,P))N[B]=z,N[ee]=P,B=ee;else break e}}return R}function s(N,R){var P=N.sortIndex-R.sortIndex;return P!==0?P:N.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,i=l.now();e.unstable_now=function(){return l.now()-i}}var o=[],c=[],g=1,u=null,p=3,_=!1,y=!1,v=!1,h=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(N){for(var R=r(c);R!==null;){if(R.callback===null)n(c);else if(R.startTime<=N)n(c),R.sortIndex=R.expirationTime,t(o,R);else break;R=r(c)}}function w(N){if(v=!1,m(N),!y)if(r(o)!==null)y=!0,F(b);else{var R=r(c);R!==null&&$(w,R.startTime-N)}}function b(N,R){y=!1,v&&(v=!1,f(S),S=-1),_=!0;var P=p;try{for(m(R),u=r(o);u!==null&&(!(u.expirationTime>R)||N&&!A());){var B=u.callback;if(typeof B=="function"){u.callback=null,p=u.priorityLevel;var j=B(u.expirationTime<=R);R=e.unstable_now(),typeof j=="function"?u.callback=j:u===r(o)&&n(o),m(R)}else n(o);u=r(o)}if(u!==null)var W=!0;else{var K=r(c);K!==null&&$(w,K.startTime-R),W=!1}return W}finally{u=null,p=P,_=!1}}var x=!1,C=null,S=-1,E=5,L=-1;function A(){return!(e.unstable_now()-L<E)}function M(){if(C!==null){var N=e.unstable_now();L=N;var R=!0;try{R=C(!0,N)}finally{R?D():(x=!1,C=null)}}else x=!1}var D;if(typeof d=="function")D=function(){d(M)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,H=O.port2;O.port1.onmessage=M,D=function(){H.postMessage(null)}}else D=function(){h(M,0)};function F(N){C=N,x||(x=!0,D())}function $(N,R){S=h(function(){N(e.unstable_now())},R)}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(N){N.callback=null},e.unstable_continueExecution=function(){y||_||(y=!0,F(b))},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return r(o)},e.unstable_next=function(N){switch(p){case 1:case 2:case 3:var R=3;break;default:R=p}var P=p;p=R;try{return N()}finally{p=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(N,R){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var P=p;p=N;try{return R()}finally{p=P}},e.unstable_scheduleCallback=function(N,R,P){var B=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?B+P:B):P=B,N){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=P+j,N={id:g++,callback:R,priorityLevel:N,startTime:P,expirationTime:j,sortIndex:-1},P>B?(N.sortIndex=P,t(c,N),r(o)===null&&N===r(c)&&(v?(f(S),S=-1):v=!0,$(w,P-B))):(N.sortIndex=j,t(o,N),y||_||(y=!0,F(b))),N},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(N){var R=p;return function(){var P=p;p=R;try{return N.apply(this,arguments)}finally{p=P}}}})(Mv);Dv.exports=Mv;var mS=Dv.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -45,18 +45,18 @@ Error generating stack: `+a.message+`
45
45
  ${h}px !important;
46
46
  top: ${_}px !important;
47
47
  }
48
- `),()=>{d.contains(f)&&d.removeChild(f)}},[t]),T.jsx(c5,{isPresent:t,childRef:a,sizeRef:l,children:k.cloneElement(e,{ref:c})})}const h5=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:s,presenceAffectsLayout:a,mode:l,anchorX:i,root:o})=>{const c=tf(d5),g=k.useId();let u=!0,p=k.useMemo(()=>(u=!1,{id:g,initial:t,isPresent:r,custom:s,onExitComplete:_=>{c.set(_,!0);for(const y of c.values())if(!y)return;n&&n()},register:_=>(c.set(_,!1),()=>c.delete(_))}),[r,c,n]);return a&&u&&(p={...p}),k.useMemo(()=>{c.forEach((_,y)=>c.set(y,!1))},[r]),k.useEffect(()=>{!r&&!c.size&&n&&n()},[r]),l==="popLayout"&&(e=T.jsx(u5,{isPresent:r,anchorX:i,root:o,children:e})),T.jsx(sc.Provider,{value:p,children:e})};function d5(){return new Map}function Dy(e=!0){const t=k.useContext(sc);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=t,a=k.useId();k.useEffect(()=>{if(e)return s(a)},[e]);const l=k.useCallback(()=>e&&n&&n(a),[a,n,e]);return!r&&n?[!1,l]:[!0]}const Sa=e=>e.key||"";function Fm(e){const t=[];return k.Children.forEach(e,r=>{k.isValidElement(r)&&t.push(r)}),t}const f5=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:s=!0,mode:a="sync",propagate:l=!1,anchorX:i="left",root:o})=>{const[c,g]=Dy(l),u=k.useMemo(()=>Fm(e),[e]),p=l&&!c?[]:u.map(Sa),_=k.useRef(!0),y=k.useRef(u),v=tf(()=>new Map),h=k.useRef(new Set),[f,d]=k.useState(u),[m,w]=k.useState(u);N0(()=>{_.current=!1,y.current=u;for(let C=0;C<m.length;C++){const S=Sa(m[C]);p.includes(S)?(v.delete(S),h.current.delete(S)):v.get(S)!==!0&&v.set(S,!1)}},[m,p.length,p.join("-")]);const b=[];if(u!==f){let C=[...u];for(let S=0;S<m.length;S++){const E=m[S],L=Sa(E);p.includes(L)||(C.splice(S,0,E),b.push(E))}return a==="wait"&&b.length&&(C=b),w(Fm(C)),d(u),null}const{forceRender:x}=k.useContext(ef);return T.jsx(T.Fragment,{children:m.map(C=>{const S=Sa(C),E=l&&!c?!1:u===m||p.includes(S),L=()=>{if(h.current.has(S))return;if(h.current.add(S),v.has(S))v.set(S,!0);else return;let A=!0;v.forEach(M=>{M||(A=!1)}),A&&(x==null||x(),w(y.current),l&&(g==null||g()),n&&n())};return T.jsx(h5,{isPresent:E,initial:!_.current||r?void 0:!1,custom:t,presenceAffectsLayout:s,mode:a,root:o,onExitComplete:E?void 0:L,anchorX:i,children:C},S)})})},My=k.createContext({strict:!1}),$m={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},cs={};for(const e in $m)cs[e]={isEnabled:t=>$m[e].some(r=>!!t[r])};function p5(e){for(const t in e)cs[t]={...cs[t],...e[t]}}const m5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Rl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m5.has(e)}let Ay=e=>!Rl(e);function g5(e){typeof e=="function"&&(Ay=t=>t.startsWith("on")?!Rl(t):e(t))}try{g5(require("@emotion/is-prop-valid").default)}catch{}function v5(e,t,r){const n={};for(const s in e)s==="values"&&typeof e.values=="object"||(Ay(s)||r===!0&&Rl(s)||!t&&!Rl(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}const oc=k.createContext({});function ac(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function To(e){return typeof e=="string"||Array.isArray(e)}const Ef=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],kf=["initial",...Ef];function lc(e){return ac(e.animate)||kf.some(t=>To(e[t]))}function Py(e){return!!(lc(e)||e.variants)}function _5(e,t){if(lc(e)){const{initial:r,animate:n}=e;return{initial:r===!1||To(r)?r:void 0,animate:To(n)?n:void 0}}return e.inherit!==!1?t:{}}function y5(e){const{initial:t,animate:r}=_5(e,k.useContext(oc));return k.useMemo(()=>({initial:t,animate:r}),[Hm(t),Hm(r)])}function Hm(e){return Array.isArray(e)?e.join(" "):e}function zm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const As={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ve.test(e))e=parseFloat(e);else return e;const r=zm(e,t.target.x),n=zm(e,t.target.y);return`${r}% ${n}%`}},w5={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,s=Nn.parse(e);if(s.length>5)return n;const a=Nn.createTransformer(e),l=typeof s[0]!="number"?1:0,i=r.x.scale*t.x,o=r.y.scale*t.y;s[0+l]/=i,s[1+l]/=o;const c=st(i,o,.5);return typeof s[2+l]=="number"&&(s[2+l]/=c),typeof s[3+l]=="number"&&(s[3+l]/=c),a(s)}},Th={borderRadius:{...As,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:As,borderTopRightRadius:As,borderBottomLeftRadius:As,borderBottomRightRadius:As,boxShadow:w5};function Iy(e,{layout:t,layoutId:r}){return ms.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Th[e]||e==="opacity")}const S5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},x5=ps.length;function b5(e,t,r){let n="",s=!0;for(let a=0;a<x5;a++){const l=ps[a],i=e[l];if(i===void 0)continue;let o=!0;if(typeof i=="number"?o=i===(l.startsWith("scale")?1:0):o=parseFloat(i)===0,!o||r){const c=by(i,Sf[l]);if(!o){s=!1;const g=S5[l]||l;n+=`${g}(${c}) `}r&&(t[l]=c)}}return n=n.trim(),r?n=r(t,s?"":n):s&&(n="none"),n}function Lf(e,t,r){const{style:n,vars:s,transformOrigin:a}=e;let l=!1,i=!1;for(const o in t){const c=t[o];if(ms.has(o)){l=!0;continue}else if(ey(o)){s[o]=c;continue}else{const g=by(c,Sf[o]);o.startsWith("origin")?(i=!0,a[o]=g):n[o]=g}}if(t.transform||(l||r?n.transform=b5(t,e.transform,r):n.transform&&(n.transform="none")),i){const{originX:o="50%",originY:c="50%",originZ:g=0}=a;n.transformOrigin=`${o} ${c} ${g}`}}const Rf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function By(e,t,r){for(const n in t)!zt(t[n])&&!Iy(n,r)&&(e[n]=t[n])}function C5({transformTemplate:e},t){return k.useMemo(()=>{const r=Rf();return Lf(r,t,e),Object.assign({},r.vars,r.style)},[t])}function E5(e,t){const r=e.style||{},n={};return By(n,r,e),Object.assign(n,C5(e,t)),n}function k5(e,t){const r={},n=E5(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}const L5={offset:"stroke-dashoffset",array:"stroke-dasharray"},R5={offset:"strokeDashoffset",array:"strokeDasharray"};function T5(e,t,r=1,n=0,s=!0){e.pathLength=1;const a=s?L5:R5;e[a.offset]=ve.transform(-n);const l=ve.transform(t),i=ve.transform(r);e[a.array]=`${l} ${i}`}const D5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Oy(e,{attrX:t,attrY:r,attrScale:n,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...i},o,c,g){if(Lf(e,i,c),o){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:u,style:p}=e;u.transform&&(p.transform=u.transform,delete u.transform),(p.transform||u.transformOrigin)&&(p.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),p.transform&&(p.transformBox=(g==null?void 0:g.transformBox)??"fill-box",delete u.transformBox);for(const _ of D5)u[_]!==void 0&&(p[_]=u[_],delete u[_]);t!==void 0&&(u.x=t),r!==void 0&&(u.y=r),n!==void 0&&(u.scale=n),s!==void 0&&T5(u,s,a,l,!1)}const Ny=()=>({...Rf(),attrs:{}}),jy=e=>typeof e=="string"&&e.toLowerCase()==="svg";function M5(e,t,r,n){const s=k.useMemo(()=>{const a=Ny();return Oy(a,t,jy(n),e.transformTemplate,e.style),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};By(a,e.style,e),s.style={...a,...s.style}}return s}const A5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tf(e){return typeof e!="string"||e.includes("-")?!1:!!(A5.indexOf(e)>-1||/[A-Z]/u.test(e))}function P5(e,t,r,{latestValues:n},s,a=!1,l){const o=(l??Tf(e)?M5:k5)(t,n,s,e),c=v5(t,typeof e=="string",a),g=e!==k.Fragment?{...c,...o,ref:r}:{},{children:u}=t,p=k.useMemo(()=>zt(u)?u.get():u,[u]);return k.createElement(e,{...g,children:p})}function Um(e){const t=[{},{}];return e==null||e.values.forEach((r,n)=>{t[0][n]=r.get(),t[1][n]=r.getVelocity()}),t}function Df(e,t,r,n){if(typeof t=="function"){const[s,a]=Um(n);t=t(r!==void 0?r:e.custom,s,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,a]=Um(n);t=t(r!==void 0?r:e.custom,s,a)}return t}function Ga(e){return zt(e)?e.get():e}function I5({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,s){return{latestValues:B5(r,n,s,e),renderState:t()}}function B5(e,t,r,n){const s={},a=n(e,{});for(const p in a)s[p]=Ga(a[p]);let{initial:l,animate:i}=e;const o=lc(e),c=Py(e);t&&c&&!o&&e.inherit!==!1&&(l===void 0&&(l=t.initial),i===void 0&&(i=t.animate));let g=r?r.initial===!1:!1;g=g||l===!1;const u=g?i:l;if(u&&typeof u!="boolean"&&!ac(u)){const p=Array.isArray(u)?u:[u];for(let _=0;_<p.length;_++){const y=Df(e,p[_]);if(y){const{transitionEnd:v,transition:h,...f}=y;for(const d in f){let m=f[d];if(Array.isArray(m)){const w=g?m.length-1:0;m=m[w]}m!==null&&(s[d]=m)}for(const d in v)s[d]=v[d]}}}return s}const Fy=e=>(t,r)=>{const n=k.useContext(oc),s=k.useContext(sc),a=()=>I5(e,t,n,s);return r?a():tf(a)};function Mf(e,t,r){var a;const{style:n}=e,s={};for(const l in n)(zt(n[l])||t.style&&zt(t.style[l])||Iy(l,e)||((a=r==null?void 0:r.getValue(l))==null?void 0:a.liveStyle)!==void 0)&&(s[l]=n[l]);return s}const O5=Fy({scrapeMotionValuesFromProps:Mf,createRenderState:Rf});function $y(e,t,r){const n=Mf(e,t,r);for(const s in e)if(zt(e[s])||zt(t[s])){const a=ps.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[a]=e[s]}return n}const N5=Fy({scrapeMotionValuesFromProps:$y,createRenderState:Ny}),j5=Symbol.for("motionComponentSymbol");function F5(e,t,r){const n=k.useRef(r);k.useInsertionEffect(()=>{n.current=r});const s=k.useRef(null);return k.useCallback(a=>{var i;a&&((i=e.onMount)==null||i.call(e,a)),t&&(a?t.mount(a):t.unmount());const l=n.current;if(typeof l=="function")if(a){const o=l(a);typeof o=="function"&&(s.current=o)}else s.current?(s.current(),s.current=null):l(a);else l&&(l.current=a)},[t])}const Af=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$5="framerAppearId",Hy="data-"+Af($5),zy=k.createContext({});function Hs(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function H5(e,t,r,n,s,a){var h,f;const{visualElement:l}=k.useContext(oc),i=k.useContext(My),o=k.useContext(sc),c=k.useContext(Cf).reducedMotion,g=k.useRef(null);n=n||i.renderer,!g.current&&n&&(g.current=n(e,{visualState:t,parent:l,props:r,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:c,isSVG:a}));const u=g.current,p=k.useContext(zy);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&z5(g.current,r,s,p);const _=k.useRef(!1);k.useInsertionEffect(()=>{u&&_.current&&u.update(r,o)});const y=r[Hy],v=k.useRef(!!y&&!((h=window.MotionHandoffIsComplete)!=null&&h.call(window,y))&&((f=window.MotionHasOptimisedAnimation)==null?void 0:f.call(window,y)));return N0(()=>{u&&(_.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),v.current&&u.animationState&&u.animationState.animateChanges())}),k.useEffect(()=>{u&&(!v.current&&u.animationState&&u.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var d;(d=window.MotionHandoffMarkAsComplete)==null||d.call(window,y)}),v.current=!1),u.enteringChildren=void 0)}),u}function z5(e,t,r,n){const{layoutId:s,layout:a,drag:l,dragConstraints:i,layoutScroll:o,layoutRoot:c,layoutCrossfade:g}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:Uy(e.parent)),e.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!l||i&&Hs(i),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:o,layoutRoot:c})}function Uy(e){if(e)return e.options.allowProjection!==!1?e.projection:Uy(e.parent)}function qc(e,{forwardMotionProps:t=!1,type:r}={},n,s){n&&p5(n);const a=r?r==="svg":Tf(e),l=a?N5:O5;function i(c,g){let u;const p={...k.useContext(Cf),...c,layoutId:U5(c)},{isStatic:_}=p,y=y5(c),v=l(c,_);if(!_&&rf){W5();const h=V5(p);u=h.MeasureLayout,y.visualElement=H5(e,v,p,s,h.ProjectionNode,a)}return T.jsxs(oc.Provider,{value:y,children:[u&&y.visualElement?T.jsx(u,{visualElement:y.visualElement,...p}):null,P5(e,c,F5(v,y.visualElement,g),v,_,t,a)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const o=k.forwardRef(i);return o[j5]=e,o}function U5({layoutId:e}){const t=k.useContext(ef).id;return t&&e!==void 0?t+"-"+e:e}function W5(e,t){k.useContext(My).strict}function V5(e){const{drag:t,layout:r}=cs;if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t!=null&&t.isEnabled(e)||r!=null&&r.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function K5(e,t){if(typeof Proxy>"u")return qc;const r=new Map,n=(a,l)=>qc(a,l,e,t),s=(a,l)=>n(a,l);return new Proxy(s,{get:(a,l)=>l==="create"?n:(r.has(l)||r.set(l,qc(l,void 0,e,t)),r.get(l))})}function Wy({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function G5({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function q5(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function Xc(e){return e===void 0||e===1}function Dh({scale:e,scaleX:t,scaleY:r}){return!Xc(e)||!Xc(t)||!Xc(r)}function Zn(e){return Dh(e)||Vy(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Vy(e){return Wm(e.x)||Wm(e.y)}function Wm(e){return e&&e!=="0%"}function Tl(e,t,r){const n=e-r,s=t*n;return r+s}function Vm(e,t,r,n,s){return s!==void 0&&(e=Tl(e,s,n)),Tl(e,r,n)+t}function Mh(e,t=0,r=1,n,s){e.min=Vm(e.min,t,r,n,s),e.max=Vm(e.max,t,r,n,s)}function Ky(e,{x:t,y:r}){Mh(e.x,t.translate,t.scale,t.originPoint),Mh(e.y,r.translate,r.scale,r.originPoint)}const Km=.999999999999,Gm=1.0000000000001;function X5(e,t,r,n=!1){const s=r.length;if(!s)return;t.x=t.y=1;let a,l;for(let i=0;i<s;i++){a=r[i],l=a.projectionDelta;const{visualElement:o}=a.options;o&&o.props.style&&o.props.style.display==="contents"||(n&&a.options.layoutScroll&&a.scroll&&a!==a.root&&$i(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Ky(e,l)),n&&Zn(a.latestValues)&&$i(e,a.latestValues))}t.x<Gm&&t.x>Km&&(t.x=1),t.y<Gm&&t.y>Km&&(t.y=1)}function Fi(e,t){e.min=e.min+t,e.max=e.max+t}function qm(e,t,r,n,s=.5){const a=st(e.min,e.max,s);Mh(e,t,r,a,n)}function $i(e,t){qm(e.x,t.x,t.scaleX,t.scale,t.originX),qm(e.y,t.y,t.scaleY,t.scale,t.originY)}function Gy(e,t){return Wy(q5(e.getBoundingClientRect(),t))}function Y5(e,t,r){const n=Gy(e,r),{scroll:s}=t;return s&&(Fi(n.x,s.offset.x),Fi(n.y,s.offset.y)),n}const Xm=()=>({translate:0,scale:1,origin:0,originPoint:0}),Hi=()=>({x:Xm(),y:Xm()}),Ym=()=>({min:0,max:0}),_t=()=>({x:Ym(),y:Ym()}),Dl={current:null},Pf={current:!1};function qy(){if(Pf.current=!0,!!rf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Dl.current=e.matches;e.addEventListener("change",t),t()}else Dl.current=!1}const J5=new WeakMap;function Q5(e,t,r){for(const n in t){const s=t[n],a=r[n];if(zt(s))e.addValue(n,s);else if(zt(a))e.addValue(n,ls(s,{owner:e}));else if(a!==s)if(e.hasValue(n)){const l=e.getValue(n);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=e.getStaticValue(n);e.addValue(n,ls(l!==void 0?l:s,{owner:e}))}}for(const n in r)t[n]===void 0&&e.removeValue(n);return t}const Jm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Z5{scrapeMotionValuesFromProps(t,r,n){return{}}constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:a,visualState:l},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=yf,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Gt.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,tt.render(this.render,!1,!0))};const{latestValues:o,renderState:c}=l;this.latestValues=o,this.baseTarget={...o},this.initialValues=r.initial?{...o}:{},this.renderState=c,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=i,this.blockInitialAnimation=!!a,this.isControllingVariants=lc(r),this.isVariantNode=Py(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...u}=this.scrapeMotionValuesFromProps(r,{},this);for(const p in u){const _=u[p];o[p]!==void 0&&zt(_)&&_.set(o[p])}}mount(t){var r;this.current=t,J5.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Pf.current||qy(),this.shouldReduceMotion=Dl.current),(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),On(this.notifyUpdate),On(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ms.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&tt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{s(),a&&a(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in cs){const r=cs[t];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_t()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<Jm.length;n++){const s=Jm[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,l=t[a];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=Q5(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const n=this.values.get(t);r!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=ls(r===null?void 0:r,{owner:this}),this.addValue(t,n)),n}readValue(t,r){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(j0(n)||$0(n))?n=parseFloat(n):!o5(n)&&Nn.test(r)&&(n=xy(t,r)),this.setBaseTarget(t,zt(n)?n.get():n)),zt(n)?n.get():n}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var a;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const l=Df(this.props,r,(a=this.presenceContext)==null?void 0:a.custom);l&&(n=l[t])}if(r&&n!==void 0)return n;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!zt(s)?s:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new lf),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){xf.render(this.render)}}class Xy extends Z5{constructor(){super(...arguments),this.KeyframeResolver=X2}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;zt(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Yy(e,{style:t,vars:r},n,s){const a=e.style;let l;for(l in t)a[l]=t[l];s==null||s.applyProjectionStyles(a,n);for(l in r)a.setProperty(l,r[l])}function eE(e){return window.getComputedStyle(e)}class tE extends Xy{constructor(){super(...arguments),this.type="html",this.renderInstance=Yy}readValueFromInstance(t,r){var n;if(ms.has(r))return(n=this.projection)!=null&&n.isProjecting?xh(r):p2(t,r);{const s=eE(t),a=(ey(r)?s.getPropertyValue(r):s[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:r}){return Gy(t,r)}build(t,r,n){Lf(t,r,n.transformTemplate)}scrapeMotionValuesFromProps(t,r,n){return Mf(t,r,n)}}const Jy=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function rE(e,t,r,n){Yy(e,t,void 0,n);for(const s in t.attrs)e.setAttribute(Jy.has(s)?s:Af(s),t.attrs[s])}class nE extends Xy{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_t}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(ms.has(r)){const n=Sy(r);return n&&n.default||0}return r=Jy.has(r)?r:Af(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,n){return $y(t,r,n)}build(t,r,n){Oy(t,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,r,n,s){rE(t,r,n,s)}mount(t){this.isSVGTag=jy(t.tagName),super.mount(t)}}const iE=(e,t)=>t.isSVG??Tf(e)?new nE(t):new tE(t,{allowProjection:e!==k.Fragment});function Ji(e,t,r){const n=e.getProps();return Df(n,t,r!==void 0?r:n.custom,e)}const Ah=e=>Array.isArray(e);function sE(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,ls(r))}function oE(e){return Ah(e)?e[e.length-1]||0:e}function aE(e,t){const r=Ji(e,t);let{transitionEnd:n={},transition:s={},...a}=r||{};a={...a,...n};for(const l in a){const i=oE(a[l]);sE(e,l,i)}}function lE(e){return!!(zt(e)&&e.add)}function Ph(e,t){const r=e.getValue("willChange");if(lE(r))return r.add(t);if(!r&&un.WillChange){const n=new un.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function Qy(e){return e.props[Hy]}const cE=e=>e!==null;function uE(e,{repeat:t,repeatType:r="loop"},n){const s=e.filter(cE),a=t&&r!=="loop"&&t%2===1?0:s.length-1;return s[a]}const hE={type:"spring",stiffness:500,damping:25,restSpeed:10},dE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),fE={type:"keyframes",duration:.8},pE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},mE=(e,{keyframes:t})=>t.length>2?fE:ms.has(e)?e.startsWith("scale")?dE(t[1]):hE:pE;function gE({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:a,repeatType:l,repeatDelay:i,from:o,elapsed:c,...g}){return!!Object.keys(g).length}const If=(e,t,r,n={},s,a)=>l=>{const i=wf(n,e)||{},o=i.delay||n.delay||0;let{elapsed:c=0}=n;c=c-sn(o);const g={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:p=>{t.set(p),i.onUpdate&&i.onUpdate(p)},onComplete:()=>{l(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:a?void 0:s};gE(i)||Object.assign(g,mE(e,g)),g.duration&&(g.duration=sn(g.duration)),g.repeatDelay&&(g.repeatDelay=sn(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let u=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Lh(g),g.delay===0&&(u=!0)),(un.instantAnimations||un.skipAnimations)&&(u=!0,Lh(g),g.delay=0),g.allowFlatten=!i.type&&!i.ease,u&&!a&&t.get()!==void 0){const p=uE(g.keyframes,i);if(p!==void 0){tt.update(()=>{g.onUpdate(p),g.onComplete()});return}}return i.isSync?new _f(g):new N2(g)};function vE({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,n}function Zy(e,t,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:l,...i}=t;n&&(a=n);const o=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const g in i){const u=e.getValue(g,e.latestValues[g]??null),p=i[g];if(p===void 0||c&&vE(c,g))continue;const _={delay:r,...wf(a||{},g)},y=u.get();if(y!==void 0&&!u.isAnimating&&!Array.isArray(p)&&p===y&&!_.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const f=Qy(e);if(f){const d=window.MotionHandoffAnimation(f,g,tt);d!==null&&(_.startTime=d,v=!0)}}Ph(e,g),u.start(If(g,u,p,e.shouldReduceMotion&&_y.has(g)?{type:!1}:_,e,v));const h=u.animation;h&&o.push(h)}return l&&Promise.all(o).then(()=>{tt.update(()=>{l&&aE(e,l)})}),o}function e1(e,t,r,n=0,s=1){const a=Array.from(e).sort((c,g)=>c.sortNodePosition(g)).indexOf(t),l=e.size,i=(l-1)*n;return typeof r=="function"?r(a,l):s===1?a*n:i-a*n}function Ih(e,t,r={}){var o;const n=Ji(e,t,r.type==="exit"?(o=e.presenceContext)==null?void 0:o.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const a=n?()=>Promise.all(Zy(e,n,r)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:g=0,staggerChildren:u,staggerDirection:p}=s;return _E(e,t,c,g,u,p,r)}:()=>Promise.resolve(),{when:i}=s;if(i){const[c,g]=i==="beforeChildren"?[a,l]:[l,a];return c().then(()=>g())}else return Promise.all([a(),l(r.delay)])}function _E(e,t,r=0,n=0,s=0,a=1,l){const i=[];for(const o of e.variantChildren)o.notify("AnimationStart",t),i.push(Ih(o,t,{...l,delay:r+(typeof n=="function"?0:n)+e1(e.variantChildren,o,n,s,a)}).then(()=>o.notify("AnimationComplete",t)));return Promise.all(i)}function yE(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const s=t.map(a=>Ih(e,a,r));n=Promise.all(s)}else if(typeof t=="string")n=Ih(e,t,r);else{const s=typeof t=="function"?Ji(e,t,r.custom):t;n=Promise.all(Zy(e,s,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}function t1(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}const wE=kf.length;function r1(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?r1(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<wE;r++){const n=kf[r],s=e.props[n];(To(s)||s===!1)&&(t[n]=s)}return t}const SE=[...Ef].reverse(),xE=Ef.length;function bE(e){return t=>Promise.all(t.map(({animation:r,options:n})=>yE(e,r,n)))}function CE(e){let t=bE(e),r=Qm(),n=!0;const s=o=>(c,g)=>{var p;const u=Ji(e,g,o==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(u){const{transition:_,transitionEnd:y,...v}=u;c={...c,...v,...y}}return c};function a(o){t=o(e)}function l(o){const{props:c}=e,g=r1(e.parent)||{},u=[],p=new Set;let _={},y=1/0;for(let h=0;h<xE;h++){const f=SE[h],d=r[f],m=c[f]!==void 0?c[f]:g[f],w=To(m),b=f===o?d.isActive:null;b===!1&&(y=h);let x=m===g[f]&&m!==c[f]&&w;if(x&&n&&e.manuallyAnimateOnMount&&(x=!1),d.protectedKeys={..._},!d.isActive&&b===null||!m&&!d.prevProp||ac(m)||typeof m=="boolean")continue;const C=EE(d.prevProp,m);let S=C||f===o&&d.isActive&&!x&&w||h>y&&w,E=!1;const L=Array.isArray(m)?m:[m];let A=L.reduce(s(f),{});b===!1&&(A={});const{prevResolvedValues:M={}}=d,D={...M,...A},N=$=>{S=!0,p.has($)&&(E=!0,p.delete($)),d.needsAnimating[$]=!0;const O=e.getValue($);O&&(O.liveStyle=!1)};for(const $ in D){const O=A[$],R=M[$];if(_.hasOwnProperty($))continue;let P=!1;Ah(O)&&Ah(R)?P=!t1(O,R):P=O!==R,P?O!=null?N($):p.add($):O!==void 0&&p.has($)?N($):d.protectedKeys[$]=!0}d.prevProp=m,d.prevResolvedValues=A,d.isActive&&(_={..._,...A}),n&&e.blockInitialAnimation&&(S=!1);const H=x&&C;S&&(!H||E)&&u.push(...L.map($=>{const O={type:f};if(typeof $=="string"&&n&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:R}=e,P=Ji(R,$);if(R.enteringChildren&&P){const{delayChildren:B}=P.transition||{};O.delay=e1(R.enteringChildren,e,B)}}return{animation:$,options:O}}))}if(p.size){const h={};if(typeof c.initial!="boolean"){const f=Ji(e,Array.isArray(c.initial)?c.initial[0]:c.initial);f&&f.transition&&(h.transition=f.transition)}p.forEach(f=>{const d=e.getBaseTarget(f),m=e.getValue(f);m&&(m.liveStyle=!0),h[f]=d??null}),u.push({animation:h})}let v=!!u.length;return n&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(v=!1),n=!1,v?t(u):Promise.resolve()}function i(o,c){var u;if(r[o].isActive===c)return Promise.resolve();(u=e.variantChildren)==null||u.forEach(p=>{var _;return(_=p.animationState)==null?void 0:_.setActive(o,c)}),r[o].isActive=c;const g=l(o);for(const p in r)r[p].protectedKeys={};return g}return{animateChanges:l,setActive:i,setAnimateFunction:a,getState:()=>r,reset:()=>{r=Qm()}}}function EE(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!t1(t,e):!1}function Vn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Qm(){return{animate:Vn(!0),whileInView:Vn(),whileHover:Vn(),whileTap:Vn(),whileDrag:Vn(),whileFocus:Vn(),exit:Vn()}}class Hn{constructor(t){this.isMounted=!1,this.node=t}update(){}}class kE extends Hn{constructor(t){super(t),t.animationState||(t.animationState=CE(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ac(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let LE=0;class RE extends Hn{constructor(){super(...arguments),this.id=LE++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const s=this.node.animationState.setActive("exit",!t);r&&!t&&s.then(()=>{r(this.id)})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const TE={animation:{Feature:kE},exit:{Feature:RE}};function Do(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function Go(e){return{point:{x:e.pageX,y:e.pageY}}}const DE=e=>t=>bf(t)&&e(t,Go(t));function to(e,t,r,n){return Do(e,t,DE(r),n)}const n1=1e-4,ME=1-n1,AE=1+n1,i1=.01,PE=0-i1,IE=0+i1;function qt(e){return e.max-e.min}function BE(e,t,r){return Math.abs(e-t)<=r}function Zm(e,t,r,n=.5){e.origin=n,e.originPoint=st(t.min,t.max,e.origin),e.scale=qt(r)/qt(t),e.translate=st(r.min,r.max,e.origin)-e.originPoint,(e.scale>=ME&&e.scale<=AE||isNaN(e.scale))&&(e.scale=1),(e.translate>=PE&&e.translate<=IE||isNaN(e.translate))&&(e.translate=0)}function ro(e,t,r,n){Zm(e.x,t.x,r.x,n?n.originX:void 0),Zm(e.y,t.y,r.y,n?n.originY:void 0)}function eg(e,t,r){e.min=r.min+t.min,e.max=e.min+qt(t)}function OE(e,t,r){eg(e.x,t.x,r.x),eg(e.y,t.y,r.y)}function tg(e,t,r){e.min=t.min-r.min,e.max=e.min+qt(t)}function Ml(e,t,r){tg(e.x,t.x,r.x),tg(e.y,t.y,r.y)}function dr(e){return[e("x"),e("y")]}const s1=({current:e})=>e?e.ownerDocument.defaultView:null,rg=(e,t)=>Math.abs(e-t);function NE(e,t){const r=rg(e.x,t.x),n=rg(e.y,t.y);return Math.sqrt(r**2+n**2)}const ng=new Set(["auto","scroll"]);class o1{constructor(t,r,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:l=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Jc(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=NE(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:h}=_,{timestamp:f}=Pt;this.history.push({...h,timestamp:f});const{onStart:d,onMove:m}=this.handlers;y||(d&&d(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,_)},this.handlePointerMove=(_,y)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=Yc(y,this.transformPagePoint),tt.update(this.updatePoint,!0)},this.handlePointerUp=(_,y)=>{this.end();const{onEnd:v,onSessionEnd:h,resumeAnimation:f}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&f&&f(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=Jc(_.type==="pointercancel"?this.lastMoveEventInfo:Yc(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(_,d),h&&h(_,d)},!bf(t))return;this.dragSnapToOrigin=a,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=l,this.contextWindow=s||window;const o=Go(t),c=Yc(o,this.transformPagePoint),{point:g}=c,{timestamp:u}=Pt;this.history=[{...g,timestamp:u}];const{onSessionStart:p}=r;p&&p(t,Jc(c,this.history)),this.removeListeners=Wo(to(this.contextWindow,"pointermove",this.handlePointerMove),to(this.contextWindow,"pointerup",this.handlePointerUp),to(this.contextWindow,"pointercancel",this.handlePointerUp)),i&&this.startScrollTracking(i)}startScrollTracking(t){let r=t.parentElement;for(;r;){const n=getComputedStyle(r);(ng.has(n.overflowX)||ng.has(n.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const n=t===window,s=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},a={x:s.x-r.x,y:s.y-r.y};a.x===0&&a.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(t,s),tt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),On(this.updatePoint)}}function Yc(e,t){return t?{point:t(e.point)}:e}function ig(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jc({point:e},t){return{point:e,delta:ig(e,a1(t)),offset:ig(e,jE(t)),velocity:FE(t,.1)}}function jE(e){return e[0]}function a1(e){return e[e.length-1]}function FE(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const s=a1(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>sn(t)));)r--;if(!n)return{x:0,y:0};const a=vr(s.timestamp-n.timestamp);if(a===0)return{x:0,y:0};const l={x:(s.x-n.x)/a,y:(s.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function $E(e,{min:t,max:r},n){return t!==void 0&&e<t?e=n?st(t,e,n.min):Math.max(e,t):r!==void 0&&e>r&&(e=n?st(r,e,n.max):Math.min(e,r)),e}function sg(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function HE(e,{top:t,left:r,bottom:n,right:s}){return{x:sg(e.x,r,s),y:sg(e.y,t,n)}}function og(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function zE(e,t){return{x:og(e.x,t.x),y:og(e.y,t.y)}}function UE(e,t){let r=.5;const n=qt(e),s=qt(t);return s>n?r=ko(t.min,t.max-n,e.min):n>s&&(r=ko(e.min,e.max-s,t.min)),zr(0,1,r)}function WE(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Bh=.35;function VE(e=Bh){return e===!1?e=0:e===!0&&(e=Bh),{x:ag(e,"left","right"),y:ag(e,"top","bottom")}}function ag(e,t,r){return{min:lg(e,t),max:lg(e,r)}}function lg(e,t){return typeof e=="number"?e:e[t]||0}const KE=new WeakMap;class GE{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_t(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=u=>{r?(this.stopAnimation(),this.snapToCursor(Go(u).point)):this.pauseAnimation()},l=(u,p)=>{this.stopAnimation();const{drag:_,dragPropagation:y,onDragStart:v}=this.getProps();if(_&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Z2(_),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),dr(f=>{let d=this.getAxisMotionValue(f).get()||0;if(Hr.test(d)){const{projection:m}=this.visualElement;if(m&&m.layout){const w=m.layout.layoutBox[f];w&&(d=qt(w)*(parseFloat(d)/100))}}this.originPoint[f]=d}),v&&tt.postRender(()=>v(u,p)),Ph(this.visualElement,"transform");const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},i=(u,p)=>{this.latestPointerEvent=u,this.latestPanInfo=p;const{dragPropagation:_,dragDirectionLock:y,onDirectionLock:v,onDrag:h}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:f}=p;if(y&&this.currentDirection===null){this.currentDirection=qE(f),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",p.point,f),this.updateAxis("y",p.point,f),this.visualElement.render(),h&&h(u,p)},o=(u,p)=>{this.latestPointerEvent=u,this.latestPanInfo=p,this.stop(u,p),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>dr(u=>{var p;return this.getAnimationState(u)==="paused"&&((p=this.getAxisMotionValue(u).animation)==null?void 0:p.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new o1(t,{onSessionStart:a,onStart:l,onMove:i,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:n,contextWindow:s1(this.visualElement),element:this.visualElement.current})}stop(t,r){const n=t||this.latestPointerEvent,s=r||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!n)return;const{velocity:l}=s;this.startAnimation(l);const{onDragEnd:i}=this.getProps();i&&tt.postRender(()=>i(n,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:s}=this.getProps();if(!n||!xa(t,s,this.currentDirection))return;const a=this.getAxisMotionValue(t);let l=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(l=$E(l,this.constraints[t],this.elastic[t])),a.set(l)}resolveConstraints(){var a;const{dragConstraints:t,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,s=this.constraints;t&&Hs(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=HE(n.layoutBox,t):this.constraints=!1,this.elastic=VE(r),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&dr(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=WE(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!Hs(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=Y5(n,s.root,this.visualElement.getTransformPagePoint());let l=zE(s.layout.layoutBox,a);if(r){const i=r(G5(l));this.hasMutatedConstraints=!!i,i&&(l=Wy(i))}return l}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:i}=this.getProps(),o=this.constraints||{},c=dr(g=>{if(!xa(g,r,this.currentDirection))return;let u=o&&o[g]||{};l&&(u={min:0,max:0});const p=s?200:1e6,_=s?40:1e7,y={type:"inertia",velocity:n?t[g]:0,bounceStiffness:p,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...a,...u};return this.startAxisValueAnimation(g,y)});return Promise.all(c).then(i)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return Ph(this.visualElement,t),n.start(If(t,n,0,r,this.visualElement,!1))}stopAnimation(){dr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){dr(t=>{var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.state}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){dr(r=>{const{drag:n}=this.getProps();if(!xa(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(r);if(s&&s.layout){const{min:l,max:i}=s.layout.layoutBox[r],o=a.get()||0;a.set(t[r]-st(l,i,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Hs(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};dr(l=>{const i=this.getAxisMotionValue(l);if(i&&this.constraints!==!1){const o=i.get();s[l]=UE({min:o,max:o},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),dr(l=>{if(!xa(l,t,null))return;const i=this.getAxisMotionValue(l),{min:o,max:c}=this.constraints[l];i.set(st(o,c,s[l]))})}addListeners(){if(!this.visualElement.current)return;KE.set(this.visualElement,this);const t=this.visualElement.current,r=to(t,"pointerdown",o=>{const{drag:c,dragListener:g=!0}=this.getProps();c&&g&&!Ry(o.target)&&this.start(o)}),n=()=>{const{dragConstraints:o}=this.getProps();Hs(o)&&o.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,a=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),tt.read(n);const l=Do(window,"resize",()=>this.scalePositionWithinConstraints()),i=s.addEventListener("didUpdate",({delta:o,hasLayoutChanged:c})=>{this.isDragging&&c&&(dr(g=>{const u=this.getAxisMotionValue(g);u&&(this.originPoint[g]+=o[g].translate,u.set(u.get()+o[g].translate))}),this.visualElement.render())});return()=>{l(),r(),a(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:l=Bh,dragMomentum:i=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:a,dragElastic:l,dragMomentum:i}}}function xa(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function qE(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class XE extends Hn{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new GE(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const cg=e=>(t,r)=>{e&&tt.postRender(()=>e(t,r))};class YE extends Hn{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new o1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:s1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:cg(t),onStart:cg(r),onMove:n,onEnd:(a,l)=>{delete this.session,s&&tt.postRender(()=>s(a,l))}}}mount(){this.removePointerDownListener=to(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const qa={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Qc=!1;class JE extends k.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:a}=t;a&&(r.group&&r.group.add(a),n&&n.register&&s&&n.register(a),Qc&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),qa.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:s,isPresent:a}=this.props,{projection:l}=n;return l&&(l.isPresent=a,Qc=!0,s||t.layoutDependency!==r||r===void 0||t.isPresent!==a?l.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?l.promote():l.relegate()||tt.postRender(()=>{const i=l.getStack();(!i||!i.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),xf.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=t;Qc=!0,s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function l1(e){const[t,r]=Dy(),n=k.useContext(ef);return T.jsx(JE,{...e,layoutGroup:n,switchLayoutGroup:k.useContext(zy),isPresent:t,safeToRemove:r})}function QE(e,t,r){const n=zt(e)?e:ls(e);return n.start(If("",n,t,r)),n.animation}const ZE=(e,t)=>e.depth-t.depth;class ek{constructor(){this.children=[],this.isDirty=!1}add(t){nf(this.children,t),this.isDirty=!0}remove(t){sf(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ZE),this.isDirty=!1,this.children.forEach(t)}}function tk(e,t){const r=Gt.now(),n=({timestamp:s})=>{const a=s-r;a>=t&&(On(n),e(a-t))};return tt.setup(n,!0),()=>On(n)}const c1=["TopLeft","TopRight","BottomLeft","BottomRight"],rk=c1.length,ug=e=>typeof e=="string"?parseFloat(e):e,hg=e=>typeof e=="number"||ve.test(e);function nk(e,t,r,n,s,a){s?(e.opacity=st(0,r.opacity??1,ik(n)),e.opacityExit=st(t.opacity??1,0,sk(n))):a&&(e.opacity=st(t.opacity??1,r.opacity??1,n));for(let l=0;l<rk;l++){const i=`border${c1[l]}Radius`;let o=dg(t,i),c=dg(r,i);if(o===void 0&&c===void 0)continue;o||(o=0),c||(c=0),o===0||c===0||hg(o)===hg(c)?(e[i]=Math.max(st(ug(o),ug(c),n),0),(Hr.test(c)||Hr.test(o))&&(e[i]+="%")):e[i]=c}(t.rotate||r.rotate)&&(e.rotate=st(t.rotate||0,r.rotate||0,n))}function dg(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ik=u1(0,.5,q0),sk=u1(.5,.95,yr);function u1(e,t,r){return n=>n<e?0:n>t?1:r(ko(e,t,n))}function fg(e,t){e.min=t.min,e.max=t.max}function br(e,t){fg(e.x,t.x),fg(e.y,t.y)}function pg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function mg(e,t,r,n,s){return e-=t,e=Tl(e,1/r,n),s!==void 0&&(e=Tl(e,1/s,n)),e}function ok(e,t=0,r=1,n=.5,s,a=e,l=e){if(Hr.test(t)&&(t=parseFloat(t),t=st(l.min,l.max,t/100)-l.min),typeof t!="number")return;let i=st(a.min,a.max,n);e===a&&(i-=t),e.min=mg(e.min,t,r,i,s),e.max=mg(e.max,t,r,i,s)}function gg(e,t,[r,n,s],a,l){ok(e,t[r],t[n],t[s],t.scale,a,l)}const ak=["x","scaleX","originX"],lk=["y","scaleY","originY"];function vg(e,t,r,n){gg(e.x,t,ak,r?r.x:void 0,n?n.x:void 0),gg(e.y,t,lk,r?r.y:void 0,n?n.y:void 0)}function _g(e){return e.translate===0&&e.scale===1}function h1(e){return _g(e.x)&&_g(e.y)}function yg(e,t){return e.min===t.min&&e.max===t.max}function ck(e,t){return yg(e.x,t.x)&&yg(e.y,t.y)}function wg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function d1(e,t){return wg(e.x,t.x)&&wg(e.y,t.y)}function Sg(e){return qt(e.x)/qt(e.y)}function xg(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class uk{constructor(){this.members=[]}add(t){nf(this.members,t),t.scheduleRender()}remove(t){if(sf(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(s=>t===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const a=this.members[s];if(a.isPresent!==!1){n=a;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function hk(e,t,r){let n="";const s=e.x.translate/t.x,a=e.y.translate/t.y,l=(r==null?void 0:r.z)||0;if((s||a||l)&&(n=`translate3d(${s}px, ${a}px, ${l}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:c,rotate:g,rotateX:u,rotateY:p,skewX:_,skewY:y}=r;c&&(n=`perspective(${c}px) ${n}`),g&&(n+=`rotate(${g}deg) `),u&&(n+=`rotateX(${u}deg) `),p&&(n+=`rotateY(${p}deg) `),_&&(n+=`skewX(${_}deg) `),y&&(n+=`skewY(${y}deg) `)}const i=e.x.scale*t.x,o=e.y.scale*t.y;return(i!==1||o!==1)&&(n+=`scale(${i}, ${o})`),n||"none"}const Zc=["","X","Y","Z"],dk=1e3;let fk=0;function eu(e,t,r,n){const{latestValues:s}=t;s[e]&&(r[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function f1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=Qy(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",tt,!(s||a))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&f1(n)}function p1({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(l={},i=t==null?void 0:t()){this.id=fk++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(gk),this.nodes.forEach(wk),this.nodes.forEach(Sk),this.nodes.forEach(vk)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let o=0;o<this.path.length;o++)this.path[o].shouldResetTransform=!0;this.root===this&&(this.nodes=new ek)}addEventListener(l,i){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new lf),this.eventHandlers.get(l).add(i)}notifyListeners(l,...i){const o=this.eventHandlers.get(l);o&&o.notify(...i)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=Ty(l)&&!i5(l),this.instance=l;const{layoutId:i,layout:o,visualElement:c}=this.options;if(c&&!c.current&&c.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(o||i)&&(this.isLayoutDirty=!0),e){let g,u=0;const p=()=>this.root.updateBlockedByResize=!1;tt.read(()=>{u=window.innerWidth}),e(l,()=>{const _=window.innerWidth;_!==u&&(u=_,this.root.updateBlockedByResize=!0,g&&g(),g=tk(p,250),qa.hasAnimatedSinceResize&&(qa.hasAnimatedSinceResize=!1,this.nodes.forEach(Eg)))})}i&&this.root.registerSharedNode(i,this),this.options.animate!==!1&&c&&(i||o)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:u,hasRelativeLayoutChanged:p,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||kk,{onLayoutAnimationStart:v,onLayoutAnimationComplete:h}=c.getProps(),f=!this.targetLayout||!d1(this.targetLayout,_),d=!u&&p;if(this.options.layoutRoot||this.resumeFrom||d||u&&(f||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const m={...wf(y,"layout"),onPlay:v,onComplete:h};(c.shouldReduceMotion||this.options.layoutRoot)&&(m.delay=0,m.type=!1),this.startAnimation(m),this.setAnimationOrigin(g,d)}else u||Eg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),On(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(xk),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&f1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const u=this.path[g];u.shouldResetTransform=!0,u.updateScroll("snapshot"),u.options.layoutRoot&&u.willUpdate(!1)}const{layoutId:i,layout:o}=this.options;if(i===void 0&&!o)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(bg);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Cg);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yk),this.nodes.forEach(pk),this.nodes.forEach(mk)):this.nodes.forEach(Cg),this.clearAllSnapshots();const i=Gt.now();Pt.delta=zr(0,1e3/60,i-Pt.timestamp),Pt.timestamp=i,Pt.isProcessing=!0,Hc.update.process(Pt),Hc.preRender.process(Pt),Hc.render.process(Pt),Pt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,xf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(_k),this.sharedNodes.forEach(bk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,tt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){tt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!qt(this.snapshot.measuredBox.x)&&!qt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let o=0;o<this.path.length;o++)this.path[o].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=_t(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:i}=this.options;i&&i.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let i=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(i=!1),i&&this.instance){const o=n(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:o,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:o}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,i=this.projectionDelta&&!h1(this.projectionDelta),o=this.getTransformTemplate(),c=o?o(this.latestValues,""):void 0,g=c!==this.prevTransformTemplateValue;l&&this.instance&&(i||Zn(this.latestValues)||g)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const i=this.measurePageBox();let o=this.removeElementScroll(i);return l&&(o=this.removeTransform(o)),Lk(o),{animationId:this.root.animationId,measuredBox:i,layoutBox:o,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:l}=this.options;if(!l)return _t();const i=l.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(Rk))){const{scroll:g}=this.root;g&&(Fi(i.x,g.offset.x),Fi(i.y,g.offset.y))}return i}removeElementScroll(l){var o;const i=_t();if(br(i,l),(o=this.scroll)!=null&&o.wasRoot)return i;for(let c=0;c<this.path.length;c++){const g=this.path[c],{scroll:u,options:p}=g;g!==this.root&&u&&p.layoutScroll&&(u.wasRoot&&br(i,l),Fi(i.x,u.offset.x),Fi(i.y,u.offset.y))}return i}applyTransform(l,i=!1){const o=_t();br(o,l);for(let c=0;c<this.path.length;c++){const g=this.path[c];!i&&g.options.layoutScroll&&g.scroll&&g!==g.root&&$i(o,{x:-g.scroll.offset.x,y:-g.scroll.offset.y}),Zn(g.latestValues)&&$i(o,g.latestValues)}return Zn(this.latestValues)&&$i(o,this.latestValues),o}removeTransform(l){const i=_t();br(i,l);for(let o=0;o<this.path.length;o++){const c=this.path[o];if(!c.instance||!Zn(c.latestValues))continue;Dh(c.latestValues)&&c.updateSnapshot();const g=_t(),u=c.measurePageBox();br(g,u),vg(i,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,g)}return Zn(this.latestValues)&&vg(i,this.latestValues),i}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var _;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const o=!!this.resumingFrom||this!==i;if(!(l||o&&this.isSharedProjectionDirty||this.isProjectionDirty||(_=this.parent)!=null&&_.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:u}=this.options;if(!this.layout||!(g||u))return;this.resolvedRelativeTargetAt=Pt.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_t(),this.targetWithTransforms=_t()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),OE(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):br(this.target,this.layout.layoutBox),Ky(this.target,this.targetDelta)):br(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Dh(this.parent.latestValues)||Vy(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,i,o){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_t(),this.relativeTargetOrigin=_t(),Ml(this.relativeTargetOrigin,i,o),br(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const l=this.getLead(),i=!!this.resumingFrom||this!==l;let o=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(o=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(o=!1),this.resolvedRelativeTargetAt===Pt.timestamp&&(o=!1),o)return;const{layout:c,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||g))return;br(this.layoutCorrected,this.layout.layoutBox);const u=this.treeScale.x,p=this.treeScale.y;X5(this.layoutCorrected,this.treeScale,this.path,i),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=_t());const{target:_}=l;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(pg(this.prevProjectionDelta.x,this.projectionDelta.x),pg(this.prevProjectionDelta.y,this.projectionDelta.y)),ro(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==u||this.treeScale.y!==p||!xg(this.projectionDelta.x,this.prevProjectionDelta.x)||!xg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var i;if((i=this.options.visualElement)==null||i.scheduleRender(),l){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Hi(),this.projectionDelta=Hi(),this.projectionDeltaWithTransform=Hi()}setAnimationOrigin(l,i=!1){const o=this.snapshot,c=o?o.latestValues:{},g={...this.latestValues},u=Hi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;const p=_t(),_=o?o.source:void 0,y=this.layout?this.layout.source:void 0,v=_!==y,h=this.getStack(),f=!h||h.members.length<=1,d=!!(v&&!f&&this.options.crossfade===!0&&!this.path.some(Ek));this.animationProgress=0;let m;this.mixTargetDelta=w=>{const b=w/1e3;kg(u.x,l.x,b),kg(u.y,l.y,b),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ml(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ck(this.relativeTarget,this.relativeTargetOrigin,p,b),m&&ck(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=_t()),br(m,this.relativeTarget)),v&&(this.animationValues=g,nk(g,c,this.latestValues,b,d,f)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=b},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){var i,o,c;this.notifyListeners("animationStart"),(i=this.currentAnimation)==null||i.stop(),(c=(o=this.resumingFrom)==null?void 0:o.currentAnimation)==null||c.stop(),this.pendingAnimation&&(On(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=tt.update(()=>{qa.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ls(0)),this.currentAnimation=QE(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:g=>{this.mixTargetDelta(g),l.onUpdate&&l.onUpdate(g)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dk),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:i,target:o,layout:c,latestValues:g}=l;if(!(!i||!o||!c)){if(this!==l&&this.layout&&c&&m1(this.options.animationType,this.layout.layoutBox,c.layoutBox)){o=this.target||_t();const u=qt(this.layout.layoutBox.x);o.x.min=l.target.x.min,o.x.max=o.x.min+u;const p=qt(this.layout.layoutBox.y);o.y.min=l.target.y.min,o.y.max=o.y.min+p}br(i,o),$i(i,g),ro(this.projectionDeltaWithTransform,this.layoutCorrected,i,g)}}registerSharedNode(l,i){this.sharedNodes.has(l)||this.sharedNodes.set(l,new uk),this.sharedNodes.get(l).add(i);const c=i.options.initialPromotionConfig;i.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(i):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var i;const{layoutId:l}=this.options;return l?((i=this.getStack())==null?void 0:i.lead)||this:this}getPrevLead(){var i;const{layoutId:l}=this.options;return l?(i=this.getStack())==null?void 0:i.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:i,preserveFollowOpacity:o}={}){const c=this.getStack();c&&c.promote(this,o),l&&(this.projectionDelta=void 0,this.needsReset=!0),i&&this.setOptions({transition:i})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let i=!1;const{latestValues:o}=l;if((o.z||o.rotate||o.rotateX||o.rotateY||o.rotateZ||o.skewX||o.skewY)&&(i=!0),!i)return;const c={};o.z&&eu("z",l,c,this.animationValues);for(let g=0;g<Zc.length;g++)eu(`rotate${Zc[g]}`,l,c,this.animationValues),eu(`skew${Zc[g]}`,l,c,this.animationValues);l.render();for(const g in c)l.setStaticValue(g,c[g]),this.animationValues&&(this.animationValues[g]=c[g]);l.scheduleRender()}applyProjectionStyles(l,i){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const o=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Ga(i==null?void 0:i.pointerEvents)||"",l.transform=o?o(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Ga(i==null?void 0:i.pointerEvents)||""),this.hasProjected&&!Zn(this.latestValues)&&(l.transform=o?o({},""):"none",this.hasProjected=!1);return}l.visibility="";const g=c.animationValues||c.latestValues;this.applyTransformsToTarget();let u=hk(this.projectionDeltaWithTransform,this.treeScale,g);o&&(u=o(g,u)),l.transform=u;const{x:p,y:_}=this.projectionDelta;l.transformOrigin=`${p.origin*100}% ${_.origin*100}% 0`,c.animationValues?l.opacity=c===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:l.opacity=c===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const y in Th){if(g[y]===void 0)continue;const{correct:v,applyTo:h,isCSSVariable:f}=Th[y],d=u==="none"?g[y]:v(g[y],c);if(h){const m=h.length;for(let w=0;w<m;w++)l[h[w]]=d}else f?this.options.visualElement.renderState.vars[y]=d:l[y]=d}this.options.layoutId&&(l.pointerEvents=c===this?Ga(i==null?void 0:i.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var i;return(i=l.currentAnimation)==null?void 0:i.stop()}),this.root.nodes.forEach(bg),this.root.sharedNodes.clear()}}}function pk(e){e.updateLayout()}function mk(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:a}=e.options,l=t.source!==e.layout.source;a==="size"?dr(u=>{const p=l?t.measuredBox[u]:t.layoutBox[u],_=qt(p);p.min=n[u].min,p.max=p.min+_}):m1(a,t.layoutBox,n)&&dr(u=>{const p=l?t.measuredBox[u]:t.layoutBox[u],_=qt(n[u]);p.max=p.min+_,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+_)});const i=Hi();ro(i,n,t.layoutBox);const o=Hi();l?ro(o,e.applyTransform(s,!0),t.measuredBox):ro(o,n,t.layoutBox);const c=!h1(i);let g=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:_}=u;if(p&&_){const y=_t();Ml(y,t.layoutBox,p.layoutBox);const v=_t();Ml(v,n,_.layoutBox),d1(y,v)||(g=!0),u.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=y,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:o,layoutDelta:i,hasLayoutChanged:c,hasRelativeLayoutChanged:g})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function gk(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function vk(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function _k(e){e.clearSnapshot()}function bg(e){e.clearMeasurements()}function Cg(e){e.isLayoutDirty=!1}function yk(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Eg(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function wk(e){e.resolveTargetDelta()}function Sk(e){e.calcProjection()}function xk(e){e.resetSkewAndRotation()}function bk(e){e.removeLeadSnapshot()}function kg(e,t,r){e.translate=st(t.translate,0,r),e.scale=st(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function Lg(e,t,r,n){e.min=st(t.min,r.min,n),e.max=st(t.max,r.max,n)}function Ck(e,t,r,n){Lg(e.x,t.x,r.x,n),Lg(e.y,t.y,r.y,n)}function Ek(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const kk={duration:.45,ease:[.4,0,.1,1]},Rg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Tg=Rg("applewebkit/")&&!Rg("chrome/")?Math.round:yr;function Dg(e){e.min=Tg(e.min),e.max=Tg(e.max)}function Lk(e){Dg(e.x),Dg(e.y)}function m1(e,t,r){return e==="position"||e==="preserve-aspect"&&!BE(Sg(t),Sg(r),.2)}function Rk(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Tk=p1({attachResizeListener:(e,t)=>Do(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tu={current:void 0},g1=p1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tu.current){const e=new Tk({});e.mount(window),e.setOptions({layoutScroll:!0}),tu.current=e}return tu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Dk={pan:{Feature:YE},drag:{Feature:XE,ProjectionNode:g1,MeasureLayout:l1}};function Mg(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,a=n[s];a&&tt.postRender(()=>a(t,Go(t)))}class Mk extends Hn{mount(){const{current:t}=this.node;t&&(this.unmount=e5(t,(r,n)=>(Mg(this.node,n,"Start"),s=>Mg(this.node,s,"End"))))}unmount(){}}class Ak extends Hn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Wo(Do(this.node.current,"focus",()=>this.onFocus()),Do(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ag(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),a=n[s];a&&tt.postRender(()=>a(t,Go(t)))}class Pk extends Hn{mount(){const{current:t}=this.node;t&&(this.unmount=n5(t,(r,n)=>(Ag(this.node,n,"Start"),(s,{success:a})=>Ag(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Oh=new WeakMap,ru=new WeakMap,Ik=e=>{const t=Oh.get(e.target);t&&t(e)},Bk=e=>{e.forEach(Ik)};function Ok({root:e,...t}){const r=e||document;ru.has(r)||ru.set(r,{});const n=ru.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(Bk,{root:e,...t})),n[s]}function Nk(e,t,r){const n=Ok(t);return Oh.set(e,r),n.observe(e),()=>{Oh.delete(e),n.unobserve(e)}}const jk={some:0,all:1};class Fk extends Hn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:a}=t,l={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:jk[s]},i=o=>{const{isIntersecting:c}=o;if(this.isInView===c||(this.isInView=c,a&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:g,onViewportLeave:u}=this.node.getProps(),p=c?g:u;p&&p(o)};return Nk(this.node.current,l,i)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some($k(t,r))&&this.startObserver()}unmount(){}}function $k({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const Hk={inView:{Feature:Fk},tap:{Feature:Pk},focus:{Feature:Ak},hover:{Feature:Mk}},zk={layout:{ProjectionNode:g1,MeasureLayout:l1}},Uk={...TE,...Hk,...Dk,...zk},Nh=K5(Uk,iE);function v1(){!Pf.current&&qy();const[e]=k.useState(Dl.current);return e}function Wk(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const cc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gs(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Bf(e){return"nodeType"in e}function nr(e){var t,r;return e?gs(e)?e:Bf(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Of(e){const{Document:t}=nr(e);return e instanceof t}function qo(e){return gs(e)?!1:e instanceof nr(e).HTMLElement}function _1(e){return e instanceof nr(e).SVGElement}function vs(e){return e?gs(e)?e.document:Bf(e)?Of(e)?e:qo(e)||_1(e)?e.ownerDocument:document:document:document}const Ur=cc?k.useLayoutEffect:k.useEffect;function Nf(e){const t=k.useRef(e);return Ur(()=>{t.current=e}),k.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Vk(){const e=k.useRef(null),t=k.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Mo(e,t){t===void 0&&(t=[e]);const r=k.useRef(e);return Ur(()=>{r.current!==e&&(r.current=e)},t),r}function Xo(e,t){const r=k.useRef();return k.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Al(e){const t=Nf(e),r=k.useRef(null),n=k.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function jh(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let nu={};function Yo(e,t){return k.useMemo(()=>{if(t)return t;const r=nu[e]==null?0:nu[e]+1;return nu[e]=r,e+"-"+r},[e,t])}function y1(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((a,l)=>{const i=Object.entries(l);for(const[o,c]of i){const g=a[o];g!=null&&(a[o]=g+e*c)}return a},{...t})}}const Qi=y1(1),Pl=y1(-1);function Kk(e){return"clientX"in e&&"clientY"in e}function jf(e){if(!e)return!1;const{KeyboardEvent:t}=nr(e.target);return t&&e instanceof t}function Gk(e){if(!e)return!1;const{TouchEvent:t}=nr(e.target);return t&&e instanceof t}function Fh(e){if(Gk(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Kk(e)?{x:e.clientX,y:e.clientY}:null}const Ao=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Ao.Translate.toString(e),Ao.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Pg="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qk(e){return e.matches(Pg)?e:e.querySelector(Pg)}const Xk={display:"none"};function Yk(e){let{id:t,value:r}=e;return mt.createElement("div",{id:t,style:Xk},r)}function Jk(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return mt.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Qk(){const[e,t]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const w1=k.createContext(null);function Zk(e){const t=k.useContext(w1);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function eL(){const[e]=k.useState(()=>new Set),t=k.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[k.useCallback(n=>{let{type:s,event:a}=n;e.forEach(l=>{var i;return(i=l[s])==null?void 0:i.call(l,a)})},[e]),t]}const tL={draggable:`
48
+ `),()=>{d.contains(f)&&d.removeChild(f)}},[t]),T.jsx(c5,{isPresent:t,childRef:a,sizeRef:l,children:k.cloneElement(e,{ref:c})})}const h5=({children:e,initial:t,isPresent:r,onExitComplete:n,custom:s,presenceAffectsLayout:a,mode:l,anchorX:i,root:o})=>{const c=tf(d5),g=k.useId();let u=!0,p=k.useMemo(()=>(u=!1,{id:g,initial:t,isPresent:r,custom:s,onExitComplete:_=>{c.set(_,!0);for(const y of c.values())if(!y)return;n&&n()},register:_=>(c.set(_,!1),()=>c.delete(_))}),[r,c,n]);return a&&u&&(p={...p}),k.useMemo(()=>{c.forEach((_,y)=>c.set(y,!1))},[r]),k.useEffect(()=>{!r&&!c.size&&n&&n()},[r]),l==="popLayout"&&(e=T.jsx(u5,{isPresent:r,anchorX:i,root:o,children:e})),T.jsx(sc.Provider,{value:p,children:e})};function d5(){return new Map}function Dy(e=!0){const t=k.useContext(sc);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=t,a=k.useId();k.useEffect(()=>{if(e)return s(a)},[e]);const l=k.useCallback(()=>e&&n&&n(a),[a,n,e]);return!r&&n?[!1,l]:[!0]}const Sa=e=>e.key||"";function Fm(e){const t=[];return k.Children.forEach(e,r=>{k.isValidElement(r)&&t.push(r)}),t}const f5=({children:e,custom:t,initial:r=!0,onExitComplete:n,presenceAffectsLayout:s=!0,mode:a="sync",propagate:l=!1,anchorX:i="left",root:o})=>{const[c,g]=Dy(l),u=k.useMemo(()=>Fm(e),[e]),p=l&&!c?[]:u.map(Sa),_=k.useRef(!0),y=k.useRef(u),v=tf(()=>new Map),h=k.useRef(new Set),[f,d]=k.useState(u),[m,w]=k.useState(u);N0(()=>{_.current=!1,y.current=u;for(let C=0;C<m.length;C++){const S=Sa(m[C]);p.includes(S)?(v.delete(S),h.current.delete(S)):v.get(S)!==!0&&v.set(S,!1)}},[m,p.length,p.join("-")]);const b=[];if(u!==f){let C=[...u];for(let S=0;S<m.length;S++){const E=m[S],L=Sa(E);p.includes(L)||(C.splice(S,0,E),b.push(E))}return a==="wait"&&b.length&&(C=b),w(Fm(C)),d(u),null}const{forceRender:x}=k.useContext(ef);return T.jsx(T.Fragment,{children:m.map(C=>{const S=Sa(C),E=l&&!c?!1:u===m||p.includes(S),L=()=>{if(h.current.has(S))return;if(h.current.add(S),v.has(S))v.set(S,!0);else return;let A=!0;v.forEach(M=>{M||(A=!1)}),A&&(x==null||x(),w(y.current),l&&(g==null||g()),n&&n())};return T.jsx(h5,{isPresent:E,initial:!_.current||r?void 0:!1,custom:t,presenceAffectsLayout:s,mode:a,root:o,onExitComplete:E?void 0:L,anchorX:i,children:C},S)})})},My=k.createContext({strict:!1}),$m={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},cs={};for(const e in $m)cs[e]={isEnabled:t=>$m[e].some(r=>!!t[r])};function p5(e){for(const t in e)cs[t]={...cs[t],...e[t]}}const m5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Rl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m5.has(e)}let Ay=e=>!Rl(e);function g5(e){typeof e=="function"&&(Ay=t=>t.startsWith("on")?!Rl(t):e(t))}try{g5(require("@emotion/is-prop-valid").default)}catch{}function v5(e,t,r){const n={};for(const s in e)s==="values"&&typeof e.values=="object"||(Ay(s)||r===!0&&Rl(s)||!t&&!Rl(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}const oc=k.createContext({});function ac(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function To(e){return typeof e=="string"||Array.isArray(e)}const Ef=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],kf=["initial",...Ef];function lc(e){return ac(e.animate)||kf.some(t=>To(e[t]))}function Py(e){return!!(lc(e)||e.variants)}function _5(e,t){if(lc(e)){const{initial:r,animate:n}=e;return{initial:r===!1||To(r)?r:void 0,animate:To(n)?n:void 0}}return e.inherit!==!1?t:{}}function y5(e){const{initial:t,animate:r}=_5(e,k.useContext(oc));return k.useMemo(()=>({initial:t,animate:r}),[Hm(t),Hm(r)])}function Hm(e){return Array.isArray(e)?e.join(" "):e}function zm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const As={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ve.test(e))e=parseFloat(e);else return e;const r=zm(e,t.target.x),n=zm(e,t.target.y);return`${r}% ${n}%`}},w5={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,s=Nn.parse(e);if(s.length>5)return n;const a=Nn.createTransformer(e),l=typeof s[0]!="number"?1:0,i=r.x.scale*t.x,o=r.y.scale*t.y;s[0+l]/=i,s[1+l]/=o;const c=st(i,o,.5);return typeof s[2+l]=="number"&&(s[2+l]/=c),typeof s[3+l]=="number"&&(s[3+l]/=c),a(s)}},Th={borderRadius:{...As,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:As,borderTopRightRadius:As,borderBottomLeftRadius:As,borderBottomRightRadius:As,boxShadow:w5};function Iy(e,{layout:t,layoutId:r}){return ms.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Th[e]||e==="opacity")}const S5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},x5=ps.length;function b5(e,t,r){let n="",s=!0;for(let a=0;a<x5;a++){const l=ps[a],i=e[l];if(i===void 0)continue;let o=!0;if(typeof i=="number"?o=i===(l.startsWith("scale")?1:0):o=parseFloat(i)===0,!o||r){const c=by(i,Sf[l]);if(!o){s=!1;const g=S5[l]||l;n+=`${g}(${c}) `}r&&(t[l]=c)}}return n=n.trim(),r?n=r(t,s?"":n):s&&(n="none"),n}function Lf(e,t,r){const{style:n,vars:s,transformOrigin:a}=e;let l=!1,i=!1;for(const o in t){const c=t[o];if(ms.has(o)){l=!0;continue}else if(ey(o)){s[o]=c;continue}else{const g=by(c,Sf[o]);o.startsWith("origin")?(i=!0,a[o]=g):n[o]=g}}if(t.transform||(l||r?n.transform=b5(t,e.transform,r):n.transform&&(n.transform="none")),i){const{originX:o="50%",originY:c="50%",originZ:g=0}=a;n.transformOrigin=`${o} ${c} ${g}`}}const Rf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function By(e,t,r){for(const n in t)!zt(t[n])&&!Iy(n,r)&&(e[n]=t[n])}function C5({transformTemplate:e},t){return k.useMemo(()=>{const r=Rf();return Lf(r,t,e),Object.assign({},r.vars,r.style)},[t])}function E5(e,t){const r=e.style||{},n={};return By(n,r,e),Object.assign(n,C5(e,t)),n}function k5(e,t){const r={},n=E5(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}const L5={offset:"stroke-dashoffset",array:"stroke-dasharray"},R5={offset:"strokeDashoffset",array:"strokeDasharray"};function T5(e,t,r=1,n=0,s=!0){e.pathLength=1;const a=s?L5:R5;e[a.offset]=ve.transform(-n);const l=ve.transform(t),i=ve.transform(r);e[a.array]=`${l} ${i}`}const D5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Oy(e,{attrX:t,attrY:r,attrScale:n,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...i},o,c,g){if(Lf(e,i,c),o){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:u,style:p}=e;u.transform&&(p.transform=u.transform,delete u.transform),(p.transform||u.transformOrigin)&&(p.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),p.transform&&(p.transformBox=(g==null?void 0:g.transformBox)??"fill-box",delete u.transformBox);for(const _ of D5)u[_]!==void 0&&(p[_]=u[_],delete u[_]);t!==void 0&&(u.x=t),r!==void 0&&(u.y=r),n!==void 0&&(u.scale=n),s!==void 0&&T5(u,s,a,l,!1)}const Ny=()=>({...Rf(),attrs:{}}),jy=e=>typeof e=="string"&&e.toLowerCase()==="svg";function M5(e,t,r,n){const s=k.useMemo(()=>{const a=Ny();return Oy(a,t,jy(n),e.transformTemplate,e.style),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};By(a,e.style,e),s.style={...a,...s.style}}return s}const A5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tf(e){return typeof e!="string"||e.includes("-")?!1:!!(A5.indexOf(e)>-1||/[A-Z]/u.test(e))}function P5(e,t,r,{latestValues:n},s,a=!1,l){const o=(l??Tf(e)?M5:k5)(t,n,s,e),c=v5(t,typeof e=="string",a),g=e!==k.Fragment?{...c,...o,ref:r}:{},{children:u}=t,p=k.useMemo(()=>zt(u)?u.get():u,[u]);return k.createElement(e,{...g,children:p})}function Um(e){const t=[{},{}];return e==null||e.values.forEach((r,n)=>{t[0][n]=r.get(),t[1][n]=r.getVelocity()}),t}function Df(e,t,r,n){if(typeof t=="function"){const[s,a]=Um(n);t=t(r!==void 0?r:e.custom,s,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,a]=Um(n);t=t(r!==void 0?r:e.custom,s,a)}return t}function Ga(e){return zt(e)?e.get():e}function I5({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,s){return{latestValues:B5(r,n,s,e),renderState:t()}}function B5(e,t,r,n){const s={},a=n(e,{});for(const p in a)s[p]=Ga(a[p]);let{initial:l,animate:i}=e;const o=lc(e),c=Py(e);t&&c&&!o&&e.inherit!==!1&&(l===void 0&&(l=t.initial),i===void 0&&(i=t.animate));let g=r?r.initial===!1:!1;g=g||l===!1;const u=g?i:l;if(u&&typeof u!="boolean"&&!ac(u)){const p=Array.isArray(u)?u:[u];for(let _=0;_<p.length;_++){const y=Df(e,p[_]);if(y){const{transitionEnd:v,transition:h,...f}=y;for(const d in f){let m=f[d];if(Array.isArray(m)){const w=g?m.length-1:0;m=m[w]}m!==null&&(s[d]=m)}for(const d in v)s[d]=v[d]}}}return s}const Fy=e=>(t,r)=>{const n=k.useContext(oc),s=k.useContext(sc),a=()=>I5(e,t,n,s);return r?a():tf(a)};function Mf(e,t,r){var a;const{style:n}=e,s={};for(const l in n)(zt(n[l])||t.style&&zt(t.style[l])||Iy(l,e)||((a=r==null?void 0:r.getValue(l))==null?void 0:a.liveStyle)!==void 0)&&(s[l]=n[l]);return s}const O5=Fy({scrapeMotionValuesFromProps:Mf,createRenderState:Rf});function $y(e,t,r){const n=Mf(e,t,r);for(const s in e)if(zt(e[s])||zt(t[s])){const a=ps.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[a]=e[s]}return n}const N5=Fy({scrapeMotionValuesFromProps:$y,createRenderState:Ny}),j5=Symbol.for("motionComponentSymbol");function F5(e,t,r){const n=k.useRef(r);k.useInsertionEffect(()=>{n.current=r});const s=k.useRef(null);return k.useCallback(a=>{var i;a&&((i=e.onMount)==null||i.call(e,a)),t&&(a?t.mount(a):t.unmount());const l=n.current;if(typeof l=="function")if(a){const o=l(a);typeof o=="function"&&(s.current=o)}else s.current?(s.current(),s.current=null):l(a);else l&&(l.current=a)},[t])}const Af=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$5="framerAppearId",Hy="data-"+Af($5),zy=k.createContext({});function Hs(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function H5(e,t,r,n,s,a){var h,f;const{visualElement:l}=k.useContext(oc),i=k.useContext(My),o=k.useContext(sc),c=k.useContext(Cf).reducedMotion,g=k.useRef(null);n=n||i.renderer,!g.current&&n&&(g.current=n(e,{visualState:t,parent:l,props:r,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:c,isSVG:a}));const u=g.current,p=k.useContext(zy);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&z5(g.current,r,s,p);const _=k.useRef(!1);k.useInsertionEffect(()=>{u&&_.current&&u.update(r,o)});const y=r[Hy],v=k.useRef(!!y&&!((h=window.MotionHandoffIsComplete)!=null&&h.call(window,y))&&((f=window.MotionHasOptimisedAnimation)==null?void 0:f.call(window,y)));return N0(()=>{u&&(_.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),v.current&&u.animationState&&u.animationState.animateChanges())}),k.useEffect(()=>{u&&(!v.current&&u.animationState&&u.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var d;(d=window.MotionHandoffMarkAsComplete)==null||d.call(window,y)}),v.current=!1),u.enteringChildren=void 0)}),u}function z5(e,t,r,n){const{layoutId:s,layout:a,drag:l,dragConstraints:i,layoutScroll:o,layoutRoot:c,layoutCrossfade:g}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:Uy(e.parent)),e.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!l||i&&Hs(i),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:o,layoutRoot:c})}function Uy(e){if(e)return e.options.allowProjection!==!1?e.projection:Uy(e.parent)}function qc(e,{forwardMotionProps:t=!1,type:r}={},n,s){n&&p5(n);const a=r?r==="svg":Tf(e),l=a?N5:O5;function i(c,g){let u;const p={...k.useContext(Cf),...c,layoutId:U5(c)},{isStatic:_}=p,y=y5(c),v=l(c,_);if(!_&&rf){W5();const h=V5(p);u=h.MeasureLayout,y.visualElement=H5(e,v,p,s,h.ProjectionNode,a)}return T.jsxs(oc.Provider,{value:y,children:[u&&y.visualElement?T.jsx(u,{visualElement:y.visualElement,...p}):null,P5(e,c,F5(v,y.visualElement,g),v,_,t,a)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const o=k.forwardRef(i);return o[j5]=e,o}function U5({layoutId:e}){const t=k.useContext(ef).id;return t&&e!==void 0?t+"-"+e:e}function W5(e,t){k.useContext(My).strict}function V5(e){const{drag:t,layout:r}=cs;if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t!=null&&t.isEnabled(e)||r!=null&&r.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function K5(e,t){if(typeof Proxy>"u")return qc;const r=new Map,n=(a,l)=>qc(a,l,e,t),s=(a,l)=>n(a,l);return new Proxy(s,{get:(a,l)=>l==="create"?n:(r.has(l)||r.set(l,qc(l,void 0,e,t)),r.get(l))})}function Wy({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function G5({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function q5(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function Xc(e){return e===void 0||e===1}function Dh({scale:e,scaleX:t,scaleY:r}){return!Xc(e)||!Xc(t)||!Xc(r)}function Zn(e){return Dh(e)||Vy(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Vy(e){return Wm(e.x)||Wm(e.y)}function Wm(e){return e&&e!=="0%"}function Tl(e,t,r){const n=e-r,s=t*n;return r+s}function Vm(e,t,r,n,s){return s!==void 0&&(e=Tl(e,s,n)),Tl(e,r,n)+t}function Mh(e,t=0,r=1,n,s){e.min=Vm(e.min,t,r,n,s),e.max=Vm(e.max,t,r,n,s)}function Ky(e,{x:t,y:r}){Mh(e.x,t.translate,t.scale,t.originPoint),Mh(e.y,r.translate,r.scale,r.originPoint)}const Km=.999999999999,Gm=1.0000000000001;function X5(e,t,r,n=!1){const s=r.length;if(!s)return;t.x=t.y=1;let a,l;for(let i=0;i<s;i++){a=r[i],l=a.projectionDelta;const{visualElement:o}=a.options;o&&o.props.style&&o.props.style.display==="contents"||(n&&a.options.layoutScroll&&a.scroll&&a!==a.root&&$i(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Ky(e,l)),n&&Zn(a.latestValues)&&$i(e,a.latestValues))}t.x<Gm&&t.x>Km&&(t.x=1),t.y<Gm&&t.y>Km&&(t.y=1)}function Fi(e,t){e.min=e.min+t,e.max=e.max+t}function qm(e,t,r,n,s=.5){const a=st(e.min,e.max,s);Mh(e,t,r,a,n)}function $i(e,t){qm(e.x,t.x,t.scaleX,t.scale,t.originX),qm(e.y,t.y,t.scaleY,t.scale,t.originY)}function Gy(e,t){return Wy(q5(e.getBoundingClientRect(),t))}function Y5(e,t,r){const n=Gy(e,r),{scroll:s}=t;return s&&(Fi(n.x,s.offset.x),Fi(n.y,s.offset.y)),n}const Xm=()=>({translate:0,scale:1,origin:0,originPoint:0}),Hi=()=>({x:Xm(),y:Xm()}),Ym=()=>({min:0,max:0}),_t=()=>({x:Ym(),y:Ym()}),Dl={current:null},Pf={current:!1};function qy(){if(Pf.current=!0,!!rf)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Dl.current=e.matches;e.addEventListener("change",t),t()}else Dl.current=!1}const J5=new WeakMap;function Q5(e,t,r){for(const n in t){const s=t[n],a=r[n];if(zt(s))e.addValue(n,s);else if(zt(a))e.addValue(n,ls(s,{owner:e}));else if(a!==s)if(e.hasValue(n)){const l=e.getValue(n);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=e.getStaticValue(n);e.addValue(n,ls(l!==void 0?l:s,{owner:e}))}}for(const n in r)t[n]===void 0&&e.removeValue(n);return t}const Jm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Z5{scrapeMotionValuesFromProps(t,r,n){return{}}constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:a,visualState:l},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=yf,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Gt.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,tt.render(this.render,!1,!0))};const{latestValues:o,renderState:c}=l;this.latestValues=o,this.baseTarget={...o},this.initialValues=r.initial?{...o}:{},this.renderState=c,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=i,this.blockInitialAnimation=!!a,this.isControllingVariants=lc(r),this.isVariantNode=Py(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...u}=this.scrapeMotionValuesFromProps(r,{},this);for(const p in u){const _=u[p];o[p]!==void 0&&zt(_)&&_.set(o[p])}}mount(t){var r;this.current=t,J5.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Pf.current||qy(),this.shouldReduceMotion=Dl.current),(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),On(this.notifyUpdate),On(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ms.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&tt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{s(),a&&a(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in cs){const r=cs[t];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_t()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<Jm.length;n++){const s=Jm[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,l=t[a];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=Q5(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const n=this.values.get(t);r!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=ls(r===null?void 0:r,{owner:this}),this.addValue(t,n)),n}readValue(t,r){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(j0(n)||$0(n))?n=parseFloat(n):!o5(n)&&Nn.test(r)&&(n=xy(t,r)),this.setBaseTarget(t,zt(n)?n.get():n)),zt(n)?n.get():n}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var a;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const l=Df(this.props,r,(a=this.presenceContext)==null?void 0:a.custom);l&&(n=l[t])}if(r&&n!==void 0)return n;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!zt(s)?s:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new lf),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){xf.render(this.render)}}class Xy extends Z5{constructor(){super(...arguments),this.KeyframeResolver=X2}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;zt(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Yy(e,{style:t,vars:r},n,s){const a=e.style;let l;for(l in t)a[l]=t[l];s==null||s.applyProjectionStyles(a,n);for(l in r)a.setProperty(l,r[l])}function eE(e){return window.getComputedStyle(e)}class tE extends Xy{constructor(){super(...arguments),this.type="html",this.renderInstance=Yy}readValueFromInstance(t,r){var n;if(ms.has(r))return(n=this.projection)!=null&&n.isProjecting?xh(r):p2(t,r);{const s=eE(t),a=(ey(r)?s.getPropertyValue(r):s[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:r}){return Gy(t,r)}build(t,r,n){Lf(t,r,n.transformTemplate)}scrapeMotionValuesFromProps(t,r,n){return Mf(t,r,n)}}const Jy=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function rE(e,t,r,n){Yy(e,t,void 0,n);for(const s in t.attrs)e.setAttribute(Jy.has(s)?s:Af(s),t.attrs[s])}class nE extends Xy{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_t}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(ms.has(r)){const n=Sy(r);return n&&n.default||0}return r=Jy.has(r)?r:Af(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,n){return $y(t,r,n)}build(t,r,n){Oy(t,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,r,n,s){rE(t,r,n,s)}mount(t){this.isSVGTag=jy(t.tagName),super.mount(t)}}const iE=(e,t)=>t.isSVG??Tf(e)?new nE(t):new tE(t,{allowProjection:e!==k.Fragment});function Ji(e,t,r){const n=e.getProps();return Df(n,t,r!==void 0?r:n.custom,e)}const Ah=e=>Array.isArray(e);function sE(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,ls(r))}function oE(e){return Ah(e)?e[e.length-1]||0:e}function aE(e,t){const r=Ji(e,t);let{transitionEnd:n={},transition:s={},...a}=r||{};a={...a,...n};for(const l in a){const i=oE(a[l]);sE(e,l,i)}}function lE(e){return!!(zt(e)&&e.add)}function Ph(e,t){const r=e.getValue("willChange");if(lE(r))return r.add(t);if(!r&&un.WillChange){const n=new un.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function Qy(e){return e.props[Hy]}const cE=e=>e!==null;function uE(e,{repeat:t,repeatType:r="loop"},n){const s=e.filter(cE),a=t&&r!=="loop"&&t%2===1?0:s.length-1;return s[a]}const hE={type:"spring",stiffness:500,damping:25,restSpeed:10},dE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),fE={type:"keyframes",duration:.8},pE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},mE=(e,{keyframes:t})=>t.length>2?fE:ms.has(e)?e.startsWith("scale")?dE(t[1]):hE:pE;function gE({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:a,repeatType:l,repeatDelay:i,from:o,elapsed:c,...g}){return!!Object.keys(g).length}const If=(e,t,r,n={},s,a)=>l=>{const i=wf(n,e)||{},o=i.delay||n.delay||0;let{elapsed:c=0}=n;c=c-sn(o);const g={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:p=>{t.set(p),i.onUpdate&&i.onUpdate(p)},onComplete:()=>{l(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:a?void 0:s};gE(i)||Object.assign(g,mE(e,g)),g.duration&&(g.duration=sn(g.duration)),g.repeatDelay&&(g.repeatDelay=sn(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let u=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Lh(g),g.delay===0&&(u=!0)),(un.instantAnimations||un.skipAnimations)&&(u=!0,Lh(g),g.delay=0),g.allowFlatten=!i.type&&!i.ease,u&&!a&&t.get()!==void 0){const p=uE(g.keyframes,i);if(p!==void 0){tt.update(()=>{g.onUpdate(p),g.onComplete()});return}}return i.isSync?new _f(g):new N2(g)};function vE({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,n}function Zy(e,t,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:l,...i}=t;n&&(a=n);const o=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const g in i){const u=e.getValue(g,e.latestValues[g]??null),p=i[g];if(p===void 0||c&&vE(c,g))continue;const _={delay:r,...wf(a||{},g)},y=u.get();if(y!==void 0&&!u.isAnimating&&!Array.isArray(p)&&p===y&&!_.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const f=Qy(e);if(f){const d=window.MotionHandoffAnimation(f,g,tt);d!==null&&(_.startTime=d,v=!0)}}Ph(e,g),u.start(If(g,u,p,e.shouldReduceMotion&&_y.has(g)?{type:!1}:_,e,v));const h=u.animation;h&&o.push(h)}return l&&Promise.all(o).then(()=>{tt.update(()=>{l&&aE(e,l)})}),o}function e1(e,t,r,n=0,s=1){const a=Array.from(e).sort((c,g)=>c.sortNodePosition(g)).indexOf(t),l=e.size,i=(l-1)*n;return typeof r=="function"?r(a,l):s===1?a*n:i-a*n}function Ih(e,t,r={}){var o;const n=Ji(e,t,r.type==="exit"?(o=e.presenceContext)==null?void 0:o.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const a=n?()=>Promise.all(Zy(e,n,r)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:g=0,staggerChildren:u,staggerDirection:p}=s;return _E(e,t,c,g,u,p,r)}:()=>Promise.resolve(),{when:i}=s;if(i){const[c,g]=i==="beforeChildren"?[a,l]:[l,a];return c().then(()=>g())}else return Promise.all([a(),l(r.delay)])}function _E(e,t,r=0,n=0,s=0,a=1,l){const i=[];for(const o of e.variantChildren)o.notify("AnimationStart",t),i.push(Ih(o,t,{...l,delay:r+(typeof n=="function"?0:n)+e1(e.variantChildren,o,n,s,a)}).then(()=>o.notify("AnimationComplete",t)));return Promise.all(i)}function yE(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const s=t.map(a=>Ih(e,a,r));n=Promise.all(s)}else if(typeof t=="string")n=Ih(e,t,r);else{const s=typeof t=="function"?Ji(e,t,r.custom):t;n=Promise.all(Zy(e,s,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}function t1(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}const wE=kf.length;function r1(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?r1(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<wE;r++){const n=kf[r],s=e.props[n];(To(s)||s===!1)&&(t[n]=s)}return t}const SE=[...Ef].reverse(),xE=Ef.length;function bE(e){return t=>Promise.all(t.map(({animation:r,options:n})=>yE(e,r,n)))}function CE(e){let t=bE(e),r=Qm(),n=!0;const s=o=>(c,g)=>{var p;const u=Ji(e,g,o==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(u){const{transition:_,transitionEnd:y,...v}=u;c={...c,...v,...y}}return c};function a(o){t=o(e)}function l(o){const{props:c}=e,g=r1(e.parent)||{},u=[],p=new Set;let _={},y=1/0;for(let h=0;h<xE;h++){const f=SE[h],d=r[f],m=c[f]!==void 0?c[f]:g[f],w=To(m),b=f===o?d.isActive:null;b===!1&&(y=h);let x=m===g[f]&&m!==c[f]&&w;if(x&&n&&e.manuallyAnimateOnMount&&(x=!1),d.protectedKeys={..._},!d.isActive&&b===null||!m&&!d.prevProp||ac(m)||typeof m=="boolean")continue;const C=EE(d.prevProp,m);let S=C||f===o&&d.isActive&&!x&&w||h>y&&w,E=!1;const L=Array.isArray(m)?m:[m];let A=L.reduce(s(f),{});b===!1&&(A={});const{prevResolvedValues:M={}}=d,D={...M,...A},O=$=>{S=!0,p.has($)&&(E=!0,p.delete($)),d.needsAnimating[$]=!0;const N=e.getValue($);N&&(N.liveStyle=!1)};for(const $ in D){const N=A[$],R=M[$];if(_.hasOwnProperty($))continue;let P=!1;Ah(N)&&Ah(R)?P=!t1(N,R):P=N!==R,P?N!=null?O($):p.add($):N!==void 0&&p.has($)?O($):d.protectedKeys[$]=!0}d.prevProp=m,d.prevResolvedValues=A,d.isActive&&(_={..._,...A}),n&&e.blockInitialAnimation&&(S=!1);const H=x&&C;S&&(!H||E)&&u.push(...L.map($=>{const N={type:f};if(typeof $=="string"&&n&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:R}=e,P=Ji(R,$);if(R.enteringChildren&&P){const{delayChildren:B}=P.transition||{};N.delay=e1(R.enteringChildren,e,B)}}return{animation:$,options:N}}))}if(p.size){const h={};if(typeof c.initial!="boolean"){const f=Ji(e,Array.isArray(c.initial)?c.initial[0]:c.initial);f&&f.transition&&(h.transition=f.transition)}p.forEach(f=>{const d=e.getBaseTarget(f),m=e.getValue(f);m&&(m.liveStyle=!0),h[f]=d??null}),u.push({animation:h})}let v=!!u.length;return n&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(v=!1),n=!1,v?t(u):Promise.resolve()}function i(o,c){var u;if(r[o].isActive===c)return Promise.resolve();(u=e.variantChildren)==null||u.forEach(p=>{var _;return(_=p.animationState)==null?void 0:_.setActive(o,c)}),r[o].isActive=c;const g=l(o);for(const p in r)r[p].protectedKeys={};return g}return{animateChanges:l,setActive:i,setAnimateFunction:a,getState:()=>r,reset:()=>{r=Qm()}}}function EE(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!t1(t,e):!1}function Vn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Qm(){return{animate:Vn(!0),whileInView:Vn(),whileHover:Vn(),whileTap:Vn(),whileDrag:Vn(),whileFocus:Vn(),exit:Vn()}}class Hn{constructor(t){this.isMounted=!1,this.node=t}update(){}}class kE extends Hn{constructor(t){super(t),t.animationState||(t.animationState=CE(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ac(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let LE=0;class RE extends Hn{constructor(){super(...arguments),this.id=LE++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const s=this.node.animationState.setActive("exit",!t);r&&!t&&s.then(()=>{r(this.id)})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const TE={animation:{Feature:kE},exit:{Feature:RE}};function Do(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function Go(e){return{point:{x:e.pageX,y:e.pageY}}}const DE=e=>t=>bf(t)&&e(t,Go(t));function to(e,t,r,n){return Do(e,t,DE(r),n)}const n1=1e-4,ME=1-n1,AE=1+n1,i1=.01,PE=0-i1,IE=0+i1;function qt(e){return e.max-e.min}function BE(e,t,r){return Math.abs(e-t)<=r}function Zm(e,t,r,n=.5){e.origin=n,e.originPoint=st(t.min,t.max,e.origin),e.scale=qt(r)/qt(t),e.translate=st(r.min,r.max,e.origin)-e.originPoint,(e.scale>=ME&&e.scale<=AE||isNaN(e.scale))&&(e.scale=1),(e.translate>=PE&&e.translate<=IE||isNaN(e.translate))&&(e.translate=0)}function ro(e,t,r,n){Zm(e.x,t.x,r.x,n?n.originX:void 0),Zm(e.y,t.y,r.y,n?n.originY:void 0)}function eg(e,t,r){e.min=r.min+t.min,e.max=e.min+qt(t)}function OE(e,t,r){eg(e.x,t.x,r.x),eg(e.y,t.y,r.y)}function tg(e,t,r){e.min=t.min-r.min,e.max=e.min+qt(t)}function Ml(e,t,r){tg(e.x,t.x,r.x),tg(e.y,t.y,r.y)}function dr(e){return[e("x"),e("y")]}const s1=({current:e})=>e?e.ownerDocument.defaultView:null,rg=(e,t)=>Math.abs(e-t);function NE(e,t){const r=rg(e.x,t.x),n=rg(e.y,t.y);return Math.sqrt(r**2+n**2)}const ng=new Set(["auto","scroll"]);class o1{constructor(t,r,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:l=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Jc(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=NE(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:h}=_,{timestamp:f}=Pt;this.history.push({...h,timestamp:f});const{onStart:d,onMove:m}=this.handlers;y||(d&&d(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,_)},this.handlePointerMove=(_,y)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=Yc(y,this.transformPagePoint),tt.update(this.updatePoint,!0)},this.handlePointerUp=(_,y)=>{this.end();const{onEnd:v,onSessionEnd:h,resumeAnimation:f}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&f&&f(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=Jc(_.type==="pointercancel"?this.lastMoveEventInfo:Yc(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(_,d),h&&h(_,d)},!bf(t))return;this.dragSnapToOrigin=a,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=l,this.contextWindow=s||window;const o=Go(t),c=Yc(o,this.transformPagePoint),{point:g}=c,{timestamp:u}=Pt;this.history=[{...g,timestamp:u}];const{onSessionStart:p}=r;p&&p(t,Jc(c,this.history)),this.removeListeners=Wo(to(this.contextWindow,"pointermove",this.handlePointerMove),to(this.contextWindow,"pointerup",this.handlePointerUp),to(this.contextWindow,"pointercancel",this.handlePointerUp)),i&&this.startScrollTracking(i)}startScrollTracking(t){let r=t.parentElement;for(;r;){const n=getComputedStyle(r);(ng.has(n.overflowX)||ng.has(n.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const n=t===window,s=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},a={x:s.x-r.x,y:s.y-r.y};a.x===0&&a.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(t,s),tt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),On(this.updatePoint)}}function Yc(e,t){return t?{point:t(e.point)}:e}function ig(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jc({point:e},t){return{point:e,delta:ig(e,a1(t)),offset:ig(e,jE(t)),velocity:FE(t,.1)}}function jE(e){return e[0]}function a1(e){return e[e.length-1]}function FE(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const s=a1(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>sn(t)));)r--;if(!n)return{x:0,y:0};const a=vr(s.timestamp-n.timestamp);if(a===0)return{x:0,y:0};const l={x:(s.x-n.x)/a,y:(s.y-n.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function $E(e,{min:t,max:r},n){return t!==void 0&&e<t?e=n?st(t,e,n.min):Math.max(e,t):r!==void 0&&e>r&&(e=n?st(r,e,n.max):Math.min(e,r)),e}function sg(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function HE(e,{top:t,left:r,bottom:n,right:s}){return{x:sg(e.x,r,s),y:sg(e.y,t,n)}}function og(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function zE(e,t){return{x:og(e.x,t.x),y:og(e.y,t.y)}}function UE(e,t){let r=.5;const n=qt(e),s=qt(t);return s>n?r=ko(t.min,t.max-n,e.min):n>s&&(r=ko(e.min,e.max-s,t.min)),zr(0,1,r)}function WE(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Bh=.35;function VE(e=Bh){return e===!1?e=0:e===!0&&(e=Bh),{x:ag(e,"left","right"),y:ag(e,"top","bottom")}}function ag(e,t,r){return{min:lg(e,t),max:lg(e,r)}}function lg(e,t){return typeof e=="number"?e:e[t]||0}const KE=new WeakMap;class GE{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_t(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=u=>{r?(this.stopAnimation(),this.snapToCursor(Go(u).point)):this.pauseAnimation()},l=(u,p)=>{this.stopAnimation();const{drag:_,dragPropagation:y,onDragStart:v}=this.getProps();if(_&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Z2(_),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),dr(f=>{let d=this.getAxisMotionValue(f).get()||0;if(Hr.test(d)){const{projection:m}=this.visualElement;if(m&&m.layout){const w=m.layout.layoutBox[f];w&&(d=qt(w)*(parseFloat(d)/100))}}this.originPoint[f]=d}),v&&tt.postRender(()=>v(u,p)),Ph(this.visualElement,"transform");const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},i=(u,p)=>{this.latestPointerEvent=u,this.latestPanInfo=p;const{dragPropagation:_,dragDirectionLock:y,onDirectionLock:v,onDrag:h}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:f}=p;if(y&&this.currentDirection===null){this.currentDirection=qE(f),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",p.point,f),this.updateAxis("y",p.point,f),this.visualElement.render(),h&&h(u,p)},o=(u,p)=>{this.latestPointerEvent=u,this.latestPanInfo=p,this.stop(u,p),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>dr(u=>{var p;return this.getAnimationState(u)==="paused"&&((p=this.getAxisMotionValue(u).animation)==null?void 0:p.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new o1(t,{onSessionStart:a,onStart:l,onMove:i,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:n,contextWindow:s1(this.visualElement),element:this.visualElement.current})}stop(t,r){const n=t||this.latestPointerEvent,s=r||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!n)return;const{velocity:l}=s;this.startAnimation(l);const{onDragEnd:i}=this.getProps();i&&tt.postRender(()=>i(n,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:s}=this.getProps();if(!n||!xa(t,s,this.currentDirection))return;const a=this.getAxisMotionValue(t);let l=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(l=$E(l,this.constraints[t],this.elastic[t])),a.set(l)}resolveConstraints(){var a;const{dragConstraints:t,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,s=this.constraints;t&&Hs(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=HE(n.layoutBox,t):this.constraints=!1,this.elastic=VE(r),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&dr(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=WE(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!Hs(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=Y5(n,s.root,this.visualElement.getTransformPagePoint());let l=zE(s.layout.layoutBox,a);if(r){const i=r(G5(l));this.hasMutatedConstraints=!!i,i&&(l=Wy(i))}return l}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:i}=this.getProps(),o=this.constraints||{},c=dr(g=>{if(!xa(g,r,this.currentDirection))return;let u=o&&o[g]||{};l&&(u={min:0,max:0});const p=s?200:1e6,_=s?40:1e7,y={type:"inertia",velocity:n?t[g]:0,bounceStiffness:p,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...a,...u};return this.startAxisValueAnimation(g,y)});return Promise.all(c).then(i)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return Ph(this.visualElement,t),n.start(If(t,n,0,r,this.visualElement,!1))}stopAnimation(){dr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){dr(t=>{var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.state}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){dr(r=>{const{drag:n}=this.getProps();if(!xa(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(r);if(s&&s.layout){const{min:l,max:i}=s.layout.layoutBox[r],o=a.get()||0;a.set(t[r]-st(l,i,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Hs(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};dr(l=>{const i=this.getAxisMotionValue(l);if(i&&this.constraints!==!1){const o=i.get();s[l]=UE({min:o,max:o},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),dr(l=>{if(!xa(l,t,null))return;const i=this.getAxisMotionValue(l),{min:o,max:c}=this.constraints[l];i.set(st(o,c,s[l]))})}addListeners(){if(!this.visualElement.current)return;KE.set(this.visualElement,this);const t=this.visualElement.current,r=to(t,"pointerdown",o=>{const{drag:c,dragListener:g=!0}=this.getProps();c&&g&&!Ry(o.target)&&this.start(o)}),n=()=>{const{dragConstraints:o}=this.getProps();Hs(o)&&o.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,a=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),tt.read(n);const l=Do(window,"resize",()=>this.scalePositionWithinConstraints()),i=s.addEventListener("didUpdate",({delta:o,hasLayoutChanged:c})=>{this.isDragging&&c&&(dr(g=>{const u=this.getAxisMotionValue(g);u&&(this.originPoint[g]+=o[g].translate,u.set(u.get()+o[g].translate))}),this.visualElement.render())});return()=>{l(),r(),a(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:l=Bh,dragMomentum:i=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:a,dragElastic:l,dragMomentum:i}}}function xa(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function qE(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class XE extends Hn{constructor(t){super(t),this.removeGroupControls=yr,this.removeListeners=yr,this.controls=new GE(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||yr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const cg=e=>(t,r)=>{e&&tt.postRender(()=>e(t,r))};class YE extends Hn{constructor(){super(...arguments),this.removePointerDownListener=yr}onPointerDown(t){this.session=new o1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:s1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:cg(t),onStart:cg(r),onMove:n,onEnd:(a,l)=>{delete this.session,s&&tt.postRender(()=>s(a,l))}}}mount(){this.removePointerDownListener=to(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const qa={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Qc=!1;class JE extends k.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:a}=t;a&&(r.group&&r.group.add(a),n&&n.register&&s&&n.register(a),Qc&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),qa.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:s,isPresent:a}=this.props,{projection:l}=n;return l&&(l.isPresent=a,Qc=!0,s||t.layoutDependency!==r||r===void 0||t.isPresent!==a?l.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?l.promote():l.relegate()||tt.postRender(()=>{const i=l.getStack();(!i||!i.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),xf.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=t;Qc=!0,s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function l1(e){const[t,r]=Dy(),n=k.useContext(ef);return T.jsx(JE,{...e,layoutGroup:n,switchLayoutGroup:k.useContext(zy),isPresent:t,safeToRemove:r})}function QE(e,t,r){const n=zt(e)?e:ls(e);return n.start(If("",n,t,r)),n.animation}const ZE=(e,t)=>e.depth-t.depth;class ek{constructor(){this.children=[],this.isDirty=!1}add(t){nf(this.children,t),this.isDirty=!0}remove(t){sf(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ZE),this.isDirty=!1,this.children.forEach(t)}}function tk(e,t){const r=Gt.now(),n=({timestamp:s})=>{const a=s-r;a>=t&&(On(n),e(a-t))};return tt.setup(n,!0),()=>On(n)}const c1=["TopLeft","TopRight","BottomLeft","BottomRight"],rk=c1.length,ug=e=>typeof e=="string"?parseFloat(e):e,hg=e=>typeof e=="number"||ve.test(e);function nk(e,t,r,n,s,a){s?(e.opacity=st(0,r.opacity??1,ik(n)),e.opacityExit=st(t.opacity??1,0,sk(n))):a&&(e.opacity=st(t.opacity??1,r.opacity??1,n));for(let l=0;l<rk;l++){const i=`border${c1[l]}Radius`;let o=dg(t,i),c=dg(r,i);if(o===void 0&&c===void 0)continue;o||(o=0),c||(c=0),o===0||c===0||hg(o)===hg(c)?(e[i]=Math.max(st(ug(o),ug(c),n),0),(Hr.test(c)||Hr.test(o))&&(e[i]+="%")):e[i]=c}(t.rotate||r.rotate)&&(e.rotate=st(t.rotate||0,r.rotate||0,n))}function dg(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ik=u1(0,.5,q0),sk=u1(.5,.95,yr);function u1(e,t,r){return n=>n<e?0:n>t?1:r(ko(e,t,n))}function fg(e,t){e.min=t.min,e.max=t.max}function br(e,t){fg(e.x,t.x),fg(e.y,t.y)}function pg(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function mg(e,t,r,n,s){return e-=t,e=Tl(e,1/r,n),s!==void 0&&(e=Tl(e,1/s,n)),e}function ok(e,t=0,r=1,n=.5,s,a=e,l=e){if(Hr.test(t)&&(t=parseFloat(t),t=st(l.min,l.max,t/100)-l.min),typeof t!="number")return;let i=st(a.min,a.max,n);e===a&&(i-=t),e.min=mg(e.min,t,r,i,s),e.max=mg(e.max,t,r,i,s)}function gg(e,t,[r,n,s],a,l){ok(e,t[r],t[n],t[s],t.scale,a,l)}const ak=["x","scaleX","originX"],lk=["y","scaleY","originY"];function vg(e,t,r,n){gg(e.x,t,ak,r?r.x:void 0,n?n.x:void 0),gg(e.y,t,lk,r?r.y:void 0,n?n.y:void 0)}function _g(e){return e.translate===0&&e.scale===1}function h1(e){return _g(e.x)&&_g(e.y)}function yg(e,t){return e.min===t.min&&e.max===t.max}function ck(e,t){return yg(e.x,t.x)&&yg(e.y,t.y)}function wg(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function d1(e,t){return wg(e.x,t.x)&&wg(e.y,t.y)}function Sg(e){return qt(e.x)/qt(e.y)}function xg(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class uk{constructor(){this.members=[]}add(t){nf(this.members,t),t.scheduleRender()}remove(t){if(sf(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(s=>t===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const a=this.members[s];if(a.isPresent!==!1){n=a;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function hk(e,t,r){let n="";const s=e.x.translate/t.x,a=e.y.translate/t.y,l=(r==null?void 0:r.z)||0;if((s||a||l)&&(n=`translate3d(${s}px, ${a}px, ${l}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:c,rotate:g,rotateX:u,rotateY:p,skewX:_,skewY:y}=r;c&&(n=`perspective(${c}px) ${n}`),g&&(n+=`rotate(${g}deg) `),u&&(n+=`rotateX(${u}deg) `),p&&(n+=`rotateY(${p}deg) `),_&&(n+=`skewX(${_}deg) `),y&&(n+=`skewY(${y}deg) `)}const i=e.x.scale*t.x,o=e.y.scale*t.y;return(i!==1||o!==1)&&(n+=`scale(${i}, ${o})`),n||"none"}const Zc=["","X","Y","Z"],dk=1e3;let fk=0;function eu(e,t,r,n){const{latestValues:s}=t;s[e]&&(r[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function f1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=Qy(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",tt,!(s||a))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&f1(n)}function p1({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(l={},i=t==null?void 0:t()){this.id=fk++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(gk),this.nodes.forEach(wk),this.nodes.forEach(Sk),this.nodes.forEach(vk)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let o=0;o<this.path.length;o++)this.path[o].shouldResetTransform=!0;this.root===this&&(this.nodes=new ek)}addEventListener(l,i){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new lf),this.eventHandlers.get(l).add(i)}notifyListeners(l,...i){const o=this.eventHandlers.get(l);o&&o.notify(...i)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=Ty(l)&&!i5(l),this.instance=l;const{layoutId:i,layout:o,visualElement:c}=this.options;if(c&&!c.current&&c.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(o||i)&&(this.isLayoutDirty=!0),e){let g,u=0;const p=()=>this.root.updateBlockedByResize=!1;tt.read(()=>{u=window.innerWidth}),e(l,()=>{const _=window.innerWidth;_!==u&&(u=_,this.root.updateBlockedByResize=!0,g&&g(),g=tk(p,250),qa.hasAnimatedSinceResize&&(qa.hasAnimatedSinceResize=!1,this.nodes.forEach(Eg)))})}i&&this.root.registerSharedNode(i,this),this.options.animate!==!1&&c&&(i||o)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:u,hasRelativeLayoutChanged:p,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||c.getDefaultTransition()||kk,{onLayoutAnimationStart:v,onLayoutAnimationComplete:h}=c.getProps(),f=!this.targetLayout||!d1(this.targetLayout,_),d=!u&&p;if(this.options.layoutRoot||this.resumeFrom||d||u&&(f||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const m={...wf(y,"layout"),onPlay:v,onComplete:h};(c.shouldReduceMotion||this.options.layoutRoot)&&(m.delay=0,m.type=!1),this.startAnimation(m),this.setAnimationOrigin(g,d)}else u||Eg(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),On(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(xk),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&f1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const u=this.path[g];u.shouldResetTransform=!0,u.updateScroll("snapshot"),u.options.layoutRoot&&u.willUpdate(!1)}const{layoutId:i,layout:o}=this.options;if(i===void 0&&!o)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(bg);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Cg);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yk),this.nodes.forEach(pk),this.nodes.forEach(mk)):this.nodes.forEach(Cg),this.clearAllSnapshots();const i=Gt.now();Pt.delta=zr(0,1e3/60,i-Pt.timestamp),Pt.timestamp=i,Pt.isProcessing=!0,Hc.update.process(Pt),Hc.preRender.process(Pt),Hc.render.process(Pt),Pt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,xf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(_k),this.sharedNodes.forEach(bk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,tt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){tt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!qt(this.snapshot.measuredBox.x)&&!qt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let o=0;o<this.path.length;o++)this.path[o].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=_t(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:i}=this.options;i&&i.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let i=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(i=!1),i&&this.instance){const o=n(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:o,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:o}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,i=this.projectionDelta&&!h1(this.projectionDelta),o=this.getTransformTemplate(),c=o?o(this.latestValues,""):void 0,g=c!==this.prevTransformTemplateValue;l&&this.instance&&(i||Zn(this.latestValues)||g)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const i=this.measurePageBox();let o=this.removeElementScroll(i);return l&&(o=this.removeTransform(o)),Lk(o),{animationId:this.root.animationId,measuredBox:i,layoutBox:o,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:l}=this.options;if(!l)return _t();const i=l.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(Rk))){const{scroll:g}=this.root;g&&(Fi(i.x,g.offset.x),Fi(i.y,g.offset.y))}return i}removeElementScroll(l){var o;const i=_t();if(br(i,l),(o=this.scroll)!=null&&o.wasRoot)return i;for(let c=0;c<this.path.length;c++){const g=this.path[c],{scroll:u,options:p}=g;g!==this.root&&u&&p.layoutScroll&&(u.wasRoot&&br(i,l),Fi(i.x,u.offset.x),Fi(i.y,u.offset.y))}return i}applyTransform(l,i=!1){const o=_t();br(o,l);for(let c=0;c<this.path.length;c++){const g=this.path[c];!i&&g.options.layoutScroll&&g.scroll&&g!==g.root&&$i(o,{x:-g.scroll.offset.x,y:-g.scroll.offset.y}),Zn(g.latestValues)&&$i(o,g.latestValues)}return Zn(this.latestValues)&&$i(o,this.latestValues),o}removeTransform(l){const i=_t();br(i,l);for(let o=0;o<this.path.length;o++){const c=this.path[o];if(!c.instance||!Zn(c.latestValues))continue;Dh(c.latestValues)&&c.updateSnapshot();const g=_t(),u=c.measurePageBox();br(g,u),vg(i,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,g)}return Zn(this.latestValues)&&vg(i,this.latestValues),i}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){var _;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const o=!!this.resumingFrom||this!==i;if(!(l||o&&this.isSharedProjectionDirty||this.isProjectionDirty||(_=this.parent)!=null&&_.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:u}=this.options;if(!this.layout||!(g||u))return;this.resolvedRelativeTargetAt=Pt.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_t(),this.targetWithTransforms=_t()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),OE(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):br(this.target,this.layout.layoutBox),Ky(this.target,this.targetDelta)):br(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Dh(this.parent.latestValues)||Vy(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,i,o){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_t(),this.relativeTargetOrigin=_t(),Ml(this.relativeTargetOrigin,i,o),br(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const l=this.getLead(),i=!!this.resumingFrom||this!==l;let o=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(o=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(o=!1),this.resolvedRelativeTargetAt===Pt.timestamp&&(o=!1),o)return;const{layout:c,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||g))return;br(this.layoutCorrected,this.layout.layoutBox);const u=this.treeScale.x,p=this.treeScale.y;X5(this.layoutCorrected,this.treeScale,this.path,i),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=_t());const{target:_}=l;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(pg(this.prevProjectionDelta.x,this.projectionDelta.x),pg(this.prevProjectionDelta.y,this.projectionDelta.y)),ro(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==u||this.treeScale.y!==p||!xg(this.projectionDelta.x,this.prevProjectionDelta.x)||!xg(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){var i;if((i=this.options.visualElement)==null||i.scheduleRender(),l){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Hi(),this.projectionDelta=Hi(),this.projectionDeltaWithTransform=Hi()}setAnimationOrigin(l,i=!1){const o=this.snapshot,c=o?o.latestValues:{},g={...this.latestValues},u=Hi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;const p=_t(),_=o?o.source:void 0,y=this.layout?this.layout.source:void 0,v=_!==y,h=this.getStack(),f=!h||h.members.length<=1,d=!!(v&&!f&&this.options.crossfade===!0&&!this.path.some(Ek));this.animationProgress=0;let m;this.mixTargetDelta=w=>{const b=w/1e3;kg(u.x,l.x,b),kg(u.y,l.y,b),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ml(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ck(this.relativeTarget,this.relativeTargetOrigin,p,b),m&&ck(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=_t()),br(m,this.relativeTarget)),v&&(this.animationValues=g,nk(g,c,this.latestValues,b,d,f)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=b},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){var i,o,c;this.notifyListeners("animationStart"),(i=this.currentAnimation)==null||i.stop(),(c=(o=this.resumingFrom)==null?void 0:o.currentAnimation)==null||c.stop(),this.pendingAnimation&&(On(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=tt.update(()=>{qa.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ls(0)),this.currentAnimation=QE(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:g=>{this.mixTargetDelta(g),l.onUpdate&&l.onUpdate(g)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dk),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:i,target:o,layout:c,latestValues:g}=l;if(!(!i||!o||!c)){if(this!==l&&this.layout&&c&&m1(this.options.animationType,this.layout.layoutBox,c.layoutBox)){o=this.target||_t();const u=qt(this.layout.layoutBox.x);o.x.min=l.target.x.min,o.x.max=o.x.min+u;const p=qt(this.layout.layoutBox.y);o.y.min=l.target.y.min,o.y.max=o.y.min+p}br(i,o),$i(i,g),ro(this.projectionDeltaWithTransform,this.layoutCorrected,i,g)}}registerSharedNode(l,i){this.sharedNodes.has(l)||this.sharedNodes.set(l,new uk),this.sharedNodes.get(l).add(i);const c=i.options.initialPromotionConfig;i.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(i):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){var i;const{layoutId:l}=this.options;return l?((i=this.getStack())==null?void 0:i.lead)||this:this}getPrevLead(){var i;const{layoutId:l}=this.options;return l?(i=this.getStack())==null?void 0:i.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:i,preserveFollowOpacity:o}={}){const c=this.getStack();c&&c.promote(this,o),l&&(this.projectionDelta=void 0,this.needsReset=!0),i&&this.setOptions({transition:i})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let i=!1;const{latestValues:o}=l;if((o.z||o.rotate||o.rotateX||o.rotateY||o.rotateZ||o.skewX||o.skewY)&&(i=!0),!i)return;const c={};o.z&&eu("z",l,c,this.animationValues);for(let g=0;g<Zc.length;g++)eu(`rotate${Zc[g]}`,l,c,this.animationValues),eu(`skew${Zc[g]}`,l,c,this.animationValues);l.render();for(const g in c)l.setStaticValue(g,c[g]),this.animationValues&&(this.animationValues[g]=c[g]);l.scheduleRender()}applyProjectionStyles(l,i){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const o=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Ga(i==null?void 0:i.pointerEvents)||"",l.transform=o?o(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Ga(i==null?void 0:i.pointerEvents)||""),this.hasProjected&&!Zn(this.latestValues)&&(l.transform=o?o({},""):"none",this.hasProjected=!1);return}l.visibility="";const g=c.animationValues||c.latestValues;this.applyTransformsToTarget();let u=hk(this.projectionDeltaWithTransform,this.treeScale,g);o&&(u=o(g,u)),l.transform=u;const{x:p,y:_}=this.projectionDelta;l.transformOrigin=`${p.origin*100}% ${_.origin*100}% 0`,c.animationValues?l.opacity=c===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:l.opacity=c===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const y in Th){if(g[y]===void 0)continue;const{correct:v,applyTo:h,isCSSVariable:f}=Th[y],d=u==="none"?g[y]:v(g[y],c);if(h){const m=h.length;for(let w=0;w<m;w++)l[h[w]]=d}else f?this.options.visualElement.renderState.vars[y]=d:l[y]=d}this.options.layoutId&&(l.pointerEvents=c===this?Ga(i==null?void 0:i.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>{var i;return(i=l.currentAnimation)==null?void 0:i.stop()}),this.root.nodes.forEach(bg),this.root.sharedNodes.clear()}}}function pk(e){e.updateLayout()}function mk(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:a}=e.options,l=t.source!==e.layout.source;a==="size"?dr(u=>{const p=l?t.measuredBox[u]:t.layoutBox[u],_=qt(p);p.min=n[u].min,p.max=p.min+_}):m1(a,t.layoutBox,n)&&dr(u=>{const p=l?t.measuredBox[u]:t.layoutBox[u],_=qt(n[u]);p.max=p.min+_,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+_)});const i=Hi();ro(i,n,t.layoutBox);const o=Hi();l?ro(o,e.applyTransform(s,!0),t.measuredBox):ro(o,n,t.layoutBox);const c=!h1(i);let g=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:_}=u;if(p&&_){const y=_t();Ml(y,t.layoutBox,p.layoutBox);const v=_t();Ml(v,n,_.layoutBox),d1(y,v)||(g=!0),u.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=y,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:o,layoutDelta:i,hasLayoutChanged:c,hasRelativeLayoutChanged:g})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function gk(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function vk(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function _k(e){e.clearSnapshot()}function bg(e){e.clearMeasurements()}function Cg(e){e.isLayoutDirty=!1}function yk(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Eg(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function wk(e){e.resolveTargetDelta()}function Sk(e){e.calcProjection()}function xk(e){e.resetSkewAndRotation()}function bk(e){e.removeLeadSnapshot()}function kg(e,t,r){e.translate=st(t.translate,0,r),e.scale=st(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function Lg(e,t,r,n){e.min=st(t.min,r.min,n),e.max=st(t.max,r.max,n)}function Ck(e,t,r,n){Lg(e.x,t.x,r.x,n),Lg(e.y,t.y,r.y,n)}function Ek(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const kk={duration:.45,ease:[.4,0,.1,1]},Rg=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Tg=Rg("applewebkit/")&&!Rg("chrome/")?Math.round:yr;function Dg(e){e.min=Tg(e.min),e.max=Tg(e.max)}function Lk(e){Dg(e.x),Dg(e.y)}function m1(e,t,r){return e==="position"||e==="preserve-aspect"&&!BE(Sg(t),Sg(r),.2)}function Rk(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Tk=p1({attachResizeListener:(e,t)=>Do(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tu={current:void 0},g1=p1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tu.current){const e=new Tk({});e.mount(window),e.setOptions({layoutScroll:!0}),tu.current=e}return tu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Dk={pan:{Feature:YE},drag:{Feature:XE,ProjectionNode:g1,MeasureLayout:l1}};function Mg(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,a=n[s];a&&tt.postRender(()=>a(t,Go(t)))}class Mk extends Hn{mount(){const{current:t}=this.node;t&&(this.unmount=e5(t,(r,n)=>(Mg(this.node,n,"Start"),s=>Mg(this.node,s,"End"))))}unmount(){}}class Ak extends Hn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Wo(Do(this.node.current,"focus",()=>this.onFocus()),Do(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ag(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),a=n[s];a&&tt.postRender(()=>a(t,Go(t)))}class Pk extends Hn{mount(){const{current:t}=this.node;t&&(this.unmount=n5(t,(r,n)=>(Ag(this.node,n,"Start"),(s,{success:a})=>Ag(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Oh=new WeakMap,ru=new WeakMap,Ik=e=>{const t=Oh.get(e.target);t&&t(e)},Bk=e=>{e.forEach(Ik)};function Ok({root:e,...t}){const r=e||document;ru.has(r)||ru.set(r,{});const n=ru.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(Bk,{root:e,...t})),n[s]}function Nk(e,t,r){const n=Ok(t);return Oh.set(e,r),n.observe(e),()=>{Oh.delete(e),n.unobserve(e)}}const jk={some:0,all:1};class Fk extends Hn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:a}=t,l={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:jk[s]},i=o=>{const{isIntersecting:c}=o;if(this.isInView===c||(this.isInView=c,a&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:g,onViewportLeave:u}=this.node.getProps(),p=c?g:u;p&&p(o)};return Nk(this.node.current,l,i)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some($k(t,r))&&this.startObserver()}unmount(){}}function $k({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const Hk={inView:{Feature:Fk},tap:{Feature:Pk},focus:{Feature:Ak},hover:{Feature:Mk}},zk={layout:{ProjectionNode:g1,MeasureLayout:l1}},Uk={...TE,...Hk,...Dk,...zk},Nh=K5(Uk,iE);function v1(){!Pf.current&&qy();const[e]=k.useState(Dl.current);return e}function Wk(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const cc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gs(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Bf(e){return"nodeType"in e}function nr(e){var t,r;return e?gs(e)?e:Bf(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Of(e){const{Document:t}=nr(e);return e instanceof t}function qo(e){return gs(e)?!1:e instanceof nr(e).HTMLElement}function _1(e){return e instanceof nr(e).SVGElement}function vs(e){return e?gs(e)?e.document:Bf(e)?Of(e)?e:qo(e)||_1(e)?e.ownerDocument:document:document:document}const Ur=cc?k.useLayoutEffect:k.useEffect;function Nf(e){const t=k.useRef(e);return Ur(()=>{t.current=e}),k.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Vk(){const e=k.useRef(null),t=k.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Mo(e,t){t===void 0&&(t=[e]);const r=k.useRef(e);return Ur(()=>{r.current!==e&&(r.current=e)},t),r}function Xo(e,t){const r=k.useRef();return k.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Al(e){const t=Nf(e),r=k.useRef(null),n=k.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function jh(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let nu={};function Yo(e,t){return k.useMemo(()=>{if(t)return t;const r=nu[e]==null?0:nu[e]+1;return nu[e]=r,e+"-"+r},[e,t])}function y1(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((a,l)=>{const i=Object.entries(l);for(const[o,c]of i){const g=a[o];g!=null&&(a[o]=g+e*c)}return a},{...t})}}const Qi=y1(1),Pl=y1(-1);function Kk(e){return"clientX"in e&&"clientY"in e}function jf(e){if(!e)return!1;const{KeyboardEvent:t}=nr(e.target);return t&&e instanceof t}function Gk(e){if(!e)return!1;const{TouchEvent:t}=nr(e.target);return t&&e instanceof t}function Fh(e){if(Gk(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Kk(e)?{x:e.clientX,y:e.clientY}:null}const Ao=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Ao.Translate.toString(e),Ao.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Pg="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qk(e){return e.matches(Pg)?e:e.querySelector(Pg)}const Xk={display:"none"};function Yk(e){let{id:t,value:r}=e;return mt.createElement("div",{id:t,style:Xk},r)}function Jk(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return mt.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Qk(){const[e,t]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const w1=k.createContext(null);function Zk(e){const t=k.useContext(w1);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function eL(){const[e]=k.useState(()=>new Set),t=k.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[k.useCallback(n=>{let{type:s,event:a}=n;e.forEach(l=>{var i;return(i=l[s])==null?void 0:i.call(l,a)})},[e]),t]}const tL={draggable:`
49
49
  To pick up a draggable item, press the space bar.
50
50
  While dragging, use the arrow keys to move the item.
51
51
  Press space again to drop the item in its new position, or press escape to cancel.
52
- `},rL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nL(e){let{announcements:t=rL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=tL}=e;const{announce:a,announcement:l}=Qk(),i=Yo("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Zk(k.useMemo(()=>({onDragStart(u){let{active:p}=u;a(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:_}=u;t.onDragMove&&a(t.onDragMove({active:p,over:_}))},onDragOver(u){let{active:p,over:_}=u;a(t.onDragOver({active:p,over:_}))},onDragEnd(u){let{active:p,over:_}=u;a(t.onDragEnd({active:p,over:_}))},onDragCancel(u){let{active:p,over:_}=u;a(t.onDragCancel({active:p,over:_}))}}),[a,t])),!o)return null;const g=mt.createElement(mt.Fragment,null,mt.createElement(Yk,{id:n,value:s.draggable}),mt.createElement(Jk,{id:i,announcement:l}));return r?jr.createPortal(g,r):g}var wt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wt||(wt={}));function Il(){}function iL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ir=Object.freeze({x:0,y:0});function oL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function lL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function cL(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Ig(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const uL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Ig(t,t.left,t.top),a=[];for(const l of n){const{id:i}=l,o=r.get(i);if(o){const c=oL(Ig(o),s);a.push({id:i,data:{droppableContainer:l,value:c}})}}return a.sort(aL)};function hL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-n,i=a-r;if(n<s&&r<a){const o=t.width*t.height,c=e.width*e.height,g=l*i,u=g/(o+c-g);return Number(u.toFixed(4))}return 0}const dL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:l}=a,i=r.get(l);if(i){const o=hL(i,t);o>0&&s.push({id:l,data:{droppableContainer:a,value:o}})}}return s.sort(lL)};function fL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function S1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ir}function pL(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,i)=>({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...r})}}const mL=pL(1);function gL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vL(e,t,r){const n=gL(t);if(!n)return e;const{scaleX:s,scaleY:a,x:l,y:i}=n,o=e.left-l-(1-s)*parseFloat(r),c=e.top-i-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=s?e.width/s:e.width,u=a?e.height/a:e.height;return{width:g,height:u,top:c,right:o+g,bottom:c+u,left:o}}const _L={ignoreTransform:!1};function _s(e,t){t===void 0&&(t=_L);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:g}=nr(e).getComputedStyle(e);c&&(r=vL(r,c,g))}const{top:n,left:s,width:a,height:l,bottom:i,right:o}=r;return{top:n,left:s,width:a,height:l,bottom:i,right:o}}function Bg(e){return _s(e,{ignoreTransform:!0})}function yL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function wL(e,t){return t===void 0&&(t=nr(e).getComputedStyle(e)),t.position==="fixed"}function SL(e,t){t===void 0&&(t=nr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function Ff(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Of(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!qo(s)||_1(s)||r.includes(s))return r;const a=nr(e).getComputedStyle(s);return s!==e&&SL(s,a)&&r.push(s),wL(s,a)?r:n(s.parentNode)}return e?n(e):r}function x1(e){const[t]=Ff(e,1);return t??null}function iu(e){return!cc||!e?null:gs(e)?e:Bf(e)?Of(e)||e===vs(e).scrollingElement?window:qo(e)?e:null:null}function b1(e){return gs(e)?e.scrollX:e.scrollLeft}function C1(e){return gs(e)?e.scrollY:e.scrollTop}function $h(e){return{x:b1(e),y:C1(e)}}var kt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kt||(kt={}));function E1(e){return!cc||!e?!1:e===document.scrollingElement}function k1(e){const t={x:0,y:0},r=E1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:l,isRight:i,maxScroll:n,minScroll:t}}const xL={x:.2,y:.2};function bL(e,t,r,n,s){let{top:a,left:l,right:i,bottom:o}=r;n===void 0&&(n=10),s===void 0&&(s=xL);const{isTop:c,isBottom:g,isLeft:u,isRight:p}=k1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!c&&a<=t.top+v.height?(_.y=kt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!g&&o>=t.bottom-v.height&&(_.y=kt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!p&&i>=t.right-v.width?(_.x=kt.Forward,y.x=n*Math.abs((t.right-v.width-i)/v.width)):!u&&l<=t.left+v.width&&(_.x=kt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function CL(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function L1(e){return e.reduce((t,r)=>Qi(t,$h(r)),Ir)}function EL(e){return e.reduce((t,r)=>t+b1(r),0)}function kL(e){return e.reduce((t,r)=>t+C1(r),0)}function LL(e,t){if(t===void 0&&(t=_s),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);x1(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const RL=[["x",["left","right"],EL],["y",["top","bottom"],kL]];class $f{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ff(r),s=L1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,i]of RL)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=i(n),g=s[a]-c;return this.rect[o]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class no{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function TL(e){const{EventTarget:t}=nr(e);return e instanceof t?e:vs(e)}function su(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var fr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fr||(fr={}));function Og(e){e.preventDefault()}function DL(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(qe||(qe={}));const R1={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},ML=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case qe.Right:return{...r,x:r.x+25};case qe.Left:return{...r,x:r.x-25};case qe.Down:return{...r,y:r.y+25};case qe.Up:return{...r,y:r.y-25}}};class T1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new no(vs(r)),this.windowListeners=new no(nr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&LL(n),r(Ir)}handleKeyDown(t){if(jf(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=R1,coordinateGetter:l=ML,scrollBehavior:i="smooth"}=s,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,g=c?{x:c.left,y:c.top}:Ir;this.referenceCoordinates||(this.referenceCoordinates=g);const u=l(t,{active:r,context:n.current,currentCoordinates:g});if(u){const p=Pl(u,g),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:f,isRight:d,isLeft:m,isBottom:w,maxScroll:b,minScroll:x}=k1(v),C=CL(v),S={x:Math.min(h===qe.Right?C.right-C.width/2:C.right,Math.max(h===qe.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===qe.Down?C.bottom-C.height/2:C.bottom,Math.max(h===qe.Down?C.top:C.top+C.height/2,u.y))},E=h===qe.Right&&!d||h===qe.Left&&!m,L=h===qe.Down&&!w||h===qe.Up&&!f;if(E&&S.x!==u.x){const A=v.scrollLeft+p.x,M=h===qe.Right&&A<=b.x||h===qe.Left&&A>=x.x;if(M&&!p.y){v.scrollTo({left:A,behavior:i});return}M?_.x=v.scrollLeft-A:_.x=h===qe.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:i});break}else if(L&&S.y!==u.y){const A=v.scrollTop+p.y,M=h===qe.Down&&A<=b.y||h===qe.Up&&A>=x.y;if(M&&!p.x){v.scrollTo({top:A,behavior:i});return}M?_.y=v.scrollTop-A:_.y=h===qe.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:i});break}}this.handleMove(t,Qi(Pl(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}T1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=R1,onActivation:s}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Ng(e){return!!(e&&"distance"in e)}function jg(e){return!!(e&&"delay"in e)}class Hf{constructor(t,r,n){var s;n===void 0&&(n=TL(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=vs(l),this.documentListeners=new no(this.document),this.listeners=new no(n),this.windowListeners=new no(nr(l)),this.initialCoordinates=(s=Fh(a))!=null?s:Ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,Og),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,Og),this.documentListeners.add(fr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jg(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ng(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(fr.Click,DL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:i}}=a;if(!s)return;const o=(r=Fh(t))!=null?r:Ir,c=Pl(s,o);if(!n&&i){if(Ng(i)){if(i.tolerance!=null&&su(c,i.tolerance))return this.handleCancel();if(su(c,i.distance))return this.handleStart()}if(jg(i)&&su(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const AL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class zf extends Hf{constructor(t){const{event:r}=t,n=vs(r.target);super(t,AL,n)}}zf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const PL={move:{name:"mousemove"},end:{name:"mouseup"}};var Hh;(function(e){e[e.RightClick=2]="RightClick"})(Hh||(Hh={}));class IL extends Hf{constructor(t){super(t,PL,vs(t.event.target))}}IL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Hh.RightClick?!1:(n==null||n({event:r}),!0)}}];const ou={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BL extends Hf{constructor(t){super(t,ou)}static setup(){return window.addEventListener(ou.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ou.move.name,t)};function t(){}}}BL.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var io;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(io||(io={}));var Bl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bl||(Bl={}));function OL(e){let{acceleration:t,activator:r=io.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:l=5,order:i=Bl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:g,delta:u,threshold:p}=e;const _=jL({delta:u,disabled:!a}),[y,v]=Vk(),h=k.useRef({x:0,y:0}),f=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case io.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case io.DraggableRect:return s}},[r,s,o]),m=k.useRef(null),w=k.useCallback(()=>{const x=m.current;if(!x)return;const C=h.current.x*f.current.x,S=h.current.y*f.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>i===Bl.TreeOrder?[...c].reverse():c,[i,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=g[C];if(!S)continue;const{direction:E,speed:L}=bL(x,S,d,t,p);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),m.current=x,y(w,l),h.current=L,f.current=E;return}}h.current={x:0,y:0},f.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,g,JSON.stringify(p)])}const NL={x:{[kt.Backward]:!1,[kt.Forward]:!1},y:{[kt.Backward]:!1,[kt.Forward]:!1}};function jL(e){let{delta:t,disabled:r}=e;const n=jh(t);return Xo(s=>{if(r||!n||!s)return NL;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[kt.Backward]:s.x[kt.Backward]||a.x===-1,[kt.Forward]:s.x[kt.Forward]||a.x===1},y:{[kt.Backward]:s.y[kt.Backward]||a.y===-1,[kt.Forward]:s.y[kt.Forward]||a.y===1}}},[r,t,n])}function FL(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Xo(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function $L(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var Po;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Po||(Po={}));var zh;(function(e){e.Optimized="optimized"})(zh||(zh={}));const Fg=new Map;function HL(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,l]=k.useState(null),{frequency:i,measure:o,strategy:c}=s,g=k.useRef(e),u=h(),p=Mo(u),_=k.useCallback(function(f){f===void 0&&(f=[]),!p.current&&l(d=>d===null?f:d.concat(f.filter(m=>!d.includes(m))))},[p]),y=k.useRef(null),v=Xo(f=>{if(u&&!r)return Fg;if(!f||f===Fg||g.current!==e||a!=null){const d=new Map;for(let m of e){if(!m)continue;if(a&&a.length>0&&!a.includes(m.id)&&m.rect.current){d.set(m.id,m.rect.current);continue}const w=m.node.current,b=w?new $f(o(w),w):null;m.rect.current=b,b&&d.set(m.id,b)}return d}return f},[e,a,r,u,o]);return k.useEffect(()=>{g.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof i!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},i))},[i,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case Po.Always:return!1;case Po.BeforeDragging:return r;default:return!r}}}function D1(e,t){return Xo(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function zL(e,t){return D1(e,t)}function UL(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function uc(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function WL(e){return new $f(_s(e),e)}function $g(e,t,r){t===void 0&&(t=WL);const[n,s]=k.useState(null);function a(){s(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const g=t(e);return JSON.stringify(o)===JSON.stringify(g)?o:g})}const l=UL({callback(o){if(e)for(const c of o){const{type:g,target:u}=c;if(g==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),i=uc({callback:a});return Ur(()=>{a(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),n}function VL(e){const t=D1(e);return S1(e,t)}const Hg=[];function KL(e){const t=k.useRef(e),r=Xo(n=>e?n&&n!==Hg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ff(e):Hg,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function GL(e){const[t,r]=k.useState(null),n=k.useRef(e),s=k.useCallback(a=>{const l=iu(a.target);l&&r(i=>i?(i.set(l,$h(l)),new Map(i)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const i=e.map(o=>{const c=iu(o);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,$h(c)]):null}).filter(o=>o!=null);r(i.length?new Map(i):null),n.current=e}return()=>{l(e),l(a)};function l(i){i.forEach(o=>{const c=iu(o);c==null||c.removeEventListener("scroll",s)})}},[s,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>Qi(a,l),Ir):L1(e):Ir,[e,t])}function zg(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==Ir;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Pl(e,r.current):Ir}function qL(e){k.useEffect(()=>{if(!cc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function XL(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=l=>{a(l,t)},r},{}),[e,t])}function M1(e){return k.useMemo(()=>e?yL(e):null,[e])}const Ug=[];function YL(e,t){t===void 0&&(t=_s);const[r]=e,n=M1(r?nr(r):null),[s,a]=k.useState(Ug);function l(){a(()=>e.length?e.map(o=>E1(o)?n:new $f(t(o),o)):Ug)}const i=uc({callback:l});return Ur(()=>{i==null||i.disconnect(),l(),e.forEach(o=>i==null?void 0:i.observe(o))},[e]),s}function JL(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qo(t)?t:e}function QL(e){let{measure:t}=e;const[r,n]=k.useState(null),s=k.useCallback(c=>{for(const{target:g}of c)if(qo(g)){n(u=>{const p=t(g);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),a=uc({callback:s}),l=k.useCallback(c=>{const g=JL(c);a==null||a.disconnect(),g&&(a==null||a.observe(g)),n(g?t(g):null)},[t,a]),[i,o]=Al(l);return k.useMemo(()=>({nodeRef:i,rect:r,setRef:o}),[r,i,o])}const ZL=[{sensor:zf,options:{}},{sensor:T1,options:{}}],eR={current:{}},Xa={draggable:{measure:Bg},droppable:{measure:Bg,strategy:Po.WhileDragging,frequency:zh.Optimized},dragOverlay:{measure:_s}};class so extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const tR={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new so,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Il},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xa,measureDroppableContainers:Il,windowRect:null,measuringScheduled:!1},rR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Il,draggableNodes:new Map,over:null,measureDroppableContainers:Il},hc=k.createContext(rR),A1=k.createContext(tR);function nR(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new so}}}function iR(e,t){switch(t.type){case wt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wt.DragEnd:case wt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wt.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new so(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case wt.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new so(e.droppable.containers);return l.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case wt.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new so(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sR(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=k.useContext(hc),a=jh(n),l=jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!jf(a)||document.activeElement===a.target)return;const i=s.get(l);if(!i)return;const{activatorNode:o,node:c}=i;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const g of[o.current,c.current]){if(!g)continue;const u=qk(g);if(u){u.focus();break}}})}},[n,t,s,l,a]),null}function oR(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function aR(e){return k.useMemo(()=>({draggable:{...Xa.draggable,...e==null?void 0:e.draggable},droppable:{...Xa.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xa.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lR(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=k.useRef(!1),{x:l,y:i}=typeof s=="boolean"?{x:s,y:s}:s;Ur(()=>{if(!l&&!i||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const g=r(c),u=S1(g,n);if(l||(u.x=0),i||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=x1(c);p&&p.scrollBy({top:u.y,left:u.x})}},[t,l,i,n,r])}const P1=k.createContext({...Ir,scaleX:1,scaleY:1});var wn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(wn||(wn={}));const cR=k.memo(function(t){var r,n,s,a;let{id:l,accessibility:i,autoScroll:o=!0,children:c,sensors:g=ZL,collisionDetection:u=dL,measuring:p,modifiers:_,...y}=t;const v=k.useReducer(iR,void 0,nR),[h,f]=v,[d,m]=eL(),[w,b]=k.useState(wn.Uninitialized),x=w===wn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var De;return C!=null?{id:C,data:(De=A==null?void 0:A.data)!=null?De:eR,rect:M}:null},[C,A]),N=k.useRef(null),[H,F]=k.useState(null),[$,O]=k.useState(null),R=Mo(y,Object.values(y)),P=Yo("DndDescribedBy",l),B=k.useMemo(()=>L.getEnabled(),[L]),j=aR(p),{droppableRects:W,measureDroppableContainers:K,measuringScheduled:ee}=HL(B,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),Z=FL(S,C),z=k.useMemo(()=>$?Fh($):null,[$]),I=Fe(),V=zL(Z,j.draggable.measure);lR({activeNode:C!=null?S.get(C):null,config:I.layoutShiftCompensation,initialRect:V,measure:j.draggable.measure});const U=$g(Z,j.draggable.measure,V),J=$g(Z?Z.parentElement:null),X=k.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=L.getNodeFor((r=X.current.over)==null?void 0:r.id),ce=QL({measure:j.dragOverlay.measure}),fe=(n=ce.nodeRef.current)!=null?n:Z,Ee=x?(s=ce.rect)!=null?s:U:null,ae=!!(ce.nodeRef.current&&ce.rect),Te=VL(ae?null:U),je=M1(fe?nr(fe):null),pe=KL(x?me??Z:null),_e=YL(pe),ke=oR(_,{transform:{x:E.x-Te.x,y:E.y-Te.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:U,containerNodeRect:J,draggingNodeRect:Ee,over:X.current.over,overlayNodeRect:ce.rect,scrollableAncestors:pe,scrollableAncestorRects:_e,windowRect:je}),se=z?Qi(z,E):null,be=GL(pe),oe=zg(be),he=zg(be,[U]),Le=Qi(ke,oe),Re=Ee?mL(Ee,ke):null,Ce=D&&Re?u({active:D,collisionRect:Re,droppableRects:W,droppableContainers:B,pointerCoordinates:se}):null,q=cL(Ce,"id"),[Q,ge]=k.useState(null),He=ae?ke:Qi(ke,he),ie=fL(He,(a=Q==null?void 0:Q.rect)!=null?a:null,U),G=k.useRef(null),re=k.useCallback((De,Be)=>{let{sensor:Pe,options:Ue}=Be;if(N.current==null)return;const Me=S.get(N.current);if(!Me)return;const ze=De.nativeEvent,Je=new Pe({active:N.current,activeNode:Me,event:ze,options:Ue,context:X,onAbort(we){if(!S.get(we))return;const{onDragAbort:Ke}=R.current,Ge={id:we};Ke==null||Ke(Ge),d({type:"onDragAbort",event:Ge})},onPending(we,Ae,Ke,Ge){if(!S.get(we))return;const{onDragPending:xt}=R.current,dt={id:we,constraint:Ae,initialCoordinates:Ke,offset:Ge};xt==null||xt(dt),d({type:"onDragPending",event:dt})},onStart(we){const Ae=N.current;if(Ae==null)return;const Ke=S.get(Ae);if(!Ke)return;const{onDragStart:Ge}=R.current,lt={activatorEvent:ze,active:{id:Ae,data:Ke.data,rect:M}};jr.unstable_batchedUpdates(()=>{Ge==null||Ge(lt),b(wn.Initializing),f({type:wt.DragStart,initialCoordinates:we,active:Ae}),d({type:"onDragStart",event:lt}),F(G.current),O(ze)})},onMove(we){f({type:wt.DragMove,coordinates:we})},onEnd:nt(wt.DragEnd),onCancel:nt(wt.DragCancel)});G.current=Je;function nt(we){return async function(){const{active:Ke,collisions:Ge,over:lt,scrollAdjustedTranslate:xt}=X.current;let dt=null;if(Ke&&xt){const{cancelDrop:Wt}=R.current;dt={activatorEvent:ze,active:Ke,collisions:Ge,delta:xt,over:lt},we===wt.DragEnd&&typeof Wt=="function"&&await Promise.resolve(Wt(dt))&&(we=wt.DragCancel)}N.current=null,jr.unstable_batchedUpdates(()=>{f({type:we}),b(wn.Uninitialized),ge(null),F(null),O(null),G.current=null;const Wt=we===wt.DragEnd?"onDragEnd":"onDragCancel";if(dt){const Wr=R.current[Wt];Wr==null||Wr(dt),d({type:Wt,event:dt})}})}}},[S]),le=k.useCallback((De,Be)=>(Pe,Ue)=>{const Me=Pe.nativeEvent,ze=S.get(Ue);if(N.current!==null||!ze||Me.dndKit||Me.defaultPrevented)return;const Je={active:ze};De(Pe,Be.options,Je)===!0&&(Me.dndKit={capturedBy:Be.sensor},N.current=Ue,re(Pe,Be))},[S,re]),te=$L(g,le);qL(g),Ur(()=>{U&&w===wn.Initializing&&b(wn.Initialized)},[U,w]),k.useEffect(()=>{const{onDragMove:De}=R.current,{active:Be,activatorEvent:Pe,collisions:Ue,over:Me}=X.current;if(!Be||!Pe)return;const ze={active:Be,activatorEvent:Pe,collisions:Ue,delta:{x:Le.x,y:Le.y},over:Me};jr.unstable_batchedUpdates(()=>{De==null||De(ze),d({type:"onDragMove",event:ze})})},[Le.x,Le.y]),k.useEffect(()=>{const{active:De,activatorEvent:Be,collisions:Pe,droppableContainers:Ue,scrollAdjustedTranslate:Me}=X.current;if(!De||N.current==null||!Be||!Me)return;const{onDragOver:ze}=R.current,Je=Ue.get(q),nt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,we={active:De,activatorEvent:Be,collisions:Pe,delta:{x:Me.x,y:Me.y},over:nt};jr.unstable_batchedUpdates(()=>{ge(nt),ze==null||ze(we),d({type:"onDragOver",event:we})})},[q]),Ur(()=>{X.current={activatorEvent:$,active:D,activeNode:Z,collisionRect:Re,collisions:Ce,droppableRects:W,draggableNodes:S,draggingNode:fe,draggingNodeRect:Ee,droppableContainers:L,over:Q,scrollableAncestors:pe,scrollAdjustedTranslate:Le},M.current={initial:Ee,translated:Re}},[D,Z,Ce,Re,S,fe,Ee,W,L,Q,pe,Le]),OL({...I,delta:E,draggingRect:Re,pointerCoordinates:se,scrollableAncestors:pe,scrollableAncestorRects:_e});const ue=k.useMemo(()=>({active:D,activeNode:Z,activeNodeRect:U,activatorEvent:$,collisions:Ce,containerNodeRect:J,dragOverlay:ce,draggableNodes:S,droppableContainers:L,droppableRects:W,over:Q,measureDroppableContainers:K,scrollableAncestors:pe,scrollableAncestorRects:_e,measuringConfiguration:j,measuringScheduled:ee,windowRect:je}),[D,Z,U,$,Ce,J,ce,S,L,W,Q,K,pe,_e,j,ee,je]),Oe=k.useMemo(()=>({activatorEvent:$,activators:te,active:D,activeNodeRect:U,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:S,over:Q,measureDroppableContainers:K}),[$,te,D,U,f,P,S,Q,K]);return mt.createElement(w1.Provider,{value:m},mt.createElement(hc.Provider,{value:Oe},mt.createElement(A1.Provider,{value:ue},mt.createElement(P1.Provider,{value:ie},c)),mt.createElement(sR,{disabled:(i==null?void 0:i.restoreFocus)===!1})),mt.createElement(nL,{...i,hiddenTextDescribedById:P}));function Fe(){const De=(H==null?void 0:H.autoScrollEnabled)===!1,Be=typeof o=="object"?o.enabled===!1:o===!1,Pe=x&&!De&&!Be;return typeof o=="object"?{...o,enabled:Pe}:{enabled:Pe}}}),uR=k.createContext(null),Wg="button",hR="Draggable";function dR(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=Yo(hR),{activators:l,activatorEvent:i,active:o,activeNodeRect:c,ariaDescribedById:g,draggableNodes:u,over:p}=k.useContext(hc),{role:_=Wg,roleDescription:y="draggable",tabIndex:v=0}=s??{},h=(o==null?void 0:o.id)===t,f=k.useContext(h?P1:uR),[d,m]=Al(),[w,b]=Al(),x=XL(l,t),C=Mo(r);Ur(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===Wg?!0:void 0,"aria-roledescription":y,"aria-describedby":g.draggable}),[n,_,v,h,y,g.draggable]);return{active:o,activatorEvent:i,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:p,setNodeRef:m,setActivatorNodeRef:b,transform:f}}function fR(){return k.useContext(A1)}const pR="Droppable",mR={timeout:25};function gR(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=Yo(pR),{active:l,dispatch:i,over:o,measureDroppableContainers:c}=k.useContext(hc),g=k.useRef({disabled:r}),u=k.useRef(!1),p=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...mR,...s},f=Mo(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},h)},[h]),m=uc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{m&&(E&&(m.unobserve(E),u.current=!1),S&&m.observe(S))},[m]),[b,x]=Al(w),C=Mo(t);return k.useEffect(()=>{!m||!b.current||(m.disconnect(),u.current=!1,m.observe(b.current))},[b,m]),k.useEffect(()=>(i({type:wt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:p,data:C}}),()=>i({type:wt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==g.current.disabled&&(i({type:wt.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,i]),{active:l,rect:p,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function I1(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function vR(e,t){return e.reduce((r,n,s)=>{const a=t.get(n);return a&&(r[s]=a),r},Array(e.length))}function ba(e){return e!==null&&e>=0}function _R(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function yR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B1=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const a=I1(t,n,r),l=t[s],i=a[s];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},Ca={scaleX:1,scaleY:1},wR=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:a,overIndex:l}=e;const i=(t=a[r])!=null?t:n;if(!i)return null;if(s===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(i.top+i.height):c.top-i.top,...Ca}:null}const o=SR(a,s,r);return s>r&&s<=l?{x:0,y:-i.height-o,...Ca}:s<r&&s>=l?{x:0,y:i.height+o,...Ca}:{x:0,y:0,...Ca}};function SR(e,t,r){const n=e[t],s=e[t-1],a=e[t+1];return n?r<t?s?n.top-(s.top+s.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const O1="Sortable",N1=mt.createContext({activeIndex:-1,containerId:O1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B1,disabled:{draggable:!1,droppable:!1}});function xR(e){let{children:t,id:r,items:n,strategy:s=B1,disabled:a=!1}=e;const{active:l,dragOverlay:i,droppableRects:o,over:c,measureDroppableContainers:g}=fR(),u=Yo(O1,r),p=i.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,f=k.useRef(_),d=!_R(_,f.current),m=h!==-1&&v===-1||d,w=yR(a);Ur(()=>{d&&y&&g(_)},[d,_,y,g]),k.useEffect(()=>{f.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:m,items:_,overIndex:h,useDragOverlay:p,sortedRects:vR(_,o),strategy:s}),[v,u,w.draggable,w.droppable,m,_,h,o,p,s]);return mt.createElement(N1.Provider,{value:b},t)}const bR=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return I1(r,n,s).indexOf(t)},CR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:a,newIndex:l,previousItems:i,previousContainerId:o,transition:c}=e;return!c||!n||i!==a&&s===l?!1:r?!0:l!==s&&t===o},ER={duration:200,easing:"ease"},j1="transform",kR=Ao.Transition.toString({property:j1,duration:0,easing:"linear"}),LR={roleDescription:"sortable"};function RR(e){let{disabled:t,index:r,node:n,rect:s}=e;const[a,l]=k.useState(null),i=k.useRef(r);return Ur(()=>{if(!t&&r!==i.current&&n.current){const o=s.current;if(o){const c=_s(n.current,{ignoreTransform:!0}),g={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(g.x||g.y)&&l(g)}}r!==i.current&&(i.current=r)},[t,r,n,s]),k.useEffect(()=>{a&&l(null)},[a]),a}function TR(e){let{animateLayoutChanges:t=CR,attributes:r,disabled:n,data:s,getNewIndex:a=bR,id:l,strategy:i,resizeObserverConfig:o,transition:c=ER}=e;const{items:g,containerId:u,activeIndex:p,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:f,strategy:d}=k.useContext(N1),m=DR(n,_),w=g.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:g},...s}),[u,s,w,g]),x=k.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=gR({id:l,data:b,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:N,setNodeRef:H,listeners:F,isDragging:$,over:O,setActivatorNodeRef:R,transform:P}=dR({id:l,data:b,attributes:{...LR,...r},disabled:m.draggable}),B=Wk(L,H),j=!!A,W=j&&!y&&ba(p)&&ba(h),K=!f&&$,ee=K&&W?P:null,z=W?ee??(i??d)({rects:v,activeNodeRect:D,activeIndex:p,overIndex:h,index:w}):null,I=ba(p)&&ba(h)?a({id:l,items:g,activeIndex:p,overIndex:h}):w,V=A==null?void 0:A.id,U=k.useRef({activeId:V,items:g,newIndex:I,containerId:u}),J=g!==U.current.items,X=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:g,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:c,wasDragging:U.current.activeId!=null}),me=RR({disabled:!X,index:w,node:S,rect:C});return k.useEffect(()=>{j&&U.current.newIndex!==I&&(U.current.newIndex=I),u!==U.current.containerId&&(U.current.containerId=u),g!==U.current.items&&(U.current.items=g)},[j,I,u,g]),k.useEffect(()=>{if(V===U.current.activeId)return;if(V!=null&&U.current.activeId==null){U.current.activeId=V;return}const fe=setTimeout(()=>{U.current.activeId=V},50);return()=>clearTimeout(fe)},[V]),{active:A,activeIndex:p,attributes:N,data:b,rect:C,index:w,newIndex:I,items:g,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:O,setNodeRef:B,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:me??z,transition:ce()};function ce(){if(me||J&&U.current.newIndex===w)return kR;if(!(K&&!jf(M)||!c)&&(j||X))return Ao.Transition.toString({...c,property:j1})}}function DR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}qe.Down,qe.Right,qe.Up,qe.Left;const Ea={permission:0,waiting:1,working:2,unknown:3};function oo(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const MR={mode:"created",direction:"desc"};function Uf(e,t=MR){const{mode:r,direction:n,manualOrder:s}=t;if(r==="manual"&&s&&s.length>0){const a=new Map(s.map((l,i)=>[l,i]));return[...e].sort((l,i)=>{const o=oo(l),c=oo(i),g=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(i.id)??1/0;return g===1/0&&u===1/0?Date.parse(i.createdAt)-Date.parse(l.createdAt):g-u})}return[...e].sort((a,l)=>{if(r==="status"){const c=Ea[a.status]??Ea.unknown,g=Ea[l.status]??Ea.unknown;return c!==g?c-g:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const i=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-i:i-o})}function AR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.projectPath)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function PR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.host)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function Wf(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function ui(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function IR(e){const t=e.map(i=>{const o=i.trim(),c=o.replace(/[\\/]+$/,""),g=c.split(/[\\/]/).filter(Boolean);return{path:i,parts:g,fallback:c||o||i}}),r=new Map;for(const i of t)r.set(i.path,1);let n=!0;for(;n;){n=!1;const i=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");i.set(g,(i.get(g)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");(i.get(g)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const s=new Map,a=new Map;for(const i of t){let o=i.fallback;if(i.parts.length>0){const c=r.get(i.path)??1;o=i.parts.slice(-c).join("/")}s.set(i.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const i of t){let o=s.get(i.path)??i.fallback;(a.get(o)??0)>1&&(o=i.fallback),l.set(i.path,o)}return l}function F1(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const We=Yd()(Jd((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var g;const n=t(),s=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,i=new Set(r.map(u=>u.id)),o=a.filter(u=>!i.has(u.id)&&!l.has(u.id));let c=s;if(s!==null&&!r.some(u=>u.id===s)){const{sessionSortMode:u,sessionSortDirection:p}=de.getState();c=((g=Uf(r,{mode:u,direction:p})[0])==null?void 0:g.id)??null}if(o.length>0){const u=new Map(l);for(const p of o)u.set(p.id,p);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(s=>s.id===r.id?r:s)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(s=>s.id===r);if(n){const s=new Map(t().exitingSessions);s.set(r,n),e({exitingSessions:s})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:ic(()=>Qd),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function Vg(e,t,r=!1){const[n,s]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const g=setTimeout(()=>{l.current&&(s(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(g)}a.current=e},[e,t,r]),[n,()=>s(!1)]}function BR(e,t,r,n){const s=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const i=s.current.get(l);i&&(clearTimeout(i),s.current.delete(l)),r(l)}else if(!s.current.has(l)){const i=setTimeout(()=>{s.current.delete(l),r(l)},n+100);s.current.set(l,i)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of s.current.values())clearTimeout(a);s.current.clear()},[])}function OR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function NR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function jR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const FR=[["claude",OR],["codex",NR],["pi",jR]];function dc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[s,a]of FR)if(n.startsWith(s))return T.jsx(a,{className:r});return T.jsx(iC,{className:r})}const $R=360;function HR(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function $1(e){return{"--badge-hue":`${HR(e)%$R}`}}function H1({name:e,fullPath:t,className:r=""}){const n=$1(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const zR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:s,onResume:a,onPreview:l,onSetPinned:i}){const o=Wf(t.lastActivityAt),c=ui(t.projectPath),g=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,p=s&&!!t.lastUserMessage,_=r?F1(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},m=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",m)}},[v]);const f=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:f,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:g}),t.lastResumeError&&T.jsx(Ab,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||p)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(H1,{name:c,fullPath:t.projectPath}),p&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[i&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),i(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]})]})]})});function UR({name:e,className:t=""}){const r=$1(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function WR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),g=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var f;const h=v.target;h&&((f=i.current)!=null&&f.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[s]);const p=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:g,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>p(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function VR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>IR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),g=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??ui(y)??y).join(", "),[o,t]),p=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??ui(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const f=h.target;f&&((d=i.current)!=null&&d.contains(f))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[s]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(f=>v.has(f));r(h)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:p}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??ui(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),g&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}function KR(e){if(!e.trim())return null;try{const t=JSON.parse(e);let r="",n="other";if(typeof t.message=="string")r=t.message;else if(typeof t.content=="string")r=t.content;else if(t.type==="user"&&typeof t.message=="object"){const s=t.message;r=typeof s.content=="string"?s.content:"",n="user"}else if(t.type==="assistant"&&t.message){const s=t.message;typeof s.content=="string"?r=s.content:Array.isArray(s.content)&&(r=s.content.filter(a=>typeof a=="object"&&a!==null&&"text"in a).map(a=>a.text).join(`
53
- `)),n="assistant"}if((t.type==="tool_use"||t.event==="tool_use")&&(r=`[Tool: ${t.name??"tool"}]`,n="assistant"),t.type==="result"&&typeof t.result=="string"&&(r=t.result,n="system"),t.payload&&typeof t.payload=="object"){const s=t.payload;typeof s.content=="string"?r=s.content:typeof s.message=="string"&&(r=s.message)}return r.trim()?{type:n,content:r.trim(),raw:e}:null}catch{return{type:"other",content:e.trim(),raw:e}}}function GR({session:e,onClose:t,onResume:r}){const[n,s]=k.useState(!0),[a,l]=k.useState(null),[i,o]=k.useState(null),[c,g]=k.useState(!1),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{(async()=>{try{const f=await fetch(`/api/session-preview/${e.sessionId}`);if(!f.ok){const m=await f.json();throw new Error(m.error||"Failed to load preview")}const d=await f.json();o(d)}catch(f){l(f instanceof Error?f.message:"Failed to load preview")}finally{s(!1)}})()},[e.sessionId]),k.useEffect(()=>{u.current&&i&&(u.current.scrollTop=u.current.scrollHeight)},[i,c]),k.useEffect(()=>{const h=f=>{f.key==="Escape"?(f.stopPropagation(),t()):f.key==="Enter"&&!n&&!a&&(f.preventDefault(),r(e.sessionId))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,r,e.sessionId,n,a]),k.useEffect(()=>{var h;(h=p.current)==null||h.focus()},[]);const _=e.displayName||ui(e.projectPath)||e.sessionId.slice(0,8),y=Wf(e.lastActivityAt),v=(i==null?void 0:i.lines.map(KR).filter(h=>h!==null).slice(-30))??[];return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"preview-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&t()},children:T.jsxs("div",{ref:p,tabIndex:-1,className:"flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[T.jsx(dc,{agentType:e.agentType,className:"h-5 w-5 shrink-0 text-muted"}),T.jsxs("div",{className:"min-w-0 flex-1",children:[T.jsx("h2",{id:"preview-title",className:"truncate text-sm font-semibold text-primary",children:_}),T.jsxs("p",{className:"truncate text-xs text-muted",title:e.projectPath,children:[ui(e.projectPath)," · ",y]})]}),T.jsx("button",{type:"button",onClick:()=>g(h=>!h),className:`btn text-xs ${c?"btn-primary":""}`,children:c?"Parsed":"Raw"})]}),T.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 font-mono text-xs",children:[n&&T.jsx("div",{className:"flex items-center justify-center py-8 text-muted",children:"Loading preview..."}),a&&T.jsx("div",{className:"flex items-center justify-center py-8 text-danger",children:a}),i&&!c&&T.jsx("div",{className:"space-y-2",children:v.length===0?T.jsx("div",{className:"py-8 text-center text-muted",children:"No readable content found. Try raw view."}):v.map((h,f)=>T.jsx("div",{className:`rounded px-2 py-1 ${h.type==="user"?"bg-blue-500/10 text-blue-400":h.type==="assistant"?"bg-emerald-500/10 text-emerald-400":h.type==="system"?"bg-yellow-500/10 text-yellow-400":"text-muted"}`,children:T.jsx("span",{className:"whitespace-pre-wrap break-words",children:h.content.length>500?`${h.content.slice(0,500)}...`:h.content})},f))}),i&&c&&T.jsx("div",{className:"space-y-1",children:i.lines.slice(-50).map((h,f)=>T.jsx("div",{className:"whitespace-pre-wrap break-all text-muted",children:h||" "},f))})]}),T.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>r(e.sessionId),disabled:n||!!a,className:"btn btn-primary",children:"Resume"})]})]})})}const Kg={working:"bg-green-500/20 text-green-600",waiting:"bg-zinc-500/20 text-zinc-400",permission:"bg-amber-500/20 text-amber-600",unknown:"bg-zinc-500/20 text-zinc-400"};function qR(){const[,e]=k.useState(0);k.useEffect(()=>{const t=setInterval(()=>e(r=>r+1),3e4);return()=>clearInterval(t)},[])}function z1({sessions:e,inactiveSessions:t=[],selectedSessionId:r,loading:n,error:s,onSelect:a,onRename:l,onResume:i,onKill:o,onDuplicate:c,onSetPinned:g}){qR();const[u,p]=k.useState(null),_=de(G=>G.inactiveSessionsExpanded),y=de(G=>G.setInactiveSessionsExpanded),[v,h]=k.useState(null),[f,d]=k.useState(20),m=v1();k.useEffect(()=>{_||d(20)},[_]);const w=200,[b,x]=Vg(e.length,w),[C,S]=Vg(t.length,w,!0),E=k.useRef(new Set(e.map(G=>G.id))),L=k.useRef(new Set(t.map(G=>G.sessionId))),[A,M]=k.useState(new Set);k.useEffect(()=>{var te;const G=new Set(e.map(ue=>ue.id)),re=new Set(t.map(ue=>ue.sessionId)),le=new Set;for(const ue of G)E.current.has(ue)||le.add(ue);for(const ue of e){const Oe=(te=ue.agentSessionId)==null?void 0:te.trim();Oe&&L.current.has(Oe)&&!re.has(Oe)&&le.add(ue.id)}E.current=G,L.current=re,le.size>0&&M(le)},[e,t]),k.useEffect(()=>{if(A.size===0)return;const G=setTimeout(()=>M(new Set),500);return()=>clearTimeout(G)},[A]);const D=de(G=>G.shortcutModifier),N=Yi(Uo(D)),H=de(G=>G.sessionSortMode),F=de(G=>G.setSessionSortMode),$=de(G=>G.sessionSortDirection),O=de(G=>G.manualSessionOrder),R=de(G=>G.setManualSessionOrder),P=de(G=>G.showProjectName),B=de(G=>G.showLastUserMessage),j=de(G=>G.showSessionIdPrefix),W=de(G=>G.projectFilters),K=de(G=>G.setProjectFilters),ee=de(G=>G.hostFilters),Z=de(G=>G.setHostFilters),z=We(G=>G.exitingSessions),I=We(G=>G.clearExitingSession),V=We(G=>G.hostStatuses),U=We(G=>G.remoteAllowControl);BR(e,z,I,w),k.useEffect(()=>{if(O.length===0)return;const G=new Set;for(const le of e)G.add(oo(le)),G.add(le.id);for(const le of t)G.add(le.sessionId);const re=O.filter(le=>G.has(le));re.length!==O.length&&R(re)},[e,t,O,R]);const X=k.useMemo(()=>Uf(e,{mode:H,direction:$,manualOrder:O}),[e,H,$,O]),me=k.useMemo(()=>AR(e,t),[e,t]),ce=k.useMemo(()=>{const G=PR(e,t),re=V.map(ue=>ue.host),le=new Set,te=[];for(const ue of re)!ue||le.has(ue)||(le.add(ue),te.push(ue));for(const ue of G)!ue||le.has(ue)||(le.add(ue),te.push(ue));return te},[e,t,V]),fe=k.useMemo(()=>ce.length>1,[ce]),Ee=k.useMemo(()=>{let G=X;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),ee.length>0&&(G=G.filter(re=>ee.includes(re.host??""))),G},[X,W,ee]),ae=k.useMemo(()=>{const G=W.length===0?"all-projects":W.join("|"),re=ee.length===0?"all-hosts":ee.join("|");return`${G}::${re}`},[W,ee]),Te=k.useRef(new Set(Ee.map(G=>G.id))),[je,pe]=k.useState(new Set);k.useEffect(()=>{const G=new Set(Ee.map(le=>le.id)),re=new Set;for(const le of G)Te.current.has(le)||A.has(le)||re.add(le);Te.current=G,re.size>0&&pe(re)},[Ee,A]),k.useEffect(()=>{if(je.size===0)return;const G=setTimeout(()=>pe(new Set),500);return()=>clearTimeout(G)},[je]);const _e=k.useMemo(()=>{let G=t;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),ee.length>0&&(G=G.filter(re=>ee.includes(re.host??""))),G},[t,W,ee]),ke=k.useMemo(()=>{if(W.length===0)return 0;const G=new Set(W);return e.filter(re=>!G.has(re.projectPath)&&re.status==="permission").length},[e,W]);k.useEffect(()=>{if(W.length===0||me.length===0)return;const G=new Set(me),re=W.filter(le=>G.has(le));re.length!==W.length&&K(re)},[W,me,K]),k.useEffect(()=>{if(ee.length===0||ce.length===0)return;const G=new Set(ce),re=ee.filter(le=>G.has(le));re.length!==ee.length&&Z(re)},[ee,ce,Z]);const se=sL(iL(zf,{activationConstraint:{distance:8}})),[be,oe]=k.useState(null),[he,Le]=k.useState(null),[Re,Ce]=k.useState(!1),q=k.useCallback(G=>{oe(G.active.id),Ce(!0)},[]),Q=k.useCallback(G=>{var re;Le((re=G.over)==null?void 0:re.id)},[]),ge=k.useCallback(G=>{const{active:re,over:le}=G;if(oe(null),Le(null),!le||re.id===le.id){setTimeout(()=>Ce(!1),100);return}const te=Ee.findIndex(Me=>Me.id===re.id),ue=Ee.findIndex(Me=>Me.id===le.id);if(te===-1||ue===-1){setTimeout(()=>Ce(!1),100);return}const Oe=Ee.map(Me=>oo(Me)),[Fe]=Oe.splice(te,1);Oe.splice(ue,0,Fe);const De=X.map(Me=>oo(Me)),Be=new Set(Oe);let Pe=0;const Ue=De.map(Me=>{if(!Be.has(Me))return Me;const ze=Oe[Pe];return Pe+=1,ze});H!=="manual"&&F("manual"),R(Ue),setTimeout(()=>Ce(!1),100)},[Ee,X,H,F,R]),He=k.useCallback(()=>{oe(null),Le(null),setTimeout(()=>Ce(!1),100)},[]);k.useEffect(()=>{if(!be&&!he)return;const G=new Set(Ee.map(le=>le.id));let re=!1;be&&!G.has(be)&&(oe(null),re=!0),he&&!G.has(he)&&(Le(null),re=!0),re&&Ce(!1)},[Ee,be,he]);const ie=(G,re)=>{l(G,re),p(null)};return T.jsxs("aside",{className:"flex min-h-0 flex-1 flex-col border-r border-border bg-elevated",children:[s&&T.jsx("div",{className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:s}),T.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"sticky top-0 z-10 flex h-10 items-center justify-between border-b border-border bg-elevated px-3",children:[T.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted",children:"Sessions"}),T.jsxs("div",{className:"flex items-center gap-4",children:[fe&&T.jsx(WR,{hosts:ce,selectedHosts:ee,onSelect:Z,statuses:V}),T.jsx(VR,{projects:me,selectedProjects:W,onSelect:K,hasHiddenPermissions:ke>0}),T.jsx(Nh.span,{className:"w-8 text-right text-xs text-muted",animate:b&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:x,children:Ee.length})]})]}),n?T.jsx("div",{className:"space-y-1 p-2",children:[0,1,2].map(G=>T.jsx("div",{className:"h-14 animate-pulse rounded bg-surface"},G))}):Ee.length===0?T.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted",children:"No sessions"}):T.jsx(cR,{sensors:se,collisionDetection:uL,onDragStart:q,onDragOver:Q,onDragEnd:ge,onDragCancel:He,children:T.jsx(xR,{items:Ee.map(G=>G.id),strategy:wR,children:T.jsx("div",{children:T.jsx(f5,{initial:!1,children:Ee.map((G,re)=>{const le=A.has(G.id),te=je.has(G.id),ue=G.remote===!0,Oe=G.source==="managed",Fe=!ue||U&&Oe,De=be?Ee.findIndex(Me=>Me.id===be):-1,Pe=he===G.id&&be!==G.id?De>re?"above":"below":null,Ue=le||te;return T.jsx(U1,{session:G,isNew:Ue,exitDuration:w,prefersReducedMotion:m,layoutAnimationsDisabled:Re,isSelected:G.id===r,isEditing:G.id===u,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,showHostInfo:fe,dropIndicator:Pe,onSelect:()=>a(G.id),onStartEdit:Fe?()=>p(G.id):void 0,onCancelEdit:()=>p(null),onRename:Me=>ie(G.id,Me),onKill:o&&Fe?()=>o(G.id):void 0,onDuplicate:c&&Fe?()=>c(G.id):void 0,onSetPinned:g&&G.agentSessionId?Me=>g(G.agentSessionId.trim(),Me):void 0},G.id)})})},ae)})}),_e.length>0&&T.jsxs("div",{className:"border-t border-border",children:[T.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary",children:[T.jsxs("span",{className:"flex items-center gap-2",children:[_?T.jsx(Zd,{className:"h-4 w-4"}):T.jsx(Bb,{className:"h-4 w-4"}),"Inactive Sessions"]}),T.jsx(Nh.span,{className:"w-8 text-right text-xs",animate:C&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:S,children:_e.length})]}),_&&T.jsxs("div",{className:"py-1",children:[_e.slice(0,f).map(G=>T.jsx(zR,{session:G,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,onResume:re=>i==null?void 0:i(re),onPreview:h,onSetPinned:g},G.sessionId)),_e.length>f&&T.jsxs("button",{type:"button",onClick:()=>d(G=>G+20),className:"w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover",children:["Show more (",_e.length-f," remaining)"]})]})]})]}),T.jsx("div",{className:"hidden shrink-0 border-t border-border px-3 py-2 md:block",children:T.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted",children:[T.jsxs("span",{children:[N,"[ ] nav"]}),T.jsxs("span",{children:[N,"N new"]}),T.jsxs("span",{children:[N,"X kill"]})]})}),v&&T.jsx(GR,{session:v,onClose:()=>h(null),onResume:G=>{h(null),i==null||i(G)}})]})}const U1=k.forwardRef(function({session:t,isNew:r,exitDuration:n,prefersReducedMotion:s,layoutAnimationsDisabled:a,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,dropIndicator:p,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m},w){const{attributes:b,listeners:x,setNodeRef:C,transform:S,transition:E,isDragging:L}=TR({id:t.id,animateLayoutChanges:({isSorting:H,wasDragging:F})=>H||F}),A=Ao.Transform.toString(S),D={...!!(s&&A)?{transform:A,transition:E}:{},zIndex:L?10:void 0,opacity:L?.9:void 0},N=k.useCallback(H=>{C(H),typeof w=="function"?w(H):w&&(w.current=H)},[C,w]);return T.jsxs(Nh.div,{ref:N,style:{...D,overflow:"hidden"},className:"relative",layout:!s&&!L&&!a&&!r,transformTemplate:(H,F)=>A?!F||F==="none"?A:`${A} ${F}`:F,initial:s||!r?!1:{opacity:0,scale:.97},animate:s?{opacity:1}:r?{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:s?{opacity:0}:{opacity:0,height:0,scale:.97},transition:s?{duration:0}:{layout:{type:"spring",stiffness:500,damping:35},opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:"easeOut"}},...b,...x,children:[p==="above"&&T.jsx("div",{className:"absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"}),T.jsx(XR,{session:t,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,isDragging:L,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m}),p==="below"&&T.jsx("div",{className:"absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"})]})});U1.displayName="SortableSessionItem";function XR({session:e,isSelected:t,isEditing:r,showSessionIdPrefix:n,showProjectName:s,showLastUserMessage:a,showHostInfo:l,isDragging:i=!1,onSelect:o,onStartEdit:c,onCancelEdit:g,onRename:u,onKill:p,onDuplicate:_,onSetPinned:y}){var Z,z,I,V;const v=Wf(e.lastActivity),h=k.useRef(null),f=k.useRef(null),d=((Z=e.agentSessionName)==null?void 0:Z.trim())||((z=e.name)==null?void 0:z.trim())||e.id,[m,w]=k.useState(d),b=k.useRef(null),[x,C]=k.useState(null),S=ui(e.projectPath),E=(I=e.host)==null?void 0:I.trim(),L=e.status==="permission",A=(V=e.agentSessionId)==null?void 0:V.trim(),M=n&&A?F1(A):"",D=s&&!!S,N=l&&!!E,H=a&&!!e.lastUserMessage,F=k.useRef(e.status),[$,O]=k.useState(!1);k.useEffect(()=>{const U=F.current,J=e.status;U==="working"&&J==="waiting"?O(!0):F.current=J},[e.status]);const R=()=>{O(!1),F.current=e.status};k.useEffect(()=>{r&&h.current&&(h.current.focus(),h.current.select())},[r]),k.useEffect(()=>{w(d)},[d]);const P=()=>{const U=m.trim();U&&U!==d?u(U):g()},B=U=>{U.key==="Enter"?(U.preventDefault(),P()):U.key==="Escape"&&(U.preventDefault(),w(d),g())},j=k.useRef(null),W=U=>{if(i)return;const J=U.touches[0];j.current={x:J.clientX,y:J.clientY},b.current=setTimeout(()=>{j.current&&C(j.current)},500)},K=()=>{b.current&&(clearTimeout(b.current),b.current=null)};k.useEffect(()=>{if(!x)return;const U=X=>{f.current&&!f.current.contains(X.target)&&C(null)},J=X=>{X.key==="Escape"&&C(null)};return document.addEventListener("mousedown",U),document.addEventListener("touchstart",U),document.addEventListener("keydown",J),()=>{document.removeEventListener("mousedown",U),document.removeEventListener("touchstart",U),document.removeEventListener("keydown",J)}},[x]);const ee=U=>{U.preventDefault(),U.stopPropagation(),C({x:U.clientX,y:U.clientY})};return T.jsxs("div",{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?"selected":""} ${i?"cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated":"cursor-grab"}`,role:"button",tabIndex:0,"data-testid":"session-card","data-session-id":e.id,onClick:i?void 0:o,onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&o()},onContextMenu:ee,onTouchStart:W,onTouchEnd:K,onTouchCancel:K,children:[T.jsxs("div",{className:"flex flex-col gap-0.5 pl-0.5",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:e.agentType,command:e.command,className:"h-3.5 w-3.5 shrink-0 text-muted"}),r?T.jsx("input",{ref:h,type:"text",value:m,onChange:U=>w(U.target.value),onBlur:P,onKeyDown:B,onClick:U=>U.stopPropagation(),className:"min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:d}),e.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-primary","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),M&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:A,children:M}),L?T.jsx("span",{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${Kg[e.status]} pulse-approval`,onAnimationEnd:R,children:T.jsx(Kb,{className:"h-3 w-3","aria-label":"Needs input"})}):T.jsx("span",{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${Kg[e.status]}${$?" pulse-complete":""}`,onAnimationEnd:R,children:v})]}),(D||N||H)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[N&&T.jsx(UR,{name:E}),D&&T.jsx(H1,{name:S,fullPath:e.projectPath}),H&&T.jsxs("span",{className:"line-clamp-2 text-xs italic text-muted",children:['"',e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+"…":e.lastUserMessage,'"']})]})]}),x&&T.jsxs("div",{ref:f,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:x.x,top:x.y},role:"menu",children:[c&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),c()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",children:[T.jsx(I0,{width:14,height:14}),"Rename"]}),_&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),_()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:"Create a copy in a new tmux window",children:[T.jsx(P0,{width:14,height:14}),"Duplicate"]}),y&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),y(!e.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),e.isPinned?"Unpin":"Pin"]}),e.logFilePath&&T.jsxs("button",{onClick:U=>{U.stopPropagation();const J=e.logFilePath;if(C(null),J){const X=document.createElement("textarea");X.value=J,X.style.position="fixed",X.style.left="-9999px",document.body.appendChild(X),X.focus(),X.select();try{document.execCommand("copy")}catch{navigator.clipboard.writeText(J).catch(()=>{})}document.body.removeChild(X)}},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]}),p&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"my-1 border-t border-border"}),T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),p()},className:"w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2",role:"menuitem",children:[T.jsx(mh,{width:14,height:14}),"Kill Session"]})]})]})]})}var W1={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(globalThis,()=>(()=>{var r={4567:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const u=o(9042),p=o(9924),_=o(844),y=o(4725),v=o(2585),h=o(3656);let f=i.AccessibilityManager=class extends _.Disposable{constructor(d,m,w,b){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=b,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(x=>this._handleResize(x.rows))),this.register(this._terminal.onRender(x=>this._refreshRows(x.start,x.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(x=>this._handleChar(x))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
52
+ `},rL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nL(e){let{announcements:t=rL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=tL}=e;const{announce:a,announcement:l}=Qk(),i=Yo("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),Zk(k.useMemo(()=>({onDragStart(u){let{active:p}=u;a(t.onDragStart({active:p}))},onDragMove(u){let{active:p,over:_}=u;t.onDragMove&&a(t.onDragMove({active:p,over:_}))},onDragOver(u){let{active:p,over:_}=u;a(t.onDragOver({active:p,over:_}))},onDragEnd(u){let{active:p,over:_}=u;a(t.onDragEnd({active:p,over:_}))},onDragCancel(u){let{active:p,over:_}=u;a(t.onDragCancel({active:p,over:_}))}}),[a,t])),!o)return null;const g=mt.createElement(mt.Fragment,null,mt.createElement(Yk,{id:n,value:s.draggable}),mt.createElement(Jk,{id:i,announcement:l}));return r?jr.createPortal(g,r):g}var wt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(wt||(wt={}));function Il(){}function iL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ir=Object.freeze({x:0,y:0});function oL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function lL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function cL(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Ig(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const uL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Ig(t,t.left,t.top),a=[];for(const l of n){const{id:i}=l,o=r.get(i);if(o){const c=oL(Ig(o),s);a.push({id:i,data:{droppableContainer:l,value:c}})}}return a.sort(aL)};function hL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=s-n,i=a-r;if(n<s&&r<a){const o=t.width*t.height,c=e.width*e.height,g=l*i,u=g/(o+c-g);return Number(u.toFixed(4))}return 0}const dL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const a of n){const{id:l}=a,i=r.get(l);if(i){const o=hL(i,t);o>0&&s.push({id:l,data:{droppableContainer:a,value:o}})}}return s.sort(lL)};function fL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function S1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ir}function pL(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,i)=>({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...r})}}const mL=pL(1);function gL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vL(e,t,r){const n=gL(t);if(!n)return e;const{scaleX:s,scaleY:a,x:l,y:i}=n,o=e.left-l-(1-s)*parseFloat(r),c=e.top-i-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=s?e.width/s:e.width,u=a?e.height/a:e.height;return{width:g,height:u,top:c,right:o+g,bottom:c+u,left:o}}const _L={ignoreTransform:!1};function _s(e,t){t===void 0&&(t=_L);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:g}=nr(e).getComputedStyle(e);c&&(r=vL(r,c,g))}const{top:n,left:s,width:a,height:l,bottom:i,right:o}=r;return{top:n,left:s,width:a,height:l,bottom:i,right:o}}function Bg(e){return _s(e,{ignoreTransform:!0})}function yL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function wL(e,t){return t===void 0&&(t=nr(e).getComputedStyle(e)),t.position==="fixed"}function SL(e,t){t===void 0&&(t=nr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const a=t[s];return typeof a=="string"?r.test(a):!1})}function Ff(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Of(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!qo(s)||_1(s)||r.includes(s))return r;const a=nr(e).getComputedStyle(s);return s!==e&&SL(s,a)&&r.push(s),wL(s,a)?r:n(s.parentNode)}return e?n(e):r}function x1(e){const[t]=Ff(e,1);return t??null}function iu(e){return!cc||!e?null:gs(e)?e:Bf(e)?Of(e)||e===vs(e).scrollingElement?window:qo(e)?e:null:null}function b1(e){return gs(e)?e.scrollX:e.scrollLeft}function C1(e){return gs(e)?e.scrollY:e.scrollTop}function $h(e){return{x:b1(e),y:C1(e)}}var kt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kt||(kt={}));function E1(e){return!cc||!e?!1:e===document.scrollingElement}function k1(e){const t={x:0,y:0},r=E1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:a,isBottom:l,isRight:i,maxScroll:n,minScroll:t}}const xL={x:.2,y:.2};function bL(e,t,r,n,s){let{top:a,left:l,right:i,bottom:o}=r;n===void 0&&(n=10),s===void 0&&(s=xL);const{isTop:c,isBottom:g,isLeft:u,isRight:p}=k1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!c&&a<=t.top+v.height?(_.y=kt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!g&&o>=t.bottom-v.height&&(_.y=kt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!p&&i>=t.right-v.width?(_.x=kt.Forward,y.x=n*Math.abs((t.right-v.width-i)/v.width)):!u&&l<=t.left+v.width&&(_.x=kt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function CL(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function L1(e){return e.reduce((t,r)=>Qi(t,$h(r)),Ir)}function EL(e){return e.reduce((t,r)=>t+b1(r),0)}function kL(e){return e.reduce((t,r)=>t+C1(r),0)}function LL(e,t){if(t===void 0&&(t=_s),!e)return;const{top:r,left:n,bottom:s,right:a}=t(e);x1(e)&&(s<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const RL=[["x",["left","right"],EL],["y",["top","bottom"],kL]];class $f{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ff(r),s=L1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,i]of RL)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=i(n),g=s[a]-c;return this.rect[o]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class no{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function TL(e){const{EventTarget:t}=nr(e);return e instanceof t?e:vs(e)}function su(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var fr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fr||(fr={}));function Og(e){e.preventDefault()}function DL(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(qe||(qe={}));const R1={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},ML=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case qe.Right:return{...r,x:r.x+25};case qe.Left:return{...r,x:r.x-25};case qe.Down:return{...r,y:r.y+25};case qe.Up:return{...r,y:r.y-25}}};class T1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new no(vs(r)),this.windowListeners=new no(nr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&LL(n),r(Ir)}handleKeyDown(t){if(jf(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:a=R1,coordinateGetter:l=ML,scrollBehavior:i="smooth"}=s,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,g=c?{x:c.left,y:c.top}:Ir;this.referenceCoordinates||(this.referenceCoordinates=g);const u=l(t,{active:r,context:n.current,currentCoordinates:g});if(u){const p=Pl(u,g),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:f,isRight:d,isLeft:m,isBottom:w,maxScroll:b,minScroll:x}=k1(v),C=CL(v),S={x:Math.min(h===qe.Right?C.right-C.width/2:C.right,Math.max(h===qe.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===qe.Down?C.bottom-C.height/2:C.bottom,Math.max(h===qe.Down?C.top:C.top+C.height/2,u.y))},E=h===qe.Right&&!d||h===qe.Left&&!m,L=h===qe.Down&&!w||h===qe.Up&&!f;if(E&&S.x!==u.x){const A=v.scrollLeft+p.x,M=h===qe.Right&&A<=b.x||h===qe.Left&&A>=x.x;if(M&&!p.y){v.scrollTo({left:A,behavior:i});return}M?_.x=v.scrollLeft-A:_.x=h===qe.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:i});break}else if(L&&S.y!==u.y){const A=v.scrollTop+p.y,M=h===qe.Down&&A<=b.y||h===qe.Up&&A>=x.y;if(M&&!p.x){v.scrollTo({top:A,behavior:i});return}M?_.y=v.scrollTop-A:_.y=h===qe.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:i});break}}this.handleMove(t,Qi(Pl(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}T1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=R1,onActivation:s}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Ng(e){return!!(e&&"distance"in e)}function jg(e){return!!(e&&"delay"in e)}class Hf{constructor(t,r,n){var s;n===void 0&&(n=TL(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=vs(l),this.documentListeners=new no(this.document),this.listeners=new no(n),this.windowListeners=new no(nr(l)),this.initialCoordinates=(s=Fh(a))!=null?s:Ir,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,Og),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,Og),this.documentListeners.add(fr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jg(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ng(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(fr.Click,DL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:a}=this,{onMove:l,options:{activationConstraint:i}}=a;if(!s)return;const o=(r=Fh(t))!=null?r:Ir,c=Pl(s,o);if(!n&&i){if(Ng(i)){if(i.tolerance!=null&&su(c,i.tolerance))return this.handleCancel();if(su(c,i.distance))return this.handleStart()}if(jg(i)&&su(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const AL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class zf extends Hf{constructor(t){const{event:r}=t,n=vs(r.target);super(t,AL,n)}}zf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const PL={move:{name:"mousemove"},end:{name:"mouseup"}};var Hh;(function(e){e[e.RightClick=2]="RightClick"})(Hh||(Hh={}));class IL extends Hf{constructor(t){super(t,PL,vs(t.event.target))}}IL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Hh.RightClick?!1:(n==null||n({event:r}),!0)}}];const ou={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BL extends Hf{constructor(t){super(t,ou)}static setup(){return window.addEventListener(ou.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ou.move.name,t)};function t(){}}}BL.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var io;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(io||(io={}));var Bl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bl||(Bl={}));function OL(e){let{acceleration:t,activator:r=io.Pointer,canScroll:n,draggingRect:s,enabled:a,interval:l=5,order:i=Bl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:g,delta:u,threshold:p}=e;const _=jL({delta:u,disabled:!a}),[y,v]=Vk(),h=k.useRef({x:0,y:0}),f=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case io.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case io.DraggableRect:return s}},[r,s,o]),m=k.useRef(null),w=k.useCallback(()=>{const x=m.current;if(!x)return;const C=h.current.x*f.current.x,S=h.current.y*f.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>i===Bl.TreeOrder?[...c].reverse():c,[i,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=g[C];if(!S)continue;const{direction:E,speed:L}=bL(x,S,d,t,p);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),m.current=x,y(w,l),h.current=L,f.current=E;return}}h.current={x:0,y:0},f.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,g,JSON.stringify(p)])}const NL={x:{[kt.Backward]:!1,[kt.Forward]:!1},y:{[kt.Backward]:!1,[kt.Forward]:!1}};function jL(e){let{delta:t,disabled:r}=e;const n=jh(t);return Xo(s=>{if(r||!n||!s)return NL;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[kt.Backward]:s.x[kt.Backward]||a.x===-1,[kt.Forward]:s.x[kt.Forward]||a.x===1},y:{[kt.Backward]:s.y[kt.Backward]||a.y===-1,[kt.Forward]:s.y[kt.Forward]||a.y===1}}},[r,t,n])}function FL(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Xo(s=>{var a;return t==null?null:(a=n??s)!=null?a:null},[n,t])}function $L(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,a=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var Po;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Po||(Po={}));var zh;(function(e){e.Optimized="optimized"})(zh||(zh={}));const Fg=new Map;function HL(e,t){let{dragging:r,dependencies:n,config:s}=t;const[a,l]=k.useState(null),{frequency:i,measure:o,strategy:c}=s,g=k.useRef(e),u=h(),p=Mo(u),_=k.useCallback(function(f){f===void 0&&(f=[]),!p.current&&l(d=>d===null?f:d.concat(f.filter(m=>!d.includes(m))))},[p]),y=k.useRef(null),v=Xo(f=>{if(u&&!r)return Fg;if(!f||f===Fg||g.current!==e||a!=null){const d=new Map;for(let m of e){if(!m)continue;if(a&&a.length>0&&!a.includes(m.id)&&m.rect.current){d.set(m.id,m.rect.current);continue}const w=m.node.current,b=w?new $f(o(w),w):null;m.rect.current=b,b&&d.set(m.id,b)}return d}return f},[e,a,r,u,o]);return k.useEffect(()=>{g.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof i!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},i))},[i,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case Po.Always:return!1;case Po.BeforeDragging:return r;default:return!r}}}function D1(e,t){return Xo(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function zL(e,t){return D1(e,t)}function UL(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function uc(e){let{callback:t,disabled:r}=e;const n=Nf(t),s=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function WL(e){return new $f(_s(e),e)}function $g(e,t,r){t===void 0&&(t=WL);const[n,s]=k.useState(null);function a(){s(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const g=t(e);return JSON.stringify(o)===JSON.stringify(g)?o:g})}const l=UL({callback(o){if(e)for(const c of o){const{type:g,target:u}=c;if(g==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),i=uc({callback:a});return Ur(()=>{a(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),n}function VL(e){const t=D1(e);return S1(e,t)}const Hg=[];function KL(e){const t=k.useRef(e),r=Xo(n=>e?n&&n!==Hg&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ff(e):Hg,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function GL(e){const[t,r]=k.useState(null),n=k.useRef(e),s=k.useCallback(a=>{const l=iu(a.target);l&&r(i=>i?(i.set(l,$h(l)),new Map(i)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const i=e.map(o=>{const c=iu(o);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,$h(c)]):null}).filter(o=>o!=null);r(i.length?new Map(i):null),n.current=e}return()=>{l(e),l(a)};function l(i){i.forEach(o=>{const c=iu(o);c==null||c.removeEventListener("scroll",s)})}},[s,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>Qi(a,l),Ir):L1(e):Ir,[e,t])}function zg(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==Ir;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Pl(e,r.current):Ir}function qL(e){k.useEffect(()=>{if(!cc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function XL(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:a}=n;return r[s]=l=>{a(l,t)},r},{}),[e,t])}function M1(e){return k.useMemo(()=>e?yL(e):null,[e])}const Ug=[];function YL(e,t){t===void 0&&(t=_s);const[r]=e,n=M1(r?nr(r):null),[s,a]=k.useState(Ug);function l(){a(()=>e.length?e.map(o=>E1(o)?n:new $f(t(o),o)):Ug)}const i=uc({callback:l});return Ur(()=>{i==null||i.disconnect(),l(),e.forEach(o=>i==null?void 0:i.observe(o))},[e]),s}function JL(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return qo(t)?t:e}function QL(e){let{measure:t}=e;const[r,n]=k.useState(null),s=k.useCallback(c=>{for(const{target:g}of c)if(qo(g)){n(u=>{const p=t(g);return u?{...u,width:p.width,height:p.height}:p});break}},[t]),a=uc({callback:s}),l=k.useCallback(c=>{const g=JL(c);a==null||a.disconnect(),g&&(a==null||a.observe(g)),n(g?t(g):null)},[t,a]),[i,o]=Al(l);return k.useMemo(()=>({nodeRef:i,rect:r,setRef:o}),[r,i,o])}const ZL=[{sensor:zf,options:{}},{sensor:T1,options:{}}],eR={current:{}},Xa={draggable:{measure:Bg},droppable:{measure:Bg,strategy:Po.WhileDragging,frequency:zh.Optimized},dragOverlay:{measure:_s}};class so extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const tR={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new so,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Il},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xa,measureDroppableContainers:Il,windowRect:null,measuringScheduled:!1},rR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Il,draggableNodes:new Map,over:null,measureDroppableContainers:Il},hc=k.createContext(rR),A1=k.createContext(tR);function nR(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new so}}}function iR(e,t){switch(t.type){case wt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case wt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case wt.DragEnd:case wt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case wt.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new so(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case wt.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new so(e.droppable.containers);return l.set(r,{...a,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case wt.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const a=new so(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sR(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=k.useContext(hc),a=jh(n),l=jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!jf(a)||document.activeElement===a.target)return;const i=s.get(l);if(!i)return;const{activatorNode:o,node:c}=i;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const g of[o.current,c.current]){if(!g)continue;const u=qk(g);if(u){u.focus();break}}})}},[n,t,s,l,a]),null}function oR(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,a)=>a({transform:s,...n}),r):r}function aR(e){return k.useMemo(()=>({draggable:{...Xa.draggable,...e==null?void 0:e.draggable},droppable:{...Xa.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Xa.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lR(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const a=k.useRef(!1),{x:l,y:i}=typeof s=="boolean"?{x:s,y:s}:s;Ur(()=>{if(!l&&!i||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const g=r(c),u=S1(g,n);if(l||(u.x=0),i||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const p=x1(c);p&&p.scrollBy({top:u.y,left:u.x})}},[t,l,i,n,r])}const P1=k.createContext({...Ir,scaleX:1,scaleY:1});var wn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(wn||(wn={}));const cR=k.memo(function(t){var r,n,s,a;let{id:l,accessibility:i,autoScroll:o=!0,children:c,sensors:g=ZL,collisionDetection:u=dL,measuring:p,modifiers:_,...y}=t;const v=k.useReducer(iR,void 0,nR),[h,f]=v,[d,m]=eL(),[w,b]=k.useState(wn.Uninitialized),x=w===wn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var De;return C!=null?{id:C,data:(De=A==null?void 0:A.data)!=null?De:eR,rect:M}:null},[C,A]),O=k.useRef(null),[H,F]=k.useState(null),[$,N]=k.useState(null),R=Mo(y,Object.values(y)),P=Yo("DndDescribedBy",l),B=k.useMemo(()=>L.getEnabled(),[L]),j=aR(p),{droppableRects:W,measureDroppableContainers:K,measuringScheduled:Z}=HL(B,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),ee=FL(S,C),z=k.useMemo(()=>$?Fh($):null,[$]),I=Fe(),V=zL(ee,j.draggable.measure);lR({activeNode:C!=null?S.get(C):null,config:I.layoutShiftCompensation,initialRect:V,measure:j.draggable.measure});const U=$g(ee,j.draggable.measure,V),J=$g(ee?ee.parentElement:null),X=k.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=L.getNodeFor((r=X.current.over)==null?void 0:r.id),ce=QL({measure:j.dragOverlay.measure}),fe=(n=ce.nodeRef.current)!=null?n:ee,Ee=x?(s=ce.rect)!=null?s:U:null,ae=!!(ce.nodeRef.current&&ce.rect),Te=VL(ae?null:U),je=M1(fe?nr(fe):null),pe=KL(x?me??ee:null),_e=YL(pe),ke=oR(_,{transform:{x:E.x-Te.x,y:E.y-Te.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:U,containerNodeRect:J,draggingNodeRect:Ee,over:X.current.over,overlayNodeRect:ce.rect,scrollableAncestors:pe,scrollableAncestorRects:_e,windowRect:je}),se=z?Qi(z,E):null,be=GL(pe),oe=zg(be),he=zg(be,[U]),Le=Qi(ke,oe),Re=Ee?mL(Ee,ke):null,Ce=D&&Re?u({active:D,collisionRect:Re,droppableRects:W,droppableContainers:B,pointerCoordinates:se}):null,q=cL(Ce,"id"),[Q,ge]=k.useState(null),He=ae?ke:Qi(ke,he),ie=fL(He,(a=Q==null?void 0:Q.rect)!=null?a:null,U),G=k.useRef(null),re=k.useCallback((De,Be)=>{let{sensor:Pe,options:Ue}=Be;if(O.current==null)return;const Me=S.get(O.current);if(!Me)return;const ze=De.nativeEvent,Je=new Pe({active:O.current,activeNode:Me,event:ze,options:Ue,context:X,onAbort(we){if(!S.get(we))return;const{onDragAbort:Ke}=R.current,Ge={id:we};Ke==null||Ke(Ge),d({type:"onDragAbort",event:Ge})},onPending(we,Ae,Ke,Ge){if(!S.get(we))return;const{onDragPending:xt}=R.current,dt={id:we,constraint:Ae,initialCoordinates:Ke,offset:Ge};xt==null||xt(dt),d({type:"onDragPending",event:dt})},onStart(we){const Ae=O.current;if(Ae==null)return;const Ke=S.get(Ae);if(!Ke)return;const{onDragStart:Ge}=R.current,lt={activatorEvent:ze,active:{id:Ae,data:Ke.data,rect:M}};jr.unstable_batchedUpdates(()=>{Ge==null||Ge(lt),b(wn.Initializing),f({type:wt.DragStart,initialCoordinates:we,active:Ae}),d({type:"onDragStart",event:lt}),F(G.current),N(ze)})},onMove(we){f({type:wt.DragMove,coordinates:we})},onEnd:nt(wt.DragEnd),onCancel:nt(wt.DragCancel)});G.current=Je;function nt(we){return async function(){const{active:Ke,collisions:Ge,over:lt,scrollAdjustedTranslate:xt}=X.current;let dt=null;if(Ke&&xt){const{cancelDrop:Wt}=R.current;dt={activatorEvent:ze,active:Ke,collisions:Ge,delta:xt,over:lt},we===wt.DragEnd&&typeof Wt=="function"&&await Promise.resolve(Wt(dt))&&(we=wt.DragCancel)}O.current=null,jr.unstable_batchedUpdates(()=>{f({type:we}),b(wn.Uninitialized),ge(null),F(null),N(null),G.current=null;const Wt=we===wt.DragEnd?"onDragEnd":"onDragCancel";if(dt){const Wr=R.current[Wt];Wr==null||Wr(dt),d({type:Wt,event:dt})}})}}},[S]),le=k.useCallback((De,Be)=>(Pe,Ue)=>{const Me=Pe.nativeEvent,ze=S.get(Ue);if(O.current!==null||!ze||Me.dndKit||Me.defaultPrevented)return;const Je={active:ze};De(Pe,Be.options,Je)===!0&&(Me.dndKit={capturedBy:Be.sensor},O.current=Ue,re(Pe,Be))},[S,re]),te=$L(g,le);qL(g),Ur(()=>{U&&w===wn.Initializing&&b(wn.Initialized)},[U,w]),k.useEffect(()=>{const{onDragMove:De}=R.current,{active:Be,activatorEvent:Pe,collisions:Ue,over:Me}=X.current;if(!Be||!Pe)return;const ze={active:Be,activatorEvent:Pe,collisions:Ue,delta:{x:Le.x,y:Le.y},over:Me};jr.unstable_batchedUpdates(()=>{De==null||De(ze),d({type:"onDragMove",event:ze})})},[Le.x,Le.y]),k.useEffect(()=>{const{active:De,activatorEvent:Be,collisions:Pe,droppableContainers:Ue,scrollAdjustedTranslate:Me}=X.current;if(!De||O.current==null||!Be||!Me)return;const{onDragOver:ze}=R.current,Je=Ue.get(q),nt=Je&&Je.rect.current?{id:Je.id,rect:Je.rect.current,data:Je.data,disabled:Je.disabled}:null,we={active:De,activatorEvent:Be,collisions:Pe,delta:{x:Me.x,y:Me.y},over:nt};jr.unstable_batchedUpdates(()=>{ge(nt),ze==null||ze(we),d({type:"onDragOver",event:we})})},[q]),Ur(()=>{X.current={activatorEvent:$,active:D,activeNode:ee,collisionRect:Re,collisions:Ce,droppableRects:W,draggableNodes:S,draggingNode:fe,draggingNodeRect:Ee,droppableContainers:L,over:Q,scrollableAncestors:pe,scrollAdjustedTranslate:Le},M.current={initial:Ee,translated:Re}},[D,ee,Ce,Re,S,fe,Ee,W,L,Q,pe,Le]),OL({...I,delta:E,draggingRect:Re,pointerCoordinates:se,scrollableAncestors:pe,scrollableAncestorRects:_e});const ue=k.useMemo(()=>({active:D,activeNode:ee,activeNodeRect:U,activatorEvent:$,collisions:Ce,containerNodeRect:J,dragOverlay:ce,draggableNodes:S,droppableContainers:L,droppableRects:W,over:Q,measureDroppableContainers:K,scrollableAncestors:pe,scrollableAncestorRects:_e,measuringConfiguration:j,measuringScheduled:Z,windowRect:je}),[D,ee,U,$,Ce,J,ce,S,L,W,Q,K,pe,_e,j,Z,je]),Oe=k.useMemo(()=>({activatorEvent:$,activators:te,active:D,activeNodeRect:U,ariaDescribedById:{draggable:P},dispatch:f,draggableNodes:S,over:Q,measureDroppableContainers:K}),[$,te,D,U,f,P,S,Q,K]);return mt.createElement(w1.Provider,{value:m},mt.createElement(hc.Provider,{value:Oe},mt.createElement(A1.Provider,{value:ue},mt.createElement(P1.Provider,{value:ie},c)),mt.createElement(sR,{disabled:(i==null?void 0:i.restoreFocus)===!1})),mt.createElement(nL,{...i,hiddenTextDescribedById:P}));function Fe(){const De=(H==null?void 0:H.autoScrollEnabled)===!1,Be=typeof o=="object"?o.enabled===!1:o===!1,Pe=x&&!De&&!Be;return typeof o=="object"?{...o,enabled:Pe}:{enabled:Pe}}}),uR=k.createContext(null),Wg="button",hR="Draggable";function dR(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const a=Yo(hR),{activators:l,activatorEvent:i,active:o,activeNodeRect:c,ariaDescribedById:g,draggableNodes:u,over:p}=k.useContext(hc),{role:_=Wg,roleDescription:y="draggable",tabIndex:v=0}=s??{},h=(o==null?void 0:o.id)===t,f=k.useContext(h?P1:uR),[d,m]=Al(),[w,b]=Al(),x=XL(l,t),C=Mo(r);Ur(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===Wg?!0:void 0,"aria-roledescription":y,"aria-describedby":g.draggable}),[n,_,v,h,y,g.draggable]);return{active:o,activatorEvent:i,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:p,setNodeRef:m,setActivatorNodeRef:b,transform:f}}function fR(){return k.useContext(A1)}const pR="Droppable",mR={timeout:25};function gR(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const a=Yo(pR),{active:l,dispatch:i,over:o,measureDroppableContainers:c}=k.useContext(hc),g=k.useRef({disabled:r}),u=k.useRef(!1),p=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...mR,...s},f=Mo(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(f.current)?f.current:[f.current]),_.current=null},h)},[h]),m=uc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{m&&(E&&(m.unobserve(E),u.current=!1),S&&m.observe(S))},[m]),[b,x]=Al(w),C=Mo(t);return k.useEffect(()=>{!m||!b.current||(m.disconnect(),u.current=!1,m.observe(b.current))},[b,m]),k.useEffect(()=>(i({type:wt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:p,data:C}}),()=>i({type:wt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==g.current.disabled&&(i({type:wt.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,i]),{active:l,rect:p,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function I1(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function vR(e,t){return e.reduce((r,n,s)=>{const a=t.get(n);return a&&(r[s]=a),r},Array(e.length))}function ba(e){return e!==null&&e>=0}function _R(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function yR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B1=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const a=I1(t,n,r),l=t[s],i=a[s];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},Ca={scaleX:1,scaleY:1},wR=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:a,overIndex:l}=e;const i=(t=a[r])!=null?t:n;if(!i)return null;if(s===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(i.top+i.height):c.top-i.top,...Ca}:null}const o=SR(a,s,r);return s>r&&s<=l?{x:0,y:-i.height-o,...Ca}:s<r&&s>=l?{x:0,y:i.height+o,...Ca}:{x:0,y:0,...Ca}};function SR(e,t,r){const n=e[t],s=e[t-1],a=e[t+1];return n?r<t?s?n.top-(s.top+s.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const O1="Sortable",N1=mt.createContext({activeIndex:-1,containerId:O1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B1,disabled:{draggable:!1,droppable:!1}});function xR(e){let{children:t,id:r,items:n,strategy:s=B1,disabled:a=!1}=e;const{active:l,dragOverlay:i,droppableRects:o,over:c,measureDroppableContainers:g}=fR(),u=Yo(O1,r),p=i.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,f=k.useRef(_),d=!_R(_,f.current),m=h!==-1&&v===-1||d,w=yR(a);Ur(()=>{d&&y&&g(_)},[d,_,y,g]),k.useEffect(()=>{f.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:m,items:_,overIndex:h,useDragOverlay:p,sortedRects:vR(_,o),strategy:s}),[v,u,w.draggable,w.droppable,m,_,h,o,p,s]);return mt.createElement(N1.Provider,{value:b},t)}const bR=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return I1(r,n,s).indexOf(t)},CR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:a,newIndex:l,previousItems:i,previousContainerId:o,transition:c}=e;return!c||!n||i!==a&&s===l?!1:r?!0:l!==s&&t===o},ER={duration:200,easing:"ease"},j1="transform",kR=Ao.Transition.toString({property:j1,duration:0,easing:"linear"}),LR={roleDescription:"sortable"};function RR(e){let{disabled:t,index:r,node:n,rect:s}=e;const[a,l]=k.useState(null),i=k.useRef(r);return Ur(()=>{if(!t&&r!==i.current&&n.current){const o=s.current;if(o){const c=_s(n.current,{ignoreTransform:!0}),g={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(g.x||g.y)&&l(g)}}r!==i.current&&(i.current=r)},[t,r,n,s]),k.useEffect(()=>{a&&l(null)},[a]),a}function TR(e){let{animateLayoutChanges:t=CR,attributes:r,disabled:n,data:s,getNewIndex:a=bR,id:l,strategy:i,resizeObserverConfig:o,transition:c=ER}=e;const{items:g,containerId:u,activeIndex:p,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:f,strategy:d}=k.useContext(N1),m=DR(n,_),w=g.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:g},...s}),[u,s,w,g]),x=k.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=gR({id:l,data:b,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:O,setNodeRef:H,listeners:F,isDragging:$,over:N,setActivatorNodeRef:R,transform:P}=dR({id:l,data:b,attributes:{...LR,...r},disabled:m.draggable}),B=Wk(L,H),j=!!A,W=j&&!y&&ba(p)&&ba(h),K=!f&&$,Z=K&&W?P:null,z=W?Z??(i??d)({rects:v,activeNodeRect:D,activeIndex:p,overIndex:h,index:w}):null,I=ba(p)&&ba(h)?a({id:l,items:g,activeIndex:p,overIndex:h}):w,V=A==null?void 0:A.id,U=k.useRef({activeId:V,items:g,newIndex:I,containerId:u}),J=g!==U.current.items,X=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:g,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:c,wasDragging:U.current.activeId!=null}),me=RR({disabled:!X,index:w,node:S,rect:C});return k.useEffect(()=>{j&&U.current.newIndex!==I&&(U.current.newIndex=I),u!==U.current.containerId&&(U.current.containerId=u),g!==U.current.items&&(U.current.items=g)},[j,I,u,g]),k.useEffect(()=>{if(V===U.current.activeId)return;if(V!=null&&U.current.activeId==null){U.current.activeId=V;return}const fe=setTimeout(()=>{U.current.activeId=V},50);return()=>clearTimeout(fe)},[V]),{active:A,activeIndex:p,attributes:O,data:b,rect:C,index:w,newIndex:I,items:g,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:N,setNodeRef:B,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:me??z,transition:ce()};function ce(){if(me||J&&U.current.newIndex===w)return kR;if(!(K&&!jf(M)||!c)&&(j||X))return Ao.Transition.toString({...c,property:j1})}}function DR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}qe.Down,qe.Right,qe.Up,qe.Left;const Ea={permission:0,waiting:1,working:2,unknown:3};function oo(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const MR={mode:"created",direction:"desc"};function Uf(e,t=MR){const{mode:r,direction:n,manualOrder:s}=t;if(r==="manual"&&s&&s.length>0){const a=new Map(s.map((l,i)=>[l,i]));return[...e].sort((l,i)=>{const o=oo(l),c=oo(i),g=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(i.id)??1/0;return g===1/0&&u===1/0?Date.parse(i.createdAt)-Date.parse(l.createdAt):g-u})}return[...e].sort((a,l)=>{if(r==="status"){const c=Ea[a.status]??Ea.unknown,g=Ea[l.status]??Ea.unknown;return c!==g?c-g:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const i=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-i:i-o})}function AR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.projectPath)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function PR(e,t){var n,s;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const i=Date.parse(a.lastActivity)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}for(const a of t){const l=(s=a.host)==null?void 0:s.trim();if(l){const i=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;i>o&&r.set(l,i)}}return Array.from(r.keys()).sort((a,l)=>{const i=r.get(a)||0;return(r.get(l)||0)-i})}function Wf(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function ui(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function IR(e){const t=e.map(i=>{const o=i.trim(),c=o.replace(/[\\/]+$/,""),g=c.split(/[\\/]/).filter(Boolean);return{path:i,parts:g,fallback:c||o||i}}),r=new Map;for(const i of t)r.set(i.path,1);let n=!0;for(;n;){n=!1;const i=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");i.set(g,(i.get(g)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,g=o.parts.slice(-c).join("/");(i.get(g)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const s=new Map,a=new Map;for(const i of t){let o=i.fallback;if(i.parts.length>0){const c=r.get(i.path)??1;o=i.parts.slice(-c).join("/")}s.set(i.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const i of t){let o=s.get(i.path)??i.fallback;(a.get(o)??0)>1&&(o=i.fallback),l.set(i.path,o)}return l}function F1(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const We=Yd()(Jd((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var g;const n=t(),s=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,i=new Set(r.map(u=>u.id)),o=a.filter(u=>!i.has(u.id)&&!l.has(u.id));let c=s;if(s!==null&&!r.some(u=>u.id===s)){const{sessionSortMode:u,sessionSortDirection:p}=de.getState();c=((g=Uf(r,{mode:u,direction:p})[0])==null?void 0:g.id)??null}if(o.length>0){const u=new Map(l);for(const p of o)u.set(p.id,p);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(s=>s.id===r.id?r:s)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(s=>s.id===r);if(n){const s=new Map(t().exitingSessions);s.set(r,n),e({exitingSessions:s})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:ic(()=>Qd),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function Vg(e,t,r=!1){const[n,s]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const g=setTimeout(()=>{l.current&&(s(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(g)}a.current=e},[e,t,r]),[n,()=>s(!1)]}function BR(e,t,r,n){const s=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const i=s.current.get(l);i&&(clearTimeout(i),s.current.delete(l)),r(l)}else if(!s.current.has(l)){const i=setTimeout(()=>{s.current.delete(l),r(l)},n+100);s.current.set(l,i)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of s.current.values())clearTimeout(a);s.current.clear()},[])}function OR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function NR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function jR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const FR=[["claude",OR],["codex",NR],["pi",jR]];function dc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[s,a]of FR)if(n.startsWith(s))return T.jsx(a,{className:r});return T.jsx(iC,{className:r})}const $R=360;function HR(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function $1(e){return{"--badge-hue":`${HR(e)%$R}`}}function H1({name:e,fullPath:t,className:r=""}){const n=$1(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const zR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:s,onResume:a,onPreview:l,onSetPinned:i}){const o=Wf(t.lastActivityAt),c=ui(t.projectPath),g=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,p=s&&!!t.lastUserMessage,_=r?F1(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},m=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",m)}},[v]);const f=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:f,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:g}),t.lastResumeError&&T.jsx(Ab,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||p)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(H1,{name:c,fullPath:t.projectPath}),p&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[i&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),i(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]})]})]})});function UR({name:e,className:t=""}){const r=$1(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function WR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),g=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var f;const h=v.target;h&&((f=i.current)!=null&&f.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[s]);const p=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:g,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>p(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function VR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[s,a]=k.useState(!1),l=k.useId(),i=k.useRef(null),o=k.useMemo(()=>IR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),g=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??ui(y)??y).join(", "),[o,t]),p=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??ui(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!s||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const f=h.target;f&&((d=i.current)!=null&&d.contains(f))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[s]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(f=>v.has(f));r(h)};return T.jsxs("div",{ref:i,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:p}),T.jsx(Zd,{className:"h-3 w-3 shrink-0 text-muted"})]}),s&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??ui(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),g&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}function KR(e){if(!e.trim())return null;try{const t=JSON.parse(e);let r="",n="other";if(typeof t.message=="string")r=t.message;else if(typeof t.content=="string")r=t.content;else if(t.type==="user"&&typeof t.message=="object"){const s=t.message;r=typeof s.content=="string"?s.content:"",n="user"}else if(t.type==="assistant"&&t.message){const s=t.message;typeof s.content=="string"?r=s.content:Array.isArray(s.content)&&(r=s.content.filter(a=>typeof a=="object"&&a!==null&&"text"in a).map(a=>a.text).join(`
53
+ `)),n="assistant"}if((t.type==="tool_use"||t.event==="tool_use")&&(r=`[Tool: ${t.name??"tool"}]`,n="assistant"),t.type==="result"&&typeof t.result=="string"&&(r=t.result,n="system"),t.payload&&typeof t.payload=="object"){const s=t.payload;typeof s.content=="string"?r=s.content:typeof s.message=="string"&&(r=s.message)}return r.trim()?{type:n,content:r.trim(),raw:e}:null}catch{return{type:"other",content:e.trim(),raw:e}}}function GR({session:e,onClose:t,onResume:r}){const[n,s]=k.useState(!0),[a,l]=k.useState(null),[i,o]=k.useState(null),[c,g]=k.useState(!1),u=k.useRef(null),p=k.useRef(null);k.useEffect(()=>{(async()=>{try{const f=await fetch(`/api/session-preview/${e.sessionId}`);if(!f.ok){const m=await f.json();throw new Error(m.error||"Failed to load preview")}const d=await f.json();o(d)}catch(f){l(f instanceof Error?f.message:"Failed to load preview")}finally{s(!1)}})()},[e.sessionId]),k.useEffect(()=>{u.current&&i&&(u.current.scrollTop=u.current.scrollHeight)},[i,c]),k.useEffect(()=>{const h=f=>{f.key==="Escape"?(f.stopPropagation(),t()):f.key==="Enter"&&!n&&!a&&(f.preventDefault(),r(e.sessionId))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,r,e.sessionId,n,a]),k.useEffect(()=>{var h;(h=p.current)==null||h.focus()},[]);const _=e.displayName||ui(e.projectPath)||e.sessionId.slice(0,8),y=Wf(e.lastActivityAt),v=(i==null?void 0:i.lines.map(KR).filter(h=>h!==null).slice(-30))??[];return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"preview-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&t()},children:T.jsxs("div",{ref:p,tabIndex:-1,className:"flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[T.jsx(dc,{agentType:e.agentType,className:"h-5 w-5 shrink-0 text-muted"}),T.jsxs("div",{className:"min-w-0 flex-1",children:[T.jsx("h2",{id:"preview-title",className:"truncate text-sm font-semibold text-primary",children:_}),T.jsxs("p",{className:"truncate text-xs text-muted",title:e.projectPath,children:[ui(e.projectPath)," · ",y]})]}),T.jsx("button",{type:"button",onClick:()=>g(h=>!h),className:`btn text-xs ${c?"btn-primary":""}`,children:c?"Parsed":"Raw"})]}),T.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 font-mono text-xs",children:[n&&T.jsx("div",{className:"flex items-center justify-center py-8 text-muted",children:"Loading preview..."}),a&&T.jsx("div",{className:"flex items-center justify-center py-8 text-danger",children:a}),i&&!c&&T.jsx("div",{className:"space-y-2",children:v.length===0?T.jsx("div",{className:"py-8 text-center text-muted",children:"No readable content found. Try raw view."}):v.map((h,f)=>T.jsx("div",{className:`rounded px-2 py-1 ${h.type==="user"?"bg-blue-500/10 text-blue-400":h.type==="assistant"?"bg-emerald-500/10 text-emerald-400":h.type==="system"?"bg-yellow-500/10 text-yellow-400":"text-muted"}`,children:T.jsx("span",{className:"whitespace-pre-wrap break-words",children:h.content.length>500?`${h.content.slice(0,500)}...`:h.content})},f))}),i&&c&&T.jsx("div",{className:"space-y-1",children:i.lines.slice(-50).map((h,f)=>T.jsx("div",{className:"whitespace-pre-wrap break-all text-muted",children:h||" "},f))})]}),T.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>r(e.sessionId),disabled:n||!!a,className:"btn btn-primary",children:"Resume"})]})]})})}const Kg={working:"bg-green-500/20 text-green-600",waiting:"bg-zinc-500/20 text-zinc-400",permission:"bg-amber-500/20 text-amber-600",unknown:"bg-zinc-500/20 text-zinc-400"};function qR(){const[,e]=k.useState(0);k.useEffect(()=>{const t=setInterval(()=>e(r=>r+1),3e4);return()=>clearInterval(t)},[])}function z1({sessions:e,inactiveSessions:t=[],selectedSessionId:r,loading:n,error:s,onSelect:a,onRename:l,onResume:i,onKill:o,onDuplicate:c,onSetPinned:g}){qR();const[u,p]=k.useState(null),_=de(G=>G.inactiveSessionsExpanded),y=de(G=>G.setInactiveSessionsExpanded),[v,h]=k.useState(null),[f,d]=k.useState(20),m=v1();k.useEffect(()=>{_||d(20)},[_]);const w=200,[b,x]=Vg(e.length,w),[C,S]=Vg(t.length,w,!0),E=k.useRef(new Set(e.map(G=>G.id))),L=k.useRef(new Set(t.map(G=>G.sessionId))),[A,M]=k.useState(new Set);k.useEffect(()=>{var te;const G=new Set(e.map(ue=>ue.id)),re=new Set(t.map(ue=>ue.sessionId)),le=new Set;for(const ue of G)E.current.has(ue)||le.add(ue);for(const ue of e){const Oe=(te=ue.agentSessionId)==null?void 0:te.trim();Oe&&L.current.has(Oe)&&!re.has(Oe)&&le.add(ue.id)}E.current=G,L.current=re,le.size>0&&M(le)},[e,t]),k.useEffect(()=>{if(A.size===0)return;const G=setTimeout(()=>M(new Set),500);return()=>clearTimeout(G)},[A]);const D=de(G=>G.shortcutModifier),O=Yi(Uo(D)),H=de(G=>G.sessionSortMode),F=de(G=>G.setSessionSortMode),$=de(G=>G.sessionSortDirection),N=de(G=>G.manualSessionOrder),R=de(G=>G.setManualSessionOrder),P=de(G=>G.showProjectName),B=de(G=>G.showLastUserMessage),j=de(G=>G.showSessionIdPrefix),W=de(G=>G.projectFilters),K=de(G=>G.setProjectFilters),Z=de(G=>G.hostFilters),ee=de(G=>G.setHostFilters),z=We(G=>G.exitingSessions),I=We(G=>G.clearExitingSession),V=We(G=>G.hostStatuses),U=We(G=>G.remoteAllowControl);BR(e,z,I,w),k.useEffect(()=>{if(N.length===0)return;const G=new Set;for(const le of e)G.add(oo(le)),G.add(le.id);for(const le of t)G.add(le.sessionId);const re=N.filter(le=>G.has(le));re.length!==N.length&&R(re)},[e,t,N,R]);const X=k.useMemo(()=>Uf(e,{mode:H,direction:$,manualOrder:N}),[e,H,$,N]),me=k.useMemo(()=>AR(e,t),[e,t]),ce=k.useMemo(()=>{const G=PR(e,t),re=V.map(ue=>ue.host),le=new Set,te=[];for(const ue of re)!ue||le.has(ue)||(le.add(ue),te.push(ue));for(const ue of G)!ue||le.has(ue)||(le.add(ue),te.push(ue));return te},[e,t,V]),fe=k.useMemo(()=>ce.length>1,[ce]),Ee=k.useMemo(()=>{let G=X;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),Z.length>0&&(G=G.filter(re=>Z.includes(re.host??""))),G},[X,W,Z]),ae=k.useMemo(()=>{const G=W.length===0?"all-projects":W.join("|"),re=Z.length===0?"all-hosts":Z.join("|");return`${G}::${re}`},[W,Z]),Te=k.useRef(new Set(Ee.map(G=>G.id))),[je,pe]=k.useState(new Set);k.useEffect(()=>{const G=new Set(Ee.map(le=>le.id)),re=new Set;for(const le of G)Te.current.has(le)||A.has(le)||re.add(le);Te.current=G,re.size>0&&pe(re)},[Ee,A]),k.useEffect(()=>{if(je.size===0)return;const G=setTimeout(()=>pe(new Set),500);return()=>clearTimeout(G)},[je]);const _e=k.useMemo(()=>{let G=t;return W.length>0&&(G=G.filter(re=>W.includes(re.projectPath))),Z.length>0&&(G=G.filter(re=>Z.includes(re.host??""))),G},[t,W,Z]),ke=k.useMemo(()=>{if(W.length===0)return 0;const G=new Set(W);return e.filter(re=>!G.has(re.projectPath)&&re.status==="permission").length},[e,W]);k.useEffect(()=>{if(W.length===0||me.length===0)return;const G=new Set(me),re=W.filter(le=>G.has(le));re.length!==W.length&&K(re)},[W,me,K]),k.useEffect(()=>{if(Z.length===0||ce.length===0)return;const G=new Set(ce),re=Z.filter(le=>G.has(le));re.length!==Z.length&&ee(re)},[Z,ce,ee]);const se=sL(iL(zf,{activationConstraint:{distance:8}})),[be,oe]=k.useState(null),[he,Le]=k.useState(null),[Re,Ce]=k.useState(!1),q=k.useCallback(G=>{oe(G.active.id),Ce(!0)},[]),Q=k.useCallback(G=>{var re;Le((re=G.over)==null?void 0:re.id)},[]),ge=k.useCallback(G=>{const{active:re,over:le}=G;if(oe(null),Le(null),!le||re.id===le.id){setTimeout(()=>Ce(!1),100);return}const te=Ee.findIndex(Me=>Me.id===re.id),ue=Ee.findIndex(Me=>Me.id===le.id);if(te===-1||ue===-1){setTimeout(()=>Ce(!1),100);return}const Oe=Ee.map(Me=>oo(Me)),[Fe]=Oe.splice(te,1);Oe.splice(ue,0,Fe);const De=X.map(Me=>oo(Me)),Be=new Set(Oe);let Pe=0;const Ue=De.map(Me=>{if(!Be.has(Me))return Me;const ze=Oe[Pe];return Pe+=1,ze});H!=="manual"&&F("manual"),R(Ue),setTimeout(()=>Ce(!1),100)},[Ee,X,H,F,R]),He=k.useCallback(()=>{oe(null),Le(null),setTimeout(()=>Ce(!1),100)},[]);k.useEffect(()=>{if(!be&&!he)return;const G=new Set(Ee.map(le=>le.id));let re=!1;be&&!G.has(be)&&(oe(null),re=!0),he&&!G.has(he)&&(Le(null),re=!0),re&&Ce(!1)},[Ee,be,he]);const ie=(G,re)=>{l(G,re),p(null)};return T.jsxs("aside",{className:"flex min-h-0 flex-1 flex-col border-r border-border bg-elevated",children:[s&&T.jsx("div",{className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:s}),T.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"sticky top-0 z-10 flex h-10 items-center justify-between border-b border-border bg-elevated px-3",children:[T.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted",children:"Sessions"}),T.jsxs("div",{className:"flex items-center gap-4",children:[fe&&T.jsx(WR,{hosts:ce,selectedHosts:Z,onSelect:ee,statuses:V}),T.jsx(VR,{projects:me,selectedProjects:W,onSelect:K,hasHiddenPermissions:ke>0}),T.jsx(Nh.span,{className:"w-8 text-right text-xs text-muted",animate:b&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:x,children:Ee.length})]})]}),n?T.jsx("div",{className:"space-y-1 p-2",children:[0,1,2].map(G=>T.jsx("div",{className:"h-14 animate-pulse rounded bg-surface"},G))}):Ee.length===0?T.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted",children:"No sessions"}):T.jsx(cR,{sensors:se,collisionDetection:uL,onDragStart:q,onDragOver:Q,onDragEnd:ge,onDragCancel:He,children:T.jsx(xR,{items:Ee.map(G=>G.id),strategy:wR,children:T.jsx("div",{children:T.jsx(f5,{initial:!1,children:Ee.map((G,re)=>{const le=A.has(G.id),te=je.has(G.id),ue=G.remote===!0,Oe=G.source==="managed",Fe=!ue||U&&Oe,De=be?Ee.findIndex(Me=>Me.id===be):-1,Pe=he===G.id&&be!==G.id?De>re?"above":"below":null,Ue=le||te;return T.jsx(U1,{session:G,isNew:Ue,exitDuration:w,prefersReducedMotion:m,layoutAnimationsDisabled:Re,isSelected:G.id===r,isEditing:G.id===u,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,showHostInfo:fe,dropIndicator:Pe,onSelect:()=>a(G.id),onStartEdit:Fe?()=>p(G.id):void 0,onCancelEdit:()=>p(null),onRename:Me=>ie(G.id,Me),onKill:o&&Fe?()=>o(G.id):void 0,onDuplicate:c&&Fe?()=>c(G.id):void 0,onSetPinned:g&&G.agentSessionId?Me=>g(G.agentSessionId.trim(),Me):void 0},G.id)})})},ae)})}),_e.length>0&&T.jsxs("div",{className:"border-t border-border",children:[T.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary",children:[T.jsxs("span",{className:"flex items-center gap-2",children:[_?T.jsx(Zd,{className:"h-4 w-4"}):T.jsx(Bb,{className:"h-4 w-4"}),"Inactive Sessions"]}),T.jsx(Nh.span,{className:"w-8 text-right text-xs",animate:C&&!m?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:S,children:_e.length})]}),_&&T.jsxs("div",{className:"py-1",children:[_e.slice(0,f).map(G=>T.jsx(zR,{session:G,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:B,onResume:re=>i==null?void 0:i(re),onPreview:h,onSetPinned:g},G.sessionId)),_e.length>f&&T.jsxs("button",{type:"button",onClick:()=>d(G=>G+20),className:"w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover",children:["Show more (",_e.length-f," remaining)"]})]})]})]}),T.jsx("div",{className:"hidden shrink-0 border-t border-border px-3 py-2 md:block",children:T.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted",children:[T.jsxs("span",{children:[O,"[ ] nav"]}),T.jsxs("span",{children:[O,"N new"]}),T.jsxs("span",{children:[O,"X kill"]})]})}),v&&T.jsx(GR,{session:v,onClose:()=>h(null),onResume:G=>{h(null),i==null||i(G)}})]})}const U1=k.forwardRef(function({session:t,isNew:r,exitDuration:n,prefersReducedMotion:s,layoutAnimationsDisabled:a,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,dropIndicator:p,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m},w){const{attributes:b,listeners:x,setNodeRef:C,transform:S,transition:E,isDragging:L}=TR({id:t.id,animateLayoutChanges:({isSorting:H,wasDragging:F})=>H||F}),A=Ao.Transform.toString(S),D={...!!(s&&A)?{transform:A,transition:E}:{},zIndex:L?10:void 0,opacity:L?.9:void 0},O=k.useCallback(H=>{C(H),typeof w=="function"?w(H):w&&(w.current=H)},[C,w]);return T.jsxs(Nh.div,{ref:O,style:{...D,overflow:"hidden"},className:"relative",layout:!s&&!L&&!a&&!r,transformTemplate:(H,F)=>A?!F||F==="none"?A:`${A} ${F}`:F,initial:s||!r?!1:{opacity:0,scale:.97},animate:s?{opacity:1}:r?{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:s?{opacity:0}:{opacity:0,height:0,scale:.97},transition:s?{duration:0}:{layout:{type:"spring",stiffness:500,damping:35},opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:"easeOut"}},...b,...x,children:[p==="above"&&T.jsx("div",{className:"absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"}),T.jsx(XR,{session:t,isSelected:l,isEditing:i,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:g,showHostInfo:u,isDragging:L,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:f,onDuplicate:d,onSetPinned:m}),p==="below"&&T.jsx("div",{className:"absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"})]})});U1.displayName="SortableSessionItem";function XR({session:e,isSelected:t,isEditing:r,showSessionIdPrefix:n,showProjectName:s,showLastUserMessage:a,showHostInfo:l,isDragging:i=!1,onSelect:o,onStartEdit:c,onCancelEdit:g,onRename:u,onKill:p,onDuplicate:_,onSetPinned:y}){var ee,z,I,V;const v=Wf(e.lastActivity),h=k.useRef(null),f=k.useRef(null),d=((ee=e.agentSessionName)==null?void 0:ee.trim())||((z=e.name)==null?void 0:z.trim())||e.id,[m,w]=k.useState(d),b=k.useRef(null),[x,C]=k.useState(null),S=ui(e.projectPath),E=(I=e.host)==null?void 0:I.trim(),L=e.status==="permission",A=(V=e.agentSessionId)==null?void 0:V.trim(),M=n&&A?F1(A):"",D=s&&!!S,O=l&&!!E,H=a&&!!e.lastUserMessage,F=k.useRef(e.status),[$,N]=k.useState(!1);k.useEffect(()=>{const U=F.current,J=e.status;U==="working"&&J==="waiting"?N(!0):F.current=J},[e.status]);const R=()=>{N(!1),F.current=e.status};k.useEffect(()=>{r&&h.current&&(h.current.focus(),h.current.select())},[r]),k.useEffect(()=>{w(d)},[d]);const P=()=>{const U=m.trim();U&&U!==d?u(U):g()},B=U=>{U.key==="Enter"?(U.preventDefault(),P()):U.key==="Escape"&&(U.preventDefault(),w(d),g())},j=k.useRef(null),W=U=>{if(i)return;const J=U.touches[0];j.current={x:J.clientX,y:J.clientY},b.current=setTimeout(()=>{j.current&&C(j.current)},500)},K=()=>{b.current&&(clearTimeout(b.current),b.current=null)};k.useEffect(()=>{if(!x)return;const U=X=>{f.current&&!f.current.contains(X.target)&&C(null)},J=X=>{X.key==="Escape"&&C(null)};return document.addEventListener("mousedown",U),document.addEventListener("touchstart",U),document.addEventListener("keydown",J),()=>{document.removeEventListener("mousedown",U),document.removeEventListener("touchstart",U),document.removeEventListener("keydown",J)}},[x]);const Z=U=>{U.preventDefault(),U.stopPropagation(),C({x:U.clientX,y:U.clientY})};return T.jsxs("div",{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?"selected":""} ${i?"cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated":"cursor-grab"}`,role:"button",tabIndex:0,"data-testid":"session-card","data-session-id":e.id,onClick:i?void 0:o,onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&o()},onContextMenu:Z,onTouchStart:W,onTouchEnd:K,onTouchCancel:K,children:[T.jsxs("div",{className:"flex flex-col gap-0.5 pl-0.5",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(dc,{agentType:e.agentType,command:e.command,className:"h-3.5 w-3.5 shrink-0 text-muted"}),r?T.jsx("input",{ref:h,type:"text",value:m,onChange:U=>w(U.target.value),onBlur:P,onKeyDown:B,onClick:U=>U.stopPropagation(),className:"min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:d}),e.isPinned&&T.jsx(Cl,{className:"h-3 w-3 shrink-0 text-primary","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),M&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:A,children:M}),L?T.jsx("span",{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${Kg[e.status]} pulse-approval`,onAnimationEnd:R,children:T.jsx(Kb,{className:"h-3 w-3","aria-label":"Needs input"})}):T.jsx("span",{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${Kg[e.status]}${$?" pulse-complete":""}`,onAnimationEnd:R,children:v})]}),(D||O||H)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[O&&T.jsx(UR,{name:E}),D&&T.jsx(H1,{name:S,fullPath:e.projectPath}),H&&T.jsxs("span",{className:"line-clamp-2 text-xs italic text-muted",children:['"',e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+"…":e.lastUserMessage,'"']})]})]}),x&&T.jsxs("div",{ref:f,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:x.x,top:x.y},role:"menu",children:[c&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),c()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",children:[T.jsx(I0,{width:14,height:14}),"Rename"]}),_&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),_()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:"Create a copy in a new tmux window",children:[T.jsx(P0,{width:14,height:14}),"Duplicate"]}),y&&T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),y(!e.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Cl,{width:14,height:14}),e.isPinned?"Unpin":"Pin"]}),e.logFilePath&&T.jsxs("button",{onClick:U=>{U.stopPropagation();const J=e.logFilePath;if(C(null),J){const X=document.createElement("textarea");X.value=J,X.style.position="fixed",X.style.left="-9999px",document.body.appendChild(X),X.focus(),X.select();try{document.execCommand("copy")}catch{navigator.clipboard.writeText(J).catch(()=>{})}document.body.removeChild(X)}},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.logFilePath,children:[T.jsx(B0,{width:14,height:14}),"Copy Log Path"]}),p&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"my-1 border-t border-border"}),T.jsxs("button",{onClick:U=>{U.stopPropagation(),C(null),p()},className:"w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2",role:"menuitem",children:[T.jsx(mh,{width:14,height:14}),"Kill Session"]})]})]})]})}var W1={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(globalThis,()=>(()=>{var r={4567:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const u=o(9042),p=o(9924),_=o(844),y=o(4725),v=o(2585),h=o(3656);let f=i.AccessibilityManager=class extends _.Disposable{constructor(d,m,w,b){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=b,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(x=>this._handleResize(x.rows))),this.register(this._terminal.onRender(x=>this._refreshRows(x.start,x.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(x=>this._handleChar(x))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
54
54
  `))),this.register(this._terminal.onA11yTab(x=>this._handleTab(x))),this.register(this._terminal.onKey(x=>this._handleKey(x.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,h.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,_.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(d){for(let m=0;m<d;m++)this._handleChar(" ")}_handleChar(d){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==d&&(this._charsToAnnounce+=d):this._charsToAnnounce+=d,d===`
55
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,m){this._liveRegionDebouncer.refresh(d,m,this._terminal.rows)}_renderRows(d,m){const w=this._terminal.buffer,b=w.lines.length.toString();for(let x=d;x<=m;x++){const C=w.lines.get(w.ydisp+x),S=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,S))||"",L=(w.ydisp+x+1).toString(),A=this._rowElements[x];A&&(E.length===0?(A.innerText=" ",this._rowColumns.set(A,[0,1])):(A.textContent=E,this._rowColumns.set(A,S)),A.setAttribute("aria-posinset",L),A.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,m){const w=d.target,b=this._rowElements[m===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(m===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==b)return;let x,C;if(m===0?(x=w,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(x=this._rowElements.shift(),C=w,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),m===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(m===0?-1:1),this._rowElements[m===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let m={node:d.anchorNode,offset:d.anchorOffset},w={node:d.focusNode,offset:d.focusOffset};if((m.node.compareDocumentPosition(w.node)&Node.DOCUMENT_POSITION_PRECEDING||m.node===w.node&&m.offset>w.offset)&&([m,w]=[w,m]),m.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(m={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(m.node))return;const b=this._rowElements.slice(-1)[0];if(w.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(w={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(w.node))return;const x=({node:L,offset:A})=>{const M=L instanceof Text?L.parentNode:L;let D=parseInt(M==null?void 0:M.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const N=this._rowColumns.get(M);if(!N)return console.warn("columns is null. Race condition?"),null;let H=A<N.length?N[A]:N.slice(-1)[0]+1;return H>=this._terminal.cols&&(++D,H=0),{row:D,column:H}},C=x(m),S=x(w);if(C&&S){if(C.row>S.row||C.row===S.row&&C.column>=S.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(S.row-C.row)*this._terminal.cols-C.column+S.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let m=this._rowContainer.children.length;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=f=c([g(1,v.IInstantiationService),g(2,y.ICoreBrowserService),g(3,y.IRenderService)],f)},3614:(l,i)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function c(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function g(p,_,y,v){p=c(p=o(p),y.decPrivateModes.bracketedPasteMode&&v.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),_.value=""}function u(p,_,y){const v=y.getBoundingClientRect(),h=p.clientX-v.left-10,f=p.clientY-v.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${h}px`,_.style.top=`${f}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=o,i.bracketTextForPaste=c,i.copyHandler=function(p,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},i.handlePasteEvent=function(p,_,y,v){p.stopPropagation(),p.clipboardData&&g(p.clipboardData.getData("text/plain"),_,y,v)},i.paste=g,i.moveTextAreaUnderMouseCursor=u,i.rightClickHandler=function(p,_,y,v,h){u(p,_,y),h&&v.rightClickSelect(p),_.value=v.selectionText,_.select()}},7239:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const c=o(1505);i.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(g,u,p){this._css.set(g,u,p)}getCss(g,u){return this._css.get(g,u)}setColor(g,u,p){this._color.set(g,u,p)}getColor(g,u){return this._color.get(g,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(o,c,g,u){o.addEventListener(c,g,u);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(c,g,u))}}}},3551:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const u=o(3656),p=o(8460),_=o(844),y=o(2585),v=o(4725);let h=i.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(f,d,m,w,b){super(),this._element=f,this._mouseService=d,this._renderService=m,this._bufferService=w,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)(()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const m=f.composedPath();for(let w=0;w<m.length;w++){const b=m[w];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,d){var w,b;this._activeProviderReplies&&d||((w=this._activeProviderReplies)==null||w.forEach(x=>{x==null||x.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=f.y);let m=!1;for(const[x,C]of this._linkProviderService.linkProviders.entries())d?(b=this._activeProviderReplies)!=null&&b.get(x)&&(m=this._checkLinkProviderResult(x,f,m)):C.provideLinks(f.y,S=>{var L,A;if(this._isMouseOut)return;const E=S==null?void 0:S.map(M=>({link:M}));(L=this._activeProviderReplies)==null||L.set(x,E),m=this._checkLinkProviderResult(x,f,m),((A=this._activeProviderReplies)==null?void 0:A.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)})}_removeIntersectingLinks(f,d){const m=new Set;for(let w=0;w<d.size;w++){const b=d.get(w);if(b)for(let x=0;x<b.length;x++){const C=b[x],S=C.link.range.start.y<f?0:C.link.range.start.x,E=C.link.range.end.y>f?this._bufferService.cols:C.link.range.end.x;for(let L=S;L<=E;L++){if(m.has(L)){b.splice(x--,1);break}m.add(L)}}}}_checkLinkProviderResult(f,d,m){var x;if(!this._activeProviderReplies)return m;const w=this._activeProviderReplies.get(f);let b=!1;for(let C=0;C<f;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&w){const C=w.find(S=>this._linkAtPosition(S.link,d));C&&(m=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!m)for(let C=0;C<this._activeProviderReplies.size;C++){const S=(x=this._activeProviderReplies.get(C))==null?void 0:x.find(E=>this._linkAtPosition(E.link,d));if(S){m=!0,this._handleNewLink(S);break}}return m}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,d){this._currentLink&&this._lastMouseEvent&&(!f||!d||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(f.link,d)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.pointerCursor},set:m=>{var w;(w=this._currentLink)!=null&&w.state&&this._currentLink.state.decorations.pointerCursor!==m&&(this._currentLink.state.decorations.pointerCursor=m,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",m))}},underline:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.underline},set:m=>{var w,b,x;(w=this._currentLink)!=null&&w.state&&((x=(b=this._currentLink)==null?void 0:b.state)==null?void 0:x.decorations.underline)!==m&&(this._currentLink.state.decorations.underline=m,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,m))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(m=>{if(!this._currentLink)return;const w=m.start===0?0:m.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+m.end;if(this._currentLink.link.range.start.y>=w&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(w,b),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}})))}_linkHover(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(m,d.text)}_fireUnderlineEvent(f,d){const m=f.range,w=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(m.start.x-1,m.start.y-w-1,m.end.x,m.end.y-w-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(m,d.text)}_linkAtPosition(f,d){const m=f.range.start.y*this._bufferService.cols+f.range.start.x,w=f.range.end.y*this._bufferService.cols+f.range.end.x,b=d.y*this._bufferService.cols+d.x;return m<=b&&b<=w}_positionFromMouseEvent(f,d,m){const w=m.getCoords(f,d,this._bufferService.cols,this._bufferService.rows);if(w)return{x:w[0],y:w[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,d,m,w,b){return{x1:f,y1:d,x2:m,y2:w,cols:this._bufferService.cols,fg:b}}};i.Linkifier=h=c([g(1,v.IMouseService),g(2,v.IRenderService),g(3,y.IBufferService),g(4,v.ILinkProviderService)],h)},9042:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const u=o(511),p=o(2585);let _=i.OscLinkProvider=class{constructor(v,h,f){this._bufferService=v,this._optionsService=h,this._oscLinkService=f}provideLinks(v,h){var E;const f=this._bufferService.buffer.lines.get(v-1);if(!f)return void h(void 0);const d=[],m=this._optionsService.rawOptions.linkHandler,w=new u.CellData,b=f.getTrimmedLength();let x=-1,C=-1,S=!1;for(let L=0;L<b;L++)if(C!==-1||f.hasContent(L)){if(f.loadCell(L,w),w.hasExtendedAttrs()&&w.extended.urlId){if(C===-1){C=L,x=w.extended.urlId;continue}S=w.extended.urlId!==x}else C!==-1&&(S=!0);if(S||C!==-1&&L===b-1){const A=(E=this._oscLinkService.getLinkData(x))==null?void 0:E.uri;if(A){const M={start:{x:C+1,y:v},end:{x:L+(S||L!==b-1?0:1),y:v}};let D=!1;if(!(m!=null&&m.allowNonHttpProtocols))try{const N=new URL(A);["http:","https:"].includes(N.protocol)||(D=!0)}catch{D=!0}D||d.push({text:A,range:M,activate:(N,H)=>m?m.activate(N,H,M):y(0,H),hover:(N,H)=>{var F;return(F=m==null?void 0:m.hover)==null?void 0:F.call(m,N,H,M)},leave:(N,H)=>{var F;return(F=m==null?void 0:m.leave)==null?void 0:F.call(m,N,H,M)}})}S=!1,w.hasExtendedAttrs()&&w.extended.urlId?(C=L,x=w.extended.urlId):(C=-1,x=-1)}}h(d)}};function y(v,h){if(confirm(`Do you want to navigate to ${h}?
55
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,m){this._liveRegionDebouncer.refresh(d,m,this._terminal.rows)}_renderRows(d,m){const w=this._terminal.buffer,b=w.lines.length.toString();for(let x=d;x<=m;x++){const C=w.lines.get(w.ydisp+x),S=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,S))||"",L=(w.ydisp+x+1).toString(),A=this._rowElements[x];A&&(E.length===0?(A.innerText=" ",this._rowColumns.set(A,[0,1])):(A.textContent=E,this._rowColumns.set(A,S)),A.setAttribute("aria-posinset",L),A.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,m){const w=d.target,b=this._rowElements[m===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(m===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==b)return;let x,C;if(m===0?(x=w,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(x=this._rowElements.shift(),C=w,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),m===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(m===0?-1:1),this._rowElements[m===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let m={node:d.anchorNode,offset:d.anchorOffset},w={node:d.focusNode,offset:d.focusOffset};if((m.node.compareDocumentPosition(w.node)&Node.DOCUMENT_POSITION_PRECEDING||m.node===w.node&&m.offset>w.offset)&&([m,w]=[w,m]),m.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(m={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(m.node))return;const b=this._rowElements.slice(-1)[0];if(w.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(w={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(w.node))return;const x=({node:L,offset:A})=>{const M=L instanceof Text?L.parentNode:L;let D=parseInt(M==null?void 0:M.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(M);if(!O)return console.warn("columns is null. Race condition?"),null;let H=A<O.length?O[A]:O.slice(-1)[0]+1;return H>=this._terminal.cols&&(++D,H=0),{row:D,column:H}},C=x(m),S=x(w);if(C&&S){if(C.row>S.row||C.row===S.row&&C.column>=S.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(S.row-C.row)*this._terminal.cols-C.column+S.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let m=this._rowContainer.children.length;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=f=c([g(1,v.IInstantiationService),g(2,y.ICoreBrowserService),g(3,y.IRenderService)],f)},3614:(l,i)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function c(p,_){return _?"\x1B[200~"+p+"\x1B[201~":p}function g(p,_,y,v){p=c(p=o(p),y.decPrivateModes.bracketedPasteMode&&v.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),_.value=""}function u(p,_,y){const v=y.getBoundingClientRect(),h=p.clientX-v.left-10,f=p.clientY-v.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${h}px`,_.style.top=`${f}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=o,i.bracketTextForPaste=c,i.copyHandler=function(p,_){p.clipboardData&&p.clipboardData.setData("text/plain",_.selectionText),p.preventDefault()},i.handlePasteEvent=function(p,_,y,v){p.stopPropagation(),p.clipboardData&&g(p.clipboardData.getData("text/plain"),_,y,v)},i.paste=g,i.moveTextAreaUnderMouseCursor=u,i.rightClickHandler=function(p,_,y,v,h){u(p,_,y),h&&v.rightClickSelect(p),_.value=v.selectionText,_.select()}},7239:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const c=o(1505);i.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(g,u,p){this._css.set(g,u,p)}getCss(g,u){return this._css.get(g,u)}setColor(g,u,p){this._color.set(g,u,p)}getColor(g,u){return this._color.get(g,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(o,c,g,u){o.addEventListener(c,g,u);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(c,g,u))}}}},3551:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const u=o(3656),p=o(8460),_=o(844),y=o(2585),v=o(4725);let h=i.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(f,d,m,w,b){super(),this._element=f,this._mouseService=d,this._renderService=m,this._bufferService=w,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)(()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const m=f.composedPath();for(let w=0;w<m.length;w++){const b=m[w];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,d){var w,b;this._activeProviderReplies&&d||((w=this._activeProviderReplies)==null||w.forEach(x=>{x==null||x.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=f.y);let m=!1;for(const[x,C]of this._linkProviderService.linkProviders.entries())d?(b=this._activeProviderReplies)!=null&&b.get(x)&&(m=this._checkLinkProviderResult(x,f,m)):C.provideLinks(f.y,S=>{var L,A;if(this._isMouseOut)return;const E=S==null?void 0:S.map(M=>({link:M}));(L=this._activeProviderReplies)==null||L.set(x,E),m=this._checkLinkProviderResult(x,f,m),((A=this._activeProviderReplies)==null?void 0:A.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)})}_removeIntersectingLinks(f,d){const m=new Set;for(let w=0;w<d.size;w++){const b=d.get(w);if(b)for(let x=0;x<b.length;x++){const C=b[x],S=C.link.range.start.y<f?0:C.link.range.start.x,E=C.link.range.end.y>f?this._bufferService.cols:C.link.range.end.x;for(let L=S;L<=E;L++){if(m.has(L)){b.splice(x--,1);break}m.add(L)}}}}_checkLinkProviderResult(f,d,m){var x;if(!this._activeProviderReplies)return m;const w=this._activeProviderReplies.get(f);let b=!1;for(let C=0;C<f;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&w){const C=w.find(S=>this._linkAtPosition(S.link,d));C&&(m=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!m)for(let C=0;C<this._activeProviderReplies.size;C++){const S=(x=this._activeProviderReplies.get(C))==null?void 0:x.find(E=>this._linkAtPosition(E.link,d));if(S){m=!0,this._handleNewLink(S);break}}return m}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const d=this._positionFromMouseEvent(f,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,d){this._currentLink&&this._lastMouseEvent&&(!f||!d||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(f.link,d)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.pointerCursor},set:m=>{var w;(w=this._currentLink)!=null&&w.state&&this._currentLink.state.decorations.pointerCursor!==m&&(this._currentLink.state.decorations.pointerCursor=m,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",m))}},underline:{get:()=>{var m,w;return(w=(m=this._currentLink)==null?void 0:m.state)==null?void 0:w.decorations.underline},set:m=>{var w,b,x;(w=this._currentLink)!=null&&w.state&&((x=(b=this._currentLink)==null?void 0:b.state)==null?void 0:x.decorations.underline)!==m&&(this._currentLink.state.decorations.underline=m,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,m))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(m=>{if(!this._currentLink)return;const w=m.start===0?0:m.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+m.end;if(this._currentLink.link.range.start.y>=w&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(w,b),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}})))}_linkHover(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(m,d.text)}_fireUnderlineEvent(f,d){const m=f.range,w=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(m.start.x-1,m.start.y-w-1,m.end.x,m.end.y-w-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(f,d,m){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(m,d.text)}_linkAtPosition(f,d){const m=f.range.start.y*this._bufferService.cols+f.range.start.x,w=f.range.end.y*this._bufferService.cols+f.range.end.x,b=d.y*this._bufferService.cols+d.x;return m<=b&&b<=w}_positionFromMouseEvent(f,d,m){const w=m.getCoords(f,d,this._bufferService.cols,this._bufferService.rows);if(w)return{x:w[0],y:w[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,d,m,w,b){return{x1:f,y1:d,x2:m,y2:w,cols:this._bufferService.cols,fg:b}}};i.Linkifier=h=c([g(1,v.IMouseService),g(2,v.IRenderService),g(3,y.IBufferService),g(4,v.ILinkProviderService)],h)},9042:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const u=o(511),p=o(2585);let _=i.OscLinkProvider=class{constructor(v,h,f){this._bufferService=v,this._optionsService=h,this._oscLinkService=f}provideLinks(v,h){var E;const f=this._bufferService.buffer.lines.get(v-1);if(!f)return void h(void 0);const d=[],m=this._optionsService.rawOptions.linkHandler,w=new u.CellData,b=f.getTrimmedLength();let x=-1,C=-1,S=!1;for(let L=0;L<b;L++)if(C!==-1||f.hasContent(L)){if(f.loadCell(L,w),w.hasExtendedAttrs()&&w.extended.urlId){if(C===-1){C=L,x=w.extended.urlId;continue}S=w.extended.urlId!==x}else C!==-1&&(S=!0);if(S||C!==-1&&L===b-1){const A=(E=this._oscLinkService.getLinkData(x))==null?void 0:E.uri;if(A){const M={start:{x:C+1,y:v},end:{x:L+(S||L!==b-1?0:1),y:v}};let D=!1;if(!(m!=null&&m.allowNonHttpProtocols))try{const O=new URL(A);["http:","https:"].includes(O.protocol)||(D=!0)}catch{D=!0}D||d.push({text:A,range:M,activate:(O,H)=>m?m.activate(O,H,M):y(0,H),hover:(O,H)=>{var F;return(F=m==null?void 0:m.hover)==null?void 0:F.call(m,O,H,M)},leave:(O,H)=>{var F;return(F=m==null?void 0:m.leave)==null?void 0:F.call(m,O,H,M)}})}S=!1,w.hasExtendedAttrs()&&w.extended.urlId?(C=L,x=w.extended.urlId):(C=-1,x=-1)}}h(d)}};function y(v,h){if(confirm(`Do you want to navigate to ${h}?
56
56
 
57
- WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=_=c([g(0,p.IBufferService),g(1,p.IOptionsService),g(2,p.IOscLinkService)],_)},6193:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,g){this._rowCount=g,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const c=o(3614),g=o(3656),u=o(3551),p=o(9042),_=o(3730),y=o(1680),v=o(3107),h=o(5744),f=o(2950),d=o(1296),m=o(428),w=o(4269),b=o(5114),x=o(8934),C=o(3230),S=o(9312),E=o(4725),L=o(6731),A=o(8055),M=o(8969),D=o(8460),N=o(844),H=o(6114),F=o(8437),$=o(2584),O=o(7399),R=o(5941),P=o(9074),B=o(2585),j=o(5435),W=o(4567),K=o(779);class ee extends M.CoreTerminal{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}constructor(z={}){super(z),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new N.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((I,V)=>this.refresh(I,V))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(I=>this._reportWindowsOptions(I))),this.register(this._inputHandler.onColor(I=>this._handleColorEvent(I))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(I=>this._afterResize(I.cols,I.rows))),this.register((0,N.toDisposable)(()=>{var I,V;this._customKeyEventHandler=void 0,(V=(I=this.element)==null?void 0:I.parentNode)==null||V.removeChild(this.element)}))}_handleColorEvent(z){if(this._themeService)for(const I of z){let V,U="";switch(I.index){case 256:V="foreground",U="10";break;case 257:V="background",U="11";break;case 258:V="cursor",U="12";break;default:V="ansi",U="4;"+I.index}switch(I.type){case 0:const J=A.color.toColorRGB(V==="ansi"?this._themeService.colors.ansi[I.index]:this._themeService.colors[V]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${U};${(0,R.toRgbString)(J)}${$.C1_ESCAPED.ST}`);break;case 1:if(V==="ansi")this._themeService.modifyColors(X=>X.ansi[I.index]=A.channels.toColor(...I.color));else{const X=V;this._themeService.modifyColors(me=>me[X]=A.channels.toColor(...I.color))}break;case 2:this._themeService.restoreColor(I.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(z){z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var z;return(z=this.textarea)==null?void 0:z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const z=this.buffer.ybase+this.buffer.y,I=this.buffer.lines.get(z);if(!I)return;const V=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,J=I.getWidth(V),X=this._renderService.dimensions.css.cell.width*J,me=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=V*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=me+"px",this.textarea.style.width=X+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",I=>{this.hasSelection()&&(0,c.copyHandler)(I,this._selectionService)}));const z=I=>(0,c.handlePasteEvent)(I,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",z)),H.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",I=>{I.button===2&&(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",I=>{(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",I=>{I.button===1&&(0,c.moveTextAreaUnderMouseCursor)(I,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",z=>this._keyUp(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",z=>this._keyDown(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",z=>this._keyPress(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",z=>this._compositionHelper.compositionupdate(z))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",z=>this._inputEvent(z),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(z){var V;if(!z)throw new Error("Terminal requires a parent element.");if(z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((V=this.element)==null?void 0:V.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=z.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"),z.appendChild(this.element);const I=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),I.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",U=>this.updateCursorStyle(U))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),I.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),H.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(b.CoreBrowserService,this.textarea,z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(m.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(I);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),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.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(v.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),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(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const z=this,I=this.element;function V(X){const me=z._mouseService.getMouseReportCoords(X,z.screenElement);if(!me)return!1;let ce,fe;switch(X.overrideType||X.type){case"mousemove":fe=32,X.buttons===void 0?(ce=3,X.button!==void 0&&(ce=X.button<3?X.button:3)):ce=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":fe=0,ce=X.button<3?X.button:3;break;case"mousedown":fe=1,ce=X.button<3?X.button:3;break;case"wheel":if(z._customWheelEventHandler&&z._customWheelEventHandler(X)===!1||z.viewport.getLinesScrolled(X)===0)return!1;fe=X.deltaY<0?0:1,ce=4;break;default:return!1}return!(fe===void 0||ce===void 0||ce>4)&&z.coreMouseService.triggerMouseEvent({col:me.col,row:me.row,x:me.x,y:me.y,button:ce,action:fe,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:X=>(V(X),X.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(X)),wheel:X=>(V(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&V(X)},mousemove:X=>{X.buttons||V(X)}};this.register(this.coreMouseService.onProtocolChange(X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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()),8&X?U.mousemove||(I.addEventListener("mousemove",J.mousemove),U.mousemove=J.mousemove):(I.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&X?U.wheel||(I.addEventListener("wheel",J.wheel,{passive:!1}),U.wheel=J.wheel):(I.removeEventListener("wheel",U.wheel),U.wheel=null),2&X?U.mouseup||(U.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&X?U.mousedrag||(U.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(I,"mousedown",X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return V(X),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(X)})),this.register((0,g.addDisposableDomListener)(I,"wheel",X=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){const me=this.viewport.getLinesScrolled(X);if(me===0)return;const ce=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B");let fe="";for(let Ee=0;Ee<Math.abs(me);Ee++)fe+=ce;return this.coreService.triggerDataEvent(fe,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(I,"touchstart",X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)},{passive:!0})),this.register((0,g.addDisposableDomListener)(I,"touchmove",X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)},{passive:!1}))}refresh(z,I){var V;(V=this._renderService)==null||V.refreshRows(z,I)}updateCursorStyle(z){var I;(I=this._selectionService)!=null&&I.shouldColumnSelect(z)?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(z,I,V=0){var U;V===1?(super.scrollLines(z,I,V),this.refresh(0,this.rows-1)):(U=this.viewport)==null||U.scrollLines(z)}paste(z){(0,c.paste)(z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(z){this._customKeyEventHandler=z}attachCustomWheelEventHandler(z){this._customWheelEventHandler=z}registerLinkProvider(z){return this._linkProviderService.registerLinkProvider(z)}registerCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const I=this._characterJoinerService.register(z);return this.refresh(0,this.rows-1),I}deregisterCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+z)}registerDecoration(z){return this._decorationService.registerDecoration(z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(z,I,V){this._selectionService.setSelection(z,I,V)}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(){var z;(z=this._selectionService)==null||z.clearSelection()}selectAll(){var z;(z=this._selectionService)==null||z.selectAll()}selectLines(z,I){var V;(V=this._selectionService)==null||V.selectLines(z,I)}_keyDown(z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;const I=this.browser.isMac&&this.options.macOptionIsMeta&&z.altKey;if(!I&&!this._compositionHelper.keydown(z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;I||z.key!=="Dead"&&z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const V=(0,O.evaluateKeyboardEvent)(z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(z),V.type===3||V.type===2){const U=this.rows-1;return this.scrollLines(V.type===2?-U:U),this.cancel(z,!0)}return V.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,z)||(V.cancel&&this.cancel(z,!0),!V.key||!!(z.key&&!z.ctrlKey&&!z.altKey&&!z.metaKey&&z.key.length===1&&z.key.charCodeAt(0)>=65&&z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(V.key!==$.C0.ETX&&V.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:V.key,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(V.key,!0),!this.optionsService.rawOptions.screenReaderMode||z.altKey||z.ctrlKey?this.cancel(z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(z,I){const V=z.isMac&&!this.options.macOptionIsMeta&&I.altKey&&!I.ctrlKey&&!I.metaKey||z.isWindows&&I.altKey&&I.ctrlKey&&!I.metaKey||z.isWindows&&I.getModifierState("AltGraph");return I.type==="keypress"?V:V&&(!I.keyCode||I.keyCode>47)}_keyUp(z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1||(function(I){return I.keyCode===16||I.keyCode===17||I.keyCode===18}(z)||this.focus(),this.updateCursorStyle(z),this._keyPressHandled=!1)}_keyPress(z){let I;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;if(this.cancel(z),z.charCode)I=z.charCode;else if(z.which===null||z.which===void 0)I=z.keyCode;else{if(z.which===0||z.charCode===0)return!1;I=z.which}return!(!I||(z.altKey||z.ctrlKey||z.metaKey)&&!this._isThirdLevelShift(this.browser,z)||(I=String.fromCharCode(I),this._onKey.fire({key:I,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(I,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(z){if(z.data&&z.inputType==="insertText"&&(!z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const I=z.data;return this.coreService.triggerDataEvent(I,!0),this.cancel(z),!0}return!1}resize(z,I){z!==this.cols||I!==this.rows?super.resize(z,I):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(z,I){var V,U;(V=this._charSizeService)==null||V.measure(),(U=this.viewport)==null||U.syncScrollArea(!0)}clear(){var z;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 I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(z=this.viewport)==null||z.reset(),this.refresh(0,this.rows-1)}}reset(){var I,V;this.options.rows=this.rows,this.options.cols=this.cols;const z=this._customKeyEventHandler;this._setup(),super.reset(),(I=this._selectionService)==null||I.reset(),this._decorationService.reset(),(V=this.viewport)==null||V.reset(),this._customKeyEventHandler=z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var z;(z=this._renderService)==null||z.clearTextureAtlas()}_reportFocus(){var z;(z=this.element)!=null&&z.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(z){if(this._renderService)switch(z){case j.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const I=this._renderService.dimensions.css.canvas.width.toFixed(0),V=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${V};${I}t`);break;case j.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${J};${U}t`)}}cancel(z,I){if(this.options.cancelEvents||I)return z.preventDefault(),z.stopPropagation(),!1}}i.Terminal=ee},9924:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,g){this._rowCount=g,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=u-this._lastRefreshMs,_=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const u=o(3656),p=o(4725),_=o(8460),y=o(844),v=o(2585);let h=i.Viewport=class extends y.Disposable{constructor(f,d,m,w,b,x,C,S){super(),this._viewportElement=f,this._scrollArea=d,this._bufferService=m,this._optionsService=w,this._charSizeService=b,this._renderService=x,this._coreBrowserService=C,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(S.colors),this.register(S.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(f){if(f)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(f,d){const m=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&m<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const d=this._getPixelsScrolled(f);return d!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(f,d){var S;let m,w="";const b=[],x=d??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=f;E<x;E++){const L=C.get(E);if(!L)continue;const A=(S=C.get(E+1))==null?void 0:S.isWrapped;if(w+=L.translateToString(!A),!A||E===C.length-1){const M=document.createElement("div");M.textContent=w,b.push(M),w.length>0&&(m=M),w=""}}return{bufferElements:b,cursorElement:m}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(f,d){const m=this._optionsService.rawOptions.fastScrollModifier;return m==="alt"&&d.altKey||m==="ctrl"&&d.ctrlKey||m==="shift"&&d.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const d=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}};i.Viewport=h=c([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,p.ICharSizeService),g(5,p.IRenderService),g(6,p.ICoreBrowserService),g(7,p.IThemeService)],h)},3107:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const u=o(4725),p=o(844),_=o(2585);let y=i.BufferDecorationRenderer=class extends p.Disposable{constructor(v,h,f,d,m){super(),this._screenElement=v,this._bufferService=h,this._coreBrowserService=f,this._decorationService=d,this._renderService=m,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(w=>this._removeDecoration(w))),this.register((0,p.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const v of this._decorationService.decorations)this._renderDecoration(v);this._dimensionsChanged=!1}_renderDecoration(v){this._refreshStyle(v),this._dimensionsChanged&&this._refreshXPosition(v)}_createElement(v){var d;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((d=v==null?void 0:v.options)==null?void 0:d.layer)==="top"),h.style.width=`${Math.round((v.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(v.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(v.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=v.options.x??0;return f&&f>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(v,h),h}_refreshStyle(v){const h=v.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)v.element&&(v.element.style.display="none",v.onRenderEmitter.fire(v.element));else{let f=this._decorationElements.get(v);f||(f=this._createElement(v),v.element=f,this._decorationElements.set(v,f),this._container.appendChild(f),v.onDispose(()=>{this._decorationElements.delete(v),f.remove()})),f.style.top=h*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",v.onRenderEmitter.fire(f)}}_refreshXPosition(v,h=v.element){if(!h)return;const f=v.options.x??0;(v.options.anchor||"left")==="right"?h.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(v){var h;(h=this._decorationElements.get(v))==null||h.remove(),this._decorationElements.delete(v),v.dispose()}};i.BufferDecorationRenderer=y=c([g(1,_.IBufferService),g(2,u.ICoreBrowserService),g(3,_.IDecorationService),g(4,u.IRenderService)],y)},5871:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=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(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,g){return c>=o.startBufferLine-this._linePadding[g||"full"]&&c<=o.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(l,i,o){var c=this&&this.__decorate||function(m,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,w,b,x);else for(var L=m.length-1;L>=0;L--)(C=m[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},g=this&&this.__param||function(m,w){return function(b,x){w(b,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const u=o(5871),p=o(4725),_=o(844),y=o(2585),v={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let d=i.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(m,w,b,x,C,S,E){var A;super(),this._viewportElement=m,this._screenElement=w,this._bufferService=b,this._decorationService=x,this._renderService=C,this._optionsService=S,this._coreBrowserService=E,this._colorZoneStore=new u.ColorZoneStore,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(),(A=this._viewportElement.parentElement)==null||A.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)(()=>{var M;(M=this._canvas)==null||M.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){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())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const m=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=m,h.center=w,h.right=m,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=h.left,f.right=h.left+h.center}_refreshDrawHeightConstants(){v.full=Math.round(2*this._coreBrowserService.dpr);const m=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(m,12),6)*this._coreBrowserService.dpr);v.left=w,v.center=w,v.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.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(const w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const m=this._colorZoneStore.zones;for(const w of m)w.position!=="full"&&this._renderColorZone(w);for(const w of m)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(m){this._ctx.fillStyle=m.color,this._ctx.fillRect(f[m.position||"full"],Math.round((this._canvas.height-1)*(m.startBufferLine/this._bufferService.buffers.active.lines.length)-v[m.position||"full"]/2),h[m.position||"full"],Math.round((this._canvas.height-1)*((m.endBufferLine-m.startBufferLine)/this._bufferService.buffers.active.lines.length)+v[m.position||"full"]))}_queueRefresh(m,w){this._shouldUpdateDimensions=m||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i.OverviewRulerRenderer=d=c([g(2,y.IBufferService),g(3,y.IDecorationService),g(4,p.IRenderService),g(5,y.IOptionsService),g(6,p.ICoreBrowserService)],d)},2950:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const u=o(4725),p=o(2585),_=o(2584);let y=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(v,h,f,d,m,w){this._textarea=v,this._compositionView=h,this._bufferService=f,this._optionsService=d,this._coreService=m,this._renderService=w,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(v){this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(v){if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){const h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}},0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const v=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const h=this._textarea.value,f=h.replace(v,"");this._dataAlreadySent=f,h.length>v.length?this._coreService.triggerDataEvent(f,!0):h.length<v.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):h.length===v.length&&h!==v&&this._coreService.triggerDataEvent(h,!0)}},0)}updateCompositionElements(v){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,m=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=m+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=m+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}v||setTimeout(()=>this.updateCompositionElements(!0),0)}}};i.CompositionHelper=y=c([g(2,p.IBufferService),g(3,p.IOptionsService),g(4,p.ICoreService),g(5,u.IRenderService)],y)},9806:(l,i)=>{function o(c,g,u){const p=u.getBoundingClientRect(),_=c.getComputedStyle(u),y=parseInt(_.getPropertyValue("padding-left")),v=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-p.left-y,g.clientY-p.top-v]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=o,i.getCoords=function(c,g,u,p,_,y,v,h,f){if(!y)return;const d=o(c,g,u);return d?(d[0]=Math.ceil((d[0]+(f?v/2:0))/v),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),p+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),_),d):void 0}},9504:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const c=o(2584);function g(h,f,d,m){const w=h-u(h,d),b=f-u(f,d),x=Math.abs(w-b)-function(C,S,E){let L=0;const A=C-u(C,E),M=S-u(S,E);for(let D=0;D<Math.abs(A-M);D++){const N=p(C,S)==="A"?-1:1,H=E.buffer.lines.get(A+N*D);H!=null&&H.isWrapped&&L++}return L}(h,f,d);return v(x,y(p(h,f),m))}function u(h,f){let d=0,m=f.buffer.lines.get(h),w=m==null?void 0:m.isWrapped;for(;w&&h>=0&&h<f.rows;)d++,m=f.buffer.lines.get(--h),w=m==null?void 0:m.isWrapped;return d}function p(h,f){return h>f?"A":"B"}function _(h,f,d,m,w,b){let x=h,C=f,S="";for(;x!==d||C!==m;)x+=w?1:-1,w&&x>b.cols-1?(S+=b.buffer.translateBufferLineToString(C,!1,h,x),x=0,h=0,C++):!w&&x<0&&(S+=b.buffer.translateBufferLineToString(C,!1,0,h+1),x=b.cols-1,h=x,C--);return S+b.buffer.translateBufferLineToString(C,!1,h,x)}function y(h,f){const d=f?"O":"[";return c.C0.ESC+d+h}function v(h,f){h=Math.floor(h);let d="";for(let m=0;m<h;m++)d+=f;return d}i.moveToCellSequence=function(h,f,d,m){const w=d.buffer.x,b=d.buffer.y;if(!d.buffer.hasScrollback)return function(S,E,L,A,M,D){return g(E,A,M,D).length===0?"":v(_(S,E,S,E-u(E,M),!1,M).length,y("D",D))}(w,b,0,f,d,m)+g(b,f,d,m)+function(S,E,L,A,M,D){let N;N=g(E,A,M,D).length>0?A-u(A,M):E;const H=A,F=function($,O,R,P,B,j){let W;return W=g(R,P,B,j).length>0?P-u(P,B):O,$<R&&W<=P||$>=R&&W<P?"C":"D"}(S,E,L,A,M,D);return v(_(S,N,L,H,F==="C",M).length,y(F,D))}(w,b,h,f,d,m);let x;if(b===f)return x=w>h?"D":"C",v(Math.abs(w-h),y(x,m));x=b>f?"D":"C";const C=Math.abs(b-f);return v(function(S,E){return E.cols-S}(b>f?h:w,d)+(C-1)*d.cols+1+((b>f?w:h)-1),y(x,m))}},1296:function(l,i,o){var c=this&&this.__decorate||function(D,N,H,F){var $,O=arguments.length,R=O<3?N:F===null?F=Object.getOwnPropertyDescriptor(N,H):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(D,N,H,F);else for(var P=D.length-1;P>=0;P--)($=D[P])&&(R=(O<3?$(R):O>3?$(N,H,R):$(N,H))||R);return O>3&&R&&Object.defineProperty(N,H,R),R},g=this&&this.__param||function(D,N){return function(H,F){N(H,F,D)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const u=o(3787),p=o(2550),_=o(2223),y=o(6171),v=o(6052),h=o(4725),f=o(8055),d=o(8460),m=o(844),w=o(2585),b="xterm-dom-renderer-owner-",x="xterm-rows",C="xterm-fg-",S="xterm-bg-",E="xterm-focus",L="xterm-selection";let A=1,M=i.DomRenderer=class extends m.Disposable{constructor(D,N,H,F,$,O,R,P,B,j,W,K,ee){super(),this._terminal=D,this._document=N,this._element=H,this._screenElement=F,this._viewportElement=$,this._helperContainer=O,this._linkifier2=R,this._charSizeService=B,this._optionsService=j,this._bufferService=W,this._coreBrowserService=K,this._themeService=ee,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,v.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(Z=>this._injectCss(Z))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(Z=>this._handleLinkHover(Z))),this.register(this._linkifier2.onHideLinkUnderline(Z=>this._handleLinkLeave(Z))),this.register((0,m.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new p.WidthCache(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(){const D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const N=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=N,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let N=`${this._terminalSelector} .${x} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;N+=`${this._terminalSelector} .${x} .xterm-dim { color: ${f.color.multiplyOpacity(D.foreground,.5).css};}`,N+=`${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;}`;const H=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;N+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,N+=`@keyframes ${F} { 50% { box-shadow: none; }}`,N+=`@keyframes ${$} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,N+=`${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,N+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[O,R]of D.ansi.entries())N+=`${this._terminalSelector} .${C}${O} { color: ${R.css}; }${this._terminalSelector} .${C}${O}.xterm-dim { color: ${f.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${S}${O} { background-color: ${R.css}; }`;N+=`${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${S}${_.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=N}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,N){for(let H=this._rowElements.length;H<=N;H++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>N;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,N){this._refreshRowElements(D,N),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,N,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,N,H),this.renderRows(0,this._bufferService.rows-1),!D||!N)return;this._selectionRenderModel.update(this._terminal,D,N,H);const F=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||R<0)return;const P=this._document.createDocumentFragment();if(H){const B=D[0]>N[0];P.appendChild(this._createSelectionElement(O,B?N[0]:D[0],B?D[0]:N[0],R-O+1))}else{const B=F===O?D[0]:0,j=O===$?N[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(O,B,j));const W=R-O-1;if(P.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,W)),O!==R){const K=$===R?N[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(R,0,K))}}this._selectionContainer.appendChild(P)}_createSelectionElement(D,N,H,F=1){const $=this._document.createElement("div"),O=N*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(H-N);return O+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-O),$.style.height=F*this.dimensions.css.cell.height+"px",$.style.top=D*this.dimensions.css.cell.height+"px",$.style.left=`${O}px`,$.style.width=`${R}px`,$}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(const D of this._rowElements)D.replaceChildren()}renderRows(D,N){const H=this._bufferService.buffer,F=H.ybase+H.y,$=Math.min(H.x,this._bufferService.cols-1),O=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=D;B<=N;B++){const j=B+H.ydisp,W=this._rowElements[B],K=H.lines.get(j);if(!W||!K)break;W.replaceChildren(...this._rowFactory.createRow(K,j,j===F,R,P,$,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,N,H,F,$,O){H<0&&(D=0),F<0&&(N=0);const R=this._bufferService.rows-1;H=Math.max(Math.min(H,R),0),F=Math.max(Math.min(F,R),0),$=Math.min($,this._bufferService.cols);const P=this._bufferService.buffer,B=P.ybase+P.y,j=Math.min(P.x,$-1),W=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=H;Z<=F;++Z){const z=Z+P.ydisp,I=this._rowElements[Z],V=P.lines.get(z);if(!I||!V)break;I.replaceChildren(...this._rowFactory.createRow(V,z,z===B,K,ee,j,W,this.dimensions.css.cell.width,this._widthCache,O?Z===H?D:0:-1,O?(Z===F?N:$)-1:-1))}}};i.DomRenderer=M=c([g(7,w.IInstantiationService),g(8,h.ICharSizeService),g(9,w.IOptionsService),g(10,w.IBufferService),g(11,h.ICoreBrowserService),g(12,h.IThemeService)],M)},3787:function(l,i,o){var c=this&&this.__decorate||function(x,C,S,E){var L,A=arguments.length,M=A<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,C,S,E);else for(var D=x.length-1;D>=0;D--)(L=x[D])&&(M=(A<3?L(M):A>3?L(C,S,M):L(C,S))||M);return A>3&&M&&Object.defineProperty(C,S,M),M},g=this&&this.__param||function(x,C){return function(S,E){C(S,E,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const u=o(2223),p=o(643),_=o(511),y=o(2585),v=o(8055),h=o(4725),f=o(4269),d=o(6171),m=o(3734);let w=i.DomRendererRowFactory=class{constructor(x,C,S,E,L,A,M){this._document=x,this._characterJoinerService=C,this._optionsService=S,this._coreBrowserService=E,this._coreService=L,this._decorationService=A,this._themeService=M,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,C,S){this._selectionStart=x,this._selectionEnd=C,this._columnSelectMode=S}createRow(x,C,S,E,L,A,M,D,N,H,F){const $=[],O=this._characterJoinerService.getJoinedCharacters(C),R=this._themeService.colors;let P,B=x.getNoBgTrimmedLength();S&&B<A+1&&(B=A+1);let j=0,W="",K=0,ee=0,Z=0,z=!1,I=0,V=!1,U=0;const J=[],X=H!==-1&&F!==-1;for(let me=0;me<B;me++){x.loadCell(me,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let fe=!1,Ee=me,ae=this._workCell;if(O.length>0&&me===O[0][0]){fe=!0;const ge=O.shift();ae=new f.JoinedCellData(this._workCell,x.translateToString(!0,ge[0],ge[1]),ge[1]-ge[0]),Ee=ge[1]-1,ce=ae.getWidth()}const Te=this._isCellInSelection(me,C),je=S&&me===A,pe=X&&me>=H&&me<=F;let _e=!1;this._decorationService.forEachDecorationAtCell(me,C,void 0,ge=>{_e=!0});let ke=ae.getChars()||p.WHITESPACE_CELL_CHAR;if(ke===" "&&(ae.isUnderline()||ae.isOverline())&&(ke=" "),U=ce*D-N.get(ke,ae.isBold(),ae.isItalic()),P){if(j&&(Te&&V||!Te&&!V&&ae.bg===K)&&(Te&&V&&R.selectionForeground||ae.fg===ee)&&ae.extended.ext===Z&&pe===z&&U===I&&!je&&!fe&&!_e){ae.isInvisible()?W+=p.WHITESPACE_CELL_CHAR:W+=ke,j++;continue}j&&(P.textContent=W),P=this._document.createElement("span"),j=0,W=""}else P=this._document.createElement("span");if(K=ae.bg,ee=ae.fg,Z=ae.extended.ext,z=pe,I=U,V=Te,fe&&A>=me&&A<=Ee&&(A=me),!this._coreService.isCursorHidden&&je&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&J.push("xterm-cursor-blink"),J.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline")}}if(ae.isBold()&&J.push("xterm-bold"),ae.isItalic()&&J.push("xterm-italic"),ae.isDim()&&J.push("xterm-dim"),W=ae.isInvisible()?p.WHITESPACE_CELL_CHAR:ae.getChars()||p.WHITESPACE_CELL_CHAR,ae.isUnderline()&&(J.push(`xterm-underline-${ae.extended.underlineStyle}`),W===" "&&(W=" "),!ae.isUnderlineColorDefault()))if(ae.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${m.AttributeData.toColorRGB(ae.getUnderlineColor()).join(",")})`;else{let ge=ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ae.isBold()&&ge<8&&(ge+=8),P.style.textDecorationColor=R.ansi[ge].css}ae.isOverline()&&(J.push("xterm-overline"),W===" "&&(W=" ")),ae.isStrikethrough()&&J.push("xterm-strikethrough"),pe&&(P.style.textDecoration="underline");let se=ae.getFgColor(),be=ae.getFgColorMode(),oe=ae.getBgColor(),he=ae.getBgColorMode();const Le=!!ae.isInverse();if(Le){const ge=se;se=oe,oe=ge;const He=be;be=he,he=He}let Re,Ce,q,Q=!1;switch(this._decorationService.forEachDecorationAtCell(me,C,void 0,ge=>{ge.options.layer!=="top"&&Q||(ge.backgroundColorRGB&&(he=50331648,oe=ge.backgroundColorRGB.rgba>>8&16777215,Re=ge.backgroundColorRGB),ge.foregroundColorRGB&&(be=50331648,se=ge.foregroundColorRGB.rgba>>8&16777215,Ce=ge.foregroundColorRGB),Q=ge.options.layer==="top")}),!Q&&Te&&(Re=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,oe=Re.rgba>>8&16777215,he=50331648,Q=!0,R.selectionForeground&&(be=50331648,se=R.selectionForeground.rgba>>8&16777215,Ce=R.selectionForeground)),Q&&J.push("xterm-decoration-top"),he){case 16777216:case 33554432:q=R.ansi[oe],J.push(`xterm-bg-${oe}`);break;case 50331648:q=v.channels.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(P,`background-color:#${b((oe>>>0).toString(16),"0",6)}`);break;default:Le?(q=R.foreground,J.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):q=R.background}switch(Re||ae.isDim()&&(Re=v.color.multiplyOpacity(q,.5)),be){case 16777216:case 33554432:ae.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(P,q,R.ansi[se],ae,Re,void 0)||J.push(`xterm-fg-${se}`);break;case 50331648:const ge=v.channels.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(P,q,ge,ae,Re,Ce)||this._addStyle(P,`color:#${b(se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,q,R.foreground,ae,Re,Ce)||Le&&J.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),je||fe||_e?P.textContent=W:j++,U!==this.defaultSpacing&&(P.style.letterSpacing=`${U}px`),$.push(P),me=Ee}return P&&j&&(P.textContent=W),$}_applyMinimumContrast(x,C,S,E,L,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const M=this._getContrastCache(E);let D;if(L||A||(D=M.getColor(C.rgba,S.rgba)),D===void 0){const N=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=v.color.ensureContrastRatio(L||C,A||S,N),M.setColor((L||C).rgba,(A||S).rgba,D??null)}return!!D&&(this._addStyle(x,`color:${D.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,C){x.setAttribute("style",`${x.getAttribute("style")||""}${C};`)}_isCellInSelection(x,C){const S=this._selectionStart,E=this._selectionEnd;return!(!S||!E)&&(this._columnSelectMode?S[0]<=E[0]?x>=S[0]&&C>=S[1]&&x<E[0]&&C<=E[1]:x<S[0]&&C>=S[1]&&x>=E[0]&&C<=E[1]:C>S[1]&&C<E[1]||S[1]===E[1]&&C===S[1]&&x>=S[0]&&x<E[0]||S[1]<E[1]&&C===E[1]&&x<E[0]||S[1]<E[1]&&C===S[1]&&x>=S[0])}};function b(x,C,S){for(;x.length<S;)x=C+x;return x}i.DomRendererRowFactory=w=c([g(1,h.ICharacterJoinerService),g(2,y.IOptionsService),g(3,h.ICoreBrowserService),g(4,y.ICoreService),g(5,y.IDecorationService),g(6,h.IThemeService)],w)},2550:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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";const g=o.createElement("span");g.classList.add("xterm-char-measure-element");const u=o.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,u,p,_],this._container.appendChild(g),this._container.appendChild(u),this._container.appendChild(p),this._container.appendChild(_),c.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(o,c,g,u){o===this._font&&c===this._fontSize&&g===this._weight&&u===this._weightBold||(this._font=o,this._fontSize=c,this._weight=g,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(o,c,g){let u=0;if(!c&&!g&&o.length===1&&(u=o.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const y=this._measure(o,0);return y>0&&(this._flat[u]=y),y}let p=o;c&&(p+="B"),g&&(p+="I");let _=this._holey.get(p);if(_===void 0){let y=0;c&&(y|=1),g&&(y|=2),_=this._measure(o,y),_>0&&this._holey.set(p,_)}return _}_measure(o,c){const g=this._measureElements[c];return g.textContent=o.repeat(32),g.offsetWidth/32}}},2223:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(l,i)=>{function o(g){return 57508<=g&&g<=57558}function c(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=o,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=c,i.allowRescaling=function(g,u,p,_){return u===1&&p>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!c(g)&&!o(g)&&!function(y){return 57344<=y&&y<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return o(g)||function(u){return 9472<=u&&u<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,u,p=0){return(g-(2*Math.round(u)-p))%(2*Math.round(u))}},6052:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class o{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(g,u,p,_=!1){if(this.selectionStart=u,this.selectionEnd=p,!u||!p||u[0]===p[0]&&u[1]===p[1])return void this.clear();const y=g.buffers.active.ydisp,v=u[1]-y,h=p[1]-y,f=Math.max(v,0),d=Math.min(h,g.rows-1);f>=g.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=p[0])}isCellSelected(g,u,p){return!!this.hasSelection&&(p-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&p>=this.viewportCappedStartRow&&u<this.endCol&&p<=this.viewportCappedEndRow:u<this.startCol&&p>=this.viewportCappedStartRow&&u>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol)}}i.createSelectionRenderModel=function(){return new o}},456:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(o){this._bufferService=o,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.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()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const u=o(2585),p=o(8460),_=o(844);let y=i.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,m,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new h(d,m,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};i.CharSizeService=y=c([g(2,u.IOptionsService)],y);class v extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(m,w){m!==void 0&&m>0&&w!==void 0&&w>0&&(this._result.width=m,this._result.height=w)}}class h extends v{constructor(m,w,b){super(),this._document=m,this._parentElement=w,this._optionsService=b,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}}class f extends v{constructor(m){super(),this._optionsService=m,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const m=this._ctx.measureText("W");return this._validateAndSet(m.width,m.fontBoundingBoxAscent+m.fontBoundingBoxDescent),this._result}}},4269:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const u=o(3734),p=o(643),_=o(511),y=o(2585);class v extends u.AttributeData{constructor(d,m,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=m,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=v;let h=i.CharacterJoinerService=class V1{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(d){const m={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(m),m.id}deregister(d){for(let m=0;m<this._characterJoiners.length;m++)if(this._characterJoiners[m].id===d)return this._characterJoiners.splice(m,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const m=this._bufferService.buffer.lines.get(d);if(!m||m.length===0)return[];const w=[],b=m.translateToString(!0);let x=0,C=0,S=0,E=m.getFg(0),L=m.getBg(0);for(let A=0;A<m.getTrimmedLength();A++)if(m.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==L){if(A-x>1){const M=this._getJoinedRanges(b,S,C,m,x);for(let D=0;D<M.length;D++)w.push(M[D])}x=A,S=C,E=this._workCell.fg,L=this._workCell.bg}C+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const A=this._getJoinedRanges(b,S,C,m,x);for(let M=0;M<A.length;M++)w.push(A[M])}return w}_getJoinedRanges(d,m,w,b,x){const C=d.substring(m,w);let S=[];try{S=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const L=this._characterJoiners[E].handler(C);for(let A=0;A<L.length;A++)V1._mergeRanges(S,L[A])}catch(L){console.error(L)}return this._stringRangesToCellRanges(S,b,x),S}_stringRangesToCellRanges(d,m,w){let b=0,x=!1,C=0,S=d[b];if(S){for(let E=w;E<this._bufferService.cols;E++){const L=m.getWidth(E),A=m.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!x&&S[0]<=C&&(S[0]=E,x=!0),S[1]<=C){if(S[1]=E,S=d[++b],!S)break;S[0]<=C?(S[0]=E,x=!0):x=!1}C+=A}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(d,m){let w=!1;for(let b=0;b<d.length;b++){const x=d[b];if(w){if(m[1]<=x[0])return d[b-1][1]=m[1],d;if(m[1]<=x[1])return d[b-1][1]=Math.max(m[1],x[1]),d.splice(b,1),d;d.splice(b,1),b--}else{if(m[1]<=x[0])return d.splice(b,0,m),d;if(m[1]<=x[1])return x[0]=Math.min(m[0],x[0]),d;m[0]<x[1]&&(x[0]=Math.min(m[0],x[0]),w=!0)}}return w?d[d.length-1][1]=m[1]:d.push(m),d}};i.CharacterJoinerService=h=c([g(0,y.IBufferService)],h)},5114:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const c=o(844),g=o(8460),u=o(3656);class p extends c.Disposable{constructor(v,h,f){super(),this._textarea=v,this._window=h,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(d=>this._screenDprMonitor.setWindow(d))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(v){this._window!==v&&(this._window=v,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}}i.CoreBrowserService=p;class _ extends c.Disposable{constructor(v){super(),this._parentWindow=v,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)(()=>this.clearListener()))}setWindow(v){this._parentWindow=v,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var v;this._outerListener&&((v=this._resolutionMediaMatchList)==null||v.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)}}},779:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const c=o(844);class g extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const _=this.linkProviders.indexOf(p);_!==-1&&this.linkProviders.splice(_,1)}}}}i.LinkProviderService=g},8934:function(l,i,o){var c=this&&this.__decorate||function(y,v,h,f){var d,m=arguments.length,w=m<3?v:f===null?f=Object.getOwnPropertyDescriptor(v,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,v,h,f);else for(var b=y.length-1;b>=0;b--)(d=y[b])&&(w=(m<3?d(w):m>3?d(v,h,w):d(v,h))||w);return m>3&&w&&Object.defineProperty(v,h,w),w},g=this&&this.__param||function(y,v){return function(h,f){v(h,f,y)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const u=o(4725),p=o(9806);let _=i.MouseService=class{constructor(y,v){this._renderService=y,this._charSizeService=v}getCoords(y,v,h,f,d){return(0,p.getCoords)(window,y,v,h,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(y,v){const h=(0,p.getCoordsRelativeToElement)(window,y,v);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};i.MouseService=_=c([g(0,u.IRenderService),g(1,u.ICharSizeService)],_)},3230:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const u=o(6193),p=o(4725),_=o(8460),y=o(844),v=o(7226),h=o(2585);let f=i.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,m,w,b,x,C,S,E){super(),this._rowCount=d,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new v.DebouncedIdleTask,this._observerDisposable=this.register(new y.MutableDisposable),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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer((L,A)=>this._renderRows(L,A),S),this.register(this._renderDebouncer),this.register(S.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var L;return(L=this._renderer.value)==null?void 0:L.clear()})),this.register(w.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(x.onDecorationRegistered(()=>this._fullRefresh())),this.register(x.onDecorationRemoved(()=>this._fullRefresh())),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(S.window,m),this.register(S.onWindowChange(L=>this._registerIntersectionObserver(L,m)))}_registerIntersectionObserver(d,m){if("IntersectionObserver"in d){const w=new d.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});w.observe(m),this._observerDisposable.value=(0,y.toDisposable)(()=>w.disconnect())}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,m,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,m,this._rowCount))}_renderRows(d,m){this._renderer.value&&(d=Math.min(d,this._rowCount-1),m=Math.min(m,this._rowCount-1),this._renderer.value.renderRows(d,m),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:m}),this._onRender.fire({start:d,end:m}),this._isNextRenderRedrawOnly=!0)}resize(d,m){this._rowCount=m,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw(m=>this.refreshRows(m.start,m.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,m;this._renderer.value&&((m=(d=this._renderer.value).clearTextureAtlas)==null||m.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,m){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,m)}):this._renderer.value.handleResize(d,m),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,m,w){var b;this._selectionState.start=d,this._selectionState.end=m,this._selectionState.columnSelectMode=w,(b=this._renderer.value)==null||b.handleSelectionChanged(d,m,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};i.RenderService=f=c([g(2,h.IOptionsService),g(3,p.ICharSizeService),g(4,h.IDecorationService),g(5,h.IBufferService),g(6,p.ICoreBrowserService),g(7,p.IThemeService)],f)},9312:function(l,i,o){var c=this&&this.__decorate||function(S,E,L,A){var M,D=arguments.length,N=D<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(S,E,L,A);else for(var H=S.length-1;H>=0;H--)(M=S[H])&&(N=(D<3?M(N):D>3?M(E,L,N):M(E,L))||N);return D>3&&N&&Object.defineProperty(E,L,N),N},g=this&&this.__param||function(S,E){return function(L,A){E(L,A,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const u=o(9806),p=o(9504),_=o(456),y=o(4725),v=o(8460),h=o(844),f=o(6114),d=o(4841),m=o(511),w=o(2585),b=" ",x=new RegExp(b,"g");let C=i.SelectionService=class extends h.Disposable{constructor(S,E,L,A,M,D,N,H,F){super(),this._element=S,this._screenElement=E,this._linkifier=L,this._bufferService=A,this._coreService=M,this._mouseService=D,this._optionsService=N,this._renderService=H,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new m.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new v.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()}))}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(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E||S[0]===E[0]&&S[1]===E[1])}get selectionText(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!S||!E)return"";const L=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const M=S[0]<E[0]?S[0]:E[0],D=S[0]<E[0]?E[0]:S[0];for(let N=S[1];N<=E[1];N++){const H=L.translateBufferLineToString(N,!0,M,D);A.push(H)}}else{const M=S[1]===E[1]?E[0]:void 0;A.push(L.translateBufferLineToString(S[1],!0,S[0],M));for(let D=S[1]+1;D<=E[1]-1;D++){const N=L.lines.get(D),H=L.translateBufferLineToString(D,!0);N!=null&&N.isWrapped?A[A.length-1]+=H:A.push(H)}if(S[1]!==E[1]){const D=L.lines.get(E[1]),N=L.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?A[A.length-1]+=N:A.push(N)}}return A.map(M=>M.replace(x," ")).join(f.isWindows?`\r
57
+ WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=_=c([g(0,p.IBufferService),g(1,p.IOptionsService),g(2,p.IOscLinkService)],_)},6193:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,g){this._rowCount=g,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const c=o(3614),g=o(3656),u=o(3551),p=o(9042),_=o(3730),y=o(1680),v=o(3107),h=o(5744),f=o(2950),d=o(1296),m=o(428),w=o(4269),b=o(5114),x=o(8934),C=o(3230),S=o(9312),E=o(4725),L=o(6731),A=o(8055),M=o(8969),D=o(8460),O=o(844),H=o(6114),F=o(8437),$=o(2584),N=o(7399),R=o(5941),P=o(9074),B=o(2585),j=o(5435),W=o(4567),K=o(779);class Z extends M.CoreTerminal{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}constructor(z={}){super(z),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((I,V)=>this.refresh(I,V))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(I=>this._reportWindowsOptions(I))),this.register(this._inputHandler.onColor(I=>this._handleColorEvent(I))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(I=>this._afterResize(I.cols,I.rows))),this.register((0,O.toDisposable)(()=>{var I,V;this._customKeyEventHandler=void 0,(V=(I=this.element)==null?void 0:I.parentNode)==null||V.removeChild(this.element)}))}_handleColorEvent(z){if(this._themeService)for(const I of z){let V,U="";switch(I.index){case 256:V="foreground",U="10";break;case 257:V="background",U="11";break;case 258:V="cursor",U="12";break;default:V="ansi",U="4;"+I.index}switch(I.type){case 0:const J=A.color.toColorRGB(V==="ansi"?this._themeService.colors.ansi[I.index]:this._themeService.colors[V]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${U};${(0,R.toRgbString)(J)}${$.C1_ESCAPED.ST}`);break;case 1:if(V==="ansi")this._themeService.modifyColors(X=>X.ansi[I.index]=A.channels.toColor(...I.color));else{const X=V;this._themeService.modifyColors(me=>me[X]=A.channels.toColor(...I.color))}break;case 2:this._themeService.restoreColor(I.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(z){z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var z;return(z=this.textarea)==null?void 0:z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const z=this.buffer.ybase+this.buffer.y,I=this.buffer.lines.get(z);if(!I)return;const V=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.css.cell.height,J=I.getWidth(V),X=this._renderService.dimensions.css.cell.width*J,me=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=V*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=me+"px",this.textarea.style.width=X+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",I=>{this.hasSelection()&&(0,c.copyHandler)(I,this._selectionService)}));const z=I=>(0,c.handlePasteEvent)(I,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",z)),H.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",I=>{I.button===2&&(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",I=>{(0,c.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",I=>{I.button===1&&(0,c.moveTextAreaUnderMouseCursor)(I,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",z=>this._keyUp(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",z=>this._keyDown(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",z=>this._keyPress(z),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",z=>this._compositionHelper.compositionupdate(z))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",z=>this._inputEvent(z),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(z){var V;if(!z)throw new Error("Terminal requires a parent element.");if(z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((V=this.element)==null?void 0:V.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=z.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"),z.appendChild(this.element);const I=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),I.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",U=>this.updateCursorStyle(U))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),I.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),H.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(b.CoreBrowserService,this.textarea,z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",U=>this._handleTextAreaFocus(U))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(m.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(U=>this._onRender.fire(U))),this.onResize(U=>this._renderService.resize(U.cols,U.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(I);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),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.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(U=>this.scrollLines(U.amount,U.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(U=>this._renderService.handleSelectionChanged(U.start,U.end,U.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(U=>{this.textarea.value=U,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(U=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(v.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",U=>this._selectionService.handleMouseDown(U))),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(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",U=>this._handleScreenReaderModeOptionChange(U))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",U=>{!this._overviewRulerRenderer&&U&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const z=this,I=this.element;function V(X){const me=z._mouseService.getMouseReportCoords(X,z.screenElement);if(!me)return!1;let ce,fe;switch(X.overrideType||X.type){case"mousemove":fe=32,X.buttons===void 0?(ce=3,X.button!==void 0&&(ce=X.button<3?X.button:3)):ce=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":fe=0,ce=X.button<3?X.button:3;break;case"mousedown":fe=1,ce=X.button<3?X.button:3;break;case"wheel":if(z._customWheelEventHandler&&z._customWheelEventHandler(X)===!1||z.viewport.getLinesScrolled(X)===0)return!1;fe=X.deltaY<0?0:1,ce=4;break;default:return!1}return!(fe===void 0||ce===void 0||ce>4)&&z.coreMouseService.triggerMouseEvent({col:me.col,row:me.row,x:me.x,y:me.y,button:ce,action:fe,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},J={mouseup:X=>(V(X),X.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(X)),wheel:X=>(V(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&V(X)},mousemove:X=>{X.buttons||V(X)}};this.register(this.coreMouseService.onProtocolChange(X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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()),8&X?U.mousemove||(I.addEventListener("mousemove",J.mousemove),U.mousemove=J.mousemove):(I.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&X?U.wheel||(I.addEventListener("wheel",J.wheel,{passive:!1}),U.wheel=J.wheel):(I.removeEventListener("wheel",U.wheel),U.wheel=null),2&X?U.mouseup||(U.mouseup=J.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&X?U.mousedrag||(U.mousedrag=J.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(I,"mousedown",X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return V(X),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(X)})),this.register((0,g.addDisposableDomListener)(I,"wheel",X=>{if(!U.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){const me=this.viewport.getLinesScrolled(X);if(me===0)return;const ce=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B");let fe="";for(let Ee=0;Ee<Math.abs(me);Ee++)fe+=ce;return this.coreService.triggerDataEvent(fe,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(I,"touchstart",X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)},{passive:!0})),this.register((0,g.addDisposableDomListener)(I,"touchmove",X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)},{passive:!1}))}refresh(z,I){var V;(V=this._renderService)==null||V.refreshRows(z,I)}updateCursorStyle(z){var I;(I=this._selectionService)!=null&&I.shouldColumnSelect(z)?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(z,I,V=0){var U;V===1?(super.scrollLines(z,I,V),this.refresh(0,this.rows-1)):(U=this.viewport)==null||U.scrollLines(z)}paste(z){(0,c.paste)(z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(z){this._customKeyEventHandler=z}attachCustomWheelEventHandler(z){this._customWheelEventHandler=z}registerLinkProvider(z){return this._linkProviderService.registerLinkProvider(z)}registerCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const I=this._characterJoinerService.register(z);return this.refresh(0,this.rows-1),I}deregisterCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+z)}registerDecoration(z){return this._decorationService.registerDecoration(z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(z,I,V){this._selectionService.setSelection(z,I,V)}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(){var z;(z=this._selectionService)==null||z.clearSelection()}selectAll(){var z;(z=this._selectionService)==null||z.selectAll()}selectLines(z,I){var V;(V=this._selectionService)==null||V.selectLines(z,I)}_keyDown(z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;const I=this.browser.isMac&&this.options.macOptionIsMeta&&z.altKey;if(!I&&!this._compositionHelper.keydown(z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;I||z.key!=="Dead"&&z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const V=(0,N.evaluateKeyboardEvent)(z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(z),V.type===3||V.type===2){const U=this.rows-1;return this.scrollLines(V.type===2?-U:U),this.cancel(z,!0)}return V.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,z)||(V.cancel&&this.cancel(z,!0),!V.key||!!(z.key&&!z.ctrlKey&&!z.altKey&&!z.metaKey&&z.key.length===1&&z.key.charCodeAt(0)>=65&&z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(V.key!==$.C0.ETX&&V.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:V.key,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(V.key,!0),!this.optionsService.rawOptions.screenReaderMode||z.altKey||z.ctrlKey?this.cancel(z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(z,I){const V=z.isMac&&!this.options.macOptionIsMeta&&I.altKey&&!I.ctrlKey&&!I.metaKey||z.isWindows&&I.altKey&&I.ctrlKey&&!I.metaKey||z.isWindows&&I.getModifierState("AltGraph");return I.type==="keypress"?V:V&&(!I.keyCode||I.keyCode>47)}_keyUp(z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1||(function(I){return I.keyCode===16||I.keyCode===17||I.keyCode===18}(z)||this.focus(),this.updateCursorStyle(z),this._keyPressHandled=!1)}_keyPress(z){let I;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;if(this.cancel(z),z.charCode)I=z.charCode;else if(z.which===null||z.which===void 0)I=z.keyCode;else{if(z.which===0||z.charCode===0)return!1;I=z.which}return!(!I||(z.altKey||z.ctrlKey||z.metaKey)&&!this._isThirdLevelShift(this.browser,z)||(I=String.fromCharCode(I),this._onKey.fire({key:I,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(I,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(z){if(z.data&&z.inputType==="insertText"&&(!z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const I=z.data;return this.coreService.triggerDataEvent(I,!0),this.cancel(z),!0}return!1}resize(z,I){z!==this.cols||I!==this.rows?super.resize(z,I):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(z,I){var V,U;(V=this._charSizeService)==null||V.measure(),(U=this.viewport)==null||U.syncScrollArea(!0)}clear(){var z;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 I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(z=this.viewport)==null||z.reset(),this.refresh(0,this.rows-1)}}reset(){var I,V;this.options.rows=this.rows,this.options.cols=this.cols;const z=this._customKeyEventHandler;this._setup(),super.reset(),(I=this._selectionService)==null||I.reset(),this._decorationService.reset(),(V=this.viewport)==null||V.reset(),this._customKeyEventHandler=z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var z;(z=this._renderService)==null||z.clearTextureAtlas()}_reportFocus(){var z;(z=this.element)!=null&&z.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(z){if(this._renderService)switch(z){case j.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const I=this._renderService.dimensions.css.canvas.width.toFixed(0),V=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${V};${I}t`);break;case j.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const U=this._renderService.dimensions.css.cell.width.toFixed(0),J=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${J};${U}t`)}}cancel(z,I){if(this.options.cancelEvents||I)return z.preventDefault(),z.stopPropagation(),!1}}i.Terminal=Z},9924:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,g){this._rowCount=g,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=u-this._lastRefreshMs,_=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const u=o(3656),p=o(4725),_=o(8460),y=o(844),v=o(2585);let h=i.Viewport=class extends y.Disposable{constructor(f,d,m,w,b,x,C,S){super(),this._viewportElement=f,this._scrollArea=d,this._bufferService=m,this._optionsService=w,this._charSizeService=b,this._renderService=x,this._coreBrowserService=C,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(S.colors),this.register(S.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(f){if(f)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(f,d){const m=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&m<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const d=this._getPixelsScrolled(f);return d!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(f,d){var S;let m,w="";const b=[],x=d??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=f;E<x;E++){const L=C.get(E);if(!L)continue;const A=(S=C.get(E+1))==null?void 0:S.isWrapped;if(w+=L.translateToString(!A),!A||E===C.length-1){const M=document.createElement("div");M.textContent=w,b.push(M),w.length>0&&(m=M),w=""}}return{bufferElements:b,cursorElement:m}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let d=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(f,d){const m=this._optionsService.rawOptions.fastScrollModifier;return m==="alt"&&d.altKey||m==="ctrl"&&d.ctrlKey||m==="shift"&&d.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const d=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(f,d))}};i.Viewport=h=c([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,p.ICharSizeService),g(5,p.IRenderService),g(6,p.ICoreBrowserService),g(7,p.IThemeService)],h)},3107:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const u=o(4725),p=o(844),_=o(2585);let y=i.BufferDecorationRenderer=class extends p.Disposable{constructor(v,h,f,d,m){super(),this._screenElement=v,this._bufferService=h,this._coreBrowserService=f,this._decorationService=d,this._renderService=m,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(w=>this._removeDecoration(w))),this.register((0,p.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const v of this._decorationService.decorations)this._renderDecoration(v);this._dimensionsChanged=!1}_renderDecoration(v){this._refreshStyle(v),this._dimensionsChanged&&this._refreshXPosition(v)}_createElement(v){var d;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((d=v==null?void 0:v.options)==null?void 0:d.layer)==="top"),h.style.width=`${Math.round((v.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(v.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(v.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=v.options.x??0;return f&&f>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(v,h),h}_refreshStyle(v){const h=v.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)v.element&&(v.element.style.display="none",v.onRenderEmitter.fire(v.element));else{let f=this._decorationElements.get(v);f||(f=this._createElement(v),v.element=f,this._decorationElements.set(v,f),this._container.appendChild(f),v.onDispose(()=>{this._decorationElements.delete(v),f.remove()})),f.style.top=h*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",v.onRenderEmitter.fire(f)}}_refreshXPosition(v,h=v.element){if(!h)return;const f=v.options.x??0;(v.options.anchor||"left")==="right"?h.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(v){var h;(h=this._decorationElements.get(v))==null||h.remove(),this._decorationElements.delete(v),v.dispose()}};i.BufferDecorationRenderer=y=c([g(1,_.IBufferService),g(2,u.ICoreBrowserService),g(3,_.IDecorationService),g(4,u.IRenderService)],y)},5871:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=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(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,g){return c>=o.startBufferLine-this._linePadding[g||"full"]&&c<=o.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(l,i,o){var c=this&&this.__decorate||function(m,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,w,b,x);else for(var L=m.length-1;L>=0;L--)(C=m[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},g=this&&this.__param||function(m,w){return function(b,x){w(b,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const u=o(5871),p=o(4725),_=o(844),y=o(2585),v={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let d=i.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(m,w,b,x,C,S,E){var A;super(),this._viewportElement=m,this._screenElement=w,this._bufferService=b,this._decorationService=x,this._renderService=C,this._optionsService=S,this._coreBrowserService=E,this._colorZoneStore=new u.ColorZoneStore,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(),(A=this._viewportElement.parentElement)==null||A.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)(()=>{var M;(M=this._canvas)==null||M.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){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())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const m=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=m,h.center=w,h.right=m,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=h.left,f.right=h.left+h.center}_refreshDrawHeightConstants(){v.full=Math.round(2*this._coreBrowserService.dpr);const m=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(m,12),6)*this._coreBrowserService.dpr);v.left=w,v.center=w,v.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.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(const w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const m=this._colorZoneStore.zones;for(const w of m)w.position!=="full"&&this._renderColorZone(w);for(const w of m)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(m){this._ctx.fillStyle=m.color,this._ctx.fillRect(f[m.position||"full"],Math.round((this._canvas.height-1)*(m.startBufferLine/this._bufferService.buffers.active.lines.length)-v[m.position||"full"]/2),h[m.position||"full"],Math.round((this._canvas.height-1)*((m.endBufferLine-m.startBufferLine)/this._bufferService.buffers.active.lines.length)+v[m.position||"full"]))}_queueRefresh(m,w){this._shouldUpdateDimensions=m||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};i.OverviewRulerRenderer=d=c([g(2,y.IBufferService),g(3,y.IDecorationService),g(4,p.IRenderService),g(5,y.IOptionsService),g(6,p.ICoreBrowserService)],d)},2950:function(l,i,o){var c=this&&this.__decorate||function(v,h,f,d){var m,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,f):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,f,d);else for(var x=v.length-1;x>=0;x--)(m=v[x])&&(b=(w<3?m(b):w>3?m(h,f,b):m(h,f))||b);return w>3&&b&&Object.defineProperty(h,f,b),b},g=this&&this.__param||function(v,h){return function(f,d){h(f,d,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const u=o(4725),p=o(2585),_=o(2584);let y=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(v,h,f,d,m,w){this._textarea=v,this._compositionView=h,this._bufferService=f,this._optionsService=d,this._coreService=m,this._renderService=w,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(v){this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(v){if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){const h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}},0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const v=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const h=this._textarea.value,f=h.replace(v,"");this._dataAlreadySent=f,h.length>v.length?this._coreService.triggerDataEvent(f,!0):h.length<v.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):h.length===v.length&&h!==v&&this._coreService.triggerDataEvent(h,!0)}},0)}updateCompositionElements(v){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,m=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=m+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=m+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}v||setTimeout(()=>this.updateCompositionElements(!0),0)}}};i.CompositionHelper=y=c([g(2,p.IBufferService),g(3,p.IOptionsService),g(4,p.ICoreService),g(5,u.IRenderService)],y)},9806:(l,i)=>{function o(c,g,u){const p=u.getBoundingClientRect(),_=c.getComputedStyle(u),y=parseInt(_.getPropertyValue("padding-left")),v=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-p.left-y,g.clientY-p.top-v]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=o,i.getCoords=function(c,g,u,p,_,y,v,h,f){if(!y)return;const d=o(c,g,u);return d?(d[0]=Math.ceil((d[0]+(f?v/2:0))/v),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),p+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),_),d):void 0}},9504:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const c=o(2584);function g(h,f,d,m){const w=h-u(h,d),b=f-u(f,d),x=Math.abs(w-b)-function(C,S,E){let L=0;const A=C-u(C,E),M=S-u(S,E);for(let D=0;D<Math.abs(A-M);D++){const O=p(C,S)==="A"?-1:1,H=E.buffer.lines.get(A+O*D);H!=null&&H.isWrapped&&L++}return L}(h,f,d);return v(x,y(p(h,f),m))}function u(h,f){let d=0,m=f.buffer.lines.get(h),w=m==null?void 0:m.isWrapped;for(;w&&h>=0&&h<f.rows;)d++,m=f.buffer.lines.get(--h),w=m==null?void 0:m.isWrapped;return d}function p(h,f){return h>f?"A":"B"}function _(h,f,d,m,w,b){let x=h,C=f,S="";for(;x!==d||C!==m;)x+=w?1:-1,w&&x>b.cols-1?(S+=b.buffer.translateBufferLineToString(C,!1,h,x),x=0,h=0,C++):!w&&x<0&&(S+=b.buffer.translateBufferLineToString(C,!1,0,h+1),x=b.cols-1,h=x,C--);return S+b.buffer.translateBufferLineToString(C,!1,h,x)}function y(h,f){const d=f?"O":"[";return c.C0.ESC+d+h}function v(h,f){h=Math.floor(h);let d="";for(let m=0;m<h;m++)d+=f;return d}i.moveToCellSequence=function(h,f,d,m){const w=d.buffer.x,b=d.buffer.y;if(!d.buffer.hasScrollback)return function(S,E,L,A,M,D){return g(E,A,M,D).length===0?"":v(_(S,E,S,E-u(E,M),!1,M).length,y("D",D))}(w,b,0,f,d,m)+g(b,f,d,m)+function(S,E,L,A,M,D){let O;O=g(E,A,M,D).length>0?A-u(A,M):E;const H=A,F=function($,N,R,P,B,j){let W;return W=g(R,P,B,j).length>0?P-u(P,B):N,$<R&&W<=P||$>=R&&W<P?"C":"D"}(S,E,L,A,M,D);return v(_(S,O,L,H,F==="C",M).length,y(F,D))}(w,b,h,f,d,m);let x;if(b===f)return x=w>h?"D":"C",v(Math.abs(w-h),y(x,m));x=b>f?"D":"C";const C=Math.abs(b-f);return v(function(S,E){return E.cols-S}(b>f?h:w,d)+(C-1)*d.cols+1+((b>f?w:h)-1),y(x,m))}},1296:function(l,i,o){var c=this&&this.__decorate||function(D,O,H,F){var $,N=arguments.length,R=N<3?O:F===null?F=Object.getOwnPropertyDescriptor(O,H):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(D,O,H,F);else for(var P=D.length-1;P>=0;P--)($=D[P])&&(R=(N<3?$(R):N>3?$(O,H,R):$(O,H))||R);return N>3&&R&&Object.defineProperty(O,H,R),R},g=this&&this.__param||function(D,O){return function(H,F){O(H,F,D)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const u=o(3787),p=o(2550),_=o(2223),y=o(6171),v=o(6052),h=o(4725),f=o(8055),d=o(8460),m=o(844),w=o(2585),b="xterm-dom-renderer-owner-",x="xterm-rows",C="xterm-fg-",S="xterm-bg-",E="xterm-focus",L="xterm-selection";let A=1,M=i.DomRenderer=class extends m.Disposable{constructor(D,O,H,F,$,N,R,P,B,j,W,K,Z){super(),this._terminal=D,this._document=O,this._element=H,this._screenElement=F,this._viewportElement=$,this._helperContainer=N,this._linkifier2=R,this._charSizeService=B,this._optionsService=j,this._bufferService=W,this._coreBrowserService=K,this._themeService=Z,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,v.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,m.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new p.WidthCache(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(){const D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${x} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${x} .xterm-dim { color: ${f.color.multiplyOpacity(D.foreground,.5).css};}`,O+=`${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;}`;const H=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;O+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,O+=`@keyframes ${F} { 50% { box-shadow: none; }}`,O+=`@keyframes ${$} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,O+=`${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[N,R]of D.ansi.entries())O+=`${this._terminalSelector} .${C}${N} { color: ${R.css}; }${this._terminalSelector} .${C}${N}.xterm-dim { color: ${f.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${S}${N} { background-color: ${R.css}; }`;O+=`${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${S}${_.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,O){for(let H=this._rowElements.length;H<=O;H++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,O){this._refreshRowElements(D,O),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,O,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,O,H),this.renderRows(0,this._bufferService.rows-1),!D||!O)return;this._selectionRenderModel.update(this._terminal,D,O,H);const F=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,N=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(N>=this._bufferService.rows||R<0)return;const P=this._document.createDocumentFragment();if(H){const B=D[0]>O[0];P.appendChild(this._createSelectionElement(N,B?O[0]:D[0],B?D[0]:O[0],R-N+1))}else{const B=F===N?D[0]:0,j=N===$?O[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(N,B,j));const W=R-N-1;if(P.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,W)),N!==R){const K=$===R?O[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(R,0,K))}}this._selectionContainer.appendChild(P)}_createSelectionElement(D,O,H,F=1){const $=this._document.createElement("div"),N=O*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(H-O);return N+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-N),$.style.height=F*this.dimensions.css.cell.height+"px",$.style.top=D*this.dimensions.css.cell.height+"px",$.style.left=`${N}px`,$.style.width=`${R}px`,$}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(const D of this._rowElements)D.replaceChildren()}renderRows(D,O){const H=this._bufferService.buffer,F=H.ybase+H.y,$=Math.min(H.x,this._bufferService.cols-1),N=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=D;B<=O;B++){const j=B+H.ydisp,W=this._rowElements[B],K=H.lines.get(j);if(!W||!K)break;W.replaceChildren(...this._rowFactory.createRow(K,j,j===F,R,P,$,N,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,O,H,F,$,N){H<0&&(D=0),F<0&&(O=0);const R=this._bufferService.rows-1;H=Math.max(Math.min(H,R),0),F=Math.max(Math.min(F,R),0),$=Math.min($,this._bufferService.cols);const P=this._bufferService.buffer,B=P.ybase+P.y,j=Math.min(P.x,$-1),W=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,Z=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=H;ee<=F;++ee){const z=ee+P.ydisp,I=this._rowElements[ee],V=P.lines.get(z);if(!I||!V)break;I.replaceChildren(...this._rowFactory.createRow(V,z,z===B,K,Z,j,W,this.dimensions.css.cell.width,this._widthCache,N?ee===H?D:0:-1,N?(ee===F?O:$)-1:-1))}}};i.DomRenderer=M=c([g(7,w.IInstantiationService),g(8,h.ICharSizeService),g(9,w.IOptionsService),g(10,w.IBufferService),g(11,h.ICoreBrowserService),g(12,h.IThemeService)],M)},3787:function(l,i,o){var c=this&&this.__decorate||function(x,C,S,E){var L,A=arguments.length,M=A<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,C,S,E);else for(var D=x.length-1;D>=0;D--)(L=x[D])&&(M=(A<3?L(M):A>3?L(C,S,M):L(C,S))||M);return A>3&&M&&Object.defineProperty(C,S,M),M},g=this&&this.__param||function(x,C){return function(S,E){C(S,E,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const u=o(2223),p=o(643),_=o(511),y=o(2585),v=o(8055),h=o(4725),f=o(4269),d=o(6171),m=o(3734);let w=i.DomRendererRowFactory=class{constructor(x,C,S,E,L,A,M){this._document=x,this._characterJoinerService=C,this._optionsService=S,this._coreBrowserService=E,this._coreService=L,this._decorationService=A,this._themeService=M,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,C,S){this._selectionStart=x,this._selectionEnd=C,this._columnSelectMode=S}createRow(x,C,S,E,L,A,M,D,O,H,F){const $=[],N=this._characterJoinerService.getJoinedCharacters(C),R=this._themeService.colors;let P,B=x.getNoBgTrimmedLength();S&&B<A+1&&(B=A+1);let j=0,W="",K=0,Z=0,ee=0,z=!1,I=0,V=!1,U=0;const J=[],X=H!==-1&&F!==-1;for(let me=0;me<B;me++){x.loadCell(me,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let fe=!1,Ee=me,ae=this._workCell;if(N.length>0&&me===N[0][0]){fe=!0;const ge=N.shift();ae=new f.JoinedCellData(this._workCell,x.translateToString(!0,ge[0],ge[1]),ge[1]-ge[0]),Ee=ge[1]-1,ce=ae.getWidth()}const Te=this._isCellInSelection(me,C),je=S&&me===A,pe=X&&me>=H&&me<=F;let _e=!1;this._decorationService.forEachDecorationAtCell(me,C,void 0,ge=>{_e=!0});let ke=ae.getChars()||p.WHITESPACE_CELL_CHAR;if(ke===" "&&(ae.isUnderline()||ae.isOverline())&&(ke=" "),U=ce*D-O.get(ke,ae.isBold(),ae.isItalic()),P){if(j&&(Te&&V||!Te&&!V&&ae.bg===K)&&(Te&&V&&R.selectionForeground||ae.fg===Z)&&ae.extended.ext===ee&&pe===z&&U===I&&!je&&!fe&&!_e){ae.isInvisible()?W+=p.WHITESPACE_CELL_CHAR:W+=ke,j++;continue}j&&(P.textContent=W),P=this._document.createElement("span"),j=0,W=""}else P=this._document.createElement("span");if(K=ae.bg,Z=ae.fg,ee=ae.extended.ext,z=pe,I=U,V=Te,fe&&A>=me&&A<=Ee&&(A=me),!this._coreService.isCursorHidden&&je&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&J.push("xterm-cursor-blink"),J.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline")}}if(ae.isBold()&&J.push("xterm-bold"),ae.isItalic()&&J.push("xterm-italic"),ae.isDim()&&J.push("xterm-dim"),W=ae.isInvisible()?p.WHITESPACE_CELL_CHAR:ae.getChars()||p.WHITESPACE_CELL_CHAR,ae.isUnderline()&&(J.push(`xterm-underline-${ae.extended.underlineStyle}`),W===" "&&(W=" "),!ae.isUnderlineColorDefault()))if(ae.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${m.AttributeData.toColorRGB(ae.getUnderlineColor()).join(",")})`;else{let ge=ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ae.isBold()&&ge<8&&(ge+=8),P.style.textDecorationColor=R.ansi[ge].css}ae.isOverline()&&(J.push("xterm-overline"),W===" "&&(W=" ")),ae.isStrikethrough()&&J.push("xterm-strikethrough"),pe&&(P.style.textDecoration="underline");let se=ae.getFgColor(),be=ae.getFgColorMode(),oe=ae.getBgColor(),he=ae.getBgColorMode();const Le=!!ae.isInverse();if(Le){const ge=se;se=oe,oe=ge;const He=be;be=he,he=He}let Re,Ce,q,Q=!1;switch(this._decorationService.forEachDecorationAtCell(me,C,void 0,ge=>{ge.options.layer!=="top"&&Q||(ge.backgroundColorRGB&&(he=50331648,oe=ge.backgroundColorRGB.rgba>>8&16777215,Re=ge.backgroundColorRGB),ge.foregroundColorRGB&&(be=50331648,se=ge.foregroundColorRGB.rgba>>8&16777215,Ce=ge.foregroundColorRGB),Q=ge.options.layer==="top")}),!Q&&Te&&(Re=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,oe=Re.rgba>>8&16777215,he=50331648,Q=!0,R.selectionForeground&&(be=50331648,se=R.selectionForeground.rgba>>8&16777215,Ce=R.selectionForeground)),Q&&J.push("xterm-decoration-top"),he){case 16777216:case 33554432:q=R.ansi[oe],J.push(`xterm-bg-${oe}`);break;case 50331648:q=v.channels.toColor(oe>>16,oe>>8&255,255&oe),this._addStyle(P,`background-color:#${b((oe>>>0).toString(16),"0",6)}`);break;default:Le?(q=R.foreground,J.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):q=R.background}switch(Re||ae.isDim()&&(Re=v.color.multiplyOpacity(q,.5)),be){case 16777216:case 33554432:ae.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(P,q,R.ansi[se],ae,Re,void 0)||J.push(`xterm-fg-${se}`);break;case 50331648:const ge=v.channels.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(P,q,ge,ae,Re,Ce)||this._addStyle(P,`color:#${b(se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,q,R.foreground,ae,Re,Ce)||Le&&J.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}J.length&&(P.className=J.join(" "),J.length=0),je||fe||_e?P.textContent=W:j++,U!==this.defaultSpacing&&(P.style.letterSpacing=`${U}px`),$.push(P),me=Ee}return P&&j&&(P.textContent=W),$}_applyMinimumContrast(x,C,S,E,L,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const M=this._getContrastCache(E);let D;if(L||A||(D=M.getColor(C.rgba,S.rgba)),D===void 0){const O=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=v.color.ensureContrastRatio(L||C,A||S,O),M.setColor((L||C).rgba,(A||S).rgba,D??null)}return!!D&&(this._addStyle(x,`color:${D.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,C){x.setAttribute("style",`${x.getAttribute("style")||""}${C};`)}_isCellInSelection(x,C){const S=this._selectionStart,E=this._selectionEnd;return!(!S||!E)&&(this._columnSelectMode?S[0]<=E[0]?x>=S[0]&&C>=S[1]&&x<E[0]&&C<=E[1]:x<S[0]&&C>=S[1]&&x>=E[0]&&C<=E[1]:C>S[1]&&C<E[1]||S[1]===E[1]&&C===S[1]&&x>=S[0]&&x<E[0]||S[1]<E[1]&&C===E[1]&&x<E[0]||S[1]<E[1]&&C===S[1]&&x>=S[0])}};function b(x,C,S){for(;x.length<S;)x=C+x;return x}i.DomRendererRowFactory=w=c([g(1,h.ICharacterJoinerService),g(2,y.IOptionsService),g(3,h.ICoreBrowserService),g(4,y.ICoreService),g(5,y.IDecorationService),g(6,h.IThemeService)],w)},2550:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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";const g=o.createElement("span");g.classList.add("xterm-char-measure-element");const u=o.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,u,p,_],this._container.appendChild(g),this._container.appendChild(u),this._container.appendChild(p),this._container.appendChild(_),c.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(o,c,g,u){o===this._font&&c===this._fontSize&&g===this._weight&&u===this._weightBold||(this._font=o,this._fontSize=c,this._weight=g,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(o,c,g){let u=0;if(!c&&!g&&o.length===1&&(u=o.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const y=this._measure(o,0);return y>0&&(this._flat[u]=y),y}let p=o;c&&(p+="B"),g&&(p+="I");let _=this._holey.get(p);if(_===void 0){let y=0;c&&(y|=1),g&&(y|=2),_=this._measure(o,y),_>0&&this._holey.set(p,_)}return _}_measure(o,c){const g=this._measureElements[c];return g.textContent=o.repeat(32),g.offsetWidth/32}}},2223:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(l,i)=>{function o(g){return 57508<=g&&g<=57558}function c(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=o,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=c,i.allowRescaling=function(g,u,p,_){return u===1&&p>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!c(g)&&!o(g)&&!function(y){return 57344<=y&&y<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return o(g)||function(u){return 9472<=u&&u<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,u,p=0){return(g-(2*Math.round(u)-p))%(2*Math.round(u))}},6052:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class o{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(g,u,p,_=!1){if(this.selectionStart=u,this.selectionEnd=p,!u||!p||u[0]===p[0]&&u[1]===p[1])return void this.clear();const y=g.buffers.active.ydisp,v=u[1]-y,h=p[1]-y,f=Math.max(v,0),d=Math.min(h,g.rows-1);f>=g.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=p[0])}isCellSelected(g,u,p){return!!this.hasSelection&&(p-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&p>=this.viewportCappedStartRow&&u<this.endCol&&p<=this.viewportCappedEndRow:u<this.startCol&&p>=this.viewportCappedStartRow&&u>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol)}}i.createSelectionRenderModel=function(){return new o}},456:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(o){this._bufferService=o,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.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()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const u=o(2585),p=o(8460),_=o(844);let y=i.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,m,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new h(d,m,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};i.CharSizeService=y=c([g(2,u.IOptionsService)],y);class v extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(m,w){m!==void 0&&m>0&&w!==void 0&&w>0&&(this._result.width=m,this._result.height=w)}}class h extends v{constructor(m,w,b){super(),this._document=m,this._parentElement=w,this._optionsService=b,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}}class f extends v{constructor(m){super(),this._optionsService=m,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const m=this._ctx.measureText("W");return this._validateAndSet(m.width,m.fontBoundingBoxAscent+m.fontBoundingBoxDescent),this._result}}},4269:function(l,i,o){var c=this&&this.__decorate||function(f,d,m,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,m):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(f,d,m,w);else for(var S=f.length-1;S>=0;S--)(b=f[S])&&(C=(x<3?b(C):x>3?b(d,m,C):b(d,m))||C);return x>3&&C&&Object.defineProperty(d,m,C),C},g=this&&this.__param||function(f,d){return function(m,w){d(m,w,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const u=o(3734),p=o(643),_=o(511),y=o(2585);class v extends u.AttributeData{constructor(d,m,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=m,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=v;let h=i.CharacterJoinerService=class V1{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(d){const m={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(m),m.id}deregister(d){for(let m=0;m<this._characterJoiners.length;m++)if(this._characterJoiners[m].id===d)return this._characterJoiners.splice(m,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const m=this._bufferService.buffer.lines.get(d);if(!m||m.length===0)return[];const w=[],b=m.translateToString(!0);let x=0,C=0,S=0,E=m.getFg(0),L=m.getBg(0);for(let A=0;A<m.getTrimmedLength();A++)if(m.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==L){if(A-x>1){const M=this._getJoinedRanges(b,S,C,m,x);for(let D=0;D<M.length;D++)w.push(M[D])}x=A,S=C,E=this._workCell.fg,L=this._workCell.bg}C+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const A=this._getJoinedRanges(b,S,C,m,x);for(let M=0;M<A.length;M++)w.push(A[M])}return w}_getJoinedRanges(d,m,w,b,x){const C=d.substring(m,w);let S=[];try{S=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const L=this._characterJoiners[E].handler(C);for(let A=0;A<L.length;A++)V1._mergeRanges(S,L[A])}catch(L){console.error(L)}return this._stringRangesToCellRanges(S,b,x),S}_stringRangesToCellRanges(d,m,w){let b=0,x=!1,C=0,S=d[b];if(S){for(let E=w;E<this._bufferService.cols;E++){const L=m.getWidth(E),A=m.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!x&&S[0]<=C&&(S[0]=E,x=!0),S[1]<=C){if(S[1]=E,S=d[++b],!S)break;S[0]<=C?(S[0]=E,x=!0):x=!1}C+=A}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(d,m){let w=!1;for(let b=0;b<d.length;b++){const x=d[b];if(w){if(m[1]<=x[0])return d[b-1][1]=m[1],d;if(m[1]<=x[1])return d[b-1][1]=Math.max(m[1],x[1]),d.splice(b,1),d;d.splice(b,1),b--}else{if(m[1]<=x[0])return d.splice(b,0,m),d;if(m[1]<=x[1])return x[0]=Math.min(m[0],x[0]),d;m[0]<x[1]&&(x[0]=Math.min(m[0],x[0]),w=!0)}}return w?d[d.length-1][1]=m[1]:d.push(m),d}};i.CharacterJoinerService=h=c([g(0,y.IBufferService)],h)},5114:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const c=o(844),g=o(8460),u=o(3656);class p extends c.Disposable{constructor(v,h,f){super(),this._textarea=v,this._window=h,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(d=>this._screenDprMonitor.setWindow(d))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(v){this._window!==v&&(this._window=v,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}}i.CoreBrowserService=p;class _ extends c.Disposable{constructor(v){super(),this._parentWindow=v,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)(()=>this.clearListener()))}setWindow(v){this._parentWindow=v,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var v;this._outerListener&&((v=this._resolutionMediaMatchList)==null||v.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)}}},779:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const c=o(844);class g extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const _=this.linkProviders.indexOf(p);_!==-1&&this.linkProviders.splice(_,1)}}}}i.LinkProviderService=g},8934:function(l,i,o){var c=this&&this.__decorate||function(y,v,h,f){var d,m=arguments.length,w=m<3?v:f===null?f=Object.getOwnPropertyDescriptor(v,h):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,v,h,f);else for(var b=y.length-1;b>=0;b--)(d=y[b])&&(w=(m<3?d(w):m>3?d(v,h,w):d(v,h))||w);return m>3&&w&&Object.defineProperty(v,h,w),w},g=this&&this.__param||function(y,v){return function(h,f){v(h,f,y)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const u=o(4725),p=o(9806);let _=i.MouseService=class{constructor(y,v){this._renderService=y,this._charSizeService=v}getCoords(y,v,h,f,d){return(0,p.getCoords)(window,y,v,h,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(y,v){const h=(0,p.getCoordsRelativeToElement)(window,y,v);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};i.MouseService=_=c([g(0,u.IRenderService),g(1,u.ICharSizeService)],_)},3230:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const u=o(6193),p=o(4725),_=o(8460),y=o(844),v=o(7226),h=o(2585);let f=i.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,m,w,b,x,C,S,E){super(),this._rowCount=d,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new v.DebouncedIdleTask,this._observerDisposable=this.register(new y.MutableDisposable),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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer((L,A)=>this._renderRows(L,A),S),this.register(this._renderDebouncer),this.register(S.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var L;return(L=this._renderer.value)==null?void 0:L.clear()})),this.register(w.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(x.onDecorationRegistered(()=>this._fullRefresh())),this.register(x.onDecorationRemoved(()=>this._fullRefresh())),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(S.window,m),this.register(S.onWindowChange(L=>this._registerIntersectionObserver(L,m)))}_registerIntersectionObserver(d,m){if("IntersectionObserver"in d){const w=new d.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});w.observe(m),this._observerDisposable.value=(0,y.toDisposable)(()=>w.disconnect())}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,m,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,m,this._rowCount))}_renderRows(d,m){this._renderer.value&&(d=Math.min(d,this._rowCount-1),m=Math.min(m,this._rowCount-1),this._renderer.value.renderRows(d,m),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:m}),this._onRender.fire({start:d,end:m}),this._isNextRenderRedrawOnly=!0)}resize(d,m){this._rowCount=m,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw(m=>this.refreshRows(m.start,m.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,m;this._renderer.value&&((m=(d=this._renderer.value).clearTextureAtlas)==null||m.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,m){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,m)}):this._renderer.value.handleResize(d,m),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,m,w){var b;this._selectionState.start=d,this._selectionState.end=m,this._selectionState.columnSelectMode=w,(b=this._renderer.value)==null||b.handleSelectionChanged(d,m,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};i.RenderService=f=c([g(2,h.IOptionsService),g(3,p.ICharSizeService),g(4,h.IDecorationService),g(5,h.IBufferService),g(6,p.ICoreBrowserService),g(7,p.IThemeService)],f)},9312:function(l,i,o){var c=this&&this.__decorate||function(S,E,L,A){var M,D=arguments.length,O=D<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(S,E,L,A);else for(var H=S.length-1;H>=0;H--)(M=S[H])&&(O=(D<3?M(O):D>3?M(E,L,O):M(E,L))||O);return D>3&&O&&Object.defineProperty(E,L,O),O},g=this&&this.__param||function(S,E){return function(L,A){E(L,A,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const u=o(9806),p=o(9504),_=o(456),y=o(4725),v=o(8460),h=o(844),f=o(6114),d=o(4841),m=o(511),w=o(2585),b=" ",x=new RegExp(b,"g");let C=i.SelectionService=class extends h.Disposable{constructor(S,E,L,A,M,D,O,H,F){super(),this._element=S,this._screenElement=E,this._linkifier=L,this._bufferService=A,this._coreService=M,this._mouseService=D,this._optionsService=O,this._renderService=H,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new m.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new v.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()}))}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(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E||S[0]===E[0]&&S[1]===E[1])}get selectionText(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!S||!E)return"";const L=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const M=S[0]<E[0]?S[0]:E[0],D=S[0]<E[0]?E[0]:S[0];for(let O=S[1];O<=E[1];O++){const H=L.translateBufferLineToString(O,!0,M,D);A.push(H)}}else{const M=S[1]===E[1]?E[0]:void 0;A.push(L.translateBufferLineToString(S[1],!0,S[0],M));for(let D=S[1]+1;D<=E[1]-1;D++){const O=L.lines.get(D),H=L.translateBufferLineToString(D,!0);O!=null&&O.isWrapped?A[A.length-1]+=H:A.push(H)}if(S[1]!==E[1]){const D=L.lines.get(E[1]),O=L.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?A[A.length-1]+=O:A.push(O)}}return A.map(M=>M.replace(x," ")).join(f.isWindows?`\r
58
58
  `:`
59
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),f.isLinux&&S&&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(S){const E=this._getMouseBufferCoords(S),L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(L&&A&&E)&&this._areCoordsInSelection(E,L,A)}isCellInSelection(S,E){const L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!L||!A)&&this._areCoordsInSelection([S,E],L,A)}_areCoordsInSelection(S,E,L){return S[1]>E[1]&&S[1]<L[1]||E[1]===L[1]&&S[1]===E[1]&&S[0]>=E[0]&&S[0]<L[0]||E[1]<L[1]&&S[1]===L[1]&&S[0]<L[0]||E[1]<L[1]&&S[1]===E[1]&&S[0]>=E[0]}_selectWordAtCursor(S,E){var M,D;const L=(D=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:D.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const A=this._getMouseBufferCoords(S);return!!A&&(this._selectWordAt(A,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,E){this._model.clearSelection(),S=Math.max(S,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const E=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(S){let E=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=L?0:(E>L&&(E-=L),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(S){return f.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),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(),50)}_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(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const E=this._getMouseBufferCoords(S);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(S){return S.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);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(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const A=L.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const E=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const A=(0,p.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,L=!(!S||!E||S[0]===E[0]&&S[1]===E[1]);L?S&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,E,L)):this._oldHasSelection&&this._fireOnSelectionChange(S,E,L)}_fireOnSelectionChange(S,E,L){this._oldSelectionStart=S,this._oldSelectionEnd=E,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(S,E){let L=E;for(let A=0;E>=A;A++){const M=S.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&E!==A&&(L+=M-1)}return L}setSelection(S,E,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,E],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,E,L=!0,A=!0){if(S[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,D=M.lines.get(S[1]);if(!D)return;const N=M.translateBufferLineToString(S[1],!1);let H=this._convertViewportColToCharacterIndex(D,S[0]),F=H;const $=S[0]-H;let O=0,R=0,P=0,B=0;if(N.charAt(H)===" "){for(;H>0&&N.charAt(H-1)===" ";)H--;for(;F<N.length&&N.charAt(F+1)===" ";)F++}else{let K=S[0],ee=S[0];D.getWidth(K)===0&&(O++,K--),D.getWidth(ee)===2&&(R++,ee++);const Z=D.getString(ee).length;for(Z>1&&(B+=Z-1,F+=Z-1);K>0&&H>0&&!this._isCharWordSeparator(D.loadCell(K-1,this._workCell));){D.loadCell(K-1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===0?(O++,K--):z>1&&(P+=z-1,H-=z-1),H--,K--}for(;ee<D.length&&F+1<N.length&&!this._isCharWordSeparator(D.loadCell(ee+1,this._workCell));){D.loadCell(ee+1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,ee++):z>1&&(B+=z-1,F+=z-1),F++,ee++}}F++;let j=H+$-O+P,W=Math.min(this._bufferService.cols,F-H+O+R-P-B);if(E||N.slice(H,F).trim()!==""){if(L&&j===0&&D.getCodePoint(0)!==32){const K=M.lines.get(S[1]-1);if(K&&D.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(ee){const Z=this._bufferService.cols-ee.start;j-=Z,W+=Z}}}if(A&&j+W===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const K=M.lines.get(S[1]+1);if(K!=null&&K.isWrapped&&K.getCodePoint(0)!==32){const ee=this._getWordAt([0,S[1]+1],!1,!1,!0);ee&&(W+=ee.length)}}return{start:j,length:W}}}_selectWordAt(S,E){const L=this._getWordAt(S,E);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[L.start,S[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(S){const E=this._getWordAt(S,!0);if(E){let L=S[1];for(;E.start<0;)E.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,L]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const E=this._bufferService.buffer.getWrappedRangeForLine(S),L={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols)}};i.SelectionService=C=c([g(3,w.IBufferService),g(4,w.ICoreService),g(5,y.IMouseService),g(6,w.IOptionsService),g(7,y.IRenderService),g(8,y.ICoreBrowserService)],C)},4725:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const c=o(8343);i.ICharSizeService=(0,c.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),i.IMouseService=(0,c.createDecorator)("MouseService"),i.IRenderService=(0,c.createDecorator)("RenderService"),i.ISelectionService=(0,c.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,c.createDecorator)("ThemeService"),i.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(l,i,o){var c=this&&this.__decorate||function(C,S,E,L){var A,M=arguments.length,D=M<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,S,E,L);else for(var N=C.length-1;N>=0;N--)(A=C[N])&&(D=(M<3?A(D):M>3?A(S,E,D):A(S,E))||D);return M>3&&D&&Object.defineProperty(S,E,D),D},g=this&&this.__param||function(C,S){return function(E,L){S(E,L,C)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const u=o(7239),p=o(8055),_=o(8460),y=o(844),v=o(2585),h=p.css.toColor("#ffffff"),f=p.css.toColor("#000000"),d=p.css.toColor("#ffffff"),m=p.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let E=0;E<216;E++){const L=S[E/36%6|0],A=S[E/6%6|0],M=S[E%6];C.push({css:p.channels.toCss(L,A,M),rgba:p.channels.toRgba(L,A,M)})}for(let E=0;E<24;E++){const L=8+10*E;C.push({css:p.channels.toCss(L,L,L),rgba:p.channels.toRgba(L,L,L)})}return C})());let b=i.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:f,cursor:d,cursorAccent:m,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:p.color.blend(f,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:p.color.blend(f,w),ansi:i.DEFAULT_ANSI_COLORS.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)))}_setTheme(C={}){const S=this._colors;if(S.foreground=x(C.foreground,h),S.background=x(C.background,f),S.cursor=x(C.cursor,d),S.cursorAccent=x(C.cursorAccent,m),S.selectionBackgroundTransparent=x(C.selectionBackground,w),S.selectionBackgroundOpaque=p.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=x(C.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=p.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=C.selectionForeground?x(C.selectionForeground,p.NULL_COLOR):void 0,S.selectionForeground===p.NULL_COLOR&&(S.selectionForeground=void 0),p.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=p.color.opacity(S.selectionBackgroundTransparent,.3)),p.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=p.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=i.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=x(C.black,i.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=x(C.red,i.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=x(C.green,i.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=x(C.yellow,i.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=x(C.blue,i.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=x(C.magenta,i.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=x(C.cyan,i.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=x(C.white,i.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=x(C.brightBlack,i.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=x(C.brightRed,i.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=x(C.brightGreen,i.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=x(C.brightYellow,i.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=x(C.brightBlue,i.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=x(C.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=x(C.brightCyan,i.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=x(C.brightWhite,i.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(S.ansi.length-16,C.extendedAnsi.length);for(let L=0;L<E;L++)S.ansi[L+16]=x(C.extendedAnsi[L],i.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(C){C(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()}}};function x(C,S){if(C!==void 0)try{return p.css.toColor(C)}catch{}return S}i.ThemeService=b=c([g(0,v.IOptionsService)],b)},6349:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const c=o(8460),g=o(844);class u extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const y=new Array(_);for(let v=0;v<Math.min(_,this.length);v++)y[v]=this._array[this._getCyclicIndex(v)];this._array=y,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let y=this._length;y<_;y++)this._array[y]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,y){this._array[this._getCyclicIndex(_)]=y}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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(_,y,...v){if(y){for(let h=_;h<this._length-y;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+y)];this._length-=y,this.onDeleteEmitter.fire({index:_,amount:y})}for(let h=this._length-1;h>=_;h--)this._array[this._getCyclicIndex(h+v.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<v.length;h++)this._array[this._getCyclicIndex(_+h)]=v[h];if(v.length&&this.onInsertEmitter.fire({index:_,amount:v.length}),this._length+v.length>this._maxLength){const h=this._length+v.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=v.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,y,v){if(!(y<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let f=y-1;f>=0;f--)this.set(_+f+v,this.get(_+f));const h=_+y+v-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<y;h++)this.set(_+h+v,this.get(_+h))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}i.CircularList=u},1439:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function o(c,g=5){if(typeof c!="object")return c;const u=Array.isArray(c)?[]:{};for(const p in c)u[p]=g<=1?c[p]:c[p]&&o(c[p],g-1);return u}},8055:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let o=0,c=0,g=0,u=0;var p,_,y,v,h;function f(m){const w=m.toString(16);return w.length<2?"0"+w:w}function d(m,w){return m<w?(w+.05)/(m+.05):(m+.05)/(w+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(m){m.toCss=function(w,b,x,C){return C!==void 0?`#${f(w)}${f(b)}${f(x)}${f(C)}`:`#${f(w)}${f(b)}${f(x)}`},m.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},m.toColor=function(w,b,x,C){return{css:m.toCss(w,b,x,C),rgba:m.toRgba(w,b,x,C)}}}(p||(i.channels=p={})),function(m){function w(b,x){return u=Math.round(255*x),[o,c,g]=h.toChannels(b.rgba),{css:p.toCss(o,c,g,u),rgba:p.toRgba(o,c,g,u)}}m.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),g=M+Math.round((E-M)*u),{css:p.toCss(o,c,g),rgba:p.toRgba(o,c,g)}},m.isOpaque=function(b){return(255&b.rgba)==255},m.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return p.toColor(S>>24&255,S>>16&255,S>>8&255)},m.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,g]=h.toChannels(x),{css:p.toCss(o,c,g),rgba:x}},m.opacity=w,m.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},m.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(i.color=_={})),function(m){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}m.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),p.toColor(o,c,g);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),p.toColor(o,c,g,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),g=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),p.toColor(o,c,g,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,g,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,c,g,u),css:x}}}(y||(i.css=y={})),function(m){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}m.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},m.relativeLuminance2=w}(v||(i.rgb=v={})),function(m){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,N=C>>8&255,H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||N>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),N-=Math.max(0,Math.ceil(.1*N)),H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|N<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,N=C>>8&255,H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||N<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),N=Math.min(255,N+Math.ceil(.1*(255-N))),H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|N<<8|255)>>>0}m.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),g=D+Math.round((L-D)*u),p.toRgba(o,c,g)},m.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),N=d(E,v.relativeLuminance(D>>8));if(N<S){const H=b(x,C,S);return N>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},m.reduceLuminance=w,m.increaseLuminance=b,m.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(i.rgba=h={})),i.toPaddedHex=f,i.contrastRatio=d},8969:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const c=o(844),g=o(2585),u=o(4348),p=o(7866),_=o(744),y=o(7302),v=o(6975),h=o(8460),f=o(1753),d=o(1480),m=o(7994),w=o(9282),b=o(5435),x=o(5981),C=o(2660);let S=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(A=>{var M;(M=this._onScrollApi)==null||M.fire(A.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(A){for(const M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new y.OptionsService(A)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(m.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new x.WriteBuffer((M,D)=>this._inputHandler.parse(M,D))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=g.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,_.MINIMUM_COLS),M=Math.max(M,_.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M,D){this._bufferService.scrollLines(A,M,D)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)(()=>{for(const M of A)M.dispose()})}}}i.CoreTerminal=E},8460:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},5435:function(l,i,o){var c=this&&this.__decorate||function(O,R,P,B){var j,W=arguments.length,K=W<3?R:B===null?B=Object.getOwnPropertyDescriptor(R,P):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(O,R,P,B);else for(var ee=O.length-1;ee>=0;ee--)(j=O[ee])&&(K=(W<3?j(K):W>3?j(R,P,K):j(R,P))||K);return W>3&&K&&Object.defineProperty(R,P,K),K},g=this&&this.__param||function(O,R){return function(P,B){R(P,B,O)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const u=o(2584),p=o(7116),_=o(2015),y=o(844),v=o(482),h=o(8437),f=o(8460),d=o(643),m=o(511),w=o(3734),b=o(2585),x=o(1480),C=o(6242),S=o(6351),E=o(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function M(O,R){if(O>24)return R.setWinLines||!1;switch(O){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var D;(function(O){O[O.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",O[O.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(i.WindowsOptionsReportType=D={}));let N=0;class H extends y.Disposable{getAttrData(){return this._curAttrData}constructor(R,P,B,j,W,K,ee,Z,z=new _.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=P,this._coreService=B,this._logService=j,this._optionsService=W,this._oscLinkService=K,this._coreMouseService=ee,this._unicodeService=Z,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new m.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),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 F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(I=>this._activeBuffer=I.activeBuffer)),this._parser.setCsiHandlerFallback((I,V)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(I),params:V.toArray()})}),this._parser.setEscHandlerFallback(I=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(I)})}),this._parser.setExecuteHandlerFallback(I=>{this._logService.debug("Unknown EXECUTE code: ",{code:I})}),this._parser.setOscHandlerFallback((I,V,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:I,action:V,data:U})}),this._parser.setDcsHandlerFallback((I,V,U)=>{V==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(I),action:V,payload:U})}),this._parser.setPrintHandler((I,V,U)=>this.print(I,V,U)),this._parser.registerCsiHandler({final:"@"},I=>this.insertChars(I)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},I=>this.scrollLeft(I)),this._parser.registerCsiHandler({final:"A"},I=>this.cursorUp(I)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},I=>this.scrollRight(I)),this._parser.registerCsiHandler({final:"B"},I=>this.cursorDown(I)),this._parser.registerCsiHandler({final:"C"},I=>this.cursorForward(I)),this._parser.registerCsiHandler({final:"D"},I=>this.cursorBackward(I)),this._parser.registerCsiHandler({final:"E"},I=>this.cursorNextLine(I)),this._parser.registerCsiHandler({final:"F"},I=>this.cursorPrecedingLine(I)),this._parser.registerCsiHandler({final:"G"},I=>this.cursorCharAbsolute(I)),this._parser.registerCsiHandler({final:"H"},I=>this.cursorPosition(I)),this._parser.registerCsiHandler({final:"I"},I=>this.cursorForwardTab(I)),this._parser.registerCsiHandler({final:"J"},I=>this.eraseInDisplay(I,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},I=>this.eraseInDisplay(I,!0)),this._parser.registerCsiHandler({final:"K"},I=>this.eraseInLine(I,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},I=>this.eraseInLine(I,!0)),this._parser.registerCsiHandler({final:"L"},I=>this.insertLines(I)),this._parser.registerCsiHandler({final:"M"},I=>this.deleteLines(I)),this._parser.registerCsiHandler({final:"P"},I=>this.deleteChars(I)),this._parser.registerCsiHandler({final:"S"},I=>this.scrollUp(I)),this._parser.registerCsiHandler({final:"T"},I=>this.scrollDown(I)),this._parser.registerCsiHandler({final:"X"},I=>this.eraseChars(I)),this._parser.registerCsiHandler({final:"Z"},I=>this.cursorBackwardTab(I)),this._parser.registerCsiHandler({final:"`"},I=>this.charPosAbsolute(I)),this._parser.registerCsiHandler({final:"a"},I=>this.hPositionRelative(I)),this._parser.registerCsiHandler({final:"b"},I=>this.repeatPrecedingCharacter(I)),this._parser.registerCsiHandler({final:"c"},I=>this.sendDeviceAttributesPrimary(I)),this._parser.registerCsiHandler({prefix:">",final:"c"},I=>this.sendDeviceAttributesSecondary(I)),this._parser.registerCsiHandler({final:"d"},I=>this.linePosAbsolute(I)),this._parser.registerCsiHandler({final:"e"},I=>this.vPositionRelative(I)),this._parser.registerCsiHandler({final:"f"},I=>this.hVPosition(I)),this._parser.registerCsiHandler({final:"g"},I=>this.tabClear(I)),this._parser.registerCsiHandler({final:"h"},I=>this.setMode(I)),this._parser.registerCsiHandler({prefix:"?",final:"h"},I=>this.setModePrivate(I)),this._parser.registerCsiHandler({final:"l"},I=>this.resetMode(I)),this._parser.registerCsiHandler({prefix:"?",final:"l"},I=>this.resetModePrivate(I)),this._parser.registerCsiHandler({final:"m"},I=>this.charAttributes(I)),this._parser.registerCsiHandler({final:"n"},I=>this.deviceStatus(I)),this._parser.registerCsiHandler({prefix:"?",final:"n"},I=>this.deviceStatusPrivate(I)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},I=>this.softReset(I)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},I=>this.setCursorStyle(I)),this._parser.registerCsiHandler({final:"r"},I=>this.setScrollRegion(I)),this._parser.registerCsiHandler({final:"s"},I=>this.saveCursor(I)),this._parser.registerCsiHandler({final:"t"},I=>this.windowOptions(I)),this._parser.registerCsiHandler({final:"u"},I=>this.restoreCursor(I)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},I=>this.insertColumns(I)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},I=>this.deleteColumns(I)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},I=>this.selectProtected(I)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},I=>this.requestMode(I,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},I=>this.requestMode(I,!1)),this._parser.setExecuteHandler(u.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(u.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(u.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(u.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(u.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(u.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(u.C1.IND,()=>this.index()),this._parser.setExecuteHandler(u.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(u.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(I=>(this.setTitle(I),this.setIconName(I),!0))),this._parser.registerOscHandler(1,new C.OscHandler(I=>this.setIconName(I))),this._parser.registerOscHandler(2,new C.OscHandler(I=>this.setTitle(I))),this._parser.registerOscHandler(4,new C.OscHandler(I=>this.setOrReportIndexedColor(I))),this._parser.registerOscHandler(8,new C.OscHandler(I=>this.setHyperlink(I))),this._parser.registerOscHandler(10,new C.OscHandler(I=>this.setOrReportFgColor(I))),this._parser.registerOscHandler(11,new C.OscHandler(I=>this.setOrReportBgColor(I))),this._parser.registerOscHandler(12,new C.OscHandler(I=>this.setOrReportCursorColor(I))),this._parser.registerOscHandler(104,new C.OscHandler(I=>this.restoreIndexedColor(I))),this._parser.registerOscHandler(110,new C.OscHandler(I=>this.restoreFgColor(I))),this._parser.registerOscHandler(111,new C.OscHandler(I=>this.restoreBgColor(I))),this._parser.registerOscHandler(112,new C.OscHandler(I=>this.restoreCursorColor(I))),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(const I in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:I},()=>this.selectCharset("("+I)),this._parser.registerEscHandler({intermediates:")",final:I},()=>this.selectCharset(")"+I)),this._parser.registerEscHandler({intermediates:"*",final:I},()=>this.selectCharset("*"+I)),this._parser.registerEscHandler({intermediates:"+",final:I},()=>this.selectCharset("+"+I)),this._parser.registerEscHandler({intermediates:"-",final:I},()=>this.selectCharset("-"+I)),this._parser.registerEscHandler({intermediates:".",final:I},()=>this.selectCharset("."+I)),this._parser.registerEscHandler({intermediates:"/",final:I},()=>this.selectCharset("/"+I));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(I=>(this._logService.error("Parsing error: ",I),I)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler((I,V)=>this.requestStatusString(I,V)))}_preserveStack(R,P,B,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=B,this._parseStack.position=j}_logSlowResolvingAsync(R){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([R,new Promise((P,B)=>setTimeout(()=>B("#SLOW_TIMEOUT"),5e3))]).catch(P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,P){let B,j=this._activeBuffer.x,W=this._activeBuffer.y,K=0;const ee=this._parseStack.paused;if(ee){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(B),B;j=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>A&&(K=this._parseStack.position+A)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,I=>String.fromCharCode(I)).join("")}"`),typeof R=="string"?R.split("").map(I=>I.charCodeAt(0)):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(R.length,A))),ee||this._dirtyRowTracker.clearRange(),R.length>A)for(let I=K;I<R.length;I+=A){const V=I+A<R.length?I+A:R.length,U=typeof R=="string"?this._stringDecoder.decode(R.substring(I,V),this._parseBuffer):this._utf8Decoder.decode(R.subarray(I,V),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,U))return this._preserveStack(j,W,U,I),this._logSlowResolvingAsync(B),B}else if(!ee){const I=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,I))return this._preserveStack(j,W,I,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===j&&this._activeBuffer.y===W||this._onCursorMove.fire();const Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(z,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(R,P,B){let j,W;const K=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,I=this._coreService.modes.insertMode,V=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-P>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,V);let J=this._parser.precedingJoinState;for(let X=P;X<B;++X){if(j=R[X],j<127&&K){const Ee=K[String.fromCharCode(j)];Ee&&(j=Ee.charCodeAt(0))}const me=this._unicodeService.charProperties(j,J);W=x.UnicodeService.extractWidth(me);const ce=x.UnicodeService.extractShouldJoin(me),fe=ce?x.UnicodeService.extractWidth(J):0;if(J=me,ee&&this._onA11yChar.fire((0,v.stringFromCodePoint)(j)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-fe>Z){if(z){const Ee=U;let ae=this._activeBuffer.x-fe;for(this._activeBuffer.x=fe,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),fe>0&&U instanceof h.BufferLine&&U.copyCellsFrom(Ee,ae,0,fe,!1);ae<Z;)Ee.setCellFromCodepoint(ae++,0,1,V)}else if(this._activeBuffer.x=Z-1,W===2)continue}if(ce&&this._activeBuffer.x){const Ee=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-Ee,j,W);for(let ae=W-fe;--ae>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,V)}else if(I&&(U.insertCells(this._activeBuffer.x,W-fe,this._activeBuffer.getNullCell(V)),U.getWidth(Z-1)===2&&U.setCellFromCodepoint(Z-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,V)),U.setCellFromCodepoint(this._activeBuffer.x++,j,W,V),W>0)for(;--W;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,V)}this._parser.precedingJoinState=J,this._activeBuffer.x<Z&&B-P>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,V),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,P){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,P):this._parser.registerCsiHandler(R,B=>!M(B.params[0],this._optionsService.rawOptions.windowOptions)||P(B))}registerDcsHandler(R,P){return this._parser.registerDcsHandler(R,new S.DcsHandler(P))}registerEscHandler(R,P){return this._parser.registerEscHandler(R,P)}registerOscHandler(R,P){return this._parser.registerOscHandler(R,new C.OscHandler(P))}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(){var R;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&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,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(R,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=R,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+P)}cursorUp(R){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const P=R.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const P=R.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,P,B,j=!1,W=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);K.replaceCells(P,B,this._activeBuffer.getNullCell(this._eraseAttrData()),W),j&&(K.isWrapped=!1)}_resetBufferLine(R,P=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),B.isWrapped=!1)}eraseInDisplay(R,P=!1){let B;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);B<this._bufferService.rows;B++)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(0);break;case 3:const j=this._activeBuffer.lines.length-this._bufferService.rows;j>0&&(this._activeBuffer.lines.trimStart(j),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-j,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-j,0),this._onScroll.fire(0))}return!0}eraseInLine(R,P=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-j+1;for(;P--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let j;for(j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-j;P--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let P=R.params[0]||1;for(;P--;)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(R){let P=R.params[0]||1;for(;P--;)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(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const P=this._parser.precedingJoinState;if(!P)return!0;const B=R.params[0]||1,j=x.UnicodeService.extractWidth(P),W=this._activeBuffer.x-j,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),ee=new Uint32Array(K.length*B);let Z=0;for(let I=0;I<K.length;){const V=K.codePointAt(I)||0;ee[Z++]=V,I+=V>65535?2:1}let z=Z;for(let I=1;I<B;++I)ee.copyWithin(z,0,Z),z+=Z;return this.print(ee,0,z),!0}sendDeviceAttributesPrimary(R){return R.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(R){return R.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),R.params[P]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(R,P){const B=this._coreService.decPrivateModes,{activeProtocol:j,activeEncoding:W}=this._coreMouseService,K=this._coreService,{buffers:ee,cols:Z}=this._bufferService,{active:z,alt:I}=ee,V=this._optionsService.rawOptions,U=ce=>ce?1:2,J=R.params[0];return X=J,me=P?J===2?4:J===4?U(K.modes.insertMode):J===12?3:J===20?U(V.convertEol):0:J===1?U(B.applicationCursorKeys):J===3?V.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:J===6?U(B.origin):J===7?U(B.wraparound):J===8?3:J===9?U(j==="X10"):J===12?U(V.cursorBlink):J===25?U(!K.isCursorHidden):J===45?U(B.reverseWraparound):J===66?U(B.applicationKeypad):J===67?4:J===1e3?U(j==="VT200"):J===1002?U(j==="DRAG"):J===1003?U(j==="ANY"):J===1004?U(B.sendFocus):J===1005?4:J===1006?U(W==="SGR"):J===1015?4:J===1016?U(W==="SGR_PIXELS"):J===1048?1:J===47||J===1047||J===1049?U(z===I):J===2004?U(B.bracketedPasteMode):0,K.triggerDataEvent(`${u.C0.ESC}[${P?"":"?"}${X};${me}$y`),!0;var X,me}_updateAttrColor(R,P,B,j,W){return P===2?(R|=50331648,R&=-16777216,R|=w.AttributeData.fromColorRGB([B,j,W])):P===5&&(R&=-50331904,R|=33554432|255&B),R}_extractColor(R,P,B){const j=[0,0,-1,0,0,0];let W=0,K=0;do{if(j[K+W]=R.params[P+K],R.hasSubParams(P+K)){const ee=R.getSubParams(P+K);let Z=0;do j[1]===5&&(W=1),j[K+Z+1+W]=ee[Z];while(++Z<ee.length&&Z+K+1+W<j.length);break}if(j[1]===5&&K+W>=2||j[1]===2&&K+W>=5)break;j[1]&&(W=1)}while(++K+P<R.length&&K+W<j.length);for(let ee=2;ee<j.length;++ee)j[ee]===-1&&(j[ee]=0);switch(j[0]){case 38:B.fg=this._updateAttrColor(B.fg,j[1],j[3],j[4],j[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,j[1],j[3],j[4],j[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,j[1],j[3],j[4],j[5])}return K}_processUnderline(R,P){P.extended=P.extended.clone(),(!~R||R>5)&&(R=1),P.extended.underlineStyle=R,P.fg|=268435456,R===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(R){R.fg=h.DEFAULT_ATTR_DATA.fg,R.bg=h.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=R.length;let B;const j=this._curAttrData;for(let W=0;W<P;W++)B=R.params[W],B>=30&&B<=37?(j.fg&=-50331904,j.fg|=16777216|B-30):B>=40&&B<=47?(j.bg&=-50331904,j.bg|=16777216|B-40):B>=90&&B<=97?(j.fg&=-50331904,j.fg|=16777224|B-90):B>=100&&B<=107?(j.bg&=-50331904,j.bg|=16777224|B-100):B===0?this._processSGR0(j):B===1?j.fg|=134217728:B===3?j.bg|=67108864:B===4?(j.fg|=268435456,this._processUnderline(R.hasSubParams(W)?R.getSubParams(W)[0]:1,j)):B===5?j.fg|=536870912:B===7?j.fg|=67108864:B===8?j.fg|=1073741824:B===9?j.fg|=2147483648:B===2?j.bg|=134217728:B===21?this._processUnderline(2,j):B===22?(j.fg&=-134217729,j.bg&=-134217729):B===23?j.bg&=-67108865:B===24?(j.fg&=-268435457,this._processUnderline(0,j)):B===25?j.fg&=-536870913:B===27?j.fg&=-67108865:B===28?j.fg&=-1073741825:B===29?j.fg&=2147483647:B===39?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):B===49?(j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?W+=this._extractColor(R,W,j):B===53?j.bg|=1073741824:B===55?j.bg&=-1073741825:B===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):B===100?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${P};${B}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const P=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${P};${B}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.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(R){const P=R.params[0]||1;switch(P){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const B=P%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(R){const P=R.params[0]||1;let B;return(R.length<2||(B=R.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(R){if(!M(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){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(R){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(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const P=[],B=R.split(";");for(;B.length>1;){const j=B.shift(),W=B.shift();if(/^\d+$/.exec(j)){const K=parseInt(j);if($(K))if(W==="?")P.push({type:0,index:K});else{const ee=(0,E.parseColor)(W);ee&&P.push({type:1,index:K,color:ee})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(R){const P=R.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(R,P){this._getCurrentLinkId()&&this._finishHyperlink();const B=R.split(":");let j;const W=B.findIndex(K=>K.startsWith("id="));return W!==-1&&(j=B[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:j,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,P){const B=R.split(";");for(let j=0;j<B.length&&!(P>=this._specialColors.length);++j,++P)if(B[j]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const W=(0,E.parseColor)(B[j]);W&&this._onColor.fire([{type:1,index:this._specialColors[P],color:W}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const P=[],B=R.split(";");for(let j=0;j<B.length;++j)if(/^\d+$/.exec(B[j])){const W=parseInt(B[j]);$(W)&&P.push({type:2,index:W})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){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,p.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(L[R[0]],p.CHARSETS[R[1]]||p.DEFAULT_CHARSET),!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){const R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,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=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new m.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const B=this._activeBuffer.ybase+this._activeBuffer.y+P,j=this._activeBuffer.lines.get(B);j&&(j.fill(R),j.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,P){const B=this._bufferService.buffer,j=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${W}${u.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[j.cursorStyle]-(j.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,P){this._dirtyRowTracker.markRangeDirty(R,P)}}i.InputHandler=H;let F=class{constructor(O){this._bufferService=O,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(O){O<this.start?this.start=O:O>this.end&&(this.end=O)}markRangeDirty(O,R){O>R&&(N=O,O=R,R=N),O<this.start&&(this.start=O),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(O){return 0<=O&&O<256}F=c([g(0,b.IBufferService)],F)},844:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,u,p){this._data[g]||(this._data[g]={}),this._data[g][u]=p}get(g,u){return this._data[g]?this._data[g][u]:void 0}clear(){this._data={}}}i.TwoKeyMap=o,i.FourKeyMap=class{constructor(){this._data=new o}set(c,g,u,p,_){this._data.get(c,g)||this._data.set(c,g,new o),this._data.get(c,g).set(u,p,_)}get(c,g,u,p){var _;return(_=this._data.get(c,g))==null?void 0:_.get(u,p)}clear(){this._data.clear()}}},6114:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const o=i.isNode?"node":navigator.userAgent,c=i.isNode?"node":navigator.platform;i.isFirefox=o.includes("Firefox"),i.isLegacyEdge=o.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(o),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),i.isIpad=c==="iPad",i.isIphone=c==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),i.isLinux=c.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(o)},6106:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let o=0;i.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const g=this._getKey(c);if(g===void 0||(o=this._search(g),o===-1)||this._getKey(this._array[o])!==g)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===g);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,g){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do g(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let g=0,u=this._array.length-1;for(;u>=g;){let p=g+u>>1;const _=this._getKey(this._array[p]);if(_>c)u=p-1;else{if(!(_<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}g=p+1}}return g}}},7226:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const c=o(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),f=_.timeRemaining(),1.5*v>f)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=f}this.clear()}}class u extends g{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}i.PriorityTaskQueue=u,i.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:u,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const c=o(643);i.updateWindowsModeWrappedState=function(g){const u=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),p=u==null?void 0:u.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&p&&(_.isWrapped=p[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&p[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,p=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=c},9092:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const c=o(6349),g=o(7226),u=o(3734),p=o(8437),_=o(4634),y=o(511),v=o(643),h=o(4863),f=o(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(d,m,w){this._hasScrollback=d,this._optionsService=m,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,m){return new p.BufferLine(this._bufferService.cols,this.getNullCell(d),m)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const m=d+this._optionsService.rawOptions.scrollback;return m>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:m}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=p.DEFAULT_ATTR_DATA);let m=this._rows;for(;m--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,m){const w=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=0;const x=this._getCorrectBufferLength(m);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<d)for(let S=0;S<this.lines.length;S++)b+=+this.lines.get(S).resize(d,w);let C=0;if(this._rows<m)for(let S=this._rows;S<m;S++)this.lines.length<m+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(d,w)));else for(let S=this._rows;S>m;S--)this.lines.length>m+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const S=this.lines.length-x;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=x}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,m-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=m-1,this._isReflowEnabled&&(this._reflow(d,m),this._cols>d))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(d,w);this._cols=d,this._rows=m,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let m=0;for(;this._memoryCleanupPosition<this.lines.length;)if(m+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),m>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,m){this._cols!==d&&(d>this._cols?this._reflowLarger(d,m):this._reflowSmaller(d,m))}_reflowLarger(d,m){const w=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(w.length>0){const b=(0,_.reflowLargerCreateNewLayout)(this.lines,w);(0,_.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(d,m,b.countRemoved)}}_reflowLargerAdjustViewport(d,m,w){const b=this.getNullCell(p.DEFAULT_ATTR_DATA);let x=w;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<m&&this.lines.push(new p.BufferLine(d,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,m){const w=this.getNullCell(p.DEFAULT_ATTR_DATA),b=[];let x=0;for(let C=this.lines.length-1;C>=0;C--){let S=this.lines.get(C);if(!S||!S.isWrapped&&S.getTrimmedLength()<=d)continue;const E=[S];for(;S.isWrapped&&C>0;)S=this.lines.get(--C),E.unshift(S);const L=this.ybase+this.y;if(L>=C&&L<C+E.length)continue;const A=E[E.length-1].getTrimmedLength(),M=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,d),D=M.length-E.length;let N;N=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);const H=[];for(let B=0;B<D;B++){const j=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);H.push(j)}H.length>0&&(b.push({start:C+E.length+x,newLines:H}),x+=H.length),E.push(...H);let F=M.length-1,$=M[F];$===0&&(F--,$=M[F]);let O=E.length-D-1,R=A;for(;O>=0;){const B=Math.min(R,$);if(E[F]===void 0)break;if(E[F].copyCellsFrom(E[O],R-B,$-B,B,!0),$-=B,$===0&&(F--,$=M[F]),R-=B,R===0){O--;const j=Math.max(O,0);R=(0,_.getWrappedLineTrimmedLength)(E,j,this._cols)}}for(let B=0;B<E.length;B++)M[B]<d&&E[B].setCell(M[B],w);let P=D-N;for(;P-- >0;)this.ybase===0?this.y<m-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-m&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+m-1)}if(b.length>0){const C=[],S=[];for(let F=0;F<this.lines.length;F++)S.push(this.lines.get(F));const E=this.lines.length;let L=E-1,A=0,M=b[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let D=0;for(let F=Math.min(this.lines.maxLength-1,E+x-1);F>=0;F--)if(M&&M.start>L+D){for(let $=M.newLines.length-1;$>=0;$--)this.lines.set(F--,M.newLines[$]);F++,C.push({index:L+1,amount:M.newLines.length}),D+=M.newLines.length,M=b[++A]}else this.lines.set(F,S[L--]);let N=0;for(let F=C.length-1;F>=0;F--)C[F].index+=N,this.lines.onInsertEmitter.fire(C[F]),N+=C[F].amount;const H=Math.max(0,E+x-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(d,m,w=0,b){const x=this.lines.get(d);return x?x.translateToString(m,w,b):""}getWrappedRangeForLine(d){let m=d,w=d;for(;m>0&&this.lines.get(m).isWrapped;)m--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:m,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].line===d&&(this.markers[m].dispose(),this.markers.splice(m--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const m=new h.Marker(d);return this.markers.push(m),m.register(this.lines.onTrim(w=>{m.line-=w,m.line<0&&m.dispose()})),m.register(this.lines.onInsert(w=>{m.line>=w.index&&(m.line+=w.amount)})),m.register(this.lines.onDelete(w=>{m.line>=w.index&&m.line<w.index+w.amount&&m.dispose(),m.line>w.index&&(m.line-=w.amount)})),m.register(m.onDispose(()=>this._removeMarker(m))),m}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const c=o(3734),g=o(511),u=o(643),p=o(482);i.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class y{constructor(h,f,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const m=f||g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let w=0;w<h;++w)this.setCell(w,m);this.length=h}get(h){const f=this._data[3*h+0],d=2097151&f;return[this._data[3*h+1],2097152&f?this._combined[h]:d?(0,p.stringFromCodePoint)(d):"",f>>22,2097152&f?this._combined[h].charCodeAt(this._combined[h].length-1):d]}set(h,f){this._data[3*h+1]=f[u.CHAR_DATA_ATTR_INDEX],f[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=f[1],this._data[3*h+0]=2097152|h|f[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=f[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const f=this._data[3*h+0];return 2097152&f?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&f}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const f=this._data[3*h+0];return 2097152&f?this._combined[h]:2097151&f?(0,p.stringFromCodePoint)(2097151&f):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,f){return _=3*h,f.content=this._data[_+0],f.fg=this._data[_+1],f.bg=this._data[_+2],2097152&f.content&&(f.combinedData=this._combined[h]),268435456&f.bg&&(f.extended=this._extendedAttrs[h]),f}setCell(h,f){2097152&f.content&&(this._combined[h]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[h]=f.extended),this._data[3*h+0]=f.content,this._data[3*h+1]=f.fg,this._data[3*h+2]=f.bg}setCellFromCodepoint(h,f,d,m){268435456&m.bg&&(this._extendedAttrs[h]=m.extended),this._data[3*h+0]=f|d<<22,this._data[3*h+1]=m.fg,this._data[3*h+2]=m.bg}addCodepointToCell(h,f,d){let m=this._data[3*h+0];2097152&m?this._combined[h]+=(0,p.stringFromCodePoint)(f):2097151&m?(this._combined[h]=(0,p.stringFromCodePoint)(2097151&m)+(0,p.stringFromCodePoint)(f),m&=-2097152,m|=2097152):m=f|4194304,d&&(m&=-12582913,m|=d<<22),this._data[3*h+0]=m}insertCells(h,f,d){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length-h){const m=new g.CellData;for(let w=this.length-h-f-1;w>=0;--w)this.setCell(h+f+w,this.loadCell(h+w,m));for(let w=0;w<f;++w)this.setCell(h+w,d)}else for(let m=h;m<this.length;++m)this.setCell(m,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(h,f,d){if(h%=this.length,f<this.length-h){const m=new g.CellData;for(let w=0;w<this.length-h-f;++w)this.setCell(h+w,this.loadCell(h+f+w,m));for(let w=this.length-f;w<this.length;++w)this.setCell(w,d)}else for(let m=h;m<this.length;++m)this.setCell(m,d);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,d)}replaceCells(h,f,d,m=!1){if(m)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,d);h<f&&h<this.length;)this.isProtected(h)||this.setCell(h,d),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,d);h<f&&h<this.length;)this.setCell(h++,d)}resize(h,f){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const m=new Uint32Array(d);m.set(this._data),this._data=m}for(let m=this.length;m<h;++m)this.setCell(m,f)}else{this._data=this._data.subarray(0,d);const m=Object.keys(this._combined);for(let b=0;b<m.length;b++){const x=parseInt(m[b],10);x>=h&&delete this._combined[x]}const w=Object.keys(this._extendedAttrs);for(let b=0;b<w.length;b++){const x=parseInt(w[b],10);x>=h&&delete this._extendedAttrs[x]}}return this.length=h,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,f=!1){if(f)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,h);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const f in h._combined)this._combined[f]=h._combined[f];this._extendedAttrs={};for(const f in h._extendedAttrs)this._extendedAttrs[f]=h._extendedAttrs[f];this.isWrapped=h.isWrapped}clone(){const h=new y(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const f in this._combined)h._combined[f]=this._combined[f];for(const f in this._extendedAttrs)h._extendedAttrs[f]=this._extendedAttrs[f];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,f,d,m,w){const b=h._data;if(w)for(let C=m-1;C>=0;C--){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(f+C)+S];268435456&b[3*(f+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[f+C])}else for(let C=0;C<m;C++){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(f+C)+S];268435456&b[3*(f+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[f+C])}const x=Object.keys(h._combined);for(let C=0;C<x.length;C++){const S=parseInt(x[C],10);S>=f&&(this._combined[S-f+d]=h._combined[S])}}translateToString(h,f,d,m){f=f??0,d=d??this.length,h&&(d=Math.min(d,this.getTrimmedLength())),m&&(m.length=0);let w="";for(;f<d;){const b=this._data[3*f+0],x=2097151&b,C=2097152&b?this._combined[f]:x?(0,p.stringFromCodePoint)(x):u.WHITESPACE_CELL_CHAR;if(w+=C,m)for(let S=0;S<C.length;++S)m.push(f);f+=b>>22||1}return m&&m.push(f),w}}i.BufferLine=y},4841:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(l,i)=>{function o(c,g,u){if(g===c.length-1)return c[g].getTrimmedLength();const p=!c[g].hasContent(u-1)&&c[g].getWidth(u-1)===1,_=c[g+1].getWidth(0)===2;return p&&_?u-1:u}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(c,g,u,p,_){const y=[];for(let v=0;v<c.length-1;v++){let h=v,f=c.get(++h);if(!f.isWrapped)continue;const d=[c.get(v)];for(;h<c.length&&f.isWrapped;)d.push(f),f=c.get(++h);if(p>=v&&p<h){v+=d.length-1;continue}let m=0,w=o(d,m,g),b=1,x=0;for(;b<d.length;){const S=o(d,b,g),E=S-x,L=u-w,A=Math.min(E,L);d[m].copyCellsFrom(d[b],x,w,A,!1),w+=A,w===u&&(m++,w=0),x+=A,x===S&&(b++,x=0),w===0&&m!==0&&d[m-1].getWidth(u-1)===2&&(d[m].copyCellsFrom(d[m-1],u-1,w++,1,!1),d[m-1].setCell(u-1,_))}d[m].replaceCells(w,u,_);let C=0;for(let S=d.length-1;S>0&&(S>m||d[S].getTrimmedLength()===0);S--)C++;C>0&&(y.push(v+d.length-C),y.push(C)),v+=d.length-1}return y},i.reflowLargerCreateNewLayout=function(c,g){const u=[];let p=0,_=g[p],y=0;for(let v=0;v<c.length;v++)if(_===v){const h=g[++p];c.onDeleteEmitter.fire({index:v-y,amount:h}),v+=h-1,y+=h,_=g[++p]}else u.push(v);return{layout:u,countRemoved:y}},i.reflowLargerApplyNewLayout=function(c,g){const u=[];for(let p=0;p<g.length;p++)u.push(c.get(g[p]));for(let p=0;p<u.length;p++)c.set(p,u[p]);c.length=g.length},i.reflowSmallerGetNewLineLengths=function(c,g,u){const p=[],_=c.map((f,d)=>o(c,d,g)).reduce((f,d)=>f+d);let y=0,v=0,h=0;for(;h<_;){if(_-h<u){p.push(_-h);break}y+=u;const f=o(c,v,g);y>f&&(y-=f,v++);const d=c[v].getWidth(y-1)===2;d&&y--;const m=d?u-1:u;p.push(m),h+=m}return p},i.getWrappedLineTrimmedLength=o},5295:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const c=o(8460),g=o(844),u=o(9092);class p extends g.Disposable{constructor(y,v){super(),this._optionsService=y,this._bufferService=v,this._onBufferActivate=this.register(new c.EventEmitter),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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.Buffer(!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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,v){this._normal.resize(y,v),this._alt.resize(y,v),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}i.BufferSet=p},511:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const c=o(482),g=o(643),u=o(3734);class p extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new p;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[g.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[g.CHAR_DATA_CHAR_INDEX].length===2){const h=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const f=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(h-55296)+f-56320+65536|y[g.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[g.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=p},643:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const c=o(8460),g=o(844);class u{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}i.Marker=u,u._nextId=1},7116:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(l,i)=>{var o,c,g;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
59
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),f.isLinux&&S&&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(S){const E=this._getMouseBufferCoords(S),L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(L&&A&&E)&&this._areCoordsInSelection(E,L,A)}isCellInSelection(S,E){const L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!L||!A)&&this._areCoordsInSelection([S,E],L,A)}_areCoordsInSelection(S,E,L){return S[1]>E[1]&&S[1]<L[1]||E[1]===L[1]&&S[1]===E[1]&&S[0]>=E[0]&&S[0]<L[0]||E[1]<L[1]&&S[1]===L[1]&&S[0]<L[0]||E[1]<L[1]&&S[1]===E[1]&&S[0]>=E[0]}_selectWordAtCursor(S,E){var M,D;const L=(D=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:D.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const A=this._getMouseBufferCoords(S);return!!A&&(this._selectWordAt(A,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,E){this._model.clearSelection(),S=Math.max(S,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const E=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(S){let E=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=L?0:(E>L&&(E-=L),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(S){return f.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),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(),50)}_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(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const E=this._getMouseBufferCoords(S);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(S){return S.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);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(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const A=L.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const E=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const A=(0,p.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,L=!(!S||!E||S[0]===E[0]&&S[1]===E[1]);L?S&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,E,L)):this._oldHasSelection&&this._fireOnSelectionChange(S,E,L)}_fireOnSelectionChange(S,E,L){this._oldSelectionStart=S,this._oldSelectionEnd=E,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(S,E){let L=E;for(let A=0;E>=A;A++){const M=S.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&E!==A&&(L+=M-1)}return L}setSelection(S,E,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,E],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,E,L=!0,A=!0){if(S[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,D=M.lines.get(S[1]);if(!D)return;const O=M.translateBufferLineToString(S[1],!1);let H=this._convertViewportColToCharacterIndex(D,S[0]),F=H;const $=S[0]-H;let N=0,R=0,P=0,B=0;if(O.charAt(H)===" "){for(;H>0&&O.charAt(H-1)===" ";)H--;for(;F<O.length&&O.charAt(F+1)===" ";)F++}else{let K=S[0],Z=S[0];D.getWidth(K)===0&&(N++,K--),D.getWidth(Z)===2&&(R++,Z++);const ee=D.getString(Z).length;for(ee>1&&(B+=ee-1,F+=ee-1);K>0&&H>0&&!this._isCharWordSeparator(D.loadCell(K-1,this._workCell));){D.loadCell(K-1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===0?(N++,K--):z>1&&(P+=z-1,H-=z-1),H--,K--}for(;Z<D.length&&F+1<O.length&&!this._isCharWordSeparator(D.loadCell(Z+1,this._workCell));){D.loadCell(Z+1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,Z++):z>1&&(B+=z-1,F+=z-1),F++,Z++}}F++;let j=H+$-N+P,W=Math.min(this._bufferService.cols,F-H+N+R-P-B);if(E||O.slice(H,F).trim()!==""){if(L&&j===0&&D.getCodePoint(0)!==32){const K=M.lines.get(S[1]-1);if(K&&D.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const Z=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(Z){const ee=this._bufferService.cols-Z.start;j-=ee,W+=ee}}}if(A&&j+W===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const K=M.lines.get(S[1]+1);if(K!=null&&K.isWrapped&&K.getCodePoint(0)!==32){const Z=this._getWordAt([0,S[1]+1],!1,!1,!0);Z&&(W+=Z.length)}}return{start:j,length:W}}}_selectWordAt(S,E){const L=this._getWordAt(S,E);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[L.start,S[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(S){const E=this._getWordAt(S,!0);if(E){let L=S[1];for(;E.start<0;)E.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,L]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const E=this._bufferService.buffer.getWrappedRangeForLine(S),L={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols)}};i.SelectionService=C=c([g(3,w.IBufferService),g(4,w.ICoreService),g(5,y.IMouseService),g(6,w.IOptionsService),g(7,y.IRenderService),g(8,y.ICoreBrowserService)],C)},4725:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const c=o(8343);i.ICharSizeService=(0,c.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),i.IMouseService=(0,c.createDecorator)("MouseService"),i.IRenderService=(0,c.createDecorator)("RenderService"),i.ISelectionService=(0,c.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,c.createDecorator)("ThemeService"),i.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(l,i,o){var c=this&&this.__decorate||function(C,S,E,L){var A,M=arguments.length,D=M<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,S,E,L);else for(var O=C.length-1;O>=0;O--)(A=C[O])&&(D=(M<3?A(D):M>3?A(S,E,D):A(S,E))||D);return M>3&&D&&Object.defineProperty(S,E,D),D},g=this&&this.__param||function(C,S){return function(E,L){S(E,L,C)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const u=o(7239),p=o(8055),_=o(8460),y=o(844),v=o(2585),h=p.css.toColor("#ffffff"),f=p.css.toColor("#000000"),d=p.css.toColor("#ffffff"),m=p.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let E=0;E<216;E++){const L=S[E/36%6|0],A=S[E/6%6|0],M=S[E%6];C.push({css:p.channels.toCss(L,A,M),rgba:p.channels.toRgba(L,A,M)})}for(let E=0;E<24;E++){const L=8+10*E;C.push({css:p.channels.toCss(L,L,L),rgba:p.channels.toRgba(L,L,L)})}return C})());let b=i.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:f,cursor:d,cursorAccent:m,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:p.color.blend(f,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:p.color.blend(f,w),ansi:i.DEFAULT_ANSI_COLORS.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)))}_setTheme(C={}){const S=this._colors;if(S.foreground=x(C.foreground,h),S.background=x(C.background,f),S.cursor=x(C.cursor,d),S.cursorAccent=x(C.cursorAccent,m),S.selectionBackgroundTransparent=x(C.selectionBackground,w),S.selectionBackgroundOpaque=p.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=x(C.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=p.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=C.selectionForeground?x(C.selectionForeground,p.NULL_COLOR):void 0,S.selectionForeground===p.NULL_COLOR&&(S.selectionForeground=void 0),p.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=p.color.opacity(S.selectionBackgroundTransparent,.3)),p.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=p.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=i.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=x(C.black,i.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=x(C.red,i.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=x(C.green,i.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=x(C.yellow,i.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=x(C.blue,i.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=x(C.magenta,i.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=x(C.cyan,i.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=x(C.white,i.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=x(C.brightBlack,i.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=x(C.brightRed,i.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=x(C.brightGreen,i.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=x(C.brightYellow,i.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=x(C.brightBlue,i.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=x(C.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=x(C.brightCyan,i.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=x(C.brightWhite,i.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(S.ansi.length-16,C.extendedAnsi.length);for(let L=0;L<E;L++)S.ansi[L+16]=x(C.extendedAnsi[L],i.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(C){C(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()}}};function x(C,S){if(C!==void 0)try{return p.css.toColor(C)}catch{}return S}i.ThemeService=b=c([g(0,v.IOptionsService)],b)},6349:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const c=o(8460),g=o(844);class u extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const y=new Array(_);for(let v=0;v<Math.min(_,this.length);v++)y[v]=this._array[this._getCyclicIndex(v)];this._array=y,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let y=this._length;y<_;y++)this._array[y]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,y){this._array[this._getCyclicIndex(_)]=y}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new 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(_,y,...v){if(y){for(let h=_;h<this._length-y;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+y)];this._length-=y,this.onDeleteEmitter.fire({index:_,amount:y})}for(let h=this._length-1;h>=_;h--)this._array[this._getCyclicIndex(h+v.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<v.length;h++)this._array[this._getCyclicIndex(_+h)]=v[h];if(v.length&&this.onInsertEmitter.fire({index:_,amount:v.length}),this._length+v.length>this._maxLength){const h=this._length+v.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=v.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,y,v){if(!(y<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let f=y-1;f>=0;f--)this.set(_+f+v,this.get(_+f));const h=_+y+v-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<y;h++)this.set(_+h+v,this.get(_+h))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}i.CircularList=u},1439:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function o(c,g=5){if(typeof c!="object")return c;const u=Array.isArray(c)?[]:{};for(const p in c)u[p]=g<=1?c[p]:c[p]&&o(c[p],g-1);return u}},8055:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let o=0,c=0,g=0,u=0;var p,_,y,v,h;function f(m){const w=m.toString(16);return w.length<2?"0"+w:w}function d(m,w){return m<w?(w+.05)/(m+.05):(m+.05)/(w+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(m){m.toCss=function(w,b,x,C){return C!==void 0?`#${f(w)}${f(b)}${f(x)}${f(C)}`:`#${f(w)}${f(b)}${f(x)}`},m.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},m.toColor=function(w,b,x,C){return{css:m.toCss(w,b,x,C),rgba:m.toRgba(w,b,x,C)}}}(p||(i.channels=p={})),function(m){function w(b,x){return u=Math.round(255*x),[o,c,g]=h.toChannels(b.rgba),{css:p.toCss(o,c,g,u),rgba:p.toRgba(o,c,g,u)}}m.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),g=M+Math.round((E-M)*u),{css:p.toCss(o,c,g),rgba:p.toRgba(o,c,g)}},m.isOpaque=function(b){return(255&b.rgba)==255},m.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return p.toColor(S>>24&255,S>>16&255,S>>8&255)},m.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,g]=h.toChannels(x),{css:p.toCss(o,c,g),rgba:x}},m.opacity=w,m.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},m.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(i.color=_={})),function(m){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}m.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),p.toColor(o,c,g);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),p.toColor(o,c,g,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),g=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),p.toColor(o,c,g,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,g,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,c,g,u),css:x}}}(y||(i.css=y={})),function(m){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}m.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},m.relativeLuminance2=w}(v||(i.rgb=v={})),function(m){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,O=C>>8&255,H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||O>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),O-=Math.max(0,Math.ceil(.1*O)),H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|O<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,O=C>>8&255,H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||O<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),O=Math.min(255,O+Math.ceil(.1*(255-O))),H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|O<<8|255)>>>0}m.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),g=D+Math.round((L-D)*u),p.toRgba(o,c,g)},m.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),O=d(E,v.relativeLuminance(D>>8));if(O<S){const H=b(x,C,S);return O>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},m.reduceLuminance=w,m.increaseLuminance=b,m.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(i.rgba=h={})),i.toPaddedHex=f,i.contrastRatio=d},8969:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const c=o(844),g=o(2585),u=o(4348),p=o(7866),_=o(744),y=o(7302),v=o(6975),h=o(8460),f=o(1753),d=o(1480),m=o(7994),w=o(9282),b=o(5435),x=o(5981),C=o(2660);let S=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(A=>{var M;(M=this._onScrollApi)==null||M.fire(A.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(A){for(const M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new y.OptionsService(A)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(m.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(M=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new x.WriteBuffer((M,D)=>this._inputHandler.parse(M,D))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=g.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,_.MINIMUM_COLS),M=Math.max(M,_.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M,D){this._bufferService.scrollLines(A,M,D)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)(()=>{for(const M of A)M.dispose()})}}}i.CoreTerminal=E},8460:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},5435:function(l,i,o){var c=this&&this.__decorate||function(N,R,P,B){var j,W=arguments.length,K=W<3?R:B===null?B=Object.getOwnPropertyDescriptor(R,P):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(N,R,P,B);else for(var Z=N.length-1;Z>=0;Z--)(j=N[Z])&&(K=(W<3?j(K):W>3?j(R,P,K):j(R,P))||K);return W>3&&K&&Object.defineProperty(R,P,K),K},g=this&&this.__param||function(N,R){return function(P,B){R(P,B,N)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const u=o(2584),p=o(7116),_=o(2015),y=o(844),v=o(482),h=o(8437),f=o(8460),d=o(643),m=o(511),w=o(3734),b=o(2585),x=o(1480),C=o(6242),S=o(6351),E=o(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function M(N,R){if(N>24)return R.setWinLines||!1;switch(N){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var D;(function(N){N[N.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",N[N.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(i.WindowsOptionsReportType=D={}));let O=0;class H extends y.Disposable{getAttrData(){return this._curAttrData}constructor(R,P,B,j,W,K,Z,ee,z=new _.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=P,this._coreService=B,this._logService=j,this._optionsService=W,this._oscLinkService=K,this._coreMouseService=Z,this._unicodeService=ee,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new m.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),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 F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(I=>this._activeBuffer=I.activeBuffer)),this._parser.setCsiHandlerFallback((I,V)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(I),params:V.toArray()})}),this._parser.setEscHandlerFallback(I=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(I)})}),this._parser.setExecuteHandlerFallback(I=>{this._logService.debug("Unknown EXECUTE code: ",{code:I})}),this._parser.setOscHandlerFallback((I,V,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:I,action:V,data:U})}),this._parser.setDcsHandlerFallback((I,V,U)=>{V==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(I),action:V,payload:U})}),this._parser.setPrintHandler((I,V,U)=>this.print(I,V,U)),this._parser.registerCsiHandler({final:"@"},I=>this.insertChars(I)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},I=>this.scrollLeft(I)),this._parser.registerCsiHandler({final:"A"},I=>this.cursorUp(I)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},I=>this.scrollRight(I)),this._parser.registerCsiHandler({final:"B"},I=>this.cursorDown(I)),this._parser.registerCsiHandler({final:"C"},I=>this.cursorForward(I)),this._parser.registerCsiHandler({final:"D"},I=>this.cursorBackward(I)),this._parser.registerCsiHandler({final:"E"},I=>this.cursorNextLine(I)),this._parser.registerCsiHandler({final:"F"},I=>this.cursorPrecedingLine(I)),this._parser.registerCsiHandler({final:"G"},I=>this.cursorCharAbsolute(I)),this._parser.registerCsiHandler({final:"H"},I=>this.cursorPosition(I)),this._parser.registerCsiHandler({final:"I"},I=>this.cursorForwardTab(I)),this._parser.registerCsiHandler({final:"J"},I=>this.eraseInDisplay(I,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},I=>this.eraseInDisplay(I,!0)),this._parser.registerCsiHandler({final:"K"},I=>this.eraseInLine(I,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},I=>this.eraseInLine(I,!0)),this._parser.registerCsiHandler({final:"L"},I=>this.insertLines(I)),this._parser.registerCsiHandler({final:"M"},I=>this.deleteLines(I)),this._parser.registerCsiHandler({final:"P"},I=>this.deleteChars(I)),this._parser.registerCsiHandler({final:"S"},I=>this.scrollUp(I)),this._parser.registerCsiHandler({final:"T"},I=>this.scrollDown(I)),this._parser.registerCsiHandler({final:"X"},I=>this.eraseChars(I)),this._parser.registerCsiHandler({final:"Z"},I=>this.cursorBackwardTab(I)),this._parser.registerCsiHandler({final:"`"},I=>this.charPosAbsolute(I)),this._parser.registerCsiHandler({final:"a"},I=>this.hPositionRelative(I)),this._parser.registerCsiHandler({final:"b"},I=>this.repeatPrecedingCharacter(I)),this._parser.registerCsiHandler({final:"c"},I=>this.sendDeviceAttributesPrimary(I)),this._parser.registerCsiHandler({prefix:">",final:"c"},I=>this.sendDeviceAttributesSecondary(I)),this._parser.registerCsiHandler({final:"d"},I=>this.linePosAbsolute(I)),this._parser.registerCsiHandler({final:"e"},I=>this.vPositionRelative(I)),this._parser.registerCsiHandler({final:"f"},I=>this.hVPosition(I)),this._parser.registerCsiHandler({final:"g"},I=>this.tabClear(I)),this._parser.registerCsiHandler({final:"h"},I=>this.setMode(I)),this._parser.registerCsiHandler({prefix:"?",final:"h"},I=>this.setModePrivate(I)),this._parser.registerCsiHandler({final:"l"},I=>this.resetMode(I)),this._parser.registerCsiHandler({prefix:"?",final:"l"},I=>this.resetModePrivate(I)),this._parser.registerCsiHandler({final:"m"},I=>this.charAttributes(I)),this._parser.registerCsiHandler({final:"n"},I=>this.deviceStatus(I)),this._parser.registerCsiHandler({prefix:"?",final:"n"},I=>this.deviceStatusPrivate(I)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},I=>this.softReset(I)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},I=>this.setCursorStyle(I)),this._parser.registerCsiHandler({final:"r"},I=>this.setScrollRegion(I)),this._parser.registerCsiHandler({final:"s"},I=>this.saveCursor(I)),this._parser.registerCsiHandler({final:"t"},I=>this.windowOptions(I)),this._parser.registerCsiHandler({final:"u"},I=>this.restoreCursor(I)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},I=>this.insertColumns(I)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},I=>this.deleteColumns(I)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},I=>this.selectProtected(I)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},I=>this.requestMode(I,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},I=>this.requestMode(I,!1)),this._parser.setExecuteHandler(u.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(u.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(u.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(u.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(u.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(u.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(u.C1.IND,()=>this.index()),this._parser.setExecuteHandler(u.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(u.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(I=>(this.setTitle(I),this.setIconName(I),!0))),this._parser.registerOscHandler(1,new C.OscHandler(I=>this.setIconName(I))),this._parser.registerOscHandler(2,new C.OscHandler(I=>this.setTitle(I))),this._parser.registerOscHandler(4,new C.OscHandler(I=>this.setOrReportIndexedColor(I))),this._parser.registerOscHandler(8,new C.OscHandler(I=>this.setHyperlink(I))),this._parser.registerOscHandler(10,new C.OscHandler(I=>this.setOrReportFgColor(I))),this._parser.registerOscHandler(11,new C.OscHandler(I=>this.setOrReportBgColor(I))),this._parser.registerOscHandler(12,new C.OscHandler(I=>this.setOrReportCursorColor(I))),this._parser.registerOscHandler(104,new C.OscHandler(I=>this.restoreIndexedColor(I))),this._parser.registerOscHandler(110,new C.OscHandler(I=>this.restoreFgColor(I))),this._parser.registerOscHandler(111,new C.OscHandler(I=>this.restoreBgColor(I))),this._parser.registerOscHandler(112,new C.OscHandler(I=>this.restoreCursorColor(I))),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(const I in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:I},()=>this.selectCharset("("+I)),this._parser.registerEscHandler({intermediates:")",final:I},()=>this.selectCharset(")"+I)),this._parser.registerEscHandler({intermediates:"*",final:I},()=>this.selectCharset("*"+I)),this._parser.registerEscHandler({intermediates:"+",final:I},()=>this.selectCharset("+"+I)),this._parser.registerEscHandler({intermediates:"-",final:I},()=>this.selectCharset("-"+I)),this._parser.registerEscHandler({intermediates:".",final:I},()=>this.selectCharset("."+I)),this._parser.registerEscHandler({intermediates:"/",final:I},()=>this.selectCharset("/"+I));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(I=>(this._logService.error("Parsing error: ",I),I)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler((I,V)=>this.requestStatusString(I,V)))}_preserveStack(R,P,B,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=B,this._parseStack.position=j}_logSlowResolvingAsync(R){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([R,new Promise((P,B)=>setTimeout(()=>B("#SLOW_TIMEOUT"),5e3))]).catch(P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,P){let B,j=this._activeBuffer.x,W=this._activeBuffer.y,K=0;const Z=this._parseStack.paused;if(Z){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(B),B;j=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>A&&(K=this._parseStack.position+A)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,I=>String.fromCharCode(I)).join("")}"`),typeof R=="string"?R.split("").map(I=>I.charCodeAt(0)):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(R.length,A))),Z||this._dirtyRowTracker.clearRange(),R.length>A)for(let I=K;I<R.length;I+=A){const V=I+A<R.length?I+A:R.length,U=typeof R=="string"?this._stringDecoder.decode(R.substring(I,V),this._parseBuffer):this._utf8Decoder.decode(R.subarray(I,V),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,U))return this._preserveStack(j,W,U,I),this._logSlowResolvingAsync(B),B}else if(!Z){const I=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,I))return this._preserveStack(j,W,I,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===j&&this._activeBuffer.y===W||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(z,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(R,P,B){let j,W;const K=this._charsetService.charset,Z=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,I=this._coreService.modes.insertMode,V=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-P>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodepoint(this._activeBuffer.x-1,0,1,V);let J=this._parser.precedingJoinState;for(let X=P;X<B;++X){if(j=R[X],j<127&&K){const Ee=K[String.fromCharCode(j)];Ee&&(j=Ee.charCodeAt(0))}const me=this._unicodeService.charProperties(j,J);W=x.UnicodeService.extractWidth(me);const ce=x.UnicodeService.extractShouldJoin(me),fe=ce?x.UnicodeService.extractWidth(J):0;if(J=me,Z&&this._onA11yChar.fire((0,v.stringFromCodePoint)(j)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-fe>ee){if(z){const Ee=U;let ae=this._activeBuffer.x-fe;for(this._activeBuffer.x=fe,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),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),fe>0&&U instanceof h.BufferLine&&U.copyCellsFrom(Ee,ae,0,fe,!1);ae<ee;)Ee.setCellFromCodepoint(ae++,0,1,V)}else if(this._activeBuffer.x=ee-1,W===2)continue}if(ce&&this._activeBuffer.x){const Ee=U.getWidth(this._activeBuffer.x-1)?1:2;U.addCodepointToCell(this._activeBuffer.x-Ee,j,W);for(let ae=W-fe;--ae>=0;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,V)}else if(I&&(U.insertCells(this._activeBuffer.x,W-fe,this._activeBuffer.getNullCell(V)),U.getWidth(ee-1)===2&&U.setCellFromCodepoint(ee-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,V)),U.setCellFromCodepoint(this._activeBuffer.x++,j,W,V),W>0)for(;--W;)U.setCellFromCodepoint(this._activeBuffer.x++,0,0,V)}this._parser.precedingJoinState=J,this._activeBuffer.x<ee&&B-P>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodepoint(this._activeBuffer.x,0,1,V),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,P){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,P):this._parser.registerCsiHandler(R,B=>!M(B.params[0],this._optionsService.rawOptions.windowOptions)||P(B))}registerDcsHandler(R,P){return this._parser.registerDcsHandler(R,new S.DcsHandler(P))}registerEscHandler(R,P){return this._parser.registerEscHandler(R,P)}registerOscHandler(R,P){return this._parser.registerOscHandler(R,new C.OscHandler(P))}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(){var R;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&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,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(R,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=R,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+P)}cursorUp(R){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const P=R.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const P=R.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,P,B,j=!1,W=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);K.replaceCells(P,B,this._activeBuffer.getNullCell(this._eraseAttrData()),W),j&&(K.isWrapped=!1)}_resetBufferLine(R,P=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),B.isWrapped=!1)}eraseInDisplay(R,P=!1){let B;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);B<this._bufferService.rows;B++)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,P);this._dirtyRowTracker.markDirty(0);break;case 3:const j=this._activeBuffer.lines.length-this._bufferService.rows;j>0&&(this._activeBuffer.lines.trimStart(j),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-j,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-j,0),this._onScroll.fire(0))}return!0}eraseInLine(R,P=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-j+1;for(;P--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let j;for(j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-j;P--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let P=R.params[0]||1;for(;P--;)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(R){let P=R.params[0]||1;for(;P--;)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(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);j.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const P=this._parser.precedingJoinState;if(!P)return!0;const B=R.params[0]||1,j=x.UnicodeService.extractWidth(P),W=this._activeBuffer.x-j,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),Z=new Uint32Array(K.length*B);let ee=0;for(let I=0;I<K.length;){const V=K.codePointAt(I)||0;Z[ee++]=V,I+=V>65535?2:1}let z=ee;for(let I=1;I<B;++I)Z.copyWithin(z,0,ee),z+=ee;return this.print(Z,0,z),!0}sendDeviceAttributesPrimary(R){return R.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(R){return R.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),R.params[P]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(R,P){const B=this._coreService.decPrivateModes,{activeProtocol:j,activeEncoding:W}=this._coreMouseService,K=this._coreService,{buffers:Z,cols:ee}=this._bufferService,{active:z,alt:I}=Z,V=this._optionsService.rawOptions,U=ce=>ce?1:2,J=R.params[0];return X=J,me=P?J===2?4:J===4?U(K.modes.insertMode):J===12?3:J===20?U(V.convertEol):0:J===1?U(B.applicationCursorKeys):J===3?V.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:J===6?U(B.origin):J===7?U(B.wraparound):J===8?3:J===9?U(j==="X10"):J===12?U(V.cursorBlink):J===25?U(!K.isCursorHidden):J===45?U(B.reverseWraparound):J===66?U(B.applicationKeypad):J===67?4:J===1e3?U(j==="VT200"):J===1002?U(j==="DRAG"):J===1003?U(j==="ANY"):J===1004?U(B.sendFocus):J===1005?4:J===1006?U(W==="SGR"):J===1015?4:J===1016?U(W==="SGR_PIXELS"):J===1048?1:J===47||J===1047||J===1049?U(z===I):J===2004?U(B.bracketedPasteMode):0,K.triggerDataEvent(`${u.C0.ESC}[${P?"":"?"}${X};${me}$y`),!0;var X,me}_updateAttrColor(R,P,B,j,W){return P===2?(R|=50331648,R&=-16777216,R|=w.AttributeData.fromColorRGB([B,j,W])):P===5&&(R&=-50331904,R|=33554432|255&B),R}_extractColor(R,P,B){const j=[0,0,-1,0,0,0];let W=0,K=0;do{if(j[K+W]=R.params[P+K],R.hasSubParams(P+K)){const Z=R.getSubParams(P+K);let ee=0;do j[1]===5&&(W=1),j[K+ee+1+W]=Z[ee];while(++ee<Z.length&&ee+K+1+W<j.length);break}if(j[1]===5&&K+W>=2||j[1]===2&&K+W>=5)break;j[1]&&(W=1)}while(++K+P<R.length&&K+W<j.length);for(let Z=2;Z<j.length;++Z)j[Z]===-1&&(j[Z]=0);switch(j[0]){case 38:B.fg=this._updateAttrColor(B.fg,j[1],j[3],j[4],j[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,j[1],j[3],j[4],j[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,j[1],j[3],j[4],j[5])}return K}_processUnderline(R,P){P.extended=P.extended.clone(),(!~R||R>5)&&(R=1),P.extended.underlineStyle=R,P.fg|=268435456,R===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(R){R.fg=h.DEFAULT_ATTR_DATA.fg,R.bg=h.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=R.length;let B;const j=this._curAttrData;for(let W=0;W<P;W++)B=R.params[W],B>=30&&B<=37?(j.fg&=-50331904,j.fg|=16777216|B-30):B>=40&&B<=47?(j.bg&=-50331904,j.bg|=16777216|B-40):B>=90&&B<=97?(j.fg&=-50331904,j.fg|=16777224|B-90):B>=100&&B<=107?(j.bg&=-50331904,j.bg|=16777224|B-100):B===0?this._processSGR0(j):B===1?j.fg|=134217728:B===3?j.bg|=67108864:B===4?(j.fg|=268435456,this._processUnderline(R.hasSubParams(W)?R.getSubParams(W)[0]:1,j)):B===5?j.fg|=536870912:B===7?j.fg|=67108864:B===8?j.fg|=1073741824:B===9?j.fg|=2147483648:B===2?j.bg|=134217728:B===21?this._processUnderline(2,j):B===22?(j.fg&=-134217729,j.bg&=-134217729):B===23?j.bg&=-67108865:B===24?(j.fg&=-268435457,this._processUnderline(0,j)):B===25?j.fg&=-536870913:B===27?j.fg&=-67108865:B===28?j.fg&=-1073741825:B===29?j.fg&=2147483647:B===39?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):B===49?(j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?W+=this._extractColor(R,W,j):B===53?j.bg|=1073741824:B===55?j.bg&=-1073741825:B===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):B===100?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${P};${B}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const P=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${P};${B}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.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(R){const P=R.params[0]||1;switch(P){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const B=P%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(R){const P=R.params[0]||1;let B;return(R.length<2||(B=R.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(R){if(!M(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){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(R){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(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const P=[],B=R.split(";");for(;B.length>1;){const j=B.shift(),W=B.shift();if(/^\d+$/.exec(j)){const K=parseInt(j);if($(K))if(W==="?")P.push({type:0,index:K});else{const Z=(0,E.parseColor)(W);Z&&P.push({type:1,index:K,color:Z})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(R){const P=R.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(R,P){this._getCurrentLinkId()&&this._finishHyperlink();const B=R.split(":");let j;const W=B.findIndex(K=>K.startsWith("id="));return W!==-1&&(j=B[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:j,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,P){const B=R.split(";");for(let j=0;j<B.length&&!(P>=this._specialColors.length);++j,++P)if(B[j]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const W=(0,E.parseColor)(B[j]);W&&this._onColor.fire([{type:1,index:this._specialColors[P],color:W}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const P=[],B=R.split(";");for(let j=0;j<B.length;++j)if(/^\d+$/.exec(B[j])){const W=parseInt(B[j]);$(W)&&P.push({type:2,index:W})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){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,p.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(L[R[0]],p.CHARSETS[R[1]]||p.DEFAULT_CHARSET),!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){const R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,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=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new m.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const B=this._activeBuffer.ybase+this._activeBuffer.y+P,j=this._activeBuffer.lines.get(B);j&&(j.fill(R),j.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,P){const B=this._bufferService.buffer,j=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${W}${u.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[j.cursorStyle]-(j.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,P){this._dirtyRowTracker.markRangeDirty(R,P)}}i.InputHandler=H;let F=class{constructor(N){this._bufferService=N,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(N){N<this.start?this.start=N:N>this.end&&(this.end=N)}markRangeDirty(N,R){N>R&&(O=N,N=R,R=O),N<this.start&&(this.start=N),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(N){return 0<=N&&N<256}F=c([g(0,b.IBufferService)],F)},844:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,u,p){this._data[g]||(this._data[g]={}),this._data[g][u]=p}get(g,u){return this._data[g]?this._data[g][u]:void 0}clear(){this._data={}}}i.TwoKeyMap=o,i.FourKeyMap=class{constructor(){this._data=new o}set(c,g,u,p,_){this._data.get(c,g)||this._data.set(c,g,new o),this._data.get(c,g).set(u,p,_)}get(c,g,u,p){var _;return(_=this._data.get(c,g))==null?void 0:_.get(u,p)}clear(){this._data.clear()}}},6114:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const o=i.isNode?"node":navigator.userAgent,c=i.isNode?"node":navigator.platform;i.isFirefox=o.includes("Firefox"),i.isLegacyEdge=o.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(o),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),i.isIpad=c==="iPad",i.isIphone=c==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),i.isLinux=c.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(o)},6106:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let o=0;i.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const g=this._getKey(c);if(g===void 0||(o=this._search(g),o===-1)||this._getKey(this._array[o])!==g)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===g);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,g){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do g(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let g=0,u=this._array.length-1;for(;u>=g;){let p=g+u>>1;const _=this._getKey(this._array[p]);if(_>c)u=p-1;else{if(!(_<c)){for(;p>0&&this._getKey(this._array[p-1])===c;)p--;return p}g=p+1}}return g}}},7226:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const c=o(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),f=_.timeRemaining(),1.5*v>f)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=f}this.clear()}}class u extends g{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}i.PriorityTaskQueue=u,i.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:u,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const c=o(643);i.updateWindowsModeWrappedState=function(g){const u=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),p=u==null?void 0:u.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&p&&(_.isWrapped=p[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&p[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,p=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=c},9092:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const c=o(6349),g=o(7226),u=o(3734),p=o(8437),_=o(4634),y=o(511),v=o(643),h=o(4863),f=o(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(d,m,w){this._hasScrollback=d,this._optionsService=m,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,m){return new p.BufferLine(this._bufferService.cols,this.getNullCell(d),m)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const m=d+this._optionsService.rawOptions.scrollback;return m>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:m}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=p.DEFAULT_ATTR_DATA);let m=this._rows;for(;m--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,m){const w=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=0;const x=this._getCorrectBufferLength(m);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<d)for(let S=0;S<this.lines.length;S++)b+=+this.lines.get(S).resize(d,w);let C=0;if(this._rows<m)for(let S=this._rows;S<m;S++)this.lines.length<m+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(d,w)));else for(let S=this._rows;S>m;S--)this.lines.length>m+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const S=this.lines.length-x;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=x}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,m-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=m-1,this._isReflowEnabled&&(this._reflow(d,m),this._cols>d))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(d,w);this._cols=d,this._rows=m,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let m=0;for(;this._memoryCleanupPosition<this.lines.length;)if(m+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),m>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,m){this._cols!==d&&(d>this._cols?this._reflowLarger(d,m):this._reflowSmaller(d,m))}_reflowLarger(d,m){const w=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(w.length>0){const b=(0,_.reflowLargerCreateNewLayout)(this.lines,w);(0,_.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(d,m,b.countRemoved)}}_reflowLargerAdjustViewport(d,m,w){const b=this.getNullCell(p.DEFAULT_ATTR_DATA);let x=w;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<m&&this.lines.push(new p.BufferLine(d,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,m){const w=this.getNullCell(p.DEFAULT_ATTR_DATA),b=[];let x=0;for(let C=this.lines.length-1;C>=0;C--){let S=this.lines.get(C);if(!S||!S.isWrapped&&S.getTrimmedLength()<=d)continue;const E=[S];for(;S.isWrapped&&C>0;)S=this.lines.get(--C),E.unshift(S);const L=this.ybase+this.y;if(L>=C&&L<C+E.length)continue;const A=E[E.length-1].getTrimmedLength(),M=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,d),D=M.length-E.length;let O;O=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);const H=[];for(let B=0;B<D;B++){const j=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);H.push(j)}H.length>0&&(b.push({start:C+E.length+x,newLines:H}),x+=H.length),E.push(...H);let F=M.length-1,$=M[F];$===0&&(F--,$=M[F]);let N=E.length-D-1,R=A;for(;N>=0;){const B=Math.min(R,$);if(E[F]===void 0)break;if(E[F].copyCellsFrom(E[N],R-B,$-B,B,!0),$-=B,$===0&&(F--,$=M[F]),R-=B,R===0){N--;const j=Math.max(N,0);R=(0,_.getWrappedLineTrimmedLength)(E,j,this._cols)}}for(let B=0;B<E.length;B++)M[B]<d&&E[B].setCell(M[B],w);let P=D-O;for(;P-- >0;)this.ybase===0?this.y<m-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-m&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+m-1)}if(b.length>0){const C=[],S=[];for(let F=0;F<this.lines.length;F++)S.push(this.lines.get(F));const E=this.lines.length;let L=E-1,A=0,M=b[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let D=0;for(let F=Math.min(this.lines.maxLength-1,E+x-1);F>=0;F--)if(M&&M.start>L+D){for(let $=M.newLines.length-1;$>=0;$--)this.lines.set(F--,M.newLines[$]);F++,C.push({index:L+1,amount:M.newLines.length}),D+=M.newLines.length,M=b[++A]}else this.lines.set(F,S[L--]);let O=0;for(let F=C.length-1;F>=0;F--)C[F].index+=O,this.lines.onInsertEmitter.fire(C[F]),O+=C[F].amount;const H=Math.max(0,E+x-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(d,m,w=0,b){const x=this.lines.get(d);return x?x.translateToString(m,w,b):""}getWrappedRangeForLine(d){let m=d,w=d;for(;m>0&&this.lines.get(m).isWrapped;)m--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:m,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].line===d&&(this.markers[m].dispose(),this.markers.splice(m--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const m=new h.Marker(d);return this.markers.push(m),m.register(this.lines.onTrim(w=>{m.line-=w,m.line<0&&m.dispose()})),m.register(this.lines.onInsert(w=>{m.line>=w.index&&(m.line+=w.amount)})),m.register(this.lines.onDelete(w=>{m.line>=w.index&&m.line<w.index+w.amount&&m.dispose(),m.line>w.index&&(m.line-=w.amount)})),m.register(m.onDispose(()=>this._removeMarker(m))),m}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const c=o(3734),g=o(511),u=o(643),p=o(482);i.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class y{constructor(h,f,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const m=f||g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let w=0;w<h;++w)this.setCell(w,m);this.length=h}get(h){const f=this._data[3*h+0],d=2097151&f;return[this._data[3*h+1],2097152&f?this._combined[h]:d?(0,p.stringFromCodePoint)(d):"",f>>22,2097152&f?this._combined[h].charCodeAt(this._combined[h].length-1):d]}set(h,f){this._data[3*h+1]=f[u.CHAR_DATA_ATTR_INDEX],f[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=f[1],this._data[3*h+0]=2097152|h|f[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=f[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const f=this._data[3*h+0];return 2097152&f?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&f}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const f=this._data[3*h+0];return 2097152&f?this._combined[h]:2097151&f?(0,p.stringFromCodePoint)(2097151&f):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,f){return _=3*h,f.content=this._data[_+0],f.fg=this._data[_+1],f.bg=this._data[_+2],2097152&f.content&&(f.combinedData=this._combined[h]),268435456&f.bg&&(f.extended=this._extendedAttrs[h]),f}setCell(h,f){2097152&f.content&&(this._combined[h]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[h]=f.extended),this._data[3*h+0]=f.content,this._data[3*h+1]=f.fg,this._data[3*h+2]=f.bg}setCellFromCodepoint(h,f,d,m){268435456&m.bg&&(this._extendedAttrs[h]=m.extended),this._data[3*h+0]=f|d<<22,this._data[3*h+1]=m.fg,this._data[3*h+2]=m.bg}addCodepointToCell(h,f,d){let m=this._data[3*h+0];2097152&m?this._combined[h]+=(0,p.stringFromCodePoint)(f):2097151&m?(this._combined[h]=(0,p.stringFromCodePoint)(2097151&m)+(0,p.stringFromCodePoint)(f),m&=-2097152,m|=2097152):m=f|4194304,d&&(m&=-12582913,m|=d<<22),this._data[3*h+0]=m}insertCells(h,f,d){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length-h){const m=new g.CellData;for(let w=this.length-h-f-1;w>=0;--w)this.setCell(h+f+w,this.loadCell(h+w,m));for(let w=0;w<f;++w)this.setCell(h+w,d)}else for(let m=h;m<this.length;++m)this.setCell(m,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(h,f,d){if(h%=this.length,f<this.length-h){const m=new g.CellData;for(let w=0;w<this.length-h-f;++w)this.setCell(h+w,this.loadCell(h+f+w,m));for(let w=this.length-f;w<this.length;++w)this.setCell(w,d)}else for(let m=h;m<this.length;++m)this.setCell(m,d);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,d)}replaceCells(h,f,d,m=!1){if(m)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,d);h<f&&h<this.length;)this.isProtected(h)||this.setCell(h,d),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,d);h<f&&h<this.length;)this.setCell(h++,d)}resize(h,f){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const m=new Uint32Array(d);m.set(this._data),this._data=m}for(let m=this.length;m<h;++m)this.setCell(m,f)}else{this._data=this._data.subarray(0,d);const m=Object.keys(this._combined);for(let b=0;b<m.length;b++){const x=parseInt(m[b],10);x>=h&&delete this._combined[x]}const w=Object.keys(this._extendedAttrs);for(let b=0;b<w.length;b++){const x=parseInt(w[b],10);x>=h&&delete this._extendedAttrs[x]}}return this.length=h,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,f=!1){if(f)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,h);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const f in h._combined)this._combined[f]=h._combined[f];this._extendedAttrs={};for(const f in h._extendedAttrs)this._extendedAttrs[f]=h._extendedAttrs[f];this.isWrapped=h.isWrapped}clone(){const h=new y(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const f in this._combined)h._combined[f]=this._combined[f];for(const f in this._extendedAttrs)h._extendedAttrs[f]=this._extendedAttrs[f];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,f,d,m,w){const b=h._data;if(w)for(let C=m-1;C>=0;C--){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(f+C)+S];268435456&b[3*(f+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[f+C])}else for(let C=0;C<m;C++){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(f+C)+S];268435456&b[3*(f+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[f+C])}const x=Object.keys(h._combined);for(let C=0;C<x.length;C++){const S=parseInt(x[C],10);S>=f&&(this._combined[S-f+d]=h._combined[S])}}translateToString(h,f,d,m){f=f??0,d=d??this.length,h&&(d=Math.min(d,this.getTrimmedLength())),m&&(m.length=0);let w="";for(;f<d;){const b=this._data[3*f+0],x=2097151&b,C=2097152&b?this._combined[f]:x?(0,p.stringFromCodePoint)(x):u.WHITESPACE_CELL_CHAR;if(w+=C,m)for(let S=0;S<C.length;++S)m.push(f);f+=b>>22||1}return m&&m.push(f),w}}i.BufferLine=y},4841:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(l,i)=>{function o(c,g,u){if(g===c.length-1)return c[g].getTrimmedLength();const p=!c[g].hasContent(u-1)&&c[g].getWidth(u-1)===1,_=c[g+1].getWidth(0)===2;return p&&_?u-1:u}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(c,g,u,p,_){const y=[];for(let v=0;v<c.length-1;v++){let h=v,f=c.get(++h);if(!f.isWrapped)continue;const d=[c.get(v)];for(;h<c.length&&f.isWrapped;)d.push(f),f=c.get(++h);if(p>=v&&p<h){v+=d.length-1;continue}let m=0,w=o(d,m,g),b=1,x=0;for(;b<d.length;){const S=o(d,b,g),E=S-x,L=u-w,A=Math.min(E,L);d[m].copyCellsFrom(d[b],x,w,A,!1),w+=A,w===u&&(m++,w=0),x+=A,x===S&&(b++,x=0),w===0&&m!==0&&d[m-1].getWidth(u-1)===2&&(d[m].copyCellsFrom(d[m-1],u-1,w++,1,!1),d[m-1].setCell(u-1,_))}d[m].replaceCells(w,u,_);let C=0;for(let S=d.length-1;S>0&&(S>m||d[S].getTrimmedLength()===0);S--)C++;C>0&&(y.push(v+d.length-C),y.push(C)),v+=d.length-1}return y},i.reflowLargerCreateNewLayout=function(c,g){const u=[];let p=0,_=g[p],y=0;for(let v=0;v<c.length;v++)if(_===v){const h=g[++p];c.onDeleteEmitter.fire({index:v-y,amount:h}),v+=h-1,y+=h,_=g[++p]}else u.push(v);return{layout:u,countRemoved:y}},i.reflowLargerApplyNewLayout=function(c,g){const u=[];for(let p=0;p<g.length;p++)u.push(c.get(g[p]));for(let p=0;p<u.length;p++)c.set(p,u[p]);c.length=g.length},i.reflowSmallerGetNewLineLengths=function(c,g,u){const p=[],_=c.map((f,d)=>o(c,d,g)).reduce((f,d)=>f+d);let y=0,v=0,h=0;for(;h<_;){if(_-h<u){p.push(_-h);break}y+=u;const f=o(c,v,g);y>f&&(y-=f,v++);const d=c[v].getWidth(y-1)===2;d&&y--;const m=d?u-1:u;p.push(m),h+=m}return p},i.getWrappedLineTrimmedLength=o},5295:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const c=o(8460),g=o(844),u=o(9092);class p extends g.Disposable{constructor(y,v){super(),this._optionsService=y,this._bufferService=v,this._onBufferActivate=this.register(new c.EventEmitter),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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.Buffer(!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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,v){this._normal.resize(y,v),this._alt.resize(y,v),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}i.BufferSet=p},511:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const c=o(482),g=o(643),u=o(3734);class p extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new p;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[g.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[g.CHAR_DATA_CHAR_INDEX].length===2){const h=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const f=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(h-55296)+f-56320+65536|y[g.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[g.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=p},643:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const c=o(8460),g=o(844);class u{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}i.Marker=u,u._nextId=1},7116:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(l,i)=>{var o,c,g;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
60
60
  `,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL=""}(o||(i.C0=o={})),function(u){u.PAD="€",u.HOP="",u.BPH="‚",u.NBH="ƒ",u.IND="„",u.NEL="…",u.SSA="†",u.ESA="‡",u.HTS="ˆ",u.HTJ="‰",u.VTS="Š",u.PLD="‹",u.PLU="Œ",u.RI="",u.SS2="Ž",u.SS3="",u.DCS="",u.PU1="‘",u.PU2="’",u.STS="“",u.CCH="”",u.MW="•",u.SPA="–",u.EPA="—",u.SOS="˜",u.SGCI="™",u.SCI="š",u.CSI="›",u.ST="œ",u.OSC="",u.PM="ž",u.APC="Ÿ"}(c||(i.C1=c={})),function(u){u.ST=`${o.ESC}\\`}(g||(i.C1_ESCAPED=g={}))},7399:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const c=o(2584),g={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:["'",'"']};i.evaluateKeyboardEvent=function(u,p,_,y){const v={type:0,cancel:!1,key:void 0},h=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?v.key=p?c.C0.ESC+"OA":c.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?v.key=p?c.C0.ESC+"OD":c.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?v.key=p?c.C0.ESC+"OC":c.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(v.key=p?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:v.key=u.ctrlKey?"\b":c.C0.DEL,u.altKey&&(v.key=c.C0.ESC+v.key);break;case 9:if(u.shiftKey){v.key=c.C0.ESC+"[Z";break}v.key=c.C0.HT,v.cancel=!0;break;case 13:v.key=u.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,v.cancel=!0;break;case 27:v.key=c.C0.ESC,u.altKey&&(v.key=c.C0.ESC+c.C0.ESC),v.cancel=!0;break;case 37:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"D",v.key===c.C0.ESC+"[1;3D"&&(v.key=c.C0.ESC+(_?"b":"[1;5D"))):v.key=p?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"C",v.key===c.C0.ESC+"[1;3C"&&(v.key=c.C0.ESC+(_?"f":"[1;5C"))):v.key=p?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"A",_||v.key!==c.C0.ESC+"[1;3A"||(v.key=c.C0.ESC+"[1;5A")):v.key=p?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"B",_||v.key!==c.C0.ESC+"[1;3B"||(v.key=c.C0.ESC+"[1;5B")):v.key=p?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(v.key=c.C0.ESC+"[2~");break;case 46:v.key=h?c.C0.ESC+"[3;"+(h+1)+"~":c.C0.ESC+"[3~";break;case 36:v.key=h?c.C0.ESC+"[1;"+(h+1)+"H":p?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:v.key=h?c.C0.ESC+"[1;"+(h+1)+"F":p?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:u.shiftKey?v.type=2:u.ctrlKey?v.key=c.C0.ESC+"[5;"+(h+1)+"~":v.key=c.C0.ESC+"[5~";break;case 34:u.shiftKey?v.type=3:u.ctrlKey?v.key=c.C0.ESC+"[6;"+(h+1)+"~":v.key=c.C0.ESC+"[6~";break;case 112:v.key=h?c.C0.ESC+"[1;"+(h+1)+"P":c.C0.ESC+"OP";break;case 113:v.key=h?c.C0.ESC+"[1;"+(h+1)+"Q":c.C0.ESC+"OQ";break;case 114:v.key=h?c.C0.ESC+"[1;"+(h+1)+"R":c.C0.ESC+"OR";break;case 115:v.key=h?c.C0.ESC+"[1;"+(h+1)+"S":c.C0.ESC+"OS";break;case 116:v.key=h?c.C0.ESC+"[15;"+(h+1)+"~":c.C0.ESC+"[15~";break;case 117:v.key=h?c.C0.ESC+"[17;"+(h+1)+"~":c.C0.ESC+"[17~";break;case 118:v.key=h?c.C0.ESC+"[18;"+(h+1)+"~":c.C0.ESC+"[18~";break;case 119:v.key=h?c.C0.ESC+"[19;"+(h+1)+"~":c.C0.ESC+"[19~";break;case 120:v.key=h?c.C0.ESC+"[20;"+(h+1)+"~":c.C0.ESC+"[20~";break;case 121:v.key=h?c.C0.ESC+"[21;"+(h+1)+"~":c.C0.ESC+"[21~";break;case 122:v.key=h?c.C0.ESC+"[23;"+(h+1)+"~":c.C0.ESC+"[23~";break;case 123:v.key=h?c.C0.ESC+"[24;"+(h+1)+"~":c.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(_&&!y||!u.altKey||u.metaKey)!_||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?v.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(v.key=c.C0.US),u.key==="@"&&(v.key=c.C0.NUL)):u.keyCode===65&&(v.type=1);else{const f=g[u.keyCode],d=f==null?void 0:f[u.shiftKey?1:0];if(d)v.key=c.C0.ESC+d;else if(u.keyCode>=65&&u.keyCode<=90){const m=u.ctrlKey?u.keyCode-64:u.keyCode+32;let w=String.fromCharCode(m);u.shiftKey&&(w=w.toUpperCase()),v.key=c.C0.ESC+w}else if(u.keyCode===32)v.key=c.C0.ESC+(u.ctrlKey?c.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let m=u.code.slice(3,4);u.shiftKey||(m=m.toLowerCase()),v.key=c.C0.ESC+m,v.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?v.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?v.key=c.C0.NUL:u.keyCode>=51&&u.keyCode<=55?v.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?v.key=c.C0.DEL:u.keyCode===219?v.key=c.C0.ESC:u.keyCode===220?v.key=c.C0.FS:u.keyCode===221&&(v.key=c.C0.GS)}return v}},482:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},i.utf32ToString=function(o,c=0,g=o.length){let u="";for(let p=c;p<g;++p){let _=o[p];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const g=o.length;if(!g)return 0;let u=0,p=0;if(this._interim){const _=o.charCodeAt(p++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=p;_<g;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=g)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const g=o.length;if(!g)return 0;let u,p,_,y,v=0,h=0,f=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;f<E;){if(f>=g)return 0;if(x=o[f++],(192&x)!=128){f--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?f--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=g-4;let m=f;for(;m<g;){for(;!(!(m<d)||128&(u=o[m])||128&(p=o[m+1])||128&(_=o[m+2])||128&(y=o[m+3]));)c[v++]=u,c[v++]=p,c[v++]=_,c[v++]=y,m+=4;if(u=o[m++],u<128)c[v++]=u;else if((224&u)==192){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(h=(31&u)<<6|63&p,h<128){m--;continue}c[v++]=h}else if((240&u)==224){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(h=(15&u)<<12|(63&p)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,this.interim[2]=_,v;if(y=o[m++],(192&y)!=128){m--;continue}if(h=(7&u)<<18|(63&p)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},225:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const c=o(1480),g=[[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]],u=[[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]];let p;i.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let _=0;_<g.length;++_)p.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?p[_]:function(y,v){let h,f=0,d=v.length-1;if(y<v[0][0]||y>v[d][1])return!1;for(;d>=f;)if(h=f+d>>1,y>v[h][1])f=h+1;else{if(!(y<v[h][0]))return!0;d=h-1}return!1}(_,u)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,y){let v=this.wcwidth(_),h=v===0&&y!==0;if(h){const f=c.UnicodeService.extractWidth(y);f===0?h=!1:f>v&&(v=f)}return c.UnicodeService.createPropertyValue(0,v,h)}}},5981:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const c=o(8460),g=o(844);class u extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);const h=this._callbacks.shift();h&&h()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(y),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(y)}_innerWrite(_=0,y=!0){const v=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const h=this._writeBuffer[this._bufferOffset],f=this._action(h,y);if(f){const m=w=>Date.now()-v>=12?setTimeout(()=>this._innerWrite(0,w)):this._innerWrite(v,w);return void f.catch(w=>(queueMicrotask(()=>{throw w}),Promise.resolve(!1))).then(m)}const d=this._callbacks[this._bufferOffset];if(d&&d(),this._bufferOffset++,this._pendingData-=h.length,Date.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}i.WriteBuffer=u},5941:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;const o=/^([\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})$/,c=/^[\da-f]+$/;function g(u,p){const _=u.toString(16),y=_.length<2?"0"+_:_;switch(p){case 4:return _[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}i.parseColor=function(u){if(!u)return;let p=u.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const _=o.exec(p);if(_){const y=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/y*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/y*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),c.exec(p)&&[3,6,9,12].includes(p.length))){const _=p.length/3,y=[0,0,0];for(let v=0;v<3;++v){const h=parseInt(p.slice(_*v,_*v+_),16);y[v]=_===1?h<<4:_===2?h:_===3?h>>4:h>>8}return y}},i.toRgbString=function(u,p=16){const[_,y,v]=u;return`rgb:${g(_,p)}/${g(y,p)}/${g(v,p)}`}},5770:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;const c=o(482),g=o(8742),u=o(5770),p=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(y,v){this._handlers[y]===void 0&&(this._handlers[y]=[]);const h=this._handlers[y];return h.push(v),{dispose:()=>{const f=h.indexOf(v);f!==-1&&h.splice(f,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,v){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].hook(v);else this._handlerFb(this._ident,"HOOK",v)}put(y,v,h){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,v,h);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(y,v,h))}unhook(y,v=!0){if(this._active.length){let h=!1,f=this._active.length-1,d=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,h=v,d=this._stack.fallThrough,this._stack.paused=!1),!d&&h===!1){for(;f>=0&&(h=this._active[f].unhook(y),h!==!0);f--)if(h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,h;f--}for(;f>=0;f--)if(h=this._active[f].unhook(!1),h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,h}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const _=new g.Params;_.addParam(0),i.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=_,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():_,this._data="",this._hitLimit=!1}put(y,v,h){this._hitLimit||(this._data+=(0,c.utf32ToString)(y,v,h),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let v=!1;if(this._hitLimit)v=!1;else if(y&&(v=this._handler(this._data,this._params),v instanceof Promise))return v.then(h=>(this._params=_,this._data="",this._hitLimit=!1,h));return this._params=_,this._data="",this._hitLimit=!1,v}}},2015:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const c=o(844),g=o(8742),u=o(6242),p=o(6351);class _{constructor(f){this.table=new Uint8Array(f)}setDefault(f,d){this.table.fill(f<<4|d)}add(f,d,m,w){this.table[d<<8|f]=m<<4|w}addMany(f,d,m,w){for(let b=0;b<f.length;b++)this.table[d<<8|f[b]]=m<<4|w}}i.TransitionTable=_;const y=160;i.VT500_TRANSITION_TABLE=function(){const h=new _(4095),f=Array.apply(null,Array(256)).map((C,S)=>S),d=(C,S)=>f.slice(C,S),m=d(32,127),w=d(0,24);w.push(25),w.push.apply(w,d(28,32));const b=d(0,14);let x;for(x in h.setDefault(1,0),h.addMany(m,0,2,0),b)h.addMany([24,26,153,154],x,3,0),h.addMany(d(128,144),x,3,0),h.addMany(d(144,152),x,3,0),h.add(156,x,0,0),h.add(27,x,11,1),h.add(157,x,4,8),h.addMany([152,158,159],x,0,7),h.add(155,x,11,3),h.add(144,x,11,9);return h.addMany(w,0,3,0),h.addMany(w,1,3,1),h.add(127,1,0,1),h.addMany(w,8,0,8),h.addMany(w,3,3,3),h.add(127,3,0,3),h.addMany(w,4,3,4),h.add(127,4,0,4),h.addMany(w,6,3,6),h.addMany(w,5,3,5),h.add(127,5,0,5),h.addMany(w,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(m,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(d(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(m,7,0,7),h.addMany(w,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(d(64,127),3,7,0),h.addMany(d(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(d(48,60),4,8,4),h.addMany(d(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(d(32,64),6,0,6),h.add(127,6,0,6),h.addMany(d(64,127),6,0,0),h.addMany(d(32,48),3,9,5),h.addMany(d(32,48),5,9,5),h.addMany(d(48,64),5,0,6),h.addMany(d(64,127),5,7,0),h.addMany(d(32,48),4,9,5),h.addMany(d(32,48),1,9,2),h.addMany(d(32,48),2,9,2),h.addMany(d(48,127),2,10,0),h.addMany(d(48,80),1,10,0),h.addMany(d(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(d(96,127),1,10,0),h.add(80,1,11,9),h.addMany(w,9,0,9),h.add(127,9,0,9),h.addMany(d(28,32),9,0,9),h.addMany(d(32,48),9,9,12),h.addMany(d(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(w,11,0,11),h.addMany(d(32,128),11,0,11),h.addMany(d(28,32),11,0,11),h.addMany(w,10,0,10),h.add(127,10,0,10),h.addMany(d(28,32),10,0,10),h.addMany(d(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(d(32,48),10,9,12),h.addMany(w,12,0,12),h.add(127,12,0,12),h.addMany(d(28,32),12,0,12),h.addMany(d(32,48),12,9,12),h.addMany(d(48,64),12,0,11),h.addMany(d(64,127),12,12,13),h.addMany(d(64,127),10,12,13),h.addMany(d(64,127),9,12,13),h.addMany(w,13,13,13),h.addMany(m,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(y,0,2,0),h.add(y,8,5,8),h.add(y,6,0,6),h.add(y,11,0,11),h.add(y,13,13,13),h}();class v extends c.Disposable{constructor(f=i.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(d,m,w)=>{},this._executeHandlerFb=d=>{},this._csiHandlerFb=(d,m)=>{},this._escHandlerFb=d=>{},this._errorHandlerFb=d=>d,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new u.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(f,d=[64,126]){let m=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(m=f.prefix.charCodeAt(0),m&&60>m||m>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<f.intermediates.length;++b){const x=f.intermediates.charCodeAt(b);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");m<<=8,m|=x}}if(f.final.length!==1)throw new Error("final must be a single byte");const w=f.final.charCodeAt(0);if(d[0]>w||w>d[1])throw new Error(`final must be in range ${d[0]} .. ${d[1]}`);return m<<=8,m|=w,m}identToString(f){const d=[];for(;f;)d.push(String.fromCharCode(255&f)),f>>=8;return d.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,d){const m=this._identifier(f,[48,126]);this._escHandlers[m]===void 0&&(this._escHandlers[m]=[]);const w=this._escHandlers[m];return w.push(d),{dispose:()=>{const b=w.indexOf(d);b!==-1&&w.splice(b,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,d){this._executeHandlers[f.charCodeAt(0)]=d}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,d){const m=this._identifier(f);this._csiHandlers[m]===void 0&&(this._csiHandlers[m]=[]);const w=this._csiHandlers[m];return w.push(d),{dispose:()=>{const b=w.indexOf(d);b!==-1&&w.splice(b,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,d){return this._dcsParser.registerHandler(this._identifier(f),d)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,d){return this._oscParser.registerHandler(f,d)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}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(f,d,m,w,b){this._parseStack.state=f,this._parseStack.handlers=d,this._parseStack.handlerPos=m,this._parseStack.transition=w,this._parseStack.chunkPos=b}parse(f,d,m){let w,b=0,x=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(m===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(m===!1&&E>-1){for(;E>=0&&(w=S[E](this._params),w!==!0);E--)if(w instanceof Promise)return this._parseStack.handlerPos=E,w}this._parseStack.handlers=[];break;case 4:if(m===!1&&E>-1){for(;E>=0&&(w=S[E](),w!==!0);E--)if(w instanceof Promise)return this._parseStack.handlerPos=E,w}this._parseStack.handlers=[];break;case 6:if(b=f[this._parseStack.chunkPos],w=this._dcsParser.unhook(b!==24&&b!==26,m),w)return w;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=f[this._parseStack.chunkPos],w=this._oscParser.end(b!==24&&b!==26,m),w)return w;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let S=C;S<d;++S){switch(b=f[S],x=this._transitions.table[this.currentState<<8|(b<160?b:y)],x>>4){case 2:for(let D=S+1;;++D){if(D>=d||(b=f[D])<32||b>126&&b<y){this._printHandler(f,S,D),S=D-1;break}if(++D>=d||(b=f[D])<32||b>126&&b<y){this._printHandler(f,S,D),S=D-1;break}if(++D>=d||(b=f[D])<32||b>126&&b<y){this._printHandler(f,S,D),S=D-1;break}if(++D>=d||(b=f[D])<32||b>126&&b<y){this._printHandler(f,S,D),S=D-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];let L=E?E.length-1:-1;for(;L>=0&&(w=E[L](this._params),w!==!0);L--)if(w instanceof Promise)return this._preserveStack(3,E,L,x,S),w;L<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingJoinState=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++S<d&&(b=f[S])>47&&b<60);S--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const A=this._escHandlers[this._collect<<8|b];let M=A?A.length-1:-1;for(;M>=0&&(w=A[M](),w!==!0);M--)if(w instanceof Promise)return this._preserveStack(4,A,M,x,S),w;M<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let D=S+1;;++D)if(D>=d||(b=f[D])===24||b===26||b===27||b>127&&b<y){this._dcsParser.put(f,S,D),S=D-1;break}break;case 14:if(w=this._dcsParser.unhook(b!==24&&b!==26),w)return this._preserveStack(6,[],0,x,S),w;b===27&&(x|=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 D=S+1;;D++)if(D>=d||(b=f[D])<32||b>127&&b<y){this._oscParser.put(f,S,D),S=D-1;break}break;case 6:if(w=this._oscParser.end(b!==24&&b!==26),w)return this._preserveStack(5,[],0,x,S),w;b===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}i.EscapeSequenceParser=v},6242:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const c=o(5770),g=o(482),u=[];i.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,_){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(_),{dispose:()=>{const v=y.indexOf(_);v!==-1&&y.splice(v,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,_,y){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(p,_,y);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(p,_,y))}start(){this.reset(),this._state=1}put(p,_,y){if(this._state!==3){if(this._state===1)for(;_<y;){const v=p[_++];if(v===59){this._state=2,this._start();break}if(v<48||57<v)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+v-48}this._state===2&&y-_>0&&this._put(p,_,y)}}end(p,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,v=this._active.length-1,h=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,y=_,h=this._stack.fallThrough,this._stack.paused=!1),!h&&y===!1){for(;v>=0&&(y=this._active[v].end(p),y!==!0);v--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,y;v--}for(;v>=0;v--)if(y=this._active[v].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=u,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,_,y){this._hitLimit||(this._data+=(0,g.utf32ToString)(p,_,y),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let _=!1;if(this._hitLimit)_=!1;else if(p&&(_=this._handler(this._data),_ instanceof Promise))return _.then(y=>(this._data="",this._hitLimit=!1,y));return this._data="",this._hitLimit=!1,_}}},8742:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const o=2147483647;class c{static fromArray(u){const p=new c;if(!u.length)return p;for(let _=Array.isArray(u[0])?1:0;_<u.length;++_){const y=u[_];if(Array.isArray(y))for(let v=0;v<y.length;++v)p.addSubParam(y[v]);else p.addParam(y)}return p}constructor(u=32,p=32){if(this.maxLength=u,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const u=new c(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){const u=[];for(let p=0;p<this.length;++p){u.push(this.params[p]);const _=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-_>0&&u.push(Array.prototype.slice.call(this._subParams,_,y))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>o?o:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>o?o:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){const p=this._subParamsIdx[u]>>8,_=255&this._subParamsIdx[u];return _-p>0?this._subParams.subarray(p,_):null}getSubParamsAll(){const u={};for(let p=0;p<this.length;++p){const _=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-_>0&&(u[p]=this._subParams.slice(_,y))}return u}addDigit(u){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,y=_[p-1];_[p-1]=~y?Math.min(10*y+u,o):u}}i.Params=c},5741:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const g={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(g),c.dispose=()=>this._wrappedAddonDispose(g),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===o){c=g;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const c=o(3785),g=o(511);i.BufferApiView=class{constructor(u,p){this._buffer=u,this.type=p}init(u){return this._buffer=u,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(u){const p=this._buffer.lines.get(u);if(p)return new c.BufferLineApiView(p)}getNullCell(){return new g.CellData}}},3785:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const c=o(511);i.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,u){if(!(g<0||g>=this._line.length))return u?(this._line.loadCell(g,u),u):this._line.loadCell(g,new c.CellData)}translateToString(g,u,p){return this._line.translateToString(g,u,p)}}},8285:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const c=o(8771),g=o(8460),u=o(844);class p extends u.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(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 new 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)}}i.BufferNamespaceApi=p},7975:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,g=>c(g.toArray()))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,(g,u)=>c(g,u.toArray()))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(l,i,o){var c=this&&this.__decorate||function(h,f,d,m){var w,b=arguments.length,x=b<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,f,d,m);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(f,d,x):w(f,d))||x);return b>3&&x&&Object.defineProperty(f,d,x),x},g=this&&this.__param||function(h,f){return function(d,m){f(d,m,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const u=o(8460),p=o(844),_=o(5295),y=o(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let v=i.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(h){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(h.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(h.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(h,this))}resize(h,f){this.cols=h,this.rows=f,this.buffers.resize(h,f),this._onResize.fire({cols:h,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(h,f=!1){const d=this.buffer;let m;m=this._cachedBlankLine,m&&m.length===this.cols&&m.getFg(0)===h.fg&&m.getBg(0)===h.bg||(m=d.getBlankLine(h,f),this._cachedBlankLine=m),m.isWrapped=f;const w=d.ybase+d.scrollTop,b=d.ybase+d.scrollBottom;if(d.scrollTop===0){const x=d.lines.isFull;b===d.lines.length-1?x?d.lines.recycle().copyFrom(m):d.lines.push(m.clone()):d.lines.splice(b+1,0,m.clone()),x?this.isUserScrolling&&(d.ydisp=Math.max(d.ydisp-1,0)):(d.ybase++,this.isUserScrolling||d.ydisp++)}else{const x=b-w+1;d.lines.shiftElements(w+1,x-1,-1),d.lines.set(b,m.clone())}this.isUserScrolling||(d.ydisp=d.ybase),this._onScroll.fire(d.ydisp)}scrollLines(h,f,d){const m=this.buffer;if(h<0){if(m.ydisp===0)return;this.isUserScrolling=!0}else h+m.ydisp>=m.ybase&&(this.isUserScrolling=!1);const w=m.ydisp;m.ydisp=Math.max(Math.min(m.ydisp+h,m.ybase),0),w!==m.ydisp&&(f||this._onScroll.fire(m.ydisp))}};i.BufferService=v=c([g(0,y.IOptionsService)],v)},7994:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(l,i,o){var c=this&&this.__decorate||function(m,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,w,b,x);else for(var L=m.length-1;L>=0;L--)(C=m[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},g=this&&this.__param||function(m,w){return function(b,x){w(b,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const u=o(2585),p=o(8460),_=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:m=>m.button!==4&&m.action===1&&(m.ctrl=!1,m.alt=!1,m.shift=!1,!0)},VT200:{events:19,restrict:m=>m.action!==32},DRAG:{events:23,restrict:m=>m.action!==32||m.button!==3},ANY:{events:31,restrict:m=>!0}};function v(m,w){let b=(m.ctrl?16:0)|(m.shift?4:0)|(m.alt?8:0);return m.button===4?(b|=64,b|=m.action):(b|=3&m.button,4&m.button&&(b|=64),8&m.button&&(b|=128),m.action===32?b|=32:m.action!==0||w||(b|=3)),b}const h=String.fromCharCode,f={DEFAULT:m=>{const w=[v(m,!1)+32,m.col+32,m.row+32];return w[0]>255||w[1]>255||w[2]>255?"":`\x1B[M${h(w[0])}${h(w[1])}${h(w[2])}`},SGR:m=>{const w=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${v(m,!0)};${m.col};${m.row}${w}`},SGR_PIXELS:m=>{const w=m.action===0&&m.button!==4?"m":"M";return`\x1B[<${v(m,!0)};${m.x};${m.y}${w}`}};let d=i.CoreMouseService=class extends _.Disposable{constructor(m,w){super(),this._bufferService=m,this._coreService=w,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(y))this.addProtocol(b,y[b]);for(const b of Object.keys(f))this.addEncoding(b,f[b]);this.reset()}addProtocol(m,w){this._protocols[m]=w}addEncoding(m,w){this._encodings[m]=w}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(m){if(!this._protocols[m])throw new Error(`unknown protocol "${m}"`);this._activeProtocol=m,this._onProtocolChange.fire(this._protocols[m].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(m){if(!this._encodings[m])throw new Error(`unknown encoding "${m}"`);this._activeEncoding=m}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(m){if(m.col<0||m.col>=this._bufferService.cols||m.row<0||m.row>=this._bufferService.rows||m.button===4&&m.action===32||m.button===3&&m.action!==32||m.button!==4&&(m.action===2||m.action===3)||(m.col++,m.row++,m.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,m,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(m))return!1;const w=this._encodings[this._activeEncoding](m);return w&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(w):this._coreService.triggerDataEvent(w,!0)),this._lastEvent=m,!0}explainEvents(m){return{down:!!(1&m),up:!!(2&m),drag:!!(4&m),move:!!(8&m),wheel:!!(16&m)}}_equalEvents(m,w,b){if(b){if(m.x!==w.x||m.y!==w.y)return!1}else if(m.col!==w.col||m.row!==w.row)return!1;return m.button===w.button&&m.action===w.action&&m.ctrl===w.ctrl&&m.alt===w.alt&&m.shift===w.shift}};i.CoreMouseService=d=c([g(0,u.IBufferService),g(1,u.ICoreService)],d)},6975:function(l,i,o){var c=this&&this.__decorate||function(d,m,w,b){var x,C=arguments.length,S=C<3?m:b===null?b=Object.getOwnPropertyDescriptor(m,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,m,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(m,w,S):x(m,w))||S);return C>3&&S&&Object.defineProperty(m,w,S),S},g=this&&this.__param||function(d,m){return function(w,b){m(w,b,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const u=o(1439),p=o(8460),_=o(844),y=o(2585),v=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=i.CoreService=class extends _.Disposable{constructor(d,m,w){super(),this._bufferService=d,this._logService=m,this._optionsService=w,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(v),this.decPrivateModes=(0,u.clone)(h)}reset(){this.modes=(0,u.clone)(v),this.decPrivateModes=(0,u.clone)(h)}triggerDataEvent(d,m=!1){if(this._optionsService.rawOptions.disableStdin)return;const w=this._bufferService.buffer;m&&this._optionsService.rawOptions.scrollOnUserInput&&w.ybase!==w.ydisp&&this._onRequestScrollToBottom.fire(),m&&this._onUserInput.fire(),this._logService.debug(`sending data "${d}"`,()=>d.split("").map(b=>b.charCodeAt(0))),this._onData.fire(d)}triggerBinaryEvent(d){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${d}"`,()=>d.split("").map(m=>m.charCodeAt(0))),this._onBinary.fire(d))}};i.CoreService=f=c([g(0,y.IBufferService),g(1,y.ILogService),g(2,y.IOptionsService)],f)},9074:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const c=o(8055),g=o(8460),u=o(844),p=o(6106);let _=0,y=0;class v extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(d=>d==null?void 0:d.marker.line),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,u.toDisposable)(()=>this.reset()))}registerDecoration(d){if(d.marker.isDisposed)return;const m=new h(d);if(m){const w=m.marker.onDispose(()=>m.dispose());m.onDispose(()=>{m&&(this._decorations.delete(m)&&this._onDecorationRemoved.fire(m),w.dispose())}),this._decorations.insert(m),this._onDecorationRegistered.fire(m)}return m}reset(){for(const d of this._decorations.values())d.dispose();this._decorations.clear()}*getDecorationsAtCell(d,m,w){let b=0,x=0;for(const C of this._decorations.getKeyIterator(m))b=C.options.x??0,x=b+(C.options.width??1),d>=b&&d<x&&(!w||(C.options.layer??"bottom")===w)&&(yield C)}forEachDecorationAtCell(d,m,w,b){this._decorations.forEachByKey(m,x=>{_=x.options.x??0,y=_+(x.options.width??1),d>=_&&d<y&&(!w||(x.options.layer??"bottom")===w)&&b(x)})}}i.DecorationService=v;class h extends u.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(d){super(),this.options=d,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=d.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;const c=o(2585),g=o(8343);class u{constructor(..._){this._entries=new Map;for(const[y,v]of _)this.set(y,v)}set(_,y){const v=this._entries.get(_);return this._entries.set(_,y),v}forEach(_){for(const[y,v]of this._entries.entries())_(y,v)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}i.ServiceCollection=u,i.InstantiationService=class{constructor(){this._services=new u,this._services.set(c.IInstantiationService,this)}setService(p,_){this._services.set(p,_)}getService(p){return this._services.get(p)}createInstance(p,..._){const y=(0,g.getServiceDependencies)(p).sort((f,d)=>f.index-d.index),v=[];for(const f of y){const d=this._services.get(f.id);if(!d)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${f.id}.`);v.push(d)}const h=y.length>0?y[0].index:_.length;if(_.length!==h)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${h+1} conflicts with ${_.length} static arguments`);return new p(..._,...v)}}},7866:function(l,i,o){var c=this&&this.__decorate||function(h,f,d,m){var w,b=arguments.length,x=b<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,f,d,m);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(f,d,x):w(f,d))||x);return b>3&&x&&Object.defineProperty(f,d,x),x},g=this&&this.__param||function(h,f){return function(d,m){f(d,m,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const u=o(844),p=o(2585),_={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,v=i.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let f=0;f<h.length;f++)typeof h[f]=="function"&&(h[f]=h[f]())}_log(h,f,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...d)}trace(h,...f){var d;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,f)}debug(h,...f){var d;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,f)}info(h,...f){var d;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,f)}warn(h,...f){var d;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,f)}error(h,...f){var d;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,f)}};i.LogService=v=c([g(0,p.IOptionsService)],v),i.setTraceLogger=function(h){y=h},i.traceCall=function(h,f,d){if(typeof d.value!="function")throw new Error("not supported");const m=d.value;d.value=function(...w){if(y.logLevel!==p.LogLevelEnum.TRACE)return m.apply(this,w);y.trace(`GlyphRenderer#${m.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=m.apply(this,w);return y.trace(`GlyphRenderer#${m.name} return`,b),b}}},7302:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const c=o(8460),g=o(844),u=o(6114);i.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(v){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const h={...i.DEFAULT_OPTIONS};for(const f in v)if(f in h)try{const d=v[f];h[f]=this._sanitizeAndValidateOption(f,d)}catch(d){console.error(d)}this.rawOptions=h,this.options={...h},this._setupOptions(),this.register((0,g.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(v,h){return this.onOptionChange(f=>{f===v&&h(this.rawOptions[v])})}onMultipleOptionChange(v,h){return this.onOptionChange(f=>{v.indexOf(f)!==-1&&h()})}_setupOptions(){const v=f=>{if(!(f in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},h=(f,d)=>{if(!(f in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);d=this._sanitizeAndValidateOption(f,d),this.rawOptions[f]!==d&&(this.rawOptions[f]=d,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const d={get:v.bind(this,f),set:h.bind(this,f)};Object.defineProperty(this.options,f,d)}}_sanitizeAndValidateOption(v,h){switch(v){case"cursorStyle":if(h||(h=i.DEFAULT_OPTIONS[v]),!function(f){return f==="block"||f==="underline"||f==="bar"}(h))throw new Error(`"${h}" is not a valid value for ${v}`);break;case"wordSeparator":h||(h=i.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof h=="number"&&1<=h&&h<=1e3)break;h=p.includes(h)?h:i.DEFAULT_OPTIONS[v];break;case"cursorWidth":h=Math.floor(h);case"lineHeight":case"tabStopWidth":if(h<1)throw new Error(`${v} cannot be less than 1, value: ${h}`);break;case"minimumContrastRatio":h=Math.max(1,Math.min(21,Math.round(10*h)/10));break;case"scrollback":if((h=Math.min(h,4294967295))<0)throw new Error(`${v} cannot be less than 0, value: ${h}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(h<=0)throw new Error(`${v} cannot be less than or equal to 0, value: ${h}`);break;case"rows":case"cols":if(!h&&h!==0)throw new Error(`${v} must be numeric, value: ${h}`);break;case"windowsPty":h=h??{}}return h}}i.OptionsService=_},2660:function(l,i,o){var c=this&&this.__decorate||function(_,y,v,h){var f,d=arguments.length,m=d<3?y:h===null?h=Object.getOwnPropertyDescriptor(y,v):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(_,y,v,h);else for(var w=_.length-1;w>=0;w--)(f=_[w])&&(m=(d<3?f(m):d>3?f(y,v,m):f(y,v))||m);return d>3&&m&&Object.defineProperty(y,v,m),m},g=this&&this.__param||function(_,y){return function(v,h){y(v,h,_)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const u=o(2585);let p=i.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const y=this._bufferService.buffer;if(_.id===void 0){const w=y.addMarker(y.ybase+y.y),b={data:_,id:this._nextId++,lines:[w]};return w.onDispose(()=>this._removeMarkerFromLink(b,w)),this._dataByLinkId.set(b.id,b),b.id}const v=_,h=this._getEntryIdKey(v),f=this._entriesWithId.get(h);if(f)return this.addLineToLink(f.id,y.ybase+y.y),f.id;const d=y.addMarker(y.ybase+y.y),m={id:this._nextId++,key:this._getEntryIdKey(v),data:v,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._entriesWithId.set(m.key,m),this._dataByLinkId.set(m.id,m),m.id}addLineToLink(_,y){const v=this._dataByLinkId.get(_);if(v&&v.lines.every(h=>h.line!==y)){const h=this._bufferService.buffer.addMarker(y);v.lines.push(h),h.onDispose(()=>this._removeMarkerFromLink(v,h))}}getLinkData(_){var y;return(y=this._dataByLinkId.get(_))==null?void 0:y.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,y){const v=_.lines.indexOf(y);v!==-1&&(_.lines.splice(v,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};i.OscLinkService=p=c([g(0,u.IBufferService)],p)},8343:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const o="di$target",c="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(g){return g[c]||[]},i.createDecorator=function(g){if(i.serviceRegistry.has(g))return i.serviceRegistry.get(g);const u=function(p,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,f){h[o]===h?h[c].push({id:v,index:f}):(h[c]=[{id:v,index:f}],h[o]=h)})(u,p,y)};return u.toString=()=>g,i.serviceRegistry.set(g,u),u}},2585:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const c=o(8343);var g;i.IBufferService=(0,c.createDecorator)("BufferService"),i.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),i.ICoreService=(0,c.createDecorator)("CoreService"),i.ICharsetService=(0,c.createDecorator)("CharsetService"),i.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(g||(i.LogLevelEnum=g={})),i.ILogService=(0,c.createDecorator)("LogService"),i.IOptionsService=(0,c.createDecorator)("OptionsService"),i.IOscLinkService=(0,c.createDecorator)("OscLinkService"),i.IUnicodeService=(0,c.createDecorator)("UnicodeService"),i.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const c=o(8460),g=o(225);class u{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,y,v=!1){return(16777215&_)<<3|(3&y)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let y=0,v=0;const h=_.length;for(let f=0;f<h;++f){let d=_.charCodeAt(f);if(55296<=d&&d<=56319){if(++f>=h)return y+this.wcwidth(d);const b=_.charCodeAt(f);56320<=b&&b<=57343?d=1024*(d-55296)+b-56320+65536:y+=this.wcwidth(b)}const m=this.charProperties(d,v);let w=u.extractWidth(m);u.extractShouldJoin(m)&&(w-=u.extractWidth(v)),y+=w,v=m}return y}charProperties(_,y){return this._activeProvider.charProperties(_,y)}}i.UnicodeService=u}},n={};function s(l){var i=n[l];if(i!==void 0)return i.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,s),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const i=s(9042),o=s(3236),c=s(844),g=s(5741),u=s(8285),p=s(7975),_=s(7090),y=["cols","rows"];class v extends c.Disposable{constructor(f){super(),this._core=this.register(new o.Terminal(f)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const d=w=>this._core.options[w],m=(w,b)=>{this._checkReadonlyOptions(w),this._core.options[w]=b};for(const w in this._core.options){const b={get:d.bind(this,w),set:m.bind(this,w)};Object.defineProperty(this._publicOptions,w,b)}}_checkReadonlyOptions(f){if(y.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(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._buffer=this.register(new u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let d="none";switch(this._core.coreMouseService.activeProtocol){case"X10":d="x10";break;case"VT200":d="vt200";break;case"DRAG":d="drag";break;case"ANY":d="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:d,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const d in f)this._publicOptions[d]=f[d]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,d=!0){this._core.input(f,d)}resize(f,d){this._verifyIntegers(f,d),this._core.resize(f,d)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,d,m){this._verifyIntegers(f,d,m),this._core.select(f,d,m)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,d){this._verifyIntegers(f,d),this._core.selectLines(f,d)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,d){this._core.write(f,d)}writeln(f,d){this._core.write(f),this._core.write(`\r
61
61
  `,d)}paste(f){this._core.paste(f)}refresh(f,d){this._verifyIntegers(f,d),this._core.refresh(f,d)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return i}_verifyIntegers(...f){for(const d of f)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const d of f)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}l.Terminal=v})(),a})())})(W1);var YR=W1.exports;/**
62
62
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -89,7 +89,7 @@ void main() {
89
89
  gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
90
90
  v_texpage = int(a_texpage);
91
91
  v_texcoord = a_texcoord + a_unitquad * a_texsize;
92
- }`,function(F){let $="";for(let O=1;O<F;O++)$+=` else if (v_texpage == ${O}) { outColor = texture(u_texture[${O}], v_texcoord); }`;return`#version 300 es
92
+ }`,function(F){let $="";for(let N=1;N<F;N++)$+=` else if (v_texpage == ${N}) { outColor = texture(u_texture[${N}], v_texcoord); }`;return`#version 300 es
93
93
  precision lowp float;
94
94
 
95
95
  in vec2 v_texcoord;
@@ -103,7 +103,7 @@ void main() {
103
103
  if (v_texpage == 0) {
104
104
  outColor = texture(u_texture[0], v_texcoord);
105
105
  } ${$}
106
- }`}(g.TextureAtlas.maxAtlasPages))),this.register((0,p.toDisposable)(()=>L.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=L.createVertexArray(),L.bindVertexArray(this._vertexArrayObject);const A=new Float32Array([0,0,1,0,0,1,1,1]),M=L.createBuffer();this.register((0,p.toDisposable)(()=>L.deleteBuffer(M))),L.bindBuffer(L.ARRAY_BUFFER,M),L.bufferData(L.ARRAY_BUFFER,A,L.STATIC_DRAW),L.enableVertexAttribArray(0),L.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const D=new Uint8Array([0,1,2,3]),N=L.createBuffer();this.register((0,p.toDisposable)(()=>L.deleteBuffer(N))),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,N),L.bufferData(L.ELEMENT_ARRAY_BUFFER,D,L.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(L.createBuffer()),this.register((0,p.toDisposable)(()=>L.deleteBuffer(this._attributesBuffer))),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.enableVertexAttribArray(2),L.vertexAttribPointer(2,2,L.FLOAT,!1,v,0),L.vertexAttribDivisor(2,1),L.enableVertexAttribArray(3),L.vertexAttribPointer(3,2,L.FLOAT,!1,v,2*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(3,1),L.enableVertexAttribArray(4),L.vertexAttribPointer(4,1,L.FLOAT,!1,v,4*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(4,1),L.enableVertexAttribArray(5),L.vertexAttribPointer(5,2,L.FLOAT,!1,v,5*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(5,1),L.enableVertexAttribArray(6),L.vertexAttribPointer(6,2,L.FLOAT,!1,v,7*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(6,1),L.enableVertexAttribArray(1),L.vertexAttribPointer(1,2,L.FLOAT,!1,v,9*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(1,1),L.useProgram(this._program);const H=new Int32Array(g.TextureAtlas.maxAtlasPages);for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++)H[F]=F;L.uniform1iv(this._textureLocation,H),L.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),this._atlasTextures=[];for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++){const $=new _.GLTexture((0,c.throwIfFalsy)(L.createTexture()));this.register((0,p.toDisposable)(()=>L.deleteTexture($.texture))),L.activeTexture(L.TEXTURE0+F),L.bindTexture(L.TEXTURE_2D,$.texture),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texImage2D(L.TEXTURE_2D,0,L.RGBA,1,1,0,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[F]=$}L.enable(L.BLEND),L.blendFunc(L.SRC_ALPHA,L.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(x,C,S,E,L,A,M,D,N){this._updateCell(this._vertices.attributes,x,C,S,E,L,A,M,D,N)}_updateCell(x,C,S,E,L,A,M,D,N,H){f=(S*this._terminal.cols+C)*y,E!==u.NULL_CELL_CODE&&E!==void 0?this._atlas&&(h=D&&D.length>1?this._atlas.getRasterizedGlyphCombinedChar(D,L,A,M,!1):this._atlas.getRasterizedGlyph(E,L,A,M,!1),d=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),L!==H&&h.offset.x>d?(m=h.offset.x-d,x[f]=-(h.offset.x-m)+this._dimensions.device.char.left,x[f+1]=-h.offset.y+this._dimensions.device.char.top,x[f+2]=(h.size.x-m)/this._dimensions.device.canvas.width,x[f+3]=h.size.y/this._dimensions.device.canvas.height,x[f+4]=h.texturePage,x[f+5]=h.texturePositionClipSpace.x+m/this._atlas.pages[h.texturePage].canvas.width,x[f+6]=h.texturePositionClipSpace.y,x[f+7]=h.sizeClipSpace.x-m/this._atlas.pages[h.texturePage].canvas.width,x[f+8]=h.sizeClipSpace.y):(x[f]=-h.offset.x+this._dimensions.device.char.left,x[f+1]=-h.offset.y+this._dimensions.device.char.top,x[f+2]=h.size.x/this._dimensions.device.canvas.width,x[f+3]=h.size.y/this._dimensions.device.canvas.height,x[f+4]=h.texturePage,x[f+5]=h.texturePositionClipSpace.x,x[f+6]=h.texturePositionClipSpace.y,x[f+7]=h.sizeClipSpace.x,x[f+8]=h.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,c.allowRescaling)(E,N,h.size.x,this._dimensions.device.cell.width)&&(x[f+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):x.fill(0,f,f+y-1-2)}clear(){const x=this._terminal,C=x.cols*x.rows*y;this._vertices.count!==C?this._vertices.attributes=new Float32Array(C):this._vertices.attributes.fill(0);let S=0;for(;S<this._vertices.attributesBuffers.length;S++)this._vertices.count!==C?this._vertices.attributesBuffers[S]=new Float32Array(C):this._vertices.attributesBuffers[S].fill(0);this._vertices.count=C,S=0;for(let E=0;E<x.rows;E++)for(let L=0;L<x.cols;L++)this._vertices.attributes[S+9]=L/x.cols,this._vertices.attributes[S+10]=E/x.rows,S+=y}handleResize(){const x=this._gl;x.useProgram(this._program),x.viewport(0,0,x.canvas.width,x.canvas.height),x.uniform2f(this._resolutionLocation,x.canvas.width,x.canvas.height),this.clear()}render(x){if(!this._atlas)return;const C=this._gl;C.useProgram(this._program),C.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const S=this._vertices.attributesBuffers[this._activeBuffer];let E=0;for(let L=0;L<x.lineLengths.length;L++){const A=L*this._terminal.cols*y,M=this._vertices.attributes.subarray(A,A+x.lineLengths[L]*y);S.set(M,E),E+=M.length}C.bindBuffer(C.ARRAY_BUFFER,this._attributesBuffer),C.bufferData(C.ARRAY_BUFFER,S.subarray(0,E),C.STREAM_DRAW);for(let L=0;L<this._atlas.pages.length;L++)this._atlas.pages[L].version!==this._atlasTextures[L].version&&this._bindAtlasPageTexture(C,this._atlas,L);C.drawElementsInstanced(C.TRIANGLE_STRIP,4,C.UNSIGNED_BYTE,0,E/y)}setAtlas(x){this._atlas=x;for(const C of this._atlasTextures)C.version=-1}_bindAtlasPageTexture(x,C,S){x.activeTexture(x.TEXTURE0+S),x.bindTexture(x.TEXTURE_2D,this._atlasTextures[S].texture),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,C.pages[S].canvas),x.generateMipmap(x.TEXTURE_2D),this._atlasTextures[S].version=C.pages[S].version}setDimensions(x){this._dimensions=x}}i.GlyphRenderer=w},742:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const c=o(374),g=o(859),u=o(310),p=o(381),_=8*Float32Array.BYTES_PER_ELEMENT;class y{constructor(){this.attributes=new Float32Array(160),this.count=0}}let v=0,h=0,f=0,d=0,m=0,w=0,b=0;class x extends g.Disposable{constructor(S,E,L,A){super(),this._terminal=S,this._gl=E,this._dimensions=L,this._themeService=A,this._vertices=new y,this._verticesCursor=new y;const M=this._gl;this._program=(0,c.throwIfFalsy)((0,p.createProgram)(M,`#version 300 es
106
+ }`}(g.TextureAtlas.maxAtlasPages))),this.register((0,p.toDisposable)(()=>L.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,c.throwIfFalsy)(L.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=L.createVertexArray(),L.bindVertexArray(this._vertexArrayObject);const A=new Float32Array([0,0,1,0,0,1,1,1]),M=L.createBuffer();this.register((0,p.toDisposable)(()=>L.deleteBuffer(M))),L.bindBuffer(L.ARRAY_BUFFER,M),L.bufferData(L.ARRAY_BUFFER,A,L.STATIC_DRAW),L.enableVertexAttribArray(0),L.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const D=new Uint8Array([0,1,2,3]),O=L.createBuffer();this.register((0,p.toDisposable)(()=>L.deleteBuffer(O))),L.bindBuffer(L.ELEMENT_ARRAY_BUFFER,O),L.bufferData(L.ELEMENT_ARRAY_BUFFER,D,L.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(L.createBuffer()),this.register((0,p.toDisposable)(()=>L.deleteBuffer(this._attributesBuffer))),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.enableVertexAttribArray(2),L.vertexAttribPointer(2,2,L.FLOAT,!1,v,0),L.vertexAttribDivisor(2,1),L.enableVertexAttribArray(3),L.vertexAttribPointer(3,2,L.FLOAT,!1,v,2*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(3,1),L.enableVertexAttribArray(4),L.vertexAttribPointer(4,1,L.FLOAT,!1,v,4*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(4,1),L.enableVertexAttribArray(5),L.vertexAttribPointer(5,2,L.FLOAT,!1,v,5*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(5,1),L.enableVertexAttribArray(6),L.vertexAttribPointer(6,2,L.FLOAT,!1,v,7*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(6,1),L.enableVertexAttribArray(1),L.vertexAttribPointer(1,2,L.FLOAT,!1,v,9*Float32Array.BYTES_PER_ELEMENT),L.vertexAttribDivisor(1,1),L.useProgram(this._program);const H=new Int32Array(g.TextureAtlas.maxAtlasPages);for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++)H[F]=F;L.uniform1iv(this._textureLocation,H),L.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),this._atlasTextures=[];for(let F=0;F<g.TextureAtlas.maxAtlasPages;F++){const $=new _.GLTexture((0,c.throwIfFalsy)(L.createTexture()));this.register((0,p.toDisposable)(()=>L.deleteTexture($.texture))),L.activeTexture(L.TEXTURE0+F),L.bindTexture(L.TEXTURE_2D,$.texture),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texImage2D(L.TEXTURE_2D,0,L.RGBA,1,1,0,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[F]=$}L.enable(L.BLEND),L.blendFunc(L.SRC_ALPHA,L.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(x,C,S,E,L,A,M,D,O){this._updateCell(this._vertices.attributes,x,C,S,E,L,A,M,D,O)}_updateCell(x,C,S,E,L,A,M,D,O,H){f=(S*this._terminal.cols+C)*y,E!==u.NULL_CELL_CODE&&E!==void 0?this._atlas&&(h=D&&D.length>1?this._atlas.getRasterizedGlyphCombinedChar(D,L,A,M,!1):this._atlas.getRasterizedGlyph(E,L,A,M,!1),d=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),L!==H&&h.offset.x>d?(m=h.offset.x-d,x[f]=-(h.offset.x-m)+this._dimensions.device.char.left,x[f+1]=-h.offset.y+this._dimensions.device.char.top,x[f+2]=(h.size.x-m)/this._dimensions.device.canvas.width,x[f+3]=h.size.y/this._dimensions.device.canvas.height,x[f+4]=h.texturePage,x[f+5]=h.texturePositionClipSpace.x+m/this._atlas.pages[h.texturePage].canvas.width,x[f+6]=h.texturePositionClipSpace.y,x[f+7]=h.sizeClipSpace.x-m/this._atlas.pages[h.texturePage].canvas.width,x[f+8]=h.sizeClipSpace.y):(x[f]=-h.offset.x+this._dimensions.device.char.left,x[f+1]=-h.offset.y+this._dimensions.device.char.top,x[f+2]=h.size.x/this._dimensions.device.canvas.width,x[f+3]=h.size.y/this._dimensions.device.canvas.height,x[f+4]=h.texturePage,x[f+5]=h.texturePositionClipSpace.x,x[f+6]=h.texturePositionClipSpace.y,x[f+7]=h.sizeClipSpace.x,x[f+8]=h.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,c.allowRescaling)(E,O,h.size.x,this._dimensions.device.cell.width)&&(x[f+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):x.fill(0,f,f+y-1-2)}clear(){const x=this._terminal,C=x.cols*x.rows*y;this._vertices.count!==C?this._vertices.attributes=new Float32Array(C):this._vertices.attributes.fill(0);let S=0;for(;S<this._vertices.attributesBuffers.length;S++)this._vertices.count!==C?this._vertices.attributesBuffers[S]=new Float32Array(C):this._vertices.attributesBuffers[S].fill(0);this._vertices.count=C,S=0;for(let E=0;E<x.rows;E++)for(let L=0;L<x.cols;L++)this._vertices.attributes[S+9]=L/x.cols,this._vertices.attributes[S+10]=E/x.rows,S+=y}handleResize(){const x=this._gl;x.useProgram(this._program),x.viewport(0,0,x.canvas.width,x.canvas.height),x.uniform2f(this._resolutionLocation,x.canvas.width,x.canvas.height),this.clear()}render(x){if(!this._atlas)return;const C=this._gl;C.useProgram(this._program),C.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const S=this._vertices.attributesBuffers[this._activeBuffer];let E=0;for(let L=0;L<x.lineLengths.length;L++){const A=L*this._terminal.cols*y,M=this._vertices.attributes.subarray(A,A+x.lineLengths[L]*y);S.set(M,E),E+=M.length}C.bindBuffer(C.ARRAY_BUFFER,this._attributesBuffer),C.bufferData(C.ARRAY_BUFFER,S.subarray(0,E),C.STREAM_DRAW);for(let L=0;L<this._atlas.pages.length;L++)this._atlas.pages[L].version!==this._atlasTextures[L].version&&this._bindAtlasPageTexture(C,this._atlas,L);C.drawElementsInstanced(C.TRIANGLE_STRIP,4,C.UNSIGNED_BYTE,0,E/y)}setAtlas(x){this._atlas=x;for(const C of this._atlasTextures)C.version=-1}_bindAtlasPageTexture(x,C,S){x.activeTexture(x.TEXTURE0+S),x.bindTexture(x.TEXTURE_2D,this._atlasTextures[S].texture),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,C.pages[S].canvas),x.generateMipmap(x.TEXTURE_2D),this._atlasTextures[S].version=C.pages[S].version}setDimensions(x){this._dimensions=x}}i.GlyphRenderer=w},742:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const c=o(374),g=o(859),u=o(310),p=o(381),_=8*Float32Array.BYTES_PER_ELEMENT;class y{constructor(){this.attributes=new Float32Array(160),this.count=0}}let v=0,h=0,f=0,d=0,m=0,w=0,b=0;class x extends g.Disposable{constructor(S,E,L,A){super(),this._terminal=S,this._gl=E,this._dimensions=L,this._themeService=A,this._vertices=new y,this._verticesCursor=new y;const M=this._gl;this._program=(0,c.throwIfFalsy)((0,p.createProgram)(M,`#version 300 es
107
107
  layout (location = 0) in vec2 a_position;
108
108
  layout (location = 1) in vec2 a_size;
109
109
  layout (location = 2) in vec4 a_color;
@@ -126,7 +126,7 @@ out vec4 outColor;
126
126
 
127
127
  void main() {
128
128
  outColor = v_color;
129
- }`)),this.register((0,g.toDisposable)(()=>M.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(M.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=M.createVertexArray(),M.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),N=M.createBuffer();this.register((0,g.toDisposable)(()=>M.deleteBuffer(N))),M.bindBuffer(M.ARRAY_BUFFER,N),M.bufferData(M.ARRAY_BUFFER,D,M.STATIC_DRAW),M.enableVertexAttribArray(3),M.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const H=new Uint8Array([0,1,2,3]),F=M.createBuffer();this.register((0,g.toDisposable)(()=>M.deleteBuffer(F))),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,F),M.bufferData(M.ELEMENT_ARRAY_BUFFER,H,M.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(M.createBuffer()),this.register((0,g.toDisposable)(()=>M.deleteBuffer(this._attributesBuffer))),M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,M.FLOAT,!1,_,0),M.vertexAttribDivisor(0,1),M.enableVertexAttribArray(1),M.vertexAttribPointer(1,2,M.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(1,1),M.enableVertexAttribArray(2),M.vertexAttribPointer(2,4,M.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(2,1),this._updateCachedColors(A.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),E.uniformMatrix4fv(this._projectionLocation,!1,p.PROJECTION_MATRIX),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,S.attributes,E.DYNAMIC_DRAW),E.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(S){const E=this._terminal,L=this._vertices;let A,M,D,N,H,F,$,O,R,P,B,j=1;for(A=0;A<E.rows;A++){for(D=-1,N=0,H=0,F=!1,M=0;M<E.cols;M++)$=(A*E.cols+M)*u.RENDER_MODEL_INDICIES_PER_CELL,O=S.cells[$+u.RENDER_MODEL_BG_OFFSET],R=S.cells[$+u.RENDER_MODEL_FG_OFFSET],P=!!(67108864&R),(O!==N||R!==H&&(F||P))&&((N!==0||F&&H!==0)&&(B=8*j++,this._updateRectangle(L,B,H,N,D,M,A)),D=M,N=O,H=R,F=P);(N!==0||F&&H!==0)&&(B=8*j++,this._updateRectangle(L,B,H,N,D,E.cols,A))}L.count=j}updateCursor(S){const E=this._verticesCursor,L=S.cursor;if(!L||L.style==="block")return void(E.count=0);let A,M=0;L.style!=="bar"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.style==="bar"?L.dpr*L.cursorWidth:L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.style!=="underline"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,(L.y+1)*this._dimensions.device.cell.height-L.dpr,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat)),L.style==="outline"&&(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat),A=8*M++,this._addRectangleFloat(E.attributes,A,(L.x+L.width)*this._dimensions.device.cell.width-L.dpr,L.y*this._dimensions.device.cell.height,L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),E.count=M}_updateRectangle(S,E,L,A,M,D,N){if(67108864&L)switch(50331648&L){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&L].rgba;break;case 50331648:v=(16777215&L)<<8;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&A){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&A].rgba;break;case 50331648:v=(16777215&A)<<8;break;default:v=this._themeService.colors.background.rgba}S.attributes.length<E+4&&(S.attributes=(0,p.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),h=M*this._dimensions.device.cell.width,f=N*this._dimensions.device.cell.height,d=(v>>24&255)/255,m=(v>>16&255)/255,w=(v>>8&255)/255,b=1,this._addRectangle(S.attributes,E,h,f,(D-M)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d,m,w,b)}_addRectangle(S,E,L,A,M,D,N,H,F,$){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=N,S[E+5]=H,S[E+6]=F,S[E+7]=$}_addRectangleFloat(S,E,L,A,M,D,N){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=N[0],S[E+5]=N[1],S[E+6]=N[2],S[E+7]=N[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}i.RectangleRenderer=x},310:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderModel=i.COMBINED_CHAR_BIT_MASK=i.RENDER_MODEL_EXT_OFFSET=i.RENDER_MODEL_FG_OFFSET=i.RENDER_MODEL_BG_OFFSET=i.RENDER_MODEL_INDICIES_PER_CELL=void 0;const c=o(296);i.RENDER_MODEL_INDICIES_PER_CELL=4,i.RENDER_MODEL_BG_OFFSET=1,i.RENDER_MODEL_FG_OFFSET=2,i.RENDER_MODEL_EXT_OFFSET=3,i.COMBINED_CHAR_BIT_MASK=2147483648,i.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,c.createSelectionRenderModel)()}resize(g,u){const p=g*u*i.RENDER_MODEL_INDICIES_PER_CELL;p!==this.cells.length&&(this.cells=new Uint32Array(p),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.JoinedCellData=i.WebglRenderer=void 0;const c=o(820),g=o(274),u=o(627),p=o(457),_=o(56),y=o(374),v=o(345),h=o(859),f=o(147),d=o(782),m=o(855),w=o(965),b=o(742),x=o(310),C=o(733);class S extends h.Disposable{constructor(M,D,N,H,F,$,O,R,P){super(),this._terminal=M,this._characterJoinerService=D,this._charSizeService=N,this._coreBrowserService=H,this._coreService=F,this._decorationService=$,this._optionsService=O,this._themeService=R,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new x.RenderModel,this._workCell=new d.CellData,this._workCell2=new d.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.MutableDisposable),this._onChangeTextureAtlas=this.register(new v.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new v.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new v.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new v.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new g.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new C.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,O,this._themeService)],this.dimensions=(0,y.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(O.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const B={antialias:!1,depth:!1,preserveDrawingBuffer:P};if(this._gl=this._canvas.getContext("webgl2",B),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextlost",j=>{console.log("webglcontextlost event received"),j.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(j)},3e3)})),this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextrestored",j=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(j,W)=>this._setCanvasDevicePixelDimensions(j,W)),this.register(this._coreBrowserService.onWindowChange(j=>{this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,j,(W,K)=>this._setCanvasDevicePixelDimensions(W,K))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,h.toDisposable)(()=>{var j;for(const W of this._renderLayers)W.dispose();(j=this._canvas.parentElement)==null||j.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var M;return(M=this._charAtlas)==null?void 0:M.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(M,D){var N,H,F,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const O of this._renderLayers)O.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(N=this._rectangleRenderer.value)==null||N.setDimensions(this.dimensions),(H=this._rectangleRenderer.value)==null||H.handleResize(),(F=this._glyphRenderer.value)==null||F.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var M;for(const D of this._renderLayers)D.handleBlur(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.pause(),this._requestRedrawViewport()}handleFocus(){var M;for(const D of this._renderLayers)D.handleFocus(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.resume(),this._requestRedrawViewport()}handleSelectionChanged(M,D,N){for(const H of this._renderLayers)H.handleSelectionChanged(this._terminal,M,D,N);this._model.selection.update(this._core,M,D,N),this._requestRedrawViewport()}handleCursorMove(){var M;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new w.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const M=(0,u.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==M&&(this._onChangeTextureAtlas.fire(M.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,v.forwardEvent)(M.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,v.forwardEvent)(M.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=M,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(M){var D;this._model.clear(),M&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var M;(M=this._charAtlas)==null||M.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var M;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(M){return-1}deregisterCharacterJoiner(M){return!1}renderRows(M,D){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const N of this._renderLayers)N.handleGridChanged(this._terminal,M,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(M,D),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new p.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(M,D){const N=this._core;let H,F,$,O,R,P,B,j,W,K,ee,Z,z,I,V=this._workCell;M=L(M,N.rows-1,0),D=L(D,N.rows-1,0);const U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,J=U-N.buffer.ydisp,X=Math.min(this._terminal.buffer.active.cursorX,N.cols-1);let me=-1;const ce=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let fe=!1;for(F=M;F<=D;F++)for($=F+N.buffer.ydisp,O=N.buffer.lines.get($),this._model.lineLengths[F]=0,R=this._characterJoinerService.getJoinedCharacters($),z=0;z<N.cols;z++)if(H=this._cellColorResolver.result.bg,O.loadCell(z,V),z===0&&(H=this._cellColorResolver.result.bg),P=!1,B=z,R.length>0&&z===R[0][0]&&(P=!0,j=R.shift(),V=new E(V,O.translateToString(!0,j[0],j[1]),j[1]-j[0]),B=j[1]-1),W=V.getChars(),K=V.getCode(),Z=(F*N.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(V,z,$,this.dimensions.device.cell.width),ce&&$===U&&(z===X&&(this._model.cursor={x:X,y:J,width:V.getWidth(),style:this._coreBrowserService.isFocused?N.options.cursorStyle||"block":N.options.cursorInactiveStyle,cursorWidth:N.options.cursorWidth,dpr:this._devicePixelRatio},me=X+V.getWidth()-1),z>=X&&z<=me&&(this._coreBrowserService.isFocused&&(N.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&N.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),K!==m.NULL_CELL_CODE&&(this._model.lineLengths[F]=z+1),(this._model.cells[Z]!==K||this._model.cells[Z+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Z+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Z+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(fe=!0,W.length>1&&(K|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[Z]=K,this._model.cells[Z+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Z+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Z+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ee=V.getWidth(),this._glyphRenderer.value.updateCell(z,F,K,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,W,ee,H),P))for(V=this._workCell,z++;z<B;z++)I=(F*N.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(z,F,m.NULL_CELL_CODE,0,0,0,m.NULL_CELL_CHAR,0,0),this._model.cells[I]=m.NULL_CELL_CODE,this._model.cells[I+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[I+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[I+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;fe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(M,D){this._canvas.width===M&&this._canvas.height===D||(this._canvas.width=M,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const M=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:M,end:M})}}i.WebglRenderer=S;class E extends f.AttributeData{constructor(M,D,N){super(),this.content=0,this.combinedData="",this.fg=M.fg,this.bg=M.bg,this.combinedData=D,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(M){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function L(A,M,D=0){return Math.max(Math.min(A,M),D)}i.JoinedCellData=E},381:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const c=o(374);function g(u,p,_){const y=(0,c.throwIfFalsy)(u.createShader(p));if(u.shaderSource(y,_),u.compileShader(y),u.getShaderParameter(y,u.COMPILE_STATUS))return y;console.error(u.getShaderInfoLog(y)),u.deleteShader(y)}i.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),i.createProgram=function(u,p,_){const y=(0,c.throwIfFalsy)(u.createProgram());if(u.attachShader(y,(0,c.throwIfFalsy)(g(u,u.VERTEX_SHADER,p))),u.attachShader(y,(0,c.throwIfFalsy)(g(u,u.FRAGMENT_SHADER,_))),u.linkProgram(y),u.getProgramParameter(y,u.LINK_STATUS))return y;console.error(u.getProgramInfoLog(y)),u.deleteProgram(y)},i.createShader=g,i.expandFloat32Array=function(u,p){const _=Math.min(2*u.length,p),y=new Float32Array(_);for(let v=0;v<u.length;v++)y[v]=u[v];return y},i.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const c=o(627),g=o(237),u=o(374),p=o(859);class _ extends p.Disposable{constructor(v,h,f,d,m,w,b,x){super(),this._container=h,this._alpha=m,this._coreBrowserService=w,this._optionsService=b,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${f}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(C=>{this._refreshCharAtlas(v,C),this.reset(v)})),this.register((0,p.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(v){}handleFocus(v){}handleCursorMove(v){}handleGridChanged(v,h,f){}handleSelectionChanged(v,h,f,d=!1){}_setTransparency(v,h){if(h===this._alpha)return;const f=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,f),this._refreshCharAtlas(v,this._themeService.colors),this.handleGridChanged(v,0,v.rows-1)}_refreshCharAtlas(v,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,c.acquireTextureAtlas)(v,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(v,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(v,this._themeService.colors)}_fillBottomLineAtCells(v,h,f=1){this._ctx.fillRect(v*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,f*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(v,h,f,d){this._alpha?this._ctx.clearRect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(v,h,f,d){this._ctx.font=this._getFont(v,!1,!1),this._ctx.textBaseline=g.TEXT_BASELINE,this._clipCell(f,d,h.getWidth()),this._ctx.fillText(h.getChars(),f*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(v,h,f){this._ctx.beginPath(),this._ctx.rect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(v,h,f){return`${f?"italic":""} ${h?v.options.fontWeightBold:v.options.fontWeight} ${v.options.fontSize*this._coreBrowserService.dpr}px ${v.options.fontFamily}`}}i.BaseRenderLayer=_},733:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const c=o(197),g=o(237),u=o(592);class p extends u.BaseRenderLayer{constructor(y,v,h,f,d,m,w){super(h,y,"link",v,!0,d,m,w),this.register(f.onShowLinkUnderline(b=>this._handleShowLinkUnderline(b))),this.register(f.onHideLinkUnderline(b=>this._handleHideLinkUnderline(b)))}resize(y,v){super.resize(y,v),this._state=void 0}reset(y){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(y){if(y.fg===g.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:y.fg!==void 0&&(0,c.is256Color)(y.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[y.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(let v=y.y1+1;v<y.y2;v++)this._fillBottomLineAtCells(0,v,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y}_handleHideLinkUnderline(y){this._clearCurrentLink()}}i.LinkRenderLayer=p},820:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(o,c,g,u){o.addEventListener(c,g,u);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(c,g,u))}}}},274:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const c=o(855),g=o(160),u=o(374);let p,_=0,y=0,v=!1,h=!1,f=!1,d=0;i.CellColorResolver=class{constructor(m,w,b,x,C,S){this._terminal=m,this._optionService=w,this._selectionRenderModel=b,this._decorationService=x,this._coreBrowserService=C,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(m,w,b,x){if(this.result.bg=m.bg,this.result.fg=m.fg,this.result.ext=268435456&m.bg?m.extended.ext:0,y=0,_=0,h=!1,v=!1,f=!1,p=this._themeService.colors,d=0,m.getCode()!==c.NULL_CELL_CODE&&m.extended.underlineStyle===4){const C=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));d=w*x%(2*Math.round(C))}if(this._decorationService.forEachDecorationAtCell(w,b,"bottom",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),f=this._selectionRenderModel.isCellSelected(this._terminal,w,b),f){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:y=(16777215&this.result.fg)<<8|255;break;default:y=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:y=(16777215&this.result.bg)<<8|255}y=g.rgba.blend(y,4294967040&(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else y=(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(h=!0,p.selectionForeground&&(_=p.selectionForeground.rgba>>8&16777215,v=!0),(0,u.treatGlyphAsBackgroundColor)(m.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))_=(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:_=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:_=(16777215&this.result.fg)<<8|255;break;default:_=this._themeService.colors.foreground.rgba}_=g.rgba.blend(_,4294967040&(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}v=!0}}this._decorationService.forEachDecorationAtCell(w,b,"top",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),h&&(y=f?-16777216&m.bg&-134217729|y|50331648:-16777216&m.bg|y|50331648),v&&(_=-16777216&m.fg&-67108865|_|50331648),67108864&this.result.fg&&(h&&!v&&(_=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&p.background.rgba>>8|50331648,v=!0),!h&&v&&(y=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&p.foreground.rgba>>8|50331648,h=!0)),p=void 0,this.result.bg=h?y:this.result.bg,this.result.fg=v?_:this.result.fg,this.result.ext&=536870911,this.result.ext|=d<<29&3758096384}}},627:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const c=o(509),g=o(197),u=[];i.acquireTextureAtlas=function(p,_,y,v,h,f,d,m){const w=(0,g.generateConfig)(v,h,f,d,_,y,m);for(let C=0;C<u.length;C++){const S=u[C],E=S.ownedBy.indexOf(p);if(E>=0){if((0,g.configEquals)(S.config,w))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),u.splice(C,1)):S.ownedBy.splice(E,1);break}}for(let C=0;C<u.length;C++){const S=u[C];if((0,g.configEquals)(S.config,w))return S.ownedBy.push(p),S.atlas}const b=p._core,x={atlas:new c.TextureAtlas(document,w,b.unicodeService),config:w,ownedBy:[p]};return u.push(x),x.atlas},i.removeTerminalFromCache=function(p){for(let _=0;_<u.length;_++){const y=u[_].ownedBy.indexOf(p);if(y!==-1){u[_].ownedBy.length===1?(u[_].atlas.dispose(),u.splice(_,1)):u[_].ownedBy.splice(y,1);break}}}},197:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const c=o(160);i.generateConfig=function(g,u,p,_,y,v,h){const f={foreground:v.foreground,background:v.background,cursor:c.NULL_COLOR,cursorAccent:c.NULL_COLOR,selectionForeground:c.NULL_COLOR,selectionBackgroundTransparent:c.NULL_COLOR,selectionBackgroundOpaque:c.NULL_COLOR,selectionInactiveBackgroundTransparent:c.NULL_COLOR,selectionInactiveBackgroundOpaque:c.NULL_COLOR,ansi:v.ansi.slice(),contrastCache:v.contrastCache,halfContrastCache:v.halfContrastCache};return{customGlyphs:y.customGlyphs,devicePixelRatio:h,letterSpacing:y.letterSpacing,lineHeight:y.lineHeight,deviceCellWidth:g,deviceCellHeight:u,deviceCharWidth:p,deviceCharHeight:_,fontFamily:y.fontFamily,fontSize:y.fontSize,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,allowTransparency:y.allowTransparency,drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,minimumContrastRatio:y.minimumContrastRatio,colors:f}},i.configEquals=function(g,u){for(let p=0;p<g.colors.ansi.length;p++)if(g.colors.ansi[p].rgba!==u.colors.ansi[p].rgba)return!1;return g.devicePixelRatio===u.devicePixelRatio&&g.customGlyphs===u.customGlyphs&&g.lineHeight===u.lineHeight&&g.letterSpacing===u.letterSpacing&&g.fontFamily===u.fontFamily&&g.fontSize===u.fontSize&&g.fontWeight===u.fontWeight&&g.fontWeightBold===u.fontWeightBold&&g.allowTransparency===u.allowTransparency&&g.deviceCharWidth===u.deviceCharWidth&&g.deviceCharHeight===u.deviceCharHeight&&g.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&g.minimumContrastRatio===u.minimumContrastRatio&&g.colors.foreground.rgba===u.colors.foreground.rgba&&g.colors.background.rgba===u.colors.background.rgba},i.is256Color=function(g){return(50331648&g)==16777216||(50331648&g)==33554432}},237:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const c=o(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},457:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,c>0)return void this._restartInterval(c)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(c)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tryDrawCustomChar=i.powerlineDefinitions=i.boxDrawingDefinitions=i.blockElementDefinitions=void 0;const c=o(374);i.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const g={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};i.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╒":{1:(v,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(v,h)=>`M${.5-v},1 L${.5-v},.5 L1,.5 M${.5+v},.5 L${.5+v},1`},"╔":{1:(v,h)=>`M1,${.5-h} L${.5-v},${.5-h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╕":{1:(v,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(v,h)=>`M${.5+v},1 L${.5+v},.5 L0,.5 M${.5-v},.5 L${.5-v},1`},"╗":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5+v},${.5-h} L${.5+v},1`},"╘":{1:(v,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(v,h)=>`M1,.5 L${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╚":{1:(v,h)=>`M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0 M1,${.5+h} L${.5-v},${.5+h} L${.5-v},0`},"╛":{1:(v,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(v,h)=>`M0,.5 L${.5+v},.5 L${.5+v},0 M${.5-v},.5 L${.5-v},0`},"╝":{1:(v,h)=>`M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M0,${.5+h} L${.5+v},${.5+h} L${.5+v},0`},"╞":{1:(v,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1 M${.5+v},.5 L1,.5`},"╠":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╡":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(v,h)=>`M0,.5 L${.5-v},.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╣":{1:(v,h)=>`M${.5+v},0 L${.5+v},1 M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0`},"╤":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},1 M${.5+v},.5 L${.5+v},1`},"╦":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╧":{1:(v,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╩":{1:(v,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╪":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╬":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,1,.5`}},i.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.tryDrawCustomChar=function(v,h,f,d,m,w,b,x){const C=i.blockElementDefinitions[h];if(C)return function(A,M,D,N,H,F){for(let $=0;$<M.length;$++){const O=M[$],R=H/8,P=F/8;A.fillRect(D+O.x*R,N+O.y*P,O.w*R,O.h*P)}}(v,C,f,d,m,w),!0;const S=g[h];if(S)return function(A,M,D,N,H,F){let $=u.get(M);$||($=new Map,u.set(M,$));const O=A.fillStyle;if(typeof O!="string")throw new Error(`Unexpected fillStyle type "${O}"`);let R=$.get(O);if(!R){const P=M[0].length,B=M.length,j=A.canvas.ownerDocument.createElement("canvas");j.width=P,j.height=B;const W=(0,c.throwIfFalsy)(j.getContext("2d")),K=new ImageData(P,B);let ee,Z,z,I;if(O.startsWith("#"))ee=parseInt(O.slice(1,3),16),Z=parseInt(O.slice(3,5),16),z=parseInt(O.slice(5,7),16),I=O.length>7&&parseInt(O.slice(7,9),16)||1;else{if(!O.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${O}" when drawing pattern glyph`);[ee,Z,z,I]=O.substring(5,O.length-1).split(",").map(V=>parseFloat(V))}for(let V=0;V<B;V++)for(let U=0;U<P;U++)K.data[4*(V*P+U)]=ee,K.data[4*(V*P+U)+1]=Z,K.data[4*(V*P+U)+2]=z,K.data[4*(V*P+U)+3]=M[V][U]*(255*I);W.putImageData(K,0,0),R=(0,c.throwIfFalsy)(A.createPattern(j,null)),$.set(O,R)}A.fillStyle=R,A.fillRect(D,N,H,F)}(v,S,f,d,m,w),!0;const E=i.boxDrawingDefinitions[h];if(E)return function(A,M,D,N,H,F,$){A.strokeStyle=A.fillStyle;for(const[O,R]of Object.entries(M)){let P;A.beginPath(),A.lineWidth=$*Number.parseInt(O),P=typeof R=="function"?R(.15,.15/F*H):R;for(const B of P.split(" ")){const j=B[0],W=_[j];if(!W){console.error(`Could not find drawing instructions for "${j}"`);continue}const K=B.substring(1).split(",");K[0]&&K[1]&&W(A,y(K,H,F,D,N,!0,$))}A.stroke(),A.closePath()}}(v,E,f,d,m,w,x),!0;const L=i.powerlineDefinitions[h];return!!L&&(function(A,M,D,N,H,F,$,O){const R=new Path2D;R.rect(D,N,H,F),A.clip(R),A.beginPath();const P=$/12;A.lineWidth=O*P;for(const B of M.d.split(" ")){const j=B[0],W=_[j];if(!W){console.error(`Could not find drawing instructions for "${j}"`);continue}const K=B.substring(1).split(",");K[0]&&K[1]&&W(A,y(K,H,F,D,N,!1,O,(M.leftPadding??0)*(P/2),(M.rightPadding??0)*(P/2)))}M.type===1?(A.strokeStyle=A.fillStyle,A.stroke()):A.fill(),A.closePath()}(v,L,f,d,m,w,b,x),!0)};const u=new Map;function p(v,h,f=0){return Math.max(Math.min(v,h),f)}const _={C:(v,h)=>v.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(v,h)=>v.lineTo(h[0],h[1]),M:(v,h)=>v.moveTo(h[0],h[1])};function y(v,h,f,d,m,w,b,x=0,C=0){const S=v.map(E=>parseFloat(E)||parseInt(E));if(S.length<2)throw new Error("Too few arguments for instruction");for(let E=0;E<S.length;E+=2)S[E]*=h-x*b-C*b,w&&S[E]!==0&&(S[E]=p(Math.round(S[E]+.5)-.5,h,0)),S[E]+=d+x*b;for(let E=1;E<S.length;E+=2)S[E]*=f,w&&S[E]!==0&&(S[E]=p(Math.round(S[E]+.5)-.5,f,0)),S[E]+=m;return S}},56:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const c=o(859);i.observeDevicePixelDimensions=function(g,u,p){let _=new u.ResizeObserver(y=>{const v=y.find(d=>d.target===g);if(!v)return;if(!("devicePixelContentBoxSize"in v))return _==null||_.disconnect(),void(_=void 0);const h=v.devicePixelContentBoxSize[0].inlineSize,f=v.devicePixelContentBoxSize[0].blockSize;h>0&&f>0&&p(h,f)});try{_.observe(g,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return(0,c.toDisposable)(()=>_==null?void 0:_.disconnect())}},374:(l,i)=>{function o(g){return 57508<=g&&g<=57558}function c(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=o,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=c,i.allowRescaling=function(g,u,p,_){return u===1&&p>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!c(g)&&!o(g)&&!function(y){return 57344<=y&&y<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return o(g)||function(u){return 9472<=u&&u<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,u,p=0){return(g-(2*Math.round(u)-p))%(2*Math.round(u))}},296:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class o{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(g,u,p,_=!1){if(this.selectionStart=u,this.selectionEnd=p,!u||!p||u[0]===p[0]&&u[1]===p[1])return void this.clear();const y=g.buffers.active.ydisp,v=u[1]-y,h=p[1]-y,f=Math.max(v,0),d=Math.min(h,g.rows-1);f>=g.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=p[0])}isCellSelected(g,u,p){return!!this.hasSelection&&(p-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&p>=this.viewportCappedStartRow&&u<this.endCol&&p<=this.viewportCappedEndRow:u<this.startCol&&p>=this.viewportCappedStartRow&&u>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol)}}i.createSelectionRenderModel=function(){return new o}},509:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const c=o(237),g=o(860),u=o(374),p=o(160),_=o(345),y=o(485),v=o(385),h=o(147),f=o(855),d={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let m;class w{get pages(){return this._pages}constructor(E,L,A){this._document=E,this._config=L,this._unicodeService=A,this._didWarmUp=!1,this._cacheMap=new y.FourKeyMap,this._cacheMapCombined=new y.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new _.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=C(E,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const E of this.pages)E.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const E=new v.IdleTaskQueue;for(let L=33;L<126;L++)E.enqueue(()=>{if(!this._cacheMap.get(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT)){const A=this._drawToCache(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT);this._cacheMap.set(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT,A)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const E of this._pages)E.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(w.maxAtlasPages&&this._pages.length>=Math.max(4,w.maxAtlasPages)){const L=this._pages.filter($=>2*$.canvas.width<=(w.maxTextureSize||4096)).sort(($,O)=>O.canvas.width!==$.canvas.width?O.canvas.width-$.canvas.width:O.percentageUsed-$.percentageUsed);let A=-1,M=0;for(let $=0;$<L.length;$++)if(L[$].canvas.width!==M)A=$,M=L[$].canvas.width;else if($-A==3)break;const D=L.slice(A,A+4),N=D.map($=>$.glyphs[0].texturePage).sort(($,O)=>$>O?1:-1),H=this.pages.length-D.length,F=this._mergePages(D,H);F.version++;for(let $=N.length-1;$>=0;$--)this._deletePage(N[$]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const E=new b(this._document,this._textureSize);return this._pages.push(E),this._activePages.push(E),this._onAddTextureAtlasCanvas.fire(E.canvas),E}_mergePages(E,L){const A=2*E[0].canvas.width,M=new b(this._document,A,E);for(const[D,N]of E.entries()){const H=D*N.canvas.width%A,F=Math.floor(D/2)*N.canvas.height;M.ctx.drawImage(N.canvas,H,F);for(const O of N.glyphs)O.texturePage=L,O.sizeClipSpace.x=O.size.x/A,O.sizeClipSpace.y=O.size.y/A,O.texturePosition.x+=H,O.texturePosition.y+=F,O.texturePositionClipSpace.x=O.texturePosition.x/A,O.texturePositionClipSpace.y=O.texturePosition.y/A;this._onRemoveTextureAtlasCanvas.fire(N.canvas);const $=this._activePages.indexOf(N);$!==-1&&this._activePages.splice($,1)}return M}_deletePage(E){this._pages.splice(E,1);for(let L=E;L<this._pages.length;L++){const A=this._pages[L];for(const M of A.glyphs)M.texturePage--;A.version++}}getRasterizedGlyphCombinedChar(E,L,A,M,D){return this._getFromCacheMap(this._cacheMapCombined,E,L,A,M,D)}getRasterizedGlyph(E,L,A,M,D){return this._getFromCacheMap(this._cacheMap,E,L,A,M,D)}_getFromCacheMap(E,L,A,M,D,N=!1){return m=E.get(L,A,M,D),m||(m=this._drawToCache(L,A,M,D,N),E.set(L,A,M,D,m)),m}_getColorFromAnsiIndex(E){if(E>=this._config.colors.ansi.length)throw new Error("No color found for idx "+E);return this._config.colors.ansi[E]}_getBackgroundColor(E,L,A,M){if(this._config.allowTransparency)return p.NULL_COLOR;let D;switch(E){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(L);break;case 50331648:const N=h.AttributeData.toColorRGB(L);D=p.channels.toColor(N[0],N[1],N[2]);break;default:D=A?p.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(E,L,A,M,D,N,H,F,$,O){const R=this._getMinimumContrastColor(E,L,A,M,D,N,H,$,F,O);if(R)return R;let P;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&N<8&&(N+=8),P=this._getColorFromAnsiIndex(N);break;case 50331648:const B=h.AttributeData.toColorRGB(N);P=p.channels.toColor(B[0],B[1],B[2]);break;default:P=H?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(P=p.color.opaque(P)),F&&(P=p.color.multiplyOpacity(P,c.DIM_OPACITY)),P}_resolveBackgroundRgba(E,L,A){switch(E){case 16777216:case 33554432:return this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(E,L,A,M){switch(E){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&M&&L<8&&(L+=8),this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(E,L,A,M,D,N,H,F,$,O){if(this._config.minimumContrastRatio===1||O)return;const R=this._getContrastCache($),P=R.getColor(E,M);if(P!==void 0)return P||void 0;const B=this._resolveBackgroundRgba(L,A,H),j=this._resolveForegroundRgba(D,N,H,F),W=p.rgba.ensureContrastRatio(B,j,this._config.minimumContrastRatio/($?2:1));if(!W)return void R.setColor(E,M,null);const K=p.channels.toColor(W>>24&255,W>>16&255,W>>8&255);return R.setColor(E,M,K),K}_getContrastCache(E){return E?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(E,L,A,M,D=!1){const N=typeof E=="number"?String.fromCharCode(E):E,H=Math.min(this._config.deviceCellWidth*Math.max(N.length,2)+4,this._textureSize);this._tmpCanvas.width<H&&(this._tmpCanvas.width=H);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=A,this._workAttributeData.bg=L,this._workAttributeData.extended.ext=M,this._workAttributeData.isInvisible())return d;const $=!!this._workAttributeData.isBold(),O=!!this._workAttributeData.isInverse(),R=!!this._workAttributeData.isDim(),P=!!this._workAttributeData.isItalic(),B=!!this._workAttributeData.isUnderline(),j=!!this._workAttributeData.isStrikethrough(),W=!!this._workAttributeData.isOverline();let K=this._workAttributeData.getFgColor(),ee=this._workAttributeData.getFgColorMode(),Z=this._workAttributeData.getBgColor(),z=this._workAttributeData.getBgColorMode();if(O){const se=K;K=Z,Z=se;const be=ee;ee=z,z=be}const I=this._getBackgroundColor(z,Z,O,R);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const V=$?this._config.fontWeightBold:this._config.fontWeight,U=P?"italic":"";this._tmpCtx.font=`${U} ${V} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c.TEXT_BASELINE;const J=N.length===1&&(0,u.isPowerlineGlyph)(N.charCodeAt(0)),X=N.length===1&&(0,u.isRestrictedPowerlineGlyph)(N.charCodeAt(0)),me=this._getForegroundColor(L,z,Z,A,ee,K,O,R,$,(0,u.treatGlyphAsBackgroundColor)(N.charCodeAt(0)));this._tmpCtx.fillStyle=me.css;const ce=X?0:4;let fe=!1;this._config.customGlyphs!==!1&&(fe=(0,g.tryDrawCustomChar)(this._tmpCtx,N,ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ee,ae=!J;if(Ee=typeof E=="number"?this._unicodeService.wcwidth(E):this._unicodeService.getStringCellWidth(E),B){this._tmpCtx.save();const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=se%2==1?.5:0;if(this._tmpCtx.lineWidth=se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ae=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();const oe=ce,he=Math.ceil(ce+this._config.deviceCharHeight)-be-(D?2*se:0),Le=he+se,Re=he+2*se;let Ce=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<Ee;q++){this._tmpCtx.save();const Q=oe+q*this._config.deviceCellWidth,ge=oe+(q+1)*this._config.deviceCellWidth,He=Q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he),this._tmpCtx.moveTo(Q,Re),this._tmpCtx.lineTo(ge,Re);break;case 3:const ie=se<=1?Re:Math.ceil(ce+this._config.deviceCharHeight-se/2)-be,G=se<=1?he:Math.ceil(ce+this._config.deviceCharHeight+se/2)-be,re=new Path2D;re.rect(Q,he,this._config.deviceCellWidth,Re-he),this._tmpCtx.clip(re),this._tmpCtx.moveTo(Q-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(Q-this._config.deviceCellWidth/2,G,Q,G,Q,Le),this._tmpCtx.bezierCurveTo(Q,ie,He,ie,He,Le),this._tmpCtx.bezierCurveTo(He,G,ge,G,ge,Le),this._tmpCtx.bezierCurveTo(ge,ie,ge+this._config.deviceCellWidth/2,ie,ge+this._config.deviceCellWidth/2,Le);break;case 4:const le=Ce===0?0:Ce>=se?2*se-Ce:se-Ce;Ce>=se||le===0?(this._tmpCtx.setLineDash([Math.round(se),Math.round(se)]),this._tmpCtx.moveTo(Q+le,he),this._tmpCtx.lineTo(ge,he)):(this._tmpCtx.setLineDash([Math.round(se),Math.round(se)]),this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(Q+le,he),this._tmpCtx.moveTo(Q+le+se,he),this._tmpCtx.lineTo(ge,he)),Ce=(0,u.computeNextVariantOffset)(ge-Q,se,Ce);break;case 5:const te=.6,ue=.3,Oe=ge-Q,Fe=Math.floor(te*Oe),De=Math.floor(ue*Oe),Be=Oe-Fe-De;this._tmpCtx.setLineDash([Fe,De,Be]),this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he);break;default:this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!fe&&this._config.fontSize>=12&&!this._config.allowTransparency&&N!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const q=this._tmpCtx.measureText(N);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();const Q=new Path2D;Q.rect(oe,he-Math.ceil(se/2),this._config.deviceCellWidth*Ee,Re-he+Math.ceil(se/2)),this._tmpCtx.clip(Q),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=I.css,this._tmpCtx.strokeText(N,ce,ce+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(W){const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=se%2==1?.5:0;this._tmpCtx.lineWidth=se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+be),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*Ee,ce+be),this._tmpCtx.stroke()}if(fe||this._tmpCtx.fillText(N,ce,ce+this._config.deviceCharHeight),N==="_"&&!this._config.allowTransparency){let se=x(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),I,me,ae);if(se)for(let be=1;be<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(N,ce,ce+this._config.deviceCharHeight-be),se=x(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),I,me,ae),se);be++);}if(j){const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),be=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*Ee,ce+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.stroke()}this._tmpCtx.restore();const Te=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let je;if(je=this._config.allowTransparency?function(se){for(let be=0;be<se.data.length;be+=4)if(se.data[be+3]>0)return!1;return!0}(Te):x(Te,I,me,ae),je)return d;const pe=this._findGlyphBoundingBox(Te,this._workBoundingBox,H,X,fe,ce);let _e,ke;for(;;){if(this._activePages.length===0){const se=this._createNewPage();_e=se,ke=se.currentRow,ke.height=pe.size.y;break}_e=this._activePages[this._activePages.length-1],ke=_e.currentRow;for(const se of this._activePages)pe.size.y<=se.currentRow.height&&(_e=se,ke=se.currentRow);for(let se=this._activePages.length-1;se>=0;se--)for(const be of this._activePages[se].fixedRows)be.height<=ke.height&&pe.size.y<=be.height&&(_e=this._activePages[se],ke=be);if(ke.y+pe.size.y>=_e.canvas.height||ke.height>pe.size.y+2){let se=!1;if(_e.currentRow.y+_e.currentRow.height+pe.size.y>=_e.canvas.height){let be;for(const oe of this._activePages)if(oe.currentRow.y+oe.currentRow.height+pe.size.y<oe.canvas.height){be=oe;break}if(be)_e=be;else if(w.maxAtlasPages&&this._pages.length>=w.maxAtlasPages&&ke.y+pe.size.y<=_e.canvas.height&&ke.height>=pe.size.y&&ke.x+pe.size.x<=_e.canvas.width)se=!0;else{const oe=this._createNewPage();_e=oe,ke=oe.currentRow,ke.height=pe.size.y,se=!0}}se||(_e.currentRow.height>0&&_e.fixedRows.push(_e.currentRow),ke={x:0,y:_e.currentRow.y+_e.currentRow.height,height:pe.size.y},_e.fixedRows.push(ke),_e.currentRow={x:0,y:ke.y+ke.height,height:0})}if(ke.x+pe.size.x<=_e.canvas.width)break;ke===_e.currentRow?(ke.x=0,ke.y+=ke.height,ke.height=0):_e.fixedRows.splice(_e.fixedRows.indexOf(ke),1)}return pe.texturePage=this._pages.indexOf(_e),pe.texturePosition.x=ke.x,pe.texturePosition.y=ke.y,pe.texturePositionClipSpace.x=ke.x/_e.canvas.width,pe.texturePositionClipSpace.y=ke.y/_e.canvas.height,pe.sizeClipSpace.x/=_e.canvas.width,pe.sizeClipSpace.y/=_e.canvas.height,ke.height=Math.max(ke.height,pe.size.y),ke.x+=pe.size.x,_e.ctx.putImageData(Te,pe.texturePosition.x-this._workBoundingBox.left,pe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,pe.size.x,pe.size.y),_e.addGlyph(pe),_e.version++,pe}_findGlyphBoundingBox(E,L,A,M,D,N){L.top=0;const H=M?this._config.deviceCellHeight:this._tmpCanvas.height,F=M?this._config.deviceCellWidth:A;let $=!1;for(let O=0;O<H;O++){for(let R=0;R<F;R++){const P=O*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.top=O,$=!0;break}}if($)break}L.left=0,$=!1;for(let O=0;O<N+F;O++){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*O+3;if(E.data[P]!==0){L.left=O,$=!0;break}}if($)break}L.right=F,$=!1;for(let O=N+F-1;O>=N;O--){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*O+3;if(E.data[P]!==0){L.right=O,$=!0;break}}if($)break}L.bottom=H,$=!1;for(let O=H-1;O>=0;O--){for(let R=0;R<F;R++){const P=O*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.bottom=O,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:L.right-L.left+1,y:L.bottom-L.top+1},sizeClipSpace:{x:L.right-L.left+1,y:L.bottom-L.top+1},offset:{x:-L.left+N+(M||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-L.top+N+(M||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=w;class b{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(E){this._glyphs.push(E),this._usedPixels+=E.size.x*E.size.y}constructor(E,L,A){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],A)for(const M of A)this._glyphs.push(...M.glyphs),this._usedPixels+=M._usedPixels;this.canvas=C(E,L,L),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(S,E,L,A){const M=E.rgba>>>24,D=E.rgba>>>16&255,N=E.rgba>>>8&255,H=L.rgba>>>24,F=L.rgba>>>16&255,$=L.rgba>>>8&255,O=Math.floor((Math.abs(M-H)+Math.abs(D-F)+Math.abs(N-$))/12);let R=!0;for(let P=0;P<S.data.length;P+=4)S.data[P]===M&&S.data[P+1]===D&&S.data[P+2]===N||A&&Math.abs(S.data[P]-M)+Math.abs(S.data[P+1]-D)+Math.abs(S.data[P+2]-N)<O?S.data[P+3]=0:R=!1;return R}function C(S,E,L){const A=S.createElement("canvas");return A.width=E,A.height=L,A}},160:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let o=0,c=0,g=0,u=0;var p,_,y,v,h;function f(m){const w=m.toString(16);return w.length<2?"0"+w:w}function d(m,w){return m<w?(w+.05)/(m+.05):(m+.05)/(w+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(m){m.toCss=function(w,b,x,C){return C!==void 0?`#${f(w)}${f(b)}${f(x)}${f(C)}`:`#${f(w)}${f(b)}${f(x)}`},m.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},m.toColor=function(w,b,x,C){return{css:m.toCss(w,b,x,C),rgba:m.toRgba(w,b,x,C)}}}(p||(i.channels=p={})),function(m){function w(b,x){return u=Math.round(255*x),[o,c,g]=h.toChannels(b.rgba),{css:p.toCss(o,c,g,u),rgba:p.toRgba(o,c,g,u)}}m.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),g=M+Math.round((E-M)*u),{css:p.toCss(o,c,g),rgba:p.toRgba(o,c,g)}},m.isOpaque=function(b){return(255&b.rgba)==255},m.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return p.toColor(S>>24&255,S>>16&255,S>>8&255)},m.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,g]=h.toChannels(x),{css:p.toCss(o,c,g),rgba:x}},m.opacity=w,m.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},m.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(i.color=_={})),function(m){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}m.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),p.toColor(o,c,g);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),p.toColor(o,c,g,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),g=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),p.toColor(o,c,g,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,g,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,c,g,u),css:x}}}(y||(i.css=y={})),function(m){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}m.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},m.relativeLuminance2=w}(v||(i.rgb=v={})),function(m){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,N=C>>8&255,H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||N>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),N-=Math.max(0,Math.ceil(.1*N)),H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|N<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,N=C>>8&255,H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||N<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),N=Math.min(255,N+Math.ceil(.1*(255-N))),H=d(v.relativeLuminance2(M,D,N),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|N<<8|255)>>>0}m.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),g=D+Math.round((L-D)*u),p.toRgba(o,c,g)},m.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),N=d(E,v.relativeLuminance(D>>8));if(N<S){const H=b(x,C,S);return N>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},m.reduceLuminance=w,m.increaseLuminance=b,m.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(i.rgba=h={})),i.toPaddedHex=f,i.contrastRatio=d},345:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},859:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},485:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,u,p){this._data[g]||(this._data[g]={}),this._data[g][u]=p}get(g,u){return this._data[g]?this._data[g][u]:void 0}clear(){this._data={}}}i.TwoKeyMap=o,i.FourKeyMap=class{constructor(){this._data=new o}set(c,g,u,p,_){this._data.get(c,g)||this._data.set(c,g,new o),this._data.get(c,g).set(u,p,_)}get(c,g,u,p){var _;return(_=this._data.get(c,g))==null?void 0:_.get(u,p)}clear(){this._data.clear()}}},399:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const o=i.isNode?"node":navigator.userAgent,c=i.isNode?"node":navigator.platform;i.isFirefox=o.includes("Firefox"),i.isLegacyEdge=o.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(o),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),i.isIpad=c==="iPad",i.isIphone=c==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),i.isLinux=c.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(o)},385:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const c=o(399);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),f=_.timeRemaining(),1.5*v>f)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=f}this.clear()}}class u extends g{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}i.PriorityTaskQueue=u,i.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:u,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},147:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,p=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=c},782:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const c=o(133),g=o(855),u=o(147);class p extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new p;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[g.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[g.CHAR_DATA_CHAR_INDEX].length===2){const h=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const f=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(h-55296)+f-56320+65536|y[g.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[g.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=p},855:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},133:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},i.utf32ToString=function(o,c=0,g=o.length){let u="";for(let p=c;p<g;++p){let _=o[p];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const g=o.length;if(!g)return 0;let u=0,p=0;if(this._interim){const _=o.charCodeAt(p++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=p;_<g;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=g)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const g=o.length;if(!g)return 0;let u,p,_,y,v=0,h=0,f=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;f<E;){if(f>=g)return 0;if(x=o[f++],(192&x)!=128){f--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?f--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=g-4;let m=f;for(;m<g;){for(;!(!(m<d)||128&(u=o[m])||128&(p=o[m+1])||128&(_=o[m+2])||128&(y=o[m+3]));)c[v++]=u,c[v++]=p,c[v++]=_,c[v++]=y,m+=4;if(u=o[m++],u<128)c[v++]=u;else if((224&u)==192){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(h=(31&u)<<6|63&p,h<128){m--;continue}c[v++]=h}else if((240&u)==224){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(h=(15&u)<<12|(63&p)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,this.interim[2]=_,v;if(y=o[m++],(192&y)!=128){m--;continue}if(h=(7&u)<<18|(63&p)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},776:function(l,i,o){var c=this&&this.__decorate||function(h,f,d,m){var w,b=arguments.length,x=b<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,f,d,m);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(f,d,x):w(f,d))||x);return b>3&&x&&Object.defineProperty(f,d,x),x},g=this&&this.__param||function(h,f){return function(d,m){f(d,m,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const u=o(859),p=o(97),_={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,v=i.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let f=0;f<h.length;f++)typeof h[f]=="function"&&(h[f]=h[f]())}_log(h,f,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...d)}trace(h,...f){var d;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,f)}debug(h,...f){var d;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,f)}info(h,...f){var d;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,f)}warn(h,...f){var d;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,f)}error(h,...f){var d;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,f)}};i.LogService=v=c([g(0,p.IOptionsService)],v),i.setTraceLogger=function(h){y=h},i.traceCall=function(h,f,d){if(typeof d.value!="function")throw new Error("not supported");const m=d.value;d.value=function(...w){if(y.logLevel!==p.LogLevelEnum.TRACE)return m.apply(this,w);y.trace(`GlyphRenderer#${m.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=m.apply(this,w);return y.trace(`GlyphRenderer#${m.name} return`,b),b}}},726:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const o="di$target",c="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(g){return g[c]||[]},i.createDecorator=function(g){if(i.serviceRegistry.has(g))return i.serviceRegistry.get(g);const u=function(p,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,f){h[o]===h?h[c].push({id:v,index:f}):(h[c]=[{id:v,index:f}],h[o]=h)})(u,p,y)};return u.toString=()=>g,i.serviceRegistry.set(g,u),u}},97:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const c=o(726);var g;i.IBufferService=(0,c.createDecorator)("BufferService"),i.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),i.ICoreService=(0,c.createDecorator)("CoreService"),i.ICharsetService=(0,c.createDecorator)("CharsetService"),i.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(g||(i.LogLevelEnum=g={})),i.ILogService=(0,c.createDecorator)("LogService"),i.IOptionsService=(0,c.createDecorator)("OptionsService"),i.IOscLinkService=(0,c.createDecorator)("OscLinkService"),i.IUnicodeService=(0,c.createDecorator)("UnicodeService"),i.IDecorationService=(0,c.createDecorator)("DecorationService")}},n={};function s(l){var i=n[l];if(i!==void 0)return i.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,s),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.WebglAddon=void 0;const i=s(345),o=s(859),c=s(399),g=s(666),u=s(776);class p extends o.Disposable{constructor(y){if(c.isSafari&&(0,c.getSafariVersion)()<16){const v={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",v))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=y,this._onChangeTextureAtlas=this.register(new i.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new i.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new i.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new i.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(y){const v=y._core;if(!y.element)return void this.register(v.onWillOpen(()=>this.activate(y)));this._terminal=y;const h=v.coreService,f=v.optionsService,d=v,m=d._renderService,w=d._characterJoinerService,b=d._charSizeService,x=d._coreBrowserService,C=d._decorationService,S=d._logService,E=d._themeService;(0,u.setTraceLogger)(S),this._renderer=this.register(new g.WebglRenderer(y,w,b,x,h,C,f,E,this._preserveDrawingBuffer)),this.register((0,i.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,i.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,i.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,i.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),m.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const L=this._terminal._core._renderService;L.setRenderer(this._terminal._core._createRenderer()),L.handleResize(y.cols,y.rows)}))}get textureAtlas(){var y;return(y=this._renderer)==null?void 0:y.textureAtlas}clearTextureAtlas(){var y;(y=this._renderer)==null||y.clearTextureAtlas()}}l.WebglAddon=p})(),a})())})(K1);var Gg=K1.exports;/**
129
+ }`)),this.register((0,g.toDisposable)(()=>M.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(M.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=M.createVertexArray(),M.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),O=M.createBuffer();this.register((0,g.toDisposable)(()=>M.deleteBuffer(O))),M.bindBuffer(M.ARRAY_BUFFER,O),M.bufferData(M.ARRAY_BUFFER,D,M.STATIC_DRAW),M.enableVertexAttribArray(3),M.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const H=new Uint8Array([0,1,2,3]),F=M.createBuffer();this.register((0,g.toDisposable)(()=>M.deleteBuffer(F))),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,F),M.bufferData(M.ELEMENT_ARRAY_BUFFER,H,M.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(M.createBuffer()),this.register((0,g.toDisposable)(()=>M.deleteBuffer(this._attributesBuffer))),M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,M.FLOAT,!1,_,0),M.vertexAttribDivisor(0,1),M.enableVertexAttribArray(1),M.vertexAttribPointer(1,2,M.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(1,1),M.enableVertexAttribArray(2),M.vertexAttribPointer(2,4,M.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(2,1),this._updateCachedColors(A.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),E.uniformMatrix4fv(this._projectionLocation,!1,p.PROJECTION_MATRIX),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,S.attributes,E.DYNAMIC_DRAW),E.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(S){const E=this._terminal,L=this._vertices;let A,M,D,O,H,F,$,N,R,P,B,j=1;for(A=0;A<E.rows;A++){for(D=-1,O=0,H=0,F=!1,M=0;M<E.cols;M++)$=(A*E.cols+M)*u.RENDER_MODEL_INDICIES_PER_CELL,N=S.cells[$+u.RENDER_MODEL_BG_OFFSET],R=S.cells[$+u.RENDER_MODEL_FG_OFFSET],P=!!(67108864&R),(N!==O||R!==H&&(F||P))&&((O!==0||F&&H!==0)&&(B=8*j++,this._updateRectangle(L,B,H,O,D,M,A)),D=M,O=N,H=R,F=P);(O!==0||F&&H!==0)&&(B=8*j++,this._updateRectangle(L,B,H,O,D,E.cols,A))}L.count=j}updateCursor(S){const E=this._verticesCursor,L=S.cursor;if(!L||L.style==="block")return void(E.count=0);let A,M=0;L.style!=="bar"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.style==="bar"?L.dpr*L.cursorWidth:L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.style!=="underline"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,(L.y+1)*this._dimensions.device.cell.height-L.dpr,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat)),L.style==="outline"&&(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat),A=8*M++,this._addRectangleFloat(E.attributes,A,(L.x+L.width)*this._dimensions.device.cell.width-L.dpr,L.y*this._dimensions.device.cell.height,L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),E.count=M}_updateRectangle(S,E,L,A,M,D,O){if(67108864&L)switch(50331648&L){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&L].rgba;break;case 50331648:v=(16777215&L)<<8;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&A){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&A].rgba;break;case 50331648:v=(16777215&A)<<8;break;default:v=this._themeService.colors.background.rgba}S.attributes.length<E+4&&(S.attributes=(0,p.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),h=M*this._dimensions.device.cell.width,f=O*this._dimensions.device.cell.height,d=(v>>24&255)/255,m=(v>>16&255)/255,w=(v>>8&255)/255,b=1,this._addRectangle(S.attributes,E,h,f,(D-M)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d,m,w,b)}_addRectangle(S,E,L,A,M,D,O,H,F,$){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=O,S[E+5]=H,S[E+6]=F,S[E+7]=$}_addRectangleFloat(S,E,L,A,M,D,O){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=O[0],S[E+5]=O[1],S[E+6]=O[2],S[E+7]=O[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}i.RectangleRenderer=x},310:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderModel=i.COMBINED_CHAR_BIT_MASK=i.RENDER_MODEL_EXT_OFFSET=i.RENDER_MODEL_FG_OFFSET=i.RENDER_MODEL_BG_OFFSET=i.RENDER_MODEL_INDICIES_PER_CELL=void 0;const c=o(296);i.RENDER_MODEL_INDICIES_PER_CELL=4,i.RENDER_MODEL_BG_OFFSET=1,i.RENDER_MODEL_FG_OFFSET=2,i.RENDER_MODEL_EXT_OFFSET=3,i.COMBINED_CHAR_BIT_MASK=2147483648,i.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,c.createSelectionRenderModel)()}resize(g,u){const p=g*u*i.RENDER_MODEL_INDICIES_PER_CELL;p!==this.cells.length&&(this.cells=new Uint32Array(p),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.JoinedCellData=i.WebglRenderer=void 0;const c=o(820),g=o(274),u=o(627),p=o(457),_=o(56),y=o(374),v=o(345),h=o(859),f=o(147),d=o(782),m=o(855),w=o(965),b=o(742),x=o(310),C=o(733);class S extends h.Disposable{constructor(M,D,O,H,F,$,N,R,P){super(),this._terminal=M,this._characterJoinerService=D,this._charSizeService=O,this._coreBrowserService=H,this._coreService=F,this._decorationService=$,this._optionsService=N,this._themeService=R,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new x.RenderModel,this._workCell=new d.CellData,this._workCell2=new d.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.MutableDisposable),this._onChangeTextureAtlas=this.register(new v.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new v.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new v.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new v.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new g.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new C.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,N,this._themeService)],this.dimensions=(0,y.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(N.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const B={antialias:!1,depth:!1,preserveDrawingBuffer:P};if(this._gl=this._canvas.getContext("webgl2",B),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextlost",j=>{console.log("webglcontextlost event received"),j.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(j)},3e3)})),this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextrestored",j=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(j,W)=>this._setCanvasDevicePixelDimensions(j,W)),this.register(this._coreBrowserService.onWindowChange(j=>{this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,j,(W,K)=>this._setCanvasDevicePixelDimensions(W,K))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,h.toDisposable)(()=>{var j;for(const W of this._renderLayers)W.dispose();(j=this._canvas.parentElement)==null||j.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var M;return(M=this._charAtlas)==null?void 0:M.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(M,D){var O,H,F,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const N of this._renderLayers)N.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(O=this._rectangleRenderer.value)==null||O.setDimensions(this.dimensions),(H=this._rectangleRenderer.value)==null||H.handleResize(),(F=this._glyphRenderer.value)==null||F.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var M;for(const D of this._renderLayers)D.handleBlur(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.pause(),this._requestRedrawViewport()}handleFocus(){var M;for(const D of this._renderLayers)D.handleFocus(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.resume(),this._requestRedrawViewport()}handleSelectionChanged(M,D,O){for(const H of this._renderLayers)H.handleSelectionChanged(this._terminal,M,D,O);this._model.selection.update(this._core,M,D,O),this._requestRedrawViewport()}handleCursorMove(){var M;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new w.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const M=(0,u.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==M&&(this._onChangeTextureAtlas.fire(M.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,v.forwardEvent)(M.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,v.forwardEvent)(M.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=M,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(M){var D;this._model.clear(),M&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var M;(M=this._charAtlas)==null||M.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var M;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(M){return-1}deregisterCharacterJoiner(M){return!1}renderRows(M,D){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const O of this._renderLayers)O.handleGridChanged(this._terminal,M,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(M,D),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new p.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(M,D){const O=this._core;let H,F,$,N,R,P,B,j,W,K,Z,ee,z,I,V=this._workCell;M=L(M,O.rows-1,0),D=L(D,O.rows-1,0);const U=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,J=U-O.buffer.ydisp,X=Math.min(this._terminal.buffer.active.cursorX,O.cols-1);let me=-1;const ce=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let fe=!1;for(F=M;F<=D;F++)for($=F+O.buffer.ydisp,N=O.buffer.lines.get($),this._model.lineLengths[F]=0,R=this._characterJoinerService.getJoinedCharacters($),z=0;z<O.cols;z++)if(H=this._cellColorResolver.result.bg,N.loadCell(z,V),z===0&&(H=this._cellColorResolver.result.bg),P=!1,B=z,R.length>0&&z===R[0][0]&&(P=!0,j=R.shift(),V=new E(V,N.translateToString(!0,j[0],j[1]),j[1]-j[0]),B=j[1]-1),W=V.getChars(),K=V.getCode(),ee=(F*O.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(V,z,$,this.dimensions.device.cell.width),ce&&$===U&&(z===X&&(this._model.cursor={x:X,y:J,width:V.getWidth(),style:this._coreBrowserService.isFocused?O.options.cursorStyle||"block":O.options.cursorInactiveStyle,cursorWidth:O.options.cursorWidth,dpr:this._devicePixelRatio},me=X+V.getWidth()-1),z>=X&&z<=me&&(this._coreBrowserService.isFocused&&(O.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&O.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),K!==m.NULL_CELL_CODE&&(this._model.lineLengths[F]=z+1),(this._model.cells[ee]!==K||this._model.cells[ee+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[ee+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[ee+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(fe=!0,W.length>1&&(K|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[ee]=K,this._model.cells[ee+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ee+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ee+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,Z=V.getWidth(),this._glyphRenderer.value.updateCell(z,F,K,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,W,Z,H),P))for(V=this._workCell,z++;z<B;z++)I=(F*O.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(z,F,m.NULL_CELL_CODE,0,0,0,m.NULL_CELL_CHAR,0,0),this._model.cells[I]=m.NULL_CELL_CODE,this._model.cells[I+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[I+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[I+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;fe&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(M,D){this._canvas.width===M&&this._canvas.height===D||(this._canvas.width=M,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const M=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:M,end:M})}}i.WebglRenderer=S;class E extends f.AttributeData{constructor(M,D,O){super(),this.content=0,this.combinedData="",this.fg=M.fg,this.bg=M.bg,this.combinedData=D,this._width=O}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(M){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function L(A,M,D=0){return Math.max(Math.min(A,M),D)}i.JoinedCellData=E},381:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const c=o(374);function g(u,p,_){const y=(0,c.throwIfFalsy)(u.createShader(p));if(u.shaderSource(y,_),u.compileShader(y),u.getShaderParameter(y,u.COMPILE_STATUS))return y;console.error(u.getShaderInfoLog(y)),u.deleteShader(y)}i.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),i.createProgram=function(u,p,_){const y=(0,c.throwIfFalsy)(u.createProgram());if(u.attachShader(y,(0,c.throwIfFalsy)(g(u,u.VERTEX_SHADER,p))),u.attachShader(y,(0,c.throwIfFalsy)(g(u,u.FRAGMENT_SHADER,_))),u.linkProgram(y),u.getProgramParameter(y,u.LINK_STATUS))return y;console.error(u.getProgramInfoLog(y)),u.deleteProgram(y)},i.createShader=g,i.expandFloat32Array=function(u,p){const _=Math.min(2*u.length,p),y=new Float32Array(_);for(let v=0;v<u.length;v++)y[v]=u[v];return y},i.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const c=o(627),g=o(237),u=o(374),p=o(859);class _ extends p.Disposable{constructor(v,h,f,d,m,w,b,x){super(),this._container=h,this._alpha=m,this._coreBrowserService=w,this._optionsService=b,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${f}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(C=>{this._refreshCharAtlas(v,C),this.reset(v)})),this.register((0,p.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(v){}handleFocus(v){}handleCursorMove(v){}handleGridChanged(v,h,f){}handleSelectionChanged(v,h,f,d=!1){}_setTransparency(v,h){if(h===this._alpha)return;const f=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,f),this._refreshCharAtlas(v,this._themeService.colors),this.handleGridChanged(v,0,v.rows-1)}_refreshCharAtlas(v,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,c.acquireTextureAtlas)(v,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(v,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(v,this._themeService.colors)}_fillBottomLineAtCells(v,h,f=1){this._ctx.fillRect(v*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,f*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(v,h,f,d){this._alpha?this._ctx.clearRect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(v,h,f,d){this._ctx.font=this._getFont(v,!1,!1),this._ctx.textBaseline=g.TEXT_BASELINE,this._clipCell(f,d,h.getWidth()),this._ctx.fillText(h.getChars(),f*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(v,h,f){this._ctx.beginPath(),this._ctx.rect(v*this._deviceCellWidth,h*this._deviceCellHeight,f*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(v,h,f){return`${f?"italic":""} ${h?v.options.fontWeightBold:v.options.fontWeight} ${v.options.fontSize*this._coreBrowserService.dpr}px ${v.options.fontFamily}`}}i.BaseRenderLayer=_},733:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const c=o(197),g=o(237),u=o(592);class p extends u.BaseRenderLayer{constructor(y,v,h,f,d,m,w){super(h,y,"link",v,!0,d,m,w),this.register(f.onShowLinkUnderline(b=>this._handleShowLinkUnderline(b))),this.register(f.onHideLinkUnderline(b=>this._handleHideLinkUnderline(b)))}resize(y,v){super.resize(y,v),this._state=void 0}reset(y){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(y){if(y.fg===g.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:y.fg!==void 0&&(0,c.is256Color)(y.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[y.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(let v=y.y1+1;v<y.y2;v++)this._fillBottomLineAtCells(0,v,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y}_handleHideLinkUnderline(y){this._clearCurrentLink()}}i.LinkRenderLayer=p},820:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(o,c,g,u){o.addEventListener(c,g,u);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(c,g,u))}}}},274:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const c=o(855),g=o(160),u=o(374);let p,_=0,y=0,v=!1,h=!1,f=!1,d=0;i.CellColorResolver=class{constructor(m,w,b,x,C,S){this._terminal=m,this._optionService=w,this._selectionRenderModel=b,this._decorationService=x,this._coreBrowserService=C,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(m,w,b,x){if(this.result.bg=m.bg,this.result.fg=m.fg,this.result.ext=268435456&m.bg?m.extended.ext:0,y=0,_=0,h=!1,v=!1,f=!1,p=this._themeService.colors,d=0,m.getCode()!==c.NULL_CELL_CODE&&m.extended.underlineStyle===4){const C=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));d=w*x%(2*Math.round(C))}if(this._decorationService.forEachDecorationAtCell(w,b,"bottom",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),f=this._selectionRenderModel.isCellSelected(this._terminal,w,b),f){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:y=(16777215&this.result.fg)<<8|255;break;default:y=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:y=(16777215&this.result.bg)<<8|255}y=g.rgba.blend(y,4294967040&(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else y=(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(h=!0,p.selectionForeground&&(_=p.selectionForeground.rgba>>8&16777215,v=!0),(0,u.treatGlyphAsBackgroundColor)(m.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))_=(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:_=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:_=(16777215&this.result.fg)<<8|255;break;default:_=this._themeService.colors.foreground.rgba}_=g.rgba.blend(_,4294967040&(this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}v=!0}}this._decorationService.forEachDecorationAtCell(w,b,"top",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),h&&(y=f?-16777216&m.bg&-134217729|y|50331648:-16777216&m.bg|y|50331648),v&&(_=-16777216&m.fg&-67108865|_|50331648),67108864&this.result.fg&&(h&&!v&&(_=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&p.background.rgba>>8|50331648,v=!0),!h&&v&&(y=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&p.foreground.rgba>>8|50331648,h=!0)),p=void 0,this.result.bg=h?y:this.result.bg,this.result.fg=v?_:this.result.fg,this.result.ext&=536870911,this.result.ext|=d<<29&3758096384}}},627:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const c=o(509),g=o(197),u=[];i.acquireTextureAtlas=function(p,_,y,v,h,f,d,m){const w=(0,g.generateConfig)(v,h,f,d,_,y,m);for(let C=0;C<u.length;C++){const S=u[C],E=S.ownedBy.indexOf(p);if(E>=0){if((0,g.configEquals)(S.config,w))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),u.splice(C,1)):S.ownedBy.splice(E,1);break}}for(let C=0;C<u.length;C++){const S=u[C];if((0,g.configEquals)(S.config,w))return S.ownedBy.push(p),S.atlas}const b=p._core,x={atlas:new c.TextureAtlas(document,w,b.unicodeService),config:w,ownedBy:[p]};return u.push(x),x.atlas},i.removeTerminalFromCache=function(p){for(let _=0;_<u.length;_++){const y=u[_].ownedBy.indexOf(p);if(y!==-1){u[_].ownedBy.length===1?(u[_].atlas.dispose(),u.splice(_,1)):u[_].ownedBy.splice(y,1);break}}}},197:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const c=o(160);i.generateConfig=function(g,u,p,_,y,v,h){const f={foreground:v.foreground,background:v.background,cursor:c.NULL_COLOR,cursorAccent:c.NULL_COLOR,selectionForeground:c.NULL_COLOR,selectionBackgroundTransparent:c.NULL_COLOR,selectionBackgroundOpaque:c.NULL_COLOR,selectionInactiveBackgroundTransparent:c.NULL_COLOR,selectionInactiveBackgroundOpaque:c.NULL_COLOR,ansi:v.ansi.slice(),contrastCache:v.contrastCache,halfContrastCache:v.halfContrastCache};return{customGlyphs:y.customGlyphs,devicePixelRatio:h,letterSpacing:y.letterSpacing,lineHeight:y.lineHeight,deviceCellWidth:g,deviceCellHeight:u,deviceCharWidth:p,deviceCharHeight:_,fontFamily:y.fontFamily,fontSize:y.fontSize,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,allowTransparency:y.allowTransparency,drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,minimumContrastRatio:y.minimumContrastRatio,colors:f}},i.configEquals=function(g,u){for(let p=0;p<g.colors.ansi.length;p++)if(g.colors.ansi[p].rgba!==u.colors.ansi[p].rgba)return!1;return g.devicePixelRatio===u.devicePixelRatio&&g.customGlyphs===u.customGlyphs&&g.lineHeight===u.lineHeight&&g.letterSpacing===u.letterSpacing&&g.fontFamily===u.fontFamily&&g.fontSize===u.fontSize&&g.fontWeight===u.fontWeight&&g.fontWeightBold===u.fontWeightBold&&g.allowTransparency===u.allowTransparency&&g.deviceCharWidth===u.deviceCharWidth&&g.deviceCharHeight===u.deviceCharHeight&&g.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&g.minimumContrastRatio===u.minimumContrastRatio&&g.colors.foreground.rgba===u.colors.foreground.rgba&&g.colors.background.rgba===u.colors.background.rgba},i.is256Color=function(g){return(50331648&g)==16777216||(50331648&g)==33554432}},237:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const c=o(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},457:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,c>0)return void this._restartInterval(c)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(c)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tryDrawCustomChar=i.powerlineDefinitions=i.boxDrawingDefinitions=i.blockElementDefinitions=void 0;const c=o(374);i.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const g={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};i.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╒":{1:(v,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(v,h)=>`M${.5-v},1 L${.5-v},.5 L1,.5 M${.5+v},.5 L${.5+v},1`},"╔":{1:(v,h)=>`M1,${.5-h} L${.5-v},${.5-h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╕":{1:(v,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(v,h)=>`M${.5+v},1 L${.5+v},.5 L0,.5 M${.5-v},.5 L${.5-v},1`},"╗":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5+v},${.5-h} L${.5+v},1`},"╘":{1:(v,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(v,h)=>`M1,.5 L${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╚":{1:(v,h)=>`M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0 M1,${.5+h} L${.5-v},${.5+h} L${.5-v},0`},"╛":{1:(v,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(v,h)=>`M0,.5 L${.5+v},.5 L${.5+v},0 M${.5-v},.5 L${.5-v},0`},"╝":{1:(v,h)=>`M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M0,${.5+h} L${.5+v},${.5+h} L${.5+v},0`},"╞":{1:(v,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1 M${.5+v},.5 L1,.5`},"╠":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╡":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(v,h)=>`M0,.5 L${.5-v},.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╣":{1:(v,h)=>`M${.5+v},0 L${.5+v},1 M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0`},"╤":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},1 M${.5+v},.5 L${.5+v},1`},"╦":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╧":{1:(v,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╩":{1:(v,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╪":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╬":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,1,.5`}},i.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.tryDrawCustomChar=function(v,h,f,d,m,w,b,x){const C=i.blockElementDefinitions[h];if(C)return function(A,M,D,O,H,F){for(let $=0;$<M.length;$++){const N=M[$],R=H/8,P=F/8;A.fillRect(D+N.x*R,O+N.y*P,N.w*R,N.h*P)}}(v,C,f,d,m,w),!0;const S=g[h];if(S)return function(A,M,D,O,H,F){let $=u.get(M);$||($=new Map,u.set(M,$));const N=A.fillStyle;if(typeof N!="string")throw new Error(`Unexpected fillStyle type "${N}"`);let R=$.get(N);if(!R){const P=M[0].length,B=M.length,j=A.canvas.ownerDocument.createElement("canvas");j.width=P,j.height=B;const W=(0,c.throwIfFalsy)(j.getContext("2d")),K=new ImageData(P,B);let Z,ee,z,I;if(N.startsWith("#"))Z=parseInt(N.slice(1,3),16),ee=parseInt(N.slice(3,5),16),z=parseInt(N.slice(5,7),16),I=N.length>7&&parseInt(N.slice(7,9),16)||1;else{if(!N.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${N}" when drawing pattern glyph`);[Z,ee,z,I]=N.substring(5,N.length-1).split(",").map(V=>parseFloat(V))}for(let V=0;V<B;V++)for(let U=0;U<P;U++)K.data[4*(V*P+U)]=Z,K.data[4*(V*P+U)+1]=ee,K.data[4*(V*P+U)+2]=z,K.data[4*(V*P+U)+3]=M[V][U]*(255*I);W.putImageData(K,0,0),R=(0,c.throwIfFalsy)(A.createPattern(j,null)),$.set(N,R)}A.fillStyle=R,A.fillRect(D,O,H,F)}(v,S,f,d,m,w),!0;const E=i.boxDrawingDefinitions[h];if(E)return function(A,M,D,O,H,F,$){A.strokeStyle=A.fillStyle;for(const[N,R]of Object.entries(M)){let P;A.beginPath(),A.lineWidth=$*Number.parseInt(N),P=typeof R=="function"?R(.15,.15/F*H):R;for(const B of P.split(" ")){const j=B[0],W=_[j];if(!W){console.error(`Could not find drawing instructions for "${j}"`);continue}const K=B.substring(1).split(",");K[0]&&K[1]&&W(A,y(K,H,F,D,O,!0,$))}A.stroke(),A.closePath()}}(v,E,f,d,m,w,x),!0;const L=i.powerlineDefinitions[h];return!!L&&(function(A,M,D,O,H,F,$,N){const R=new Path2D;R.rect(D,O,H,F),A.clip(R),A.beginPath();const P=$/12;A.lineWidth=N*P;for(const B of M.d.split(" ")){const j=B[0],W=_[j];if(!W){console.error(`Could not find drawing instructions for "${j}"`);continue}const K=B.substring(1).split(",");K[0]&&K[1]&&W(A,y(K,H,F,D,O,!1,N,(M.leftPadding??0)*(P/2),(M.rightPadding??0)*(P/2)))}M.type===1?(A.strokeStyle=A.fillStyle,A.stroke()):A.fill(),A.closePath()}(v,L,f,d,m,w,b,x),!0)};const u=new Map;function p(v,h,f=0){return Math.max(Math.min(v,h),f)}const _={C:(v,h)=>v.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(v,h)=>v.lineTo(h[0],h[1]),M:(v,h)=>v.moveTo(h[0],h[1])};function y(v,h,f,d,m,w,b,x=0,C=0){const S=v.map(E=>parseFloat(E)||parseInt(E));if(S.length<2)throw new Error("Too few arguments for instruction");for(let E=0;E<S.length;E+=2)S[E]*=h-x*b-C*b,w&&S[E]!==0&&(S[E]=p(Math.round(S[E]+.5)-.5,h,0)),S[E]+=d+x*b;for(let E=1;E<S.length;E+=2)S[E]*=f,w&&S[E]!==0&&(S[E]=p(Math.round(S[E]+.5)-.5,f,0)),S[E]+=m;return S}},56:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const c=o(859);i.observeDevicePixelDimensions=function(g,u,p){let _=new u.ResizeObserver(y=>{const v=y.find(d=>d.target===g);if(!v)return;if(!("devicePixelContentBoxSize"in v))return _==null||_.disconnect(),void(_=void 0);const h=v.devicePixelContentBoxSize[0].inlineSize,f=v.devicePixelContentBoxSize[0].blockSize;h>0&&f>0&&p(h,f)});try{_.observe(g,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return(0,c.toDisposable)(()=>_==null?void 0:_.disconnect())}},374:(l,i)=>{function o(g){return 57508<=g&&g<=57558}function c(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},i.isPowerlineGlyph=o,i.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},i.isEmoji=c,i.allowRescaling=function(g,u,p,_){return u===1&&p>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!c(g)&&!o(g)&&!function(y){return 57344<=y&&y<=63743}(g)},i.treatGlyphAsBackgroundColor=function(g){return o(g)||function(u){return 9472<=u&&u<=9631}(g)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(g,u,p=0){return(g-(2*Math.round(u)-p))%(2*Math.round(u))}},296:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class o{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(g,u,p,_=!1){if(this.selectionStart=u,this.selectionEnd=p,!u||!p||u[0]===p[0]&&u[1]===p[1])return void this.clear();const y=g.buffers.active.ydisp,v=u[1]-y,h=p[1]-y,f=Math.max(v,0),d=Math.min(h,g.rows-1);f>=g.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=p[0])}isCellSelected(g,u,p){return!!this.hasSelection&&(p-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&p>=this.viewportCappedStartRow&&u<this.endCol&&p<=this.viewportCappedEndRow:u<this.startCol&&p>=this.viewportCappedStartRow&&u>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&u>=this.startCol)}}i.createSelectionRenderModel=function(){return new o}},509:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const c=o(237),g=o(860),u=o(374),p=o(160),_=o(345),y=o(485),v=o(385),h=o(147),f=o(855),d={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let m;class w{get pages(){return this._pages}constructor(E,L,A){this._document=E,this._config=L,this._unicodeService=A,this._didWarmUp=!1,this._cacheMap=new y.FourKeyMap,this._cacheMapCombined=new y.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new _.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=C(E,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const E of this.pages)E.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const E=new v.IdleTaskQueue;for(let L=33;L<126;L++)E.enqueue(()=>{if(!this._cacheMap.get(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT)){const A=this._drawToCache(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT);this._cacheMap.set(L,f.DEFAULT_COLOR,f.DEFAULT_COLOR,f.DEFAULT_EXT,A)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const E of this._pages)E.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(w.maxAtlasPages&&this._pages.length>=Math.max(4,w.maxAtlasPages)){const L=this._pages.filter($=>2*$.canvas.width<=(w.maxTextureSize||4096)).sort(($,N)=>N.canvas.width!==$.canvas.width?N.canvas.width-$.canvas.width:N.percentageUsed-$.percentageUsed);let A=-1,M=0;for(let $=0;$<L.length;$++)if(L[$].canvas.width!==M)A=$,M=L[$].canvas.width;else if($-A==3)break;const D=L.slice(A,A+4),O=D.map($=>$.glyphs[0].texturePage).sort(($,N)=>$>N?1:-1),H=this.pages.length-D.length,F=this._mergePages(D,H);F.version++;for(let $=O.length-1;$>=0;$--)this._deletePage(O[$]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const E=new b(this._document,this._textureSize);return this._pages.push(E),this._activePages.push(E),this._onAddTextureAtlasCanvas.fire(E.canvas),E}_mergePages(E,L){const A=2*E[0].canvas.width,M=new b(this._document,A,E);for(const[D,O]of E.entries()){const H=D*O.canvas.width%A,F=Math.floor(D/2)*O.canvas.height;M.ctx.drawImage(O.canvas,H,F);for(const N of O.glyphs)N.texturePage=L,N.sizeClipSpace.x=N.size.x/A,N.sizeClipSpace.y=N.size.y/A,N.texturePosition.x+=H,N.texturePosition.y+=F,N.texturePositionClipSpace.x=N.texturePosition.x/A,N.texturePositionClipSpace.y=N.texturePosition.y/A;this._onRemoveTextureAtlasCanvas.fire(O.canvas);const $=this._activePages.indexOf(O);$!==-1&&this._activePages.splice($,1)}return M}_deletePage(E){this._pages.splice(E,1);for(let L=E;L<this._pages.length;L++){const A=this._pages[L];for(const M of A.glyphs)M.texturePage--;A.version++}}getRasterizedGlyphCombinedChar(E,L,A,M,D){return this._getFromCacheMap(this._cacheMapCombined,E,L,A,M,D)}getRasterizedGlyph(E,L,A,M,D){return this._getFromCacheMap(this._cacheMap,E,L,A,M,D)}_getFromCacheMap(E,L,A,M,D,O=!1){return m=E.get(L,A,M,D),m||(m=this._drawToCache(L,A,M,D,O),E.set(L,A,M,D,m)),m}_getColorFromAnsiIndex(E){if(E>=this._config.colors.ansi.length)throw new Error("No color found for idx "+E);return this._config.colors.ansi[E]}_getBackgroundColor(E,L,A,M){if(this._config.allowTransparency)return p.NULL_COLOR;let D;switch(E){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(L);break;case 50331648:const O=h.AttributeData.toColorRGB(L);D=p.channels.toColor(O[0],O[1],O[2]);break;default:D=A?p.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(E,L,A,M,D,O,H,F,$,N){const R=this._getMinimumContrastColor(E,L,A,M,D,O,H,$,F,N);if(R)return R;let P;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&O<8&&(O+=8),P=this._getColorFromAnsiIndex(O);break;case 50331648:const B=h.AttributeData.toColorRGB(O);P=p.channels.toColor(B[0],B[1],B[2]);break;default:P=H?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(P=p.color.opaque(P)),F&&(P=p.color.multiplyOpacity(P,c.DIM_OPACITY)),P}_resolveBackgroundRgba(E,L,A){switch(E){case 16777216:case 33554432:return this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(E,L,A,M){switch(E){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&M&&L<8&&(L+=8),this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(E,L,A,M,D,O,H,F,$,N){if(this._config.minimumContrastRatio===1||N)return;const R=this._getContrastCache($),P=R.getColor(E,M);if(P!==void 0)return P||void 0;const B=this._resolveBackgroundRgba(L,A,H),j=this._resolveForegroundRgba(D,O,H,F),W=p.rgba.ensureContrastRatio(B,j,this._config.minimumContrastRatio/($?2:1));if(!W)return void R.setColor(E,M,null);const K=p.channels.toColor(W>>24&255,W>>16&255,W>>8&255);return R.setColor(E,M,K),K}_getContrastCache(E){return E?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(E,L,A,M,D=!1){const O=typeof E=="number"?String.fromCharCode(E):E,H=Math.min(this._config.deviceCellWidth*Math.max(O.length,2)+4,this._textureSize);this._tmpCanvas.width<H&&(this._tmpCanvas.width=H);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=A,this._workAttributeData.bg=L,this._workAttributeData.extended.ext=M,this._workAttributeData.isInvisible())return d;const $=!!this._workAttributeData.isBold(),N=!!this._workAttributeData.isInverse(),R=!!this._workAttributeData.isDim(),P=!!this._workAttributeData.isItalic(),B=!!this._workAttributeData.isUnderline(),j=!!this._workAttributeData.isStrikethrough(),W=!!this._workAttributeData.isOverline();let K=this._workAttributeData.getFgColor(),Z=this._workAttributeData.getFgColorMode(),ee=this._workAttributeData.getBgColor(),z=this._workAttributeData.getBgColorMode();if(N){const se=K;K=ee,ee=se;const be=Z;Z=z,z=be}const I=this._getBackgroundColor(z,ee,N,R);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const V=$?this._config.fontWeightBold:this._config.fontWeight,U=P?"italic":"";this._tmpCtx.font=`${U} ${V} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c.TEXT_BASELINE;const J=O.length===1&&(0,u.isPowerlineGlyph)(O.charCodeAt(0)),X=O.length===1&&(0,u.isRestrictedPowerlineGlyph)(O.charCodeAt(0)),me=this._getForegroundColor(L,z,ee,A,Z,K,N,R,$,(0,u.treatGlyphAsBackgroundColor)(O.charCodeAt(0)));this._tmpCtx.fillStyle=me.css;const ce=X?0:4;let fe=!1;this._config.customGlyphs!==!1&&(fe=(0,g.tryDrawCustomChar)(this._tmpCtx,O,ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ee,ae=!J;if(Ee=typeof E=="number"?this._unicodeService.wcwidth(E):this._unicodeService.getStringCellWidth(E),B){this._tmpCtx.save();const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=se%2==1?.5:0;if(this._tmpCtx.lineWidth=se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ae=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();const oe=ce,he=Math.ceil(ce+this._config.deviceCharHeight)-be-(D?2*se:0),Le=he+se,Re=he+2*se;let Ce=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<Ee;q++){this._tmpCtx.save();const Q=oe+q*this._config.deviceCellWidth,ge=oe+(q+1)*this._config.deviceCellWidth,He=Q+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he),this._tmpCtx.moveTo(Q,Re),this._tmpCtx.lineTo(ge,Re);break;case 3:const ie=se<=1?Re:Math.ceil(ce+this._config.deviceCharHeight-se/2)-be,G=se<=1?he:Math.ceil(ce+this._config.deviceCharHeight+se/2)-be,re=new Path2D;re.rect(Q,he,this._config.deviceCellWidth,Re-he),this._tmpCtx.clip(re),this._tmpCtx.moveTo(Q-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(Q-this._config.deviceCellWidth/2,G,Q,G,Q,Le),this._tmpCtx.bezierCurveTo(Q,ie,He,ie,He,Le),this._tmpCtx.bezierCurveTo(He,G,ge,G,ge,Le),this._tmpCtx.bezierCurveTo(ge,ie,ge+this._config.deviceCellWidth/2,ie,ge+this._config.deviceCellWidth/2,Le);break;case 4:const le=Ce===0?0:Ce>=se?2*se-Ce:se-Ce;Ce>=se||le===0?(this._tmpCtx.setLineDash([Math.round(se),Math.round(se)]),this._tmpCtx.moveTo(Q+le,he),this._tmpCtx.lineTo(ge,he)):(this._tmpCtx.setLineDash([Math.round(se),Math.round(se)]),this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(Q+le,he),this._tmpCtx.moveTo(Q+le+se,he),this._tmpCtx.lineTo(ge,he)),Ce=(0,u.computeNextVariantOffset)(ge-Q,se,Ce);break;case 5:const te=.6,ue=.3,Oe=ge-Q,Fe=Math.floor(te*Oe),De=Math.floor(ue*Oe),Be=Oe-Fe-De;this._tmpCtx.setLineDash([Fe,De,Be]),this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he);break;default:this._tmpCtx.moveTo(Q,he),this._tmpCtx.lineTo(ge,he)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!fe&&this._config.fontSize>=12&&!this._config.allowTransparency&&O!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const q=this._tmpCtx.measureText(O);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();const Q=new Path2D;Q.rect(oe,he-Math.ceil(se/2),this._config.deviceCellWidth*Ee,Re-he+Math.ceil(se/2)),this._tmpCtx.clip(Q),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=I.css,this._tmpCtx.strokeText(O,ce,ce+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(W){const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=se%2==1?.5:0;this._tmpCtx.lineWidth=se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+be),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*Ee,ce+be),this._tmpCtx.stroke()}if(fe||this._tmpCtx.fillText(O,ce,ce+this._config.deviceCharHeight),O==="_"&&!this._config.allowTransparency){let se=x(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),I,me,ae);if(se)for(let be=1;be<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=I.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(O,ce,ce+this._config.deviceCharHeight-be),se=x(this._tmpCtx.getImageData(ce,ce,this._config.deviceCellWidth,this._config.deviceCellHeight),I,me,ae),se);be++);}if(j){const se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),be=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ce,ce+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.lineTo(ce+this._config.deviceCharWidth*Ee,ce+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.stroke()}this._tmpCtx.restore();const Te=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let je;if(je=this._config.allowTransparency?function(se){for(let be=0;be<se.data.length;be+=4)if(se.data[be+3]>0)return!1;return!0}(Te):x(Te,I,me,ae),je)return d;const pe=this._findGlyphBoundingBox(Te,this._workBoundingBox,H,X,fe,ce);let _e,ke;for(;;){if(this._activePages.length===0){const se=this._createNewPage();_e=se,ke=se.currentRow,ke.height=pe.size.y;break}_e=this._activePages[this._activePages.length-1],ke=_e.currentRow;for(const se of this._activePages)pe.size.y<=se.currentRow.height&&(_e=se,ke=se.currentRow);for(let se=this._activePages.length-1;se>=0;se--)for(const be of this._activePages[se].fixedRows)be.height<=ke.height&&pe.size.y<=be.height&&(_e=this._activePages[se],ke=be);if(ke.y+pe.size.y>=_e.canvas.height||ke.height>pe.size.y+2){let se=!1;if(_e.currentRow.y+_e.currentRow.height+pe.size.y>=_e.canvas.height){let be;for(const oe of this._activePages)if(oe.currentRow.y+oe.currentRow.height+pe.size.y<oe.canvas.height){be=oe;break}if(be)_e=be;else if(w.maxAtlasPages&&this._pages.length>=w.maxAtlasPages&&ke.y+pe.size.y<=_e.canvas.height&&ke.height>=pe.size.y&&ke.x+pe.size.x<=_e.canvas.width)se=!0;else{const oe=this._createNewPage();_e=oe,ke=oe.currentRow,ke.height=pe.size.y,se=!0}}se||(_e.currentRow.height>0&&_e.fixedRows.push(_e.currentRow),ke={x:0,y:_e.currentRow.y+_e.currentRow.height,height:pe.size.y},_e.fixedRows.push(ke),_e.currentRow={x:0,y:ke.y+ke.height,height:0})}if(ke.x+pe.size.x<=_e.canvas.width)break;ke===_e.currentRow?(ke.x=0,ke.y+=ke.height,ke.height=0):_e.fixedRows.splice(_e.fixedRows.indexOf(ke),1)}return pe.texturePage=this._pages.indexOf(_e),pe.texturePosition.x=ke.x,pe.texturePosition.y=ke.y,pe.texturePositionClipSpace.x=ke.x/_e.canvas.width,pe.texturePositionClipSpace.y=ke.y/_e.canvas.height,pe.sizeClipSpace.x/=_e.canvas.width,pe.sizeClipSpace.y/=_e.canvas.height,ke.height=Math.max(ke.height,pe.size.y),ke.x+=pe.size.x,_e.ctx.putImageData(Te,pe.texturePosition.x-this._workBoundingBox.left,pe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,pe.size.x,pe.size.y),_e.addGlyph(pe),_e.version++,pe}_findGlyphBoundingBox(E,L,A,M,D,O){L.top=0;const H=M?this._config.deviceCellHeight:this._tmpCanvas.height,F=M?this._config.deviceCellWidth:A;let $=!1;for(let N=0;N<H;N++){for(let R=0;R<F;R++){const P=N*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.top=N,$=!0;break}}if($)break}L.left=0,$=!1;for(let N=0;N<O+F;N++){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*N+3;if(E.data[P]!==0){L.left=N,$=!0;break}}if($)break}L.right=F,$=!1;for(let N=O+F-1;N>=O;N--){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*N+3;if(E.data[P]!==0){L.right=N,$=!0;break}}if($)break}L.bottom=H,$=!1;for(let N=H-1;N>=0;N--){for(let R=0;R<F;R++){const P=N*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.bottom=N,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:L.right-L.left+1,y:L.bottom-L.top+1},sizeClipSpace:{x:L.right-L.left+1,y:L.bottom-L.top+1},offset:{x:-L.left+O+(M||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-L.top+O+(M||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=w;class b{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(E){this._glyphs.push(E),this._usedPixels+=E.size.x*E.size.y}constructor(E,L,A){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],A)for(const M of A)this._glyphs.push(...M.glyphs),this._usedPixels+=M._usedPixels;this.canvas=C(E,L,L),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(S,E,L,A){const M=E.rgba>>>24,D=E.rgba>>>16&255,O=E.rgba>>>8&255,H=L.rgba>>>24,F=L.rgba>>>16&255,$=L.rgba>>>8&255,N=Math.floor((Math.abs(M-H)+Math.abs(D-F)+Math.abs(O-$))/12);let R=!0;for(let P=0;P<S.data.length;P+=4)S.data[P]===M&&S.data[P+1]===D&&S.data[P+2]===O||A&&Math.abs(S.data[P]-M)+Math.abs(S.data[P+1]-D)+Math.abs(S.data[P+2]-O)<N?S.data[P+3]=0:R=!1;return R}function C(S,E,L){const A=S.createElement("canvas");return A.width=E,A.height=L,A}},160:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let o=0,c=0,g=0,u=0;var p,_,y,v,h;function f(m){const w=m.toString(16);return w.length<2?"0"+w:w}function d(m,w){return m<w?(w+.05)/(m+.05):(m+.05)/(w+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},function(m){m.toCss=function(w,b,x,C){return C!==void 0?`#${f(w)}${f(b)}${f(x)}${f(C)}`:`#${f(w)}${f(b)}${f(x)}`},m.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},m.toColor=function(w,b,x,C){return{css:m.toCss(w,b,x,C),rgba:m.toRgba(w,b,x,C)}}}(p||(i.channels=p={})),function(m){function w(b,x){return u=Math.round(255*x),[o,c,g]=h.toChannels(b.rgba),{css:p.toCss(o,c,g,u),rgba:p.toRgba(o,c,g,u)}}m.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),g=M+Math.round((E-M)*u),{css:p.toCss(o,c,g),rgba:p.toRgba(o,c,g)}},m.isOpaque=function(b){return(255&b.rgba)==255},m.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return p.toColor(S>>24&255,S>>16&255,S>>8&255)},m.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,g]=h.toChannels(x),{css:p.toCss(o,c,g),rgba:x}},m.opacity=w,m.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},m.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(i.color=_={})),function(m){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}m.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),p.toColor(o,c,g);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),g=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),p.toColor(o,c,g,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),g=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),p.toColor(o,c,g,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,g,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,c,g,u),css:x}}}(y||(i.css=y={})),function(m){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}m.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},m.relativeLuminance2=w}(v||(i.rgb=v={})),function(m){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,O=C>>8&255,H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||O>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),O-=Math.max(0,Math.ceil(.1*O)),H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|O<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,O=C>>8&255,H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||O<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),O=Math.min(255,O+Math.ceil(.1*(255-O))),H=d(v.relativeLuminance2(M,D,O),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|O<<8|255)>>>0}m.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),g=D+Math.round((L-D)*u),p.toRgba(o,c,g)},m.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),O=d(E,v.relativeLuminance(D>>8));if(O<S){const H=b(x,C,S);return O>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},m.reduceLuminance=w,m.increaseLuminance=b,m.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(i.rgba=h={})),i.toPaddedHex=f,i.contrastRatio=d},345:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},859:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},485:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(g,u,p){this._data[g]||(this._data[g]={}),this._data[g][u]=p}get(g,u){return this._data[g]?this._data[g][u]:void 0}clear(){this._data={}}}i.TwoKeyMap=o,i.FourKeyMap=class{constructor(){this._data=new o}set(c,g,u,p,_){this._data.get(c,g)||this._data.set(c,g,new o),this._data.get(c,g).set(u,p,_)}get(c,g,u,p){var _;return(_=this._data.get(c,g))==null?void 0:_.get(u,p)}clear(){this._data.clear()}}},399:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const o=i.isNode?"node":navigator.userAgent,c=i.isNode?"node":navigator.platform;i.isFirefox=o.includes("Firefox"),i.isLegacyEdge=o.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(o),i.getSafariVersion=function(){if(!i.isSafari)return 0;const g=o.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),i.isIpad=c==="iPad",i.isIphone=c==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),i.isLinux=c.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(o)},385:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const c=o(399);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),f=_.timeRemaining(),1.5*v>f)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=f}this.clear()}}class u extends g{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}i.PriorityTaskQueue=u,i.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:u,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},147:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,p=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=p}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=c},782:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const c=o(133),g=o(855),u=o(147);class p extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new p;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[g.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[g.CHAR_DATA_CHAR_INDEX].length===2){const h=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const f=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(h-55296)+f-56320+65536|y[g.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[g.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=p},855:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},133:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},i.utf32ToString=function(o,c=0,g=o.length){let u="";for(let p=c;p<g;++p){let _=o[p];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const g=o.length;if(!g)return 0;let u=0,p=0;if(this._interim){const _=o.charCodeAt(p++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=p;_<g;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=g)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const g=o.length;if(!g)return 0;let u,p,_,y,v=0,h=0,f=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;f<E;){if(f>=g)return 0;if(x=o[f++],(192&x)!=128){f--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?f--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=g-4;let m=f;for(;m<g;){for(;!(!(m<d)||128&(u=o[m])||128&(p=o[m+1])||128&(_=o[m+2])||128&(y=o[m+3]));)c[v++]=u,c[v++]=p,c[v++]=_,c[v++]=y,m+=4;if(u=o[m++],u<128)c[v++]=u;else if((224&u)==192){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(h=(31&u)<<6|63&p,h<128){m--;continue}c[v++]=h}else if((240&u)==224){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(h=(15&u)<<12|(63&p)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(m>=g)return this.interim[0]=u,v;if(p=o[m++],(192&p)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,v;if(_=o[m++],(192&_)!=128){m--;continue}if(m>=g)return this.interim[0]=u,this.interim[1]=p,this.interim[2]=_,v;if(y=o[m++],(192&y)!=128){m--;continue}if(h=(7&u)<<18|(63&p)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},776:function(l,i,o){var c=this&&this.__decorate||function(h,f,d,m){var w,b=arguments.length,x=b<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,f,d,m);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(f,d,x):w(f,d))||x);return b>3&&x&&Object.defineProperty(f,d,x),x},g=this&&this.__param||function(h,f){return function(d,m){f(d,m,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const u=o(859),p=o(97),_={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,v=i.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let f=0;f<h.length;f++)typeof h[f]=="function"&&(h[f]=h[f]())}_log(h,f,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...d)}trace(h,...f){var d;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,f)}debug(h,...f){var d;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,f)}info(h,...f){var d;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,f)}warn(h,...f){var d;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,f)}error(h,...f){var d;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,f)}};i.LogService=v=c([g(0,p.IOptionsService)],v),i.setTraceLogger=function(h){y=h},i.traceCall=function(h,f,d){if(typeof d.value!="function")throw new Error("not supported");const m=d.value;d.value=function(...w){if(y.logLevel!==p.LogLevelEnum.TRACE)return m.apply(this,w);y.trace(`GlyphRenderer#${m.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=m.apply(this,w);return y.trace(`GlyphRenderer#${m.name} return`,b),b}}},726:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const o="di$target",c="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(g){return g[c]||[]},i.createDecorator=function(g){if(i.serviceRegistry.has(g))return i.serviceRegistry.get(g);const u=function(p,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,f){h[o]===h?h[c].push({id:v,index:f}):(h[c]=[{id:v,index:f}],h[o]=h)})(u,p,y)};return u.toString=()=>g,i.serviceRegistry.set(g,u),u}},97:(l,i,o)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const c=o(726);var g;i.IBufferService=(0,c.createDecorator)("BufferService"),i.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),i.ICoreService=(0,c.createDecorator)("CoreService"),i.ICharsetService=(0,c.createDecorator)("CharsetService"),i.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(g||(i.LogLevelEnum=g={})),i.ILogService=(0,c.createDecorator)("LogService"),i.IOptionsService=(0,c.createDecorator)("OptionsService"),i.IOscLinkService=(0,c.createDecorator)("OscLinkService"),i.IUnicodeService=(0,c.createDecorator)("UnicodeService"),i.IDecorationService=(0,c.createDecorator)("DecorationService")}},n={};function s(l){var i=n[l];if(i!==void 0)return i.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,s),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.WebglAddon=void 0;const i=s(345),o=s(859),c=s(399),g=s(666),u=s(776);class p extends o.Disposable{constructor(y){if(c.isSafari&&(0,c.getSafariVersion)()<16){const v={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",v))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=y,this._onChangeTextureAtlas=this.register(new i.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new i.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new i.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new i.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(y){const v=y._core;if(!y.element)return void this.register(v.onWillOpen(()=>this.activate(y)));this._terminal=y;const h=v.coreService,f=v.optionsService,d=v,m=d._renderService,w=d._characterJoinerService,b=d._charSizeService,x=d._coreBrowserService,C=d._decorationService,S=d._logService,E=d._themeService;(0,u.setTraceLogger)(S),this._renderer=this.register(new g.WebglRenderer(y,w,b,x,h,C,f,E,this._preserveDrawingBuffer)),this.register((0,i.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,i.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,i.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,i.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),m.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const L=this._terminal._core._renderService;L.setRenderer(this._terminal._core._createRenderer()),L.handleResize(y.cols,y.rows)}))}get textureAtlas(){var y;return(y=this._renderer)==null?void 0:y.textureAtlas}clearTextureAtlas(){var y;(y=this._renderer)==null||y.clearTextureAtlas()}}l.WebglAddon=p})(),a})())})(K1);var Gg=K1.exports;/**
130
130
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
131
131
  * @license MIT
132
132
  *
@@ -148,7 +148,7 @@ void main() {
148
148
  * Fabrice Bellard's javascript vt100 for jslinux:
149
149
  * http://bellard.org/jslinux/
150
150
  * Copyright (c) 2011 Fabrice Bellard
151
- */var G1="3.7.8",oT=G1,ys=typeof Buffer=="function",qg=typeof TextDecoder=="function"?new TextDecoder:void 0,Xg=typeof TextEncoder=="function"?new TextEncoder:void 0,aT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",zs=Array.prototype.slice.call(aT),ka=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(zs),lT=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,It=String.fromCharCode.bind(String),Yg=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),q1=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),X1=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Y1=e=>{let t,r,n,s,a="",l=e.length%3;for(let i=0;i<e.length;){if((r=e.charCodeAt(i++))>255||(n=e.charCodeAt(i++))>255||(s=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,a+=zs[t>>18&63]+zs[t>>12&63]+zs[t>>6&63]+zs[t&63]}return l?a.slice(0,l-3)+"===".substring(l):a},Vf=typeof btoa=="function"?e=>btoa(e):ys?e=>Buffer.from(e,"binary").toString("base64"):Y1,Uh=ys?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(It.apply(null,e.subarray(r,r+4096)));return Vf(t.join(""))},Ja=(e,t=!1)=>t?q1(Uh(e)):Uh(e),cT=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?It(192|t>>>6)+It(128|t&63):It(224|t>>>12&15)+It(128|t>>>6&63)+It(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return It(240|t>>>18&7)+It(128|t>>>12&63)+It(128|t>>>6&63)+It(128|t&63)}},uT=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,J1=e=>e.replace(uT,cT),Jg=ys?e=>Buffer.from(e,"utf8").toString("base64"):Xg?e=>Uh(Xg.encode(e)):e=>Vf(J1(e)),Zi=(e,t=!1)=>t?q1(Jg(e)):Jg(e),Qg=e=>Zi(e,!0),hT=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,dT=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return It((r>>>10)+55296)+It((r&1023)+56320);case 3:return It((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return It((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Q1=e=>e.replace(hT,dT),Z1=e=>{if(e=e.replace(/\s+/g,""),!lT.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,s=[];for(let a=0;a<e.length;)t=ka[e.charAt(a++)]<<18|ka[e.charAt(a++)]<<12|(r=ka[e.charAt(a++)])<<6|(n=ka[e.charAt(a++)]),r===64?s.push(It(t>>16&255)):n===64?s.push(It(t>>16&255,t>>8&255)):s.push(It(t>>16&255,t>>8&255,t&255));return s.join("")},Kf=typeof atob=="function"?e=>atob(X1(e)):ys?e=>Buffer.from(e,"base64").toString("binary"):Z1,ew=ys?e=>Yg(Buffer.from(e,"base64")):e=>Yg(Kf(e).split("").map(t=>t.charCodeAt(0))),tw=e=>ew(rw(e)),fT=ys?e=>Buffer.from(e,"base64").toString("utf8"):qg?e=>qg.decode(ew(e)):e=>Q1(Kf(e)),rw=e=>X1(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Wh=e=>fT(rw(e)),pT=e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},nw=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),iw=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,nw(r));e("fromBase64",function(){return Wh(this)}),e("toBase64",function(t){return Zi(this,t)}),e("toBase64URI",function(){return Zi(this,!0)}),e("toBase64URL",function(){return Zi(this,!0)}),e("toUint8Array",function(){return tw(this)})},sw=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,nw(r));e("toBase64",function(t){return Ja(this,t)}),e("toBase64URI",function(){return Ja(this,!0)}),e("toBase64URL",function(){return Ja(this,!0)})},mT=()=>{iw(),sw()},La={version:G1,VERSION:oT,atob:Kf,atobPolyfill:Z1,btoa:Vf,btoaPolyfill:Y1,fromBase64:Wh,toBase64:Zi,encode:Zi,encodeURI:Qg,encodeURL:Qg,utob:J1,btou:Q1,decode:Wh,isValid:pT,fromUint8Array:Ja,toUint8Array:tw,extendString:iw,extendUint8Array:sw,extendBuiltins:mT},gT=class{constructor(e=new _T,t=new vT){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,t=>this._setOrReportClipboard(t))}dispose(){var e;return(e=this._disposable)==null?void 0:e.dispose()}_readText(e,t){var n;let r=this._base64.encodeText(t);(n=this._terminal)==null||n.input(`\x1B]52;${e};${r}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let r=t[0],n=t[1];if(n==="?"){let l=this._provider.readText(r);return l instanceof Promise?l.then(i=>(this._readText(r,i),!0)):(this._readText(r,l),!0)}let s="";try{s=this._base64.decodeText(n)}catch{}let a=this._provider.writeText(r,s);return a instanceof Promise?a.then(()=>!0):!0}},vT=class{async readText(t){return t!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(t,r){return t!=="c"?Promise.resolve():navigator.clipboard.writeText(r)}},_T=class{encodeText(t){return La.encode(t)}decodeText(t){let r=La.decode(t);return!La.isValid(t)||La.encode(r)!==t?"":r}},ow={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(self,()=>(()=>{var r={345:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},859:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},n={};function s(l){var i=n[l];if(i!==void 0)return i.exports;var o=n[l]={exports:{}};return r[l](o,o.exports,s),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.SearchAddon=void 0;const i=s(345),o=s(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class g extends o.Disposable{constructor(p){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.MutableDisposable,this._onDidChangeResults=this.register(new i.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=(p==null?void 0:p.highlightLimit)??1e3}activate(p){this._terminal=p,this.register(this._terminal.onWriteParsed(()=>this._updateMatches())),this.register(this._terminal.onResize(()=>this._updateMatches())),this.register((0,o.toDisposable)(()=>this.clearDecorations()))}_updateMatches(){var p;this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&((p=this._lastSearchOptions)!=null&&p.decorations)&&(this._highlightTimeout=setTimeout(()=>{const _=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(_,{...this._lastSearchOptions,incremental:!0,noScroll:!0})},200))}clearDecorations(p){this._selectedDecoration.clear(),(0,o.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),p||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const y=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,_);this._lastSearchOptions=_,_!=null&&_.decorations&&(this._cachedSearchTerm===void 0||p!==this._cachedSearchTerm||y)&&this._highlightAllMatches(p,_);const v=this._findNextAndSelect(p,_);return this._fireResults(_),this._cachedSearchTerm=p,v}_highlightAllMatches(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!p||p.length===0)return void this.clearDecorations();_=_||{},this.clearDecorations(!0);const y=[];let v,h=this._find(p,0,0,_);for(;h&&((v==null?void 0:v.row)!==h.row||(v==null?void 0:v.col)!==h.col)&&!(y.length>=this._highlightLimit);)v=h,y.push(v),h=this._find(p,v.col+v.term.length>=this._terminal.cols?v.row+1:v.row,v.col+v.term.length>=this._terminal.cols?0:v.col+1,_);for(const f of y){const d=this._createResultDecoration(f,_.decorations);d&&(this._highlightedLines.add(d.marker.line),this._highlightDecorations.push({decoration:d,match:f,dispose(){d.dispose()}}))}}_find(p,_,y,v){var d;if(!this._terminal||!p||p.length===0)return(d=this._terminal)==null||d.clearSelection(),void this.clearDecorations();if(y>this._terminal.cols)throw new Error(`Invalid col: ${y} to search in terminal of ${this._terminal.cols} cols`);let h;this._initLinesCache();const f={startRow:_,startCol:y};if(h=this._findInLine(p,f,v),!h)for(let m=_+1;m<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=m,f.startCol=0,h=this._findInLine(p,f,v),!h);m++);return h}_findNextAndSelect(p,_){var m;if(!this._terminal||!p||p.length===0)return(m=this._terminal)==null||m.clearSelection(),this.clearDecorations(),!1;const y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let v=0,h=0;y&&(this._cachedSearchTerm===p?(v=y.end.x,h=y.end.y):(v=y.start.x,h=y.start.y)),this._initLinesCache();const f={startRow:h,startCol:v};let d=this._findInLine(p,f,_);if(!d)for(let w=h+1;w<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=w,f.startCol=0,d=this._findInLine(p,f,_),!d);w++);if(!d&&h!==0)for(let w=0;w<h&&(f.startRow=w,f.startCol=0,d=this._findInLine(p,f,_),!d);w++);return!d&&y&&(f.startRow=y.start.y,f.startCol=0,d=this._findInLine(p,f,_)),this._selectResult(d,_==null?void 0:_.decorations,_==null?void 0:_.noScroll)}findPrevious(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const y=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,_);this._lastSearchOptions=_,_!=null&&_.decorations&&(this._cachedSearchTerm===void 0||p!==this._cachedSearchTerm||y)&&this._highlightAllMatches(p,_);const v=this._findPreviousAndSelect(p,_);return this._fireResults(_),this._cachedSearchTerm=p,v}_didOptionsChange(p,_){return!!_&&(p.caseSensitive!==_.caseSensitive||p.regex!==_.regex||p.wholeWord!==_.wholeWord)}_fireResults(p){if(p!=null&&p.decorations){let _=-1;if(this._selectedDecoration.value){const y=this._selectedDecoration.value.match;for(let v=0;v<this._highlightDecorations.length;v++){const h=this._highlightDecorations[v].match;if(h.row===y.row&&h.col===y.col&&h.size===y.size){_=v;break}}}this._onDidChangeResults.fire({resultIndex:_,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(p,_){var w;if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!p||p.length===0)return(w=this._terminal)==null||w.clearSelection(),this.clearDecorations(),!1;const y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let v=this._terminal.buffer.active.baseY+this._terminal.rows-1,h=this._terminal.cols;const f=!0;this._initLinesCache();const d={startRow:v,startCol:h};let m;if(y&&(d.startRow=v=y.start.y,d.startCol=h=y.start.x,this._cachedSearchTerm!==p&&(m=this._findInLine(p,d,_,!1),m||(d.startRow=v=y.end.y,d.startCol=h=y.end.x))),m||(m=this._findInLine(p,d,_,f)),!m){d.startCol=Math.max(d.startCol,this._terminal.cols);for(let b=v-1;b>=0&&(d.startRow=b,m=this._findInLine(p,d,_,f),!m);b--);}if(!m&&v!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let b=this._terminal.buffer.active.baseY+this._terminal.rows-1;b>=v&&(d.startRow=b,m=this._findInLine(p,d,_,f),!m);b--);return this._selectResult(m,_==null?void 0:_.decorations,_==null?void 0:_.noScroll)}_initLinesCache(){const p=this._terminal;this._linesCache||(this._linesCache=new Array(p.buffer.active.length),this._linesCacheDisposables.value=(0,o.getDisposeArrayDisposable)([p.onLineFeed(()=>this._destroyLinesCache()),p.onCursorMove(()=>this._destroyLinesCache()),p.onResize(()=>this._destroyLinesCache())])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(p,_,y){return(p===0||c.includes(_[p-1]))&&(p+y.length===_.length||c.includes(_[p+y.length]))}_findInLine(p,_,y={},v=!1){var A;const h=this._terminal,f=_.startRow,d=_.startCol,m=h.buffer.active.getLine(f);if(m!=null&&m.isWrapped)return v?void(_.startCol+=h.cols):(_.startRow--,_.startCol+=h.cols,this._findInLine(p,_,y));let w=(A=this._linesCache)==null?void 0:A[f];w||(w=this._translateBufferLineToStringWithWrap(f,!0),this._linesCache&&(this._linesCache[f]=w));const[b,x]=w,C=this._bufferColsToStringOffset(f,d),S=y.caseSensitive?p:p.toLowerCase(),E=y.caseSensitive?b:b.toLowerCase();let L=-1;if(y.regex){const M=RegExp(S,"g");let D;if(v)for(;D=M.exec(E.slice(0,C));)L=M.lastIndex-D[0].length,p=D[0],M.lastIndex-=p.length-1;else D=M.exec(E.slice(C)),D&&D[0].length>0&&(L=C+(M.lastIndex-D[0].length),p=D[0])}else v?C-S.length>=0&&(L=E.lastIndexOf(S,C-S.length)):L=E.indexOf(S,C);if(L>=0){if(y.wholeWord&&!this._isWholeWord(L,E,p))return;let M=0;for(;M<x.length-1&&L>=x[M+1];)M++;let D=M;for(;D<x.length-1&&L+p.length>=x[D+1];)D++;const N=L-x[M],H=L+p.length-x[D],F=this._stringLengthToBufferSize(f+M,N);return{term:p,col:F,row:f+M,size:this._stringLengthToBufferSize(f+D,H)-F+h.cols*(D-M)}}}_stringLengthToBufferSize(p,_){const y=this._terminal.buffer.active.getLine(p);if(!y)return 0;for(let v=0;v<_;v++){const h=y.getCell(v);if(!h)break;const f=h.getChars();f.length>1&&(_-=f.length-1);const d=y.getCell(v+1);d&&d.getWidth()===0&&_++}return _}_bufferColsToStringOffset(p,_){const y=this._terminal;let v=p,h=0,f=y.buffer.active.getLine(v);for(;_>0&&f;){for(let d=0;d<_&&d<y.cols;d++){const m=f.getCell(d);if(!m)break;m.getWidth()&&(h+=m.getCode()===0?1:m.getChars().length)}if(v++,f=y.buffer.active.getLine(v),f&&!f.isWrapped)break;_-=y.cols}return h}_translateBufferLineToStringWithWrap(p,_){var d;const y=this._terminal,v=[],h=[0];let f=y.buffer.active.getLine(p);for(;f;){const m=y.buffer.active.getLine(p+1),w=!!m&&m.isWrapped;let b=f.translateToString(!w&&_);if(w&&m){const x=f.getCell(f.length-1);x&&x.getCode()===0&&x.getWidth()===1&&((d=m.getCell(0))==null?void 0:d.getWidth())===2&&(b=b.slice(0,-1))}if(v.push(b),!w)break;h.push(h[h.length-1]+b.length),p++,f=m}return[v.join(""),h]}_selectResult(p,_,y){const v=this._terminal;if(this._selectedDecoration.clear(),!p)return v.clearSelection(),!1;if(v.select(p.col,p.row,p.size),_){const h=v.registerMarker(-v.buffer.active.baseY-v.buffer.active.cursorY+p.row);if(h){const f=v.registerDecoration({marker:h,x:p.col,width:p.size,backgroundColor:_.activeMatchBackground,layer:"top",overviewRulerOptions:{color:_.activeMatchColorOverviewRuler}});if(f){const d=[];d.push(h),d.push(f.onRender(m=>this._applyStyles(m,_.activeMatchBorder,!0))),d.push(f.onDispose(()=>(0,o.disposeArray)(d))),this._selectedDecoration.value={decoration:f,match:p,dispose(){f.dispose()}}}}}if(!y&&(p.row>=v.buffer.active.viewportY+v.rows||p.row<v.buffer.active.viewportY)){let h=p.row-v.buffer.active.viewportY;h-=Math.floor(v.rows/2),v.scrollLines(h)}return!0}_applyStyles(p,_,y){p.classList.contains("xterm-find-result-decoration")||(p.classList.add("xterm-find-result-decoration"),_&&(p.style.outline=`1px solid ${_}`)),y&&p.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(p,_){const y=this._terminal,v=y.registerMarker(-y.buffer.active.baseY-y.buffer.active.cursorY+p.row);if(!v)return;const h=y.registerDecoration({marker:v,x:p.col,width:p.size,backgroundColor:_.matchBackground,overviewRulerOptions:this._highlightedLines.has(v.line)?void 0:{color:_.matchOverviewRuler,position:"center"}});if(h){const f=[];f.push(v),f.push(h.onRender(d=>this._applyStyles(d,_.matchBorder,!1))),f.push(h.onDispose(()=>(0,o.disposeArray)(f)))}return h}}l.SearchAddon=g})(),a})())})(ow);var yT=ow.exports;/**
151
+ */var G1="3.7.8",oT=G1,ys=typeof Buffer=="function",qg=typeof TextDecoder=="function"?new TextDecoder:void 0,Xg=typeof TextEncoder=="function"?new TextEncoder:void 0,aT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",zs=Array.prototype.slice.call(aT),ka=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(zs),lT=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,It=String.fromCharCode.bind(String),Yg=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),q1=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),X1=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Y1=e=>{let t,r,n,s,a="",l=e.length%3;for(let i=0;i<e.length;){if((r=e.charCodeAt(i++))>255||(n=e.charCodeAt(i++))>255||(s=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,a+=zs[t>>18&63]+zs[t>>12&63]+zs[t>>6&63]+zs[t&63]}return l?a.slice(0,l-3)+"===".substring(l):a},Vf=typeof btoa=="function"?e=>btoa(e):ys?e=>Buffer.from(e,"binary").toString("base64"):Y1,Uh=ys?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(It.apply(null,e.subarray(r,r+4096)));return Vf(t.join(""))},Ja=(e,t=!1)=>t?q1(Uh(e)):Uh(e),cT=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?It(192|t>>>6)+It(128|t&63):It(224|t>>>12&15)+It(128|t>>>6&63)+It(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return It(240|t>>>18&7)+It(128|t>>>12&63)+It(128|t>>>6&63)+It(128|t&63)}},uT=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,J1=e=>e.replace(uT,cT),Jg=ys?e=>Buffer.from(e,"utf8").toString("base64"):Xg?e=>Uh(Xg.encode(e)):e=>Vf(J1(e)),Zi=(e,t=!1)=>t?q1(Jg(e)):Jg(e),Qg=e=>Zi(e,!0),hT=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,dT=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return It((r>>>10)+55296)+It((r&1023)+56320);case 3:return It((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return It((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Q1=e=>e.replace(hT,dT),Z1=e=>{if(e=e.replace(/\s+/g,""),!lT.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,s=[];for(let a=0;a<e.length;)t=ka[e.charAt(a++)]<<18|ka[e.charAt(a++)]<<12|(r=ka[e.charAt(a++)])<<6|(n=ka[e.charAt(a++)]),r===64?s.push(It(t>>16&255)):n===64?s.push(It(t>>16&255,t>>8&255)):s.push(It(t>>16&255,t>>8&255,t&255));return s.join("")},Kf=typeof atob=="function"?e=>atob(X1(e)):ys?e=>Buffer.from(e,"base64").toString("binary"):Z1,ew=ys?e=>Yg(Buffer.from(e,"base64")):e=>Yg(Kf(e).split("").map(t=>t.charCodeAt(0))),tw=e=>ew(rw(e)),fT=ys?e=>Buffer.from(e,"base64").toString("utf8"):qg?e=>qg.decode(ew(e)):e=>Q1(Kf(e)),rw=e=>X1(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Wh=e=>fT(rw(e)),pT=e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},nw=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),iw=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,nw(r));e("fromBase64",function(){return Wh(this)}),e("toBase64",function(t){return Zi(this,t)}),e("toBase64URI",function(){return Zi(this,!0)}),e("toBase64URL",function(){return Zi(this,!0)}),e("toUint8Array",function(){return tw(this)})},sw=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,nw(r));e("toBase64",function(t){return Ja(this,t)}),e("toBase64URI",function(){return Ja(this,!0)}),e("toBase64URL",function(){return Ja(this,!0)})},mT=()=>{iw(),sw()},La={version:G1,VERSION:oT,atob:Kf,atobPolyfill:Z1,btoa:Vf,btoaPolyfill:Y1,fromBase64:Wh,toBase64:Zi,encode:Zi,encodeURI:Qg,encodeURL:Qg,utob:J1,btou:Q1,decode:Wh,isValid:pT,fromUint8Array:Ja,toUint8Array:tw,extendString:iw,extendUint8Array:sw,extendBuiltins:mT},gT=class{constructor(e=new _T,t=new vT){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,t=>this._setOrReportClipboard(t))}dispose(){var e;return(e=this._disposable)==null?void 0:e.dispose()}_readText(e,t){var n;let r=this._base64.encodeText(t);(n=this._terminal)==null||n.input(`\x1B]52;${e};${r}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(";");if(t.length<2)return!0;let r=t[0],n=t[1];if(n==="?"){let l=this._provider.readText(r);return l instanceof Promise?l.then(i=>(this._readText(r,i),!0)):(this._readText(r,l),!0)}let s="";try{s=this._base64.decodeText(n)}catch{}let a=this._provider.writeText(r,s);return a instanceof Promise?a.then(()=>!0):!0}},vT=class{async readText(t){return t!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(t,r){return t!=="c"?Promise.resolve():navigator.clipboard.writeText(r)}},_T=class{encodeText(t){return La.encode(t)}decodeText(t){let r=La.decode(t);return!La.isValid(t)||La.encode(r)!==t?"":r}},ow={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(self,()=>(()=>{var r={345:(l,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(o,c){return o(g=>c.fire(g))},i.runAndSubscribe=function(o,c){return c(void 0),o(g=>c(g))}},859:(l,i)=>{function o(c){for(const g of c)g.dispose();c.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const g=this._disposables.indexOf(c);g!==-1&&this._disposables.splice(g,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var g;this._isDisposed||c===this._value||((g=this._value)==null||g.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},i.toDisposable=function(c){return{dispose:c}},i.disposeArray=o,i.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}}},n={};function s(l){var i=n[l];if(i!==void 0)return i.exports;var o=n[l]={exports:{}};return r[l](o,o.exports,s),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.SearchAddon=void 0;const i=s(345),o=s(859),c=" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";class g extends o.Disposable{constructor(p){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new o.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new o.MutableDisposable,this._onDidChangeResults=this.register(new i.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=(p==null?void 0:p.highlightLimit)??1e3}activate(p){this._terminal=p,this.register(this._terminal.onWriteParsed(()=>this._updateMatches())),this.register(this._terminal.onResize(()=>this._updateMatches())),this.register((0,o.toDisposable)(()=>this.clearDecorations()))}_updateMatches(){var p;this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&((p=this._lastSearchOptions)!=null&&p.decorations)&&(this._highlightTimeout=setTimeout(()=>{const _=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(_,{...this._lastSearchOptions,incremental:!0,noScroll:!0})},200))}clearDecorations(p){this._selectedDecoration.clear(),(0,o.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),p||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const y=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,_);this._lastSearchOptions=_,_!=null&&_.decorations&&(this._cachedSearchTerm===void 0||p!==this._cachedSearchTerm||y)&&this._highlightAllMatches(p,_);const v=this._findNextAndSelect(p,_);return this._fireResults(_),this._cachedSearchTerm=p,v}_highlightAllMatches(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!p||p.length===0)return void this.clearDecorations();_=_||{},this.clearDecorations(!0);const y=[];let v,h=this._find(p,0,0,_);for(;h&&((v==null?void 0:v.row)!==h.row||(v==null?void 0:v.col)!==h.col)&&!(y.length>=this._highlightLimit);)v=h,y.push(v),h=this._find(p,v.col+v.term.length>=this._terminal.cols?v.row+1:v.row,v.col+v.term.length>=this._terminal.cols?0:v.col+1,_);for(const f of y){const d=this._createResultDecoration(f,_.decorations);d&&(this._highlightedLines.add(d.marker.line),this._highlightDecorations.push({decoration:d,match:f,dispose(){d.dispose()}}))}}_find(p,_,y,v){var d;if(!this._terminal||!p||p.length===0)return(d=this._terminal)==null||d.clearSelection(),void this.clearDecorations();if(y>this._terminal.cols)throw new Error(`Invalid col: ${y} to search in terminal of ${this._terminal.cols} cols`);let h;this._initLinesCache();const f={startRow:_,startCol:y};if(h=this._findInLine(p,f,v),!h)for(let m=_+1;m<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=m,f.startCol=0,h=this._findInLine(p,f,v),!h);m++);return h}_findNextAndSelect(p,_){var m;if(!this._terminal||!p||p.length===0)return(m=this._terminal)==null||m.clearSelection(),this.clearDecorations(),!1;const y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let v=0,h=0;y&&(this._cachedSearchTerm===p?(v=y.end.x,h=y.end.y):(v=y.start.x,h=y.start.y)),this._initLinesCache();const f={startRow:h,startCol:v};let d=this._findInLine(p,f,_);if(!d)for(let w=h+1;w<this._terminal.buffer.active.baseY+this._terminal.rows&&(f.startRow=w,f.startCol=0,d=this._findInLine(p,f,_),!d);w++);if(!d&&h!==0)for(let w=0;w<h&&(f.startRow=w,f.startCol=0,d=this._findInLine(p,f,_),!d);w++);return!d&&y&&(f.startRow=y.start.y,f.startCol=0,d=this._findInLine(p,f,_)),this._selectResult(d,_==null?void 0:_.decorations,_==null?void 0:_.noScroll)}findPrevious(p,_){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");const y=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,_);this._lastSearchOptions=_,_!=null&&_.decorations&&(this._cachedSearchTerm===void 0||p!==this._cachedSearchTerm||y)&&this._highlightAllMatches(p,_);const v=this._findPreviousAndSelect(p,_);return this._fireResults(_),this._cachedSearchTerm=p,v}_didOptionsChange(p,_){return!!_&&(p.caseSensitive!==_.caseSensitive||p.regex!==_.regex||p.wholeWord!==_.wholeWord)}_fireResults(p){if(p!=null&&p.decorations){let _=-1;if(this._selectedDecoration.value){const y=this._selectedDecoration.value.match;for(let v=0;v<this._highlightDecorations.length;v++){const h=this._highlightDecorations[v].match;if(h.row===y.row&&h.col===y.col&&h.size===y.size){_=v;break}}}this._onDidChangeResults.fire({resultIndex:_,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(p,_){var w;if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!p||p.length===0)return(w=this._terminal)==null||w.clearSelection(),this.clearDecorations(),!1;const y=this._terminal.getSelectionPosition();this._terminal.clearSelection();let v=this._terminal.buffer.active.baseY+this._terminal.rows-1,h=this._terminal.cols;const f=!0;this._initLinesCache();const d={startRow:v,startCol:h};let m;if(y&&(d.startRow=v=y.start.y,d.startCol=h=y.start.x,this._cachedSearchTerm!==p&&(m=this._findInLine(p,d,_,!1),m||(d.startRow=v=y.end.y,d.startCol=h=y.end.x))),m||(m=this._findInLine(p,d,_,f)),!m){d.startCol=Math.max(d.startCol,this._terminal.cols);for(let b=v-1;b>=0&&(d.startRow=b,m=this._findInLine(p,d,_,f),!m);b--);}if(!m&&v!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let b=this._terminal.buffer.active.baseY+this._terminal.rows-1;b>=v&&(d.startRow=b,m=this._findInLine(p,d,_,f),!m);b--);return this._selectResult(m,_==null?void 0:_.decorations,_==null?void 0:_.noScroll)}_initLinesCache(){const p=this._terminal;this._linesCache||(this._linesCache=new Array(p.buffer.active.length),this._linesCacheDisposables.value=(0,o.getDisposeArrayDisposable)([p.onLineFeed(()=>this._destroyLinesCache()),p.onCursorMove(()=>this._destroyLinesCache()),p.onResize(()=>this._destroyLinesCache())])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(p,_,y){return(p===0||c.includes(_[p-1]))&&(p+y.length===_.length||c.includes(_[p+y.length]))}_findInLine(p,_,y={},v=!1){var A;const h=this._terminal,f=_.startRow,d=_.startCol,m=h.buffer.active.getLine(f);if(m!=null&&m.isWrapped)return v?void(_.startCol+=h.cols):(_.startRow--,_.startCol+=h.cols,this._findInLine(p,_,y));let w=(A=this._linesCache)==null?void 0:A[f];w||(w=this._translateBufferLineToStringWithWrap(f,!0),this._linesCache&&(this._linesCache[f]=w));const[b,x]=w,C=this._bufferColsToStringOffset(f,d),S=y.caseSensitive?p:p.toLowerCase(),E=y.caseSensitive?b:b.toLowerCase();let L=-1;if(y.regex){const M=RegExp(S,"g");let D;if(v)for(;D=M.exec(E.slice(0,C));)L=M.lastIndex-D[0].length,p=D[0],M.lastIndex-=p.length-1;else D=M.exec(E.slice(C)),D&&D[0].length>0&&(L=C+(M.lastIndex-D[0].length),p=D[0])}else v?C-S.length>=0&&(L=E.lastIndexOf(S,C-S.length)):L=E.indexOf(S,C);if(L>=0){if(y.wholeWord&&!this._isWholeWord(L,E,p))return;let M=0;for(;M<x.length-1&&L>=x[M+1];)M++;let D=M;for(;D<x.length-1&&L+p.length>=x[D+1];)D++;const O=L-x[M],H=L+p.length-x[D],F=this._stringLengthToBufferSize(f+M,O);return{term:p,col:F,row:f+M,size:this._stringLengthToBufferSize(f+D,H)-F+h.cols*(D-M)}}}_stringLengthToBufferSize(p,_){const y=this._terminal.buffer.active.getLine(p);if(!y)return 0;for(let v=0;v<_;v++){const h=y.getCell(v);if(!h)break;const f=h.getChars();f.length>1&&(_-=f.length-1);const d=y.getCell(v+1);d&&d.getWidth()===0&&_++}return _}_bufferColsToStringOffset(p,_){const y=this._terminal;let v=p,h=0,f=y.buffer.active.getLine(v);for(;_>0&&f;){for(let d=0;d<_&&d<y.cols;d++){const m=f.getCell(d);if(!m)break;m.getWidth()&&(h+=m.getCode()===0?1:m.getChars().length)}if(v++,f=y.buffer.active.getLine(v),f&&!f.isWrapped)break;_-=y.cols}return h}_translateBufferLineToStringWithWrap(p,_){var d;const y=this._terminal,v=[],h=[0];let f=y.buffer.active.getLine(p);for(;f;){const m=y.buffer.active.getLine(p+1),w=!!m&&m.isWrapped;let b=f.translateToString(!w&&_);if(w&&m){const x=f.getCell(f.length-1);x&&x.getCode()===0&&x.getWidth()===1&&((d=m.getCell(0))==null?void 0:d.getWidth())===2&&(b=b.slice(0,-1))}if(v.push(b),!w)break;h.push(h[h.length-1]+b.length),p++,f=m}return[v.join(""),h]}_selectResult(p,_,y){const v=this._terminal;if(this._selectedDecoration.clear(),!p)return v.clearSelection(),!1;if(v.select(p.col,p.row,p.size),_){const h=v.registerMarker(-v.buffer.active.baseY-v.buffer.active.cursorY+p.row);if(h){const f=v.registerDecoration({marker:h,x:p.col,width:p.size,backgroundColor:_.activeMatchBackground,layer:"top",overviewRulerOptions:{color:_.activeMatchColorOverviewRuler}});if(f){const d=[];d.push(h),d.push(f.onRender(m=>this._applyStyles(m,_.activeMatchBorder,!0))),d.push(f.onDispose(()=>(0,o.disposeArray)(d))),this._selectedDecoration.value={decoration:f,match:p,dispose(){f.dispose()}}}}}if(!y&&(p.row>=v.buffer.active.viewportY+v.rows||p.row<v.buffer.active.viewportY)){let h=p.row-v.buffer.active.viewportY;h-=Math.floor(v.rows/2),v.scrollLines(h)}return!0}_applyStyles(p,_,y){p.classList.contains("xterm-find-result-decoration")||(p.classList.add("xterm-find-result-decoration"),_&&(p.style.outline=`1px solid ${_}`)),y&&p.classList.add("xterm-find-active-result-decoration")}_createResultDecoration(p,_){const y=this._terminal,v=y.registerMarker(-y.buffer.active.baseY-y.buffer.active.cursorY+p.row);if(!v)return;const h=y.registerDecoration({marker:v,x:p.col,width:p.size,backgroundColor:_.matchBackground,overviewRulerOptions:this._highlightedLines.has(v.line)?void 0:{color:_.matchOverviewRuler,position:"center"}});if(h){const f=[];f.push(v),f.push(h.onRender(d=>this._applyStyles(d,_.matchBorder,!1))),f.push(h.onDispose(()=>(0,o.disposeArray)(f)))}return h}}l.SearchAddon=g})(),a})())})(ow);var yT=ow.exports;/**
152
152
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
153
153
  * @license MIT
154
154
  *
@@ -171,7 +171,7 @@ void main() {
171
171
  * Fabrice Bellard's javascript vt100 for jslinux:
172
172
  * http://bellard.org/jslinux/
173
173
  * Copyright (c) 2011 Fabrice Bellard
174
- */function ev(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var kT=class{constructor(){this._st=0,this._pr=0}dispose(){var e,t;(e=this._seqHandler)==null||e.dispose(),(t=this._onChange)==null||t.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=ev(r[1]),s=ev(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(s<0)return!0;this.progress={state:n,value:s};break;case 2:case 4:if(s<0)return!0;this.progress={state:n,value:s||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){var t;if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),(t=this._onChange)==null||t.fire({state:this._st,value:this._pr})}};const LT=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,RT=/[.,;:!?]+$/,TT=[["(",")"],["[","]"],["{","}"]],tv=(e,t)=>e.split(t).length-1;function au(e){let t=e.trim();if(!t)return t;const r=()=>{t=t.replace(RT,"")};r();let n=!0;for(;n;){n=!1;for(const[s,a]of TT){if(!t.endsWith(a))continue;const l=tv(t,s);tv(t,a)>l&&(t=t.slice(0,-1),n=!0)}}return r(),t}const Ra=()=>typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);class DT{async readText(t){if(t!=="c")return"";try{return await navigator.clipboard.readText()}catch{return""}}async writeText(t,r){if(!(t!=="c"||!(r!=null&&r.trim())))try{await navigator.clipboard.writeText(r)}catch{}}}const MT="︎",uw=["⏺"],AT=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),PT=new RegExp(uw.map(AT).join("|"),"g");function IT(e){for(const t of uw)if(e.indexOf(t)!==-1)return e.replace(PT,`$&${MT}`);return e}function BT({sessionId:e,tmuxTarget:t,allowAttach:r=!0,sendMessage:n,subscribe:s,theme:a,fontSize:l,lineHeight:i,letterSpacing:o,fontFamily:c,useWebGL:g,onScrollChange:u}){const p=zo(),_=k.useRef(null),y=k.useRef(null),v=k.useRef(null),h=k.useRef(null),f=k.useRef(null),d=k.useRef(null),m=k.useRef(null),w=k.useRef(null),b=k.useRef(null),x=k.useRef(null),C=k.useRef(null),S=k.useRef(null),E=k.useRef(0),L=k.useRef(!1),A=k.useRef(null),M=k.useRef(null),D=k.useRef(null),N=k.useRef(n),H=k.useRef(u),F=k.useRef(g),$="\x1B[?2026h",O="\x1B[?2026l",R=k.useRef(""),P=k.useRef(null),B=k.useRef(null),j=2,W=16;k.useEffect(()=>{N.current=n},[n]),k.useEffect(()=>{H.current=u},[u]);const K=k.useCallback(()=>{const I=y.current;if(!I||!H.current)return;const V=I.buffer.active,U=!L.current&&V.viewportY>=V.baseY;H.current(U)},[]),ee=k.useCallback(I=>{if(L.current===I)return;L.current=I;const V=y.current;V&&I&&V.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l"),K()},[K]),Z=k.useCallback(()=>{const I=M.current;I&&(A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>{A.current=null,N.current({type:"tmux-check-copy-mode",sessionId:I})},150))},[]),z=k.useCallback(()=>{const I=y.current,V=v.current;if(!I||!V)return;V.fit();const U=M.current;U&&N.current({type:"terminal-resize",sessionId:U,cols:I.cols,rows:I.rows})},[]);return k.useEffect(()=>{var He;const I=_.current;if(!I||y.current)return;let V=!1;I.innerHTML="";const J=((ie,G)=>Math.round(ie*G)/ie)(l,i),X=new YR.Terminal({fontFamily:c,fontSize:l,lineHeight:J,letterSpacing:o,scrollback:0,cursorBlink:!1,cursorStyle:"underline",convertEol:!0,theme:a,screenReaderMode:p,minimumContrastRatio:4.5}),me=new ZR;X.loadAddon(me),X.loadAddon(new gT(void 0,new DT));const ce=new yT.SearchAddon;X.loadAddon(ce),m.current=ce;const fe=new CT;X.loadAddon(fe),w.current=fe;const Ee=new kT;X.loadAddon(Ee),b.current=Ee;const ae=()=>{if(!V){if(F.current)try{const ie=new Gg.WebglAddon;X.loadAddon(ie),h.current=ie}catch{}X.open(I),me.fit(),Te&&X.element&&X.element.appendChild(Te)}};(He=document.fonts)!=null&&He.ready?document.fonts.ready.then(ae).catch(ae):ae();let Te=null,je=null,pe=null;typeof document<"u"&&document.createElement&&(Te=document.createElement("div"),Te.className="xterm-hover",Te.style.cssText=`
174
+ */function ev(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var kT=class{constructor(){this._st=0,this._pr=0}dispose(){var e,t;(e=this._seqHandler)==null||e.dispose(),(t=this._onChange)==null||t.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=ev(r[1]),s=ev(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(s<0)return!0;this.progress={state:n,value:s};break;case 2:case 4:if(s<0)return!0;this.progress={state:n,value:s||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){var t;if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),(t=this._onChange)==null||t.fire({state:this._st,value:this._pr})}};const LT=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,RT=/[.,;:!?]+$/,TT=[["(",")"],["[","]"],["{","}"]],tv=(e,t)=>e.split(t).length-1;function au(e){let t=e.trim();if(!t)return t;const r=()=>{t=t.replace(RT,"")};r();let n=!0;for(;n;){n=!1;for(const[s,a]of TT){if(!t.endsWith(a))continue;const l=tv(t,s);tv(t,a)>l&&(t=t.slice(0,-1),n=!0)}}return r(),t}const Ra=()=>typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),DT="\x1B[200~\x1B[201~";class MT{async readText(t){if(t!=="c")return"";try{return await navigator.clipboard.readText()}catch{return""}}async writeText(t,r){if(!(t!=="c"||!(r!=null&&r.trim())))try{await navigator.clipboard.writeText(r)}catch{}}}const AT="︎",uw=["⏺"],PT=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),IT=new RegExp(uw.map(PT).join("|"),"g");function BT(e){for(const t of uw)if(e.indexOf(t)!==-1)return e.replace(IT,`$&${AT}`);return e}function OT({sessionId:e,tmuxTarget:t,allowAttach:r=!0,sendMessage:n,subscribe:s,theme:a,fontSize:l,lineHeight:i,letterSpacing:o,fontFamily:c,useWebGL:g,onScrollChange:u}){const p=zo(),_=k.useRef(null),y=k.useRef(null),v=k.useRef(null),h=k.useRef(null),f=k.useRef(null),d=k.useRef(null),m=k.useRef(null),w=k.useRef(null),b=k.useRef(null),x=k.useRef(null),C=k.useRef(null),S=k.useRef(null),E=k.useRef(0),L=k.useRef(!1),A=k.useRef(null),M=k.useRef(null),D=k.useRef(null),O=k.useRef(n),H=k.useRef(u),F=k.useRef(g),$="\x1B[?2026h",N="\x1B[?2026l",R=k.useRef(""),P=k.useRef(null),B=k.useRef(null),j=2,W=16;k.useEffect(()=>{O.current=n},[n]),k.useEffect(()=>{H.current=u},[u]);const K=k.useCallback(()=>{const I=y.current;if(!I||!H.current)return;const V=I.buffer.active,U=!L.current&&V.viewportY>=V.baseY;H.current(U)},[]),Z=k.useCallback(I=>{if(L.current===I)return;L.current=I;const V=y.current;V&&I&&V.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l"),K()},[K]),ee=k.useCallback(()=>{const I=M.current;I&&(A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>{A.current=null,O.current({type:"tmux-check-copy-mode",sessionId:I})},150))},[]),z=k.useCallback(()=>{const I=y.current,V=v.current;if(!I||!V)return;V.fit();const U=M.current;U&&O.current({type:"terminal-resize",sessionId:U,cols:I.cols,rows:I.rows})},[]);return k.useEffect(()=>{var He;const I=_.current;if(!I||y.current)return;let V=!1;I.innerHTML="";const J=((ie,G)=>Math.round(ie*G)/ie)(l,i),X=new YR.Terminal({fontFamily:c,fontSize:l,lineHeight:J,letterSpacing:o,scrollback:0,cursorBlink:!1,cursorStyle:"underline",convertEol:!0,theme:a,screenReaderMode:p,minimumContrastRatio:4.5}),me=new ZR;X.loadAddon(me),X.loadAddon(new gT(void 0,new MT));const ce=new yT.SearchAddon;X.loadAddon(ce),m.current=ce;const fe=new CT;X.loadAddon(fe),w.current=fe;const Ee=new kT;X.loadAddon(Ee),b.current=Ee;const ae=()=>{if(!V){if(F.current)try{const ie=new Gg.WebglAddon;X.loadAddon(ie),h.current=ie}catch{}X.open(I),me.fit(),Te&&X.element&&X.element.appendChild(Te)}};(He=document.fonts)!=null&&He.ready?document.fonts.ready.then(ae).catch(ae):ae();let Te=null,je=null,pe=null;typeof document<"u"&&document.createElement&&(Te=document.createElement("div"),Te.className="xterm-hover",Te.style.cssText=`
175
175
  position: absolute;
176
176
  display: none;
177
177
  z-index: 20;
@@ -185,7 +185,7 @@ void main() {
185
185
  pointer-events: none;
186
186
  max-width: 400px;
187
187
  word-break: break-all;
188
- `,je=document.createElement("div"),Te.appendChild(je),pe=document.createElement("div"),pe.style.color="var(--text-muted)",pe.style.marginTop="2px",pe.style.fontSize="11px",Te.appendChild(pe),d.current=Te);const _e=(ie,G)=>{if(!X.element||!Te||!je||!pe)return;const re=au(G);if(!re)return;const le=X.element.getBoundingClientRect(),te=re.length>60?re.slice(0,57)+"...":re;je.textContent=te,pe.textContent=`${Ra()?"⌘":"Ctrl"}+click to open`,Te.style.left=`${ie.clientX-le.left+10}px`,Te.style.top=`${ie.clientY-le.top+10}px`,Te.style.display="block"},ke=()=>{Te&&(Te.style.display="none")};let se=null,be=!1,oe=null;const he={activate:(ie,G)=>{if(!be&&(ie.metaKey||ie.ctrlKey)){const re=au(G);if(!re)return;window.open(re,"_blank","noopener")}},hover:(ie,G)=>{se=au(G)||null,_e(ie,G)},leave:()=>{se=null,ke()}},Le=ie=>{se&&(ie.metaKey||ie.ctrlKey)&&(ie.preventDefault(),ie.stopPropagation(),be=!0,window.open(se,"_blank","noopener"),oe&&clearTimeout(oe),oe=setTimeout(()=>{be=!1},100))};I.addEventListener("mousedown",Le,!0),X.options.linkHandler=he;const Re=new sT((ie,G)=>he.activate(ie,G),{urlRegex:LT,hover:(ie,G)=>he.hover(ie,G),leave:()=>he.leave()});X.loadAddon(Re),f.current=Re;let Ce=null,q=null;const Q=Ra()?"metaKey":"ctrlKey";X.attachCustomKeyEventHandler(ie=>{if((ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="c"&&X.hasSelection()){const G=X.getSelection();return G!=null&&G.trim()&&navigator.clipboard&&navigator.clipboard.writeText(G),!1}if(Ra()&&!p&&ie.ctrlKey&&!ie.metaKey&&ie.key.toLowerCase()==="v"&&ie.type==="keydown")return M.current&&X.paste(""),!M.current;if(ie[Q]&&ie.key.toLowerCase()==="v"&&ie.type==="keydown"){q!==null&&(clearTimeout(q),q=null),Ce=null;const G=new Promise(re=>{q=setTimeout(()=>{q=null,Ce=null,re(null)},100),Ce=le=>{q!==null&&(clearTimeout(q),q=null),re(le)}});return(async()=>{try{const re=M.current;if(!re)return;let le=await G;if(le==null)try{le=await navigator.clipboard.readText()}catch{le=""}if(!le&&Ra()&&!p)try{const te=await fetch("/api/clipboard-file-path");if(te.ok){const{path:ue}=await te.json();if(ue){N.current({type:"terminal-input",sessionId:re,data:ue});return}}}catch{}le&&X.paste(le)}finally{Ce=null}})(),!1}if(ie.ctrlKey&&ie.key==="Backspace"&&ie.type==="keydown"){const G=M.current;return G&&N.current({type:"terminal-input",sessionId:G,data:""}),!1}return!0});const ge=ie=>{var le;if(!Ce)return;ie.preventDefault(),ie.stopPropagation();const G=((le=ie.clipboardData)==null?void 0:le.getData("text/plain"))??"",re=Ce;Ce=null,re(G)};return I.addEventListener("paste",ge,{capture:!0}),X.onData(ie=>{const G=M.current;if(G){const re=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(ie);if(L.current&&re)return;L.current&&(N.current({type:"tmux-cancel-copy-mode",sessionId:G}),ee(!1)),N.current({type:"terminal-input",sessionId:G,data:ie})}}),X.attachCustomWheelEventHandler(ie=>{const G=M.current;if(!G)return!0;const re=ie.target;if(re!=null&&re.closest('input, textarea, [contenteditable="true"], .xterm-hover')||X.hasSelection()||ie.shiftKey)return!0;const le=30;E.current+=ie.deltaY;const te=X.cols,ue=X.rows,Oe=Math.floor(te/2),Fe=Math.floor(ue/2);let De=!1,Be=!1;for(;Math.abs(E.current)>=le;){Be=!0;const Pe=E.current>0;E.current+=Pe?-le:le;const Ue=Pe?65:64;Pe||(De=!0),N.current({type:"terminal-input",sessionId:G,data:`\x1B[<${Ue};${Oe};${Fe}M`})}return De&&ee(!0),Be&&Z(),!1}),y.current=X,v.current=me,()=>{if(V=!0,oe&&clearTimeout(oe),se=null,I.removeEventListener("mousedown",Le,!0),I.removeEventListener("paste",ge,!0),q!==null&&(clearTimeout(q),q=null),Ce=null,d.current&&(d.current.remove(),d.current=null),f.current){try{f.current.dispose()}catch{}f.current=null}if(h.current){try{h.current.dispose()}catch{}h.current=null}try{X.dispose()}catch{}I&&(I.innerHTML=""),y.current=null,v.current=null,m.current=null,w.current=null,b.current=null,S.current&&window.clearTimeout(S.current),A.current!==null&&window.clearTimeout(A.current)}},[z]),k.useEffect(()=>{y.current&&(y.current.options.theme=a)},[a]),k.useEffect(()=>{const I=y.current,V=v.current;if(I&&V){I.options.fontFamily=c,I.options.fontSize=l,I.options.lineHeight=Math.round(l*i)/l,I.options.letterSpacing=o,V.fit();const U=M.current;U&&N.current({type:"terminal-resize",sessionId:U,cols:I.cols,rows:I.rows})}},[l,i,o,c]),k.useEffect(()=>{const I=y.current;if(!I)return;const V=F.current;if(F.current=g,V!==g){if(g){if(!h.current)try{const U=new Gg.WebglAddon;I.loadAddon(U),h.current=U}catch{}}else if(h.current){try{h.current.dispose()}catch{}h.current=null}}},[g]),k.useEffect(()=>{const I=y.current;if(!I)return;const V=M.current,U=D.current;if(!r){V&&(n({type:"terminal-detach",sessionId:V}),M.current=null,D.current=null,L.current=!1),I.reset();return}if(V&&V!==e&&(n({type:"terminal-detach",sessionId:V}),M.current=null,D.current=null,L.current=!1),e&&(e!==V||t!==U)){I.reset();const J=v.current;J&&J.fit(),n({type:"terminal-attach",sessionId:e,tmuxTarget:t??void 0,cols:I.cols,rows:I.rows}),M.current=e,D.current=t??null,n({type:"tmux-check-copy-mode",sessionId:e}),C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{I.scrollToBottom(),K(),I.focus()},300)}!e&&V&&(M.current=null,D.current=null)},[e,t,r,n,K]),k.useEffect(()=>{const I=()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null),B.current!==null&&(window.clearTimeout(B.current),B.current=null);const J=y.current,X=R.current;!J||!X||(R.current="",J.write($+X+O,()=>{K()}))},V=()=>{P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(I,j),B.current===null&&(B.current=window.setTimeout(I,W))},U=s(J=>{const X=M.current;J.type==="terminal-output"&&X&&J.sessionId===X&&(R.current+=p?IT(J.data):J.data,V()),J.type==="tmux-copy-mode-status"&&X&&J.sessionId===X&&ee(J.inCopyMode)});return()=>{U(),I()}},[s,K,ee]),k.useEffect(()=>{const I=_.current,V=y.current,U=v.current;if(!I||!V||!U)return;const J=()=>{x.current&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{z()},150)},X=new ResizeObserver(J);return X.observe(I),J(),()=>{X.disconnect(),x.current&&window.clearTimeout(x.current)}},[]),{containerRef:_,terminalRef:y,searchAddonRef:m,serializeAddonRef:w,progressAddonRef:b,inTmuxCopyModeRef:L,setTmuxCopyMode:ee}}function OT(e="(max-width: 767px)"){const[t,r]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(e),s=()=>r(n.matches);return s(),typeof n.addEventListener=="function"?(n.addEventListener("change",s),()=>n.removeEventListener("change",s)):(n.addListener(s),()=>n.removeListener(s))},[e]),t}function NT(e,t,r){k.useEffect(()=>{if(!t)return;const n=s=>{e.current&&!e.current.contains(s.target)&&r()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t,r])}function jT(e,t){k.useEffect(()=>{if(!e)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),t())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t])}function FT({enabled:e,isOpen:t,onOpen:r,edgeThresholdPx:n=30,swipeDistancePx:s=50,swipeRatio:a=1.5}){const l=k.useRef(!1);return k.useEffect(()=>{if(!e)return;let i=0,o=0,c=!1;const g=p=>{if(t)return;const _=p.touches[0];_.clientX<=n?(i=_.clientX,o=_.clientY,c=!0,l.current=!0):c=!1},u=p=>{if(l.current=!1,!c||t)return;const _=p.changedTouches[0],y=_.clientX-i,v=Math.abs(_.clientY-o);y>=s&&y>v*a&&r(),c=!1};return document.addEventListener("touchstart",g,{passive:!0}),document.addEventListener("touchend",u,{passive:!0}),()=>{l.current=!1,document.removeEventListener("touchstart",g),document.removeEventListener("touchend",u)}},[e,t,r,n,s,a]),l}const Ol=Yd()(Jd(e=>({theme:"dark",setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="dark"?"light":"dark"}))}),{name:"agentboard-theme",storage:ic(()=>Qd)})),$T={dark:{background:"#2d2d2d",foreground:"#d4d4d4",cursor:"#3b82f6",cursorAccent:"#2d2d2d",selectionBackground:"rgba(59, 130, 246, 0.35)",selectionForeground:"#ffffff",black:"#808080",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#d4d4d4",brightBlack:"#a0a0a0",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},light:{background:"#fafafa",foreground:"#171717",cursor:"#2563eb",cursorAccent:"#fafafa",selectionBackground:"rgba(37, 99, 235, 0.2)",selectionForeground:"#000000",black:"#171717",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f5f5f5",brightBlack:"#737373",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"}},HT={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},zT=150,UT=250,WT=400,rv=1500,VT=15,Us=70;function lu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}function KT(e,t){const r=Math.sqrt(e*e+t*t);if(r<VT)return{direction:null,distance:0};const n=Math.atan2(t,e)*(180/Math.PI);let s;return n>=-45&&n<45?s="right":n>=45&&n<135?s="down":n>=-135&&n<-45?s="up":s="left",{direction:s,distance:r}}function GT(e){const t=Us-20,r=Math.min(e/t,1);return rv-r*(rv-WT)}function qT({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[s,a]=k.useState(!1),[l,i]=k.useState(null),[o,c]=k.useState({x:0,y:0}),[g,u]=k.useState({x:0,y:0}),p=k.useRef(null),_=k.useRef(null),y=k.useRef(null),v=k.useRef(!1),h=k.useRef(null),f=k.useRef(0),d=k.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null),_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),m=k.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),w=k.useCallback(D=>{const N=GT(f.current);y.current=setTimeout(()=>{h.current&&(lu(5),e(D),w(D))},N)},[e]),b=k.useCallback((D,N)=>{if(!D||t)return;const H=HT[D];f.current=N,lu(8),e(H),m(),_.current=setTimeout(()=>{w(H)},UT)},[t,e,m,w]),x=k.useCallback((D,N)=>{const H=D-o.x,F=N-o.y,$=Math.sqrt(H*H+F*F),O=Math.min($,Us-20),R=$>0?O/$:0;u({x:H*R,y:F*R});const{direction:P,distance:B}=KT(H,F);f.current=B,P!==h.current&&(h.current=P,i(P),m(),P&&b(P,B))},[o,m,b]),C=k.useCallback(()=>{a(!1),i(null),u({x:0,y:0}),m(),h.current=null,v.current&&(r==null||r())},[m,r]),S=k.useCallback(D=>{if(t)return;D.preventDefault(),D.stopPropagation();const N=D.touches[0];v.current=(n==null?void 0:n())??!1,p.current=setTimeout(()=>{lu(15),c({x:N.clientX,y:N.clientY-80}),u({x:0,y:0}),a(!0)},zT)},[t,n]),E=k.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),!s)return;const N=D.touches[0];x(N.clientX,N.clientY)},[s,x]),L=k.useCallback(D=>{D.preventDefault(),D.stopPropagation(),p.current&&(clearTimeout(p.current),p.current=null),s&&C()},[s,C]),A=k.useCallback(D=>{D.preventDefault(),d(),C()},[d,C]);k.useEffect(()=>()=>{d()},[d]);const M=[{dir:"up",angle:-90,label:"↑"},{dir:"right",angle:0,label:"→"},{dir:"down",angle:90,label:"↓"},{dir:"left",angle:180,label:"←"}];return T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button","aria-label":"Arrow keys",className:`
188
+ `,je=document.createElement("div"),Te.appendChild(je),pe=document.createElement("div"),pe.style.color="var(--text-muted)",pe.style.marginTop="2px",pe.style.fontSize="11px",Te.appendChild(pe),d.current=Te);const _e=(ie,G)=>{if(!X.element||!Te||!je||!pe)return;const re=au(G);if(!re)return;const le=X.element.getBoundingClientRect(),te=re.length>60?re.slice(0,57)+"...":re;je.textContent=te,pe.textContent=`${Ra()?"⌘":"Ctrl"}+click to open`,Te.style.left=`${ie.clientX-le.left+10}px`,Te.style.top=`${ie.clientY-le.top+10}px`,Te.style.display="block"},ke=()=>{Te&&(Te.style.display="none")};let se=null,be=!1,oe=null;const he={activate:(ie,G)=>{if(!be&&(ie.metaKey||ie.ctrlKey)){const re=au(G);if(!re)return;window.open(re,"_blank","noopener")}},hover:(ie,G)=>{se=au(G)||null,_e(ie,G)},leave:()=>{se=null,ke()}},Le=ie=>{se&&(ie.metaKey||ie.ctrlKey)&&(ie.preventDefault(),ie.stopPropagation(),be=!0,window.open(se,"_blank","noopener"),oe&&clearTimeout(oe),oe=setTimeout(()=>{be=!1},100))};I.addEventListener("mousedown",Le,!0),X.options.linkHandler=he;const Re=new sT((ie,G)=>he.activate(ie,G),{urlRegex:LT,hover:(ie,G)=>he.hover(ie,G),leave:()=>he.leave()});X.loadAddon(Re),f.current=Re;let Ce=null,q=null;const Q=Ra()?"metaKey":"ctrlKey";X.attachCustomKeyEventHandler(ie=>{if((ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="c"&&X.hasSelection()){const G=X.getSelection();return G!=null&&G.trim()&&navigator.clipboard&&navigator.clipboard.writeText(G),!1}if(Ra()&&!p&&ie.ctrlKey&&!ie.metaKey&&ie.key.toLowerCase()==="v"&&ie.type==="keydown")return M.current&&(L.current&&(O.current({type:"tmux-cancel-copy-mode",sessionId:M.current}),Z(!1)),O.current({type:"terminal-input",sessionId:M.current,data:DT})),!M.current;if(ie[Q]&&ie.key.toLowerCase()==="v"&&ie.type==="keydown"){q!==null&&(clearTimeout(q),q=null),Ce=null;const G=new Promise(re=>{q=setTimeout(()=>{q=null,Ce=null,re(null)},100),Ce=le=>{q!==null&&(clearTimeout(q),q=null),re(le)}});return(async()=>{try{const re=M.current;if(!re)return;let le=await G;if(le==null)try{le=await navigator.clipboard.readText()}catch{le=""}if(!le&&Ra()&&!p)try{const te=await fetch("/api/clipboard-file-path");if(te.ok){const{path:ue}=await te.json();if(ue){O.current({type:"terminal-input",sessionId:re,data:ue});return}}}catch{}le&&X.paste(le)}finally{Ce=null}})(),!1}if(ie.ctrlKey&&ie.key==="Backspace"&&ie.type==="keydown"){const G=M.current;return G&&O.current({type:"terminal-input",sessionId:G,data:""}),!1}return!0});const ge=ie=>{var le;if(!Ce)return;ie.preventDefault(),ie.stopPropagation();const G=((le=ie.clipboardData)==null?void 0:le.getData("text/plain"))??"",re=Ce;Ce=null,re(G)};return I.addEventListener("paste",ge,{capture:!0}),X.onData(ie=>{const G=M.current;if(G){const re=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(ie);if(L.current&&re)return;L.current&&(O.current({type:"tmux-cancel-copy-mode",sessionId:G}),Z(!1)),O.current({type:"terminal-input",sessionId:G,data:ie})}}),X.attachCustomWheelEventHandler(ie=>{const G=M.current;if(!G)return!0;const re=ie.target;if(re!=null&&re.closest('input, textarea, [contenteditable="true"], .xterm-hover')||X.hasSelection()||ie.shiftKey)return!0;const le=30;E.current+=ie.deltaY;const te=X.cols,ue=X.rows,Oe=Math.floor(te/2),Fe=Math.floor(ue/2);let De=!1,Be=!1;for(;Math.abs(E.current)>=le;){Be=!0;const Pe=E.current>0;E.current+=Pe?-le:le;const Ue=Pe?65:64;Pe||(De=!0),O.current({type:"terminal-input",sessionId:G,data:`\x1B[<${Ue};${Oe};${Fe}M`})}return De&&Z(!0),Be&&ee(),!1}),y.current=X,v.current=me,()=>{if(V=!0,oe&&clearTimeout(oe),se=null,I.removeEventListener("mousedown",Le,!0),I.removeEventListener("paste",ge,!0),q!==null&&(clearTimeout(q),q=null),Ce=null,d.current&&(d.current.remove(),d.current=null),f.current){try{f.current.dispose()}catch{}f.current=null}if(h.current){try{h.current.dispose()}catch{}h.current=null}try{X.dispose()}catch{}I&&(I.innerHTML=""),y.current=null,v.current=null,m.current=null,w.current=null,b.current=null,S.current&&window.clearTimeout(S.current),A.current!==null&&window.clearTimeout(A.current)}},[z]),k.useEffect(()=>{y.current&&(y.current.options.theme=a)},[a]),k.useEffect(()=>{const I=y.current,V=v.current;if(I&&V){I.options.fontFamily=c,I.options.fontSize=l,I.options.lineHeight=Math.round(l*i)/l,I.options.letterSpacing=o,V.fit();const U=M.current;U&&O.current({type:"terminal-resize",sessionId:U,cols:I.cols,rows:I.rows})}},[l,i,o,c]),k.useEffect(()=>{const I=y.current;if(!I)return;const V=F.current;if(F.current=g,V!==g){if(g){if(!h.current)try{const U=new Gg.WebglAddon;I.loadAddon(U),h.current=U}catch{}}else if(h.current){try{h.current.dispose()}catch{}h.current=null}}},[g]),k.useEffect(()=>{const I=y.current;if(!I)return;const V=M.current,U=D.current;if(!r){V&&(n({type:"terminal-detach",sessionId:V}),M.current=null,D.current=null,L.current=!1),I.reset();return}if(V&&V!==e&&(n({type:"terminal-detach",sessionId:V}),M.current=null,D.current=null,L.current=!1),e&&(e!==V||t!==U)){I.reset();const J=v.current;J&&J.fit(),n({type:"terminal-attach",sessionId:e,tmuxTarget:t??void 0,cols:I.cols,rows:I.rows}),M.current=e,D.current=t??null,n({type:"tmux-check-copy-mode",sessionId:e}),C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{I.scrollToBottom(),K(),I.focus()},300)}!e&&V&&(M.current=null,D.current=null)},[e,t,r,n,K]),k.useEffect(()=>{const I=()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null),B.current!==null&&(window.clearTimeout(B.current),B.current=null);const J=y.current,X=R.current;!J||!X||(R.current="",J.write($+X+N,()=>{K()}))},V=()=>{P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(I,j),B.current===null&&(B.current=window.setTimeout(I,W))},U=s(J=>{const X=M.current;J.type==="terminal-output"&&X&&J.sessionId===X&&(R.current+=p?BT(J.data):J.data,V()),J.type==="tmux-copy-mode-status"&&X&&J.sessionId===X&&Z(J.inCopyMode)});return()=>{U(),I()}},[s,K,Z]),k.useEffect(()=>{const I=_.current,V=y.current,U=v.current;if(!I||!V||!U)return;const J=()=>{x.current&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{z()},150)},X=new ResizeObserver(J);return X.observe(I),J(),()=>{X.disconnect(),x.current&&window.clearTimeout(x.current)}},[]),{containerRef:_,terminalRef:y,searchAddonRef:m,serializeAddonRef:w,progressAddonRef:b,inTmuxCopyModeRef:L,setTmuxCopyMode:Z}}function NT(e="(max-width: 767px)"){const[t,r]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(e),s=()=>r(n.matches);return s(),typeof n.addEventListener=="function"?(n.addEventListener("change",s),()=>n.removeEventListener("change",s)):(n.addListener(s),()=>n.removeListener(s))},[e]),t}function jT(e,t,r){k.useEffect(()=>{if(!t)return;const n=s=>{e.current&&!e.current.contains(s.target)&&r()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t,r])}function FT(e,t){k.useEffect(()=>{if(!e)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),t())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t])}function $T({enabled:e,isOpen:t,onOpen:r,edgeThresholdPx:n=30,swipeDistancePx:s=50,swipeRatio:a=1.5}){const l=k.useRef(!1);return k.useEffect(()=>{if(!e)return;let i=0,o=0,c=!1;const g=p=>{if(t)return;const _=p.touches[0];_.clientX<=n?(i=_.clientX,o=_.clientY,c=!0,l.current=!0):c=!1},u=p=>{if(l.current=!1,!c||t)return;const _=p.changedTouches[0],y=_.clientX-i,v=Math.abs(_.clientY-o);y>=s&&y>v*a&&r(),c=!1};return document.addEventListener("touchstart",g,{passive:!0}),document.addEventListener("touchend",u,{passive:!0}),()=>{l.current=!1,document.removeEventListener("touchstart",g),document.removeEventListener("touchend",u)}},[e,t,r,n,s,a]),l}const Ol=Yd()(Jd(e=>({theme:"dark",setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="dark"?"light":"dark"}))}),{name:"agentboard-theme",storage:ic(()=>Qd)})),HT={dark:{background:"#2d2d2d",foreground:"#d4d4d4",cursor:"#3b82f6",cursorAccent:"#2d2d2d",selectionBackground:"rgba(59, 130, 246, 0.35)",selectionForeground:"#ffffff",black:"#808080",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#d4d4d4",brightBlack:"#a0a0a0",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},light:{background:"#fafafa",foreground:"#171717",cursor:"#2563eb",cursorAccent:"#fafafa",selectionBackground:"rgba(37, 99, 235, 0.2)",selectionForeground:"#000000",black:"#171717",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f5f5f5",brightBlack:"#737373",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"}},zT={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},UT=150,WT=250,VT=400,rv=1500,KT=15,Us=70;function lu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}function GT(e,t){const r=Math.sqrt(e*e+t*t);if(r<KT)return{direction:null,distance:0};const n=Math.atan2(t,e)*(180/Math.PI);let s;return n>=-45&&n<45?s="right":n>=45&&n<135?s="down":n>=-135&&n<-45?s="up":s="left",{direction:s,distance:r}}function qT(e){const t=Us-20,r=Math.min(e/t,1);return rv-r*(rv-VT)}function XT({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[s,a]=k.useState(!1),[l,i]=k.useState(null),[o,c]=k.useState({x:0,y:0}),[g,u]=k.useState({x:0,y:0}),p=k.useRef(null),_=k.useRef(null),y=k.useRef(null),v=k.useRef(!1),h=k.useRef(null),f=k.useRef(0),d=k.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null),_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),m=k.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),w=k.useCallback(D=>{const O=qT(f.current);y.current=setTimeout(()=>{h.current&&(lu(5),e(D),w(D))},O)},[e]),b=k.useCallback((D,O)=>{if(!D||t)return;const H=zT[D];f.current=O,lu(8),e(H),m(),_.current=setTimeout(()=>{w(H)},WT)},[t,e,m,w]),x=k.useCallback((D,O)=>{const H=D-o.x,F=O-o.y,$=Math.sqrt(H*H+F*F),N=Math.min($,Us-20),R=$>0?N/$:0;u({x:H*R,y:F*R});const{direction:P,distance:B}=GT(H,F);f.current=B,P!==h.current&&(h.current=P,i(P),m(),P&&b(P,B))},[o,m,b]),C=k.useCallback(()=>{a(!1),i(null),u({x:0,y:0}),m(),h.current=null,v.current&&(r==null||r())},[m,r]),S=k.useCallback(D=>{if(t)return;D.preventDefault(),D.stopPropagation();const O=D.touches[0];v.current=(n==null?void 0:n())??!1,p.current=setTimeout(()=>{lu(15),c({x:O.clientX,y:O.clientY-80}),u({x:0,y:0}),a(!0)},UT)},[t,n]),E=k.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),!s)return;const O=D.touches[0];x(O.clientX,O.clientY)},[s,x]),L=k.useCallback(D=>{D.preventDefault(),D.stopPropagation(),p.current&&(clearTimeout(p.current),p.current=null),s&&C()},[s,C]),A=k.useCallback(D=>{D.preventDefault(),d(),C()},[d,C]);k.useEffect(()=>()=>{d()},[d]);const M=[{dir:"up",angle:-90,label:"↑"},{dir:"right",angle:0,label:"→"},{dir:"down",angle:90,label:"↓"},{dir:"left",angle:180,label:"←"}];return T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button","aria-label":"Arrow keys",className:`
189
189
  terminal-key
190
190
  flex items-center justify-center
191
191
  h-11 min-w-[2.75rem] px-2.5
@@ -197,21 +197,21 @@ void main() {
197
197
  text-secondary
198
198
  ${t?"opacity-50":""}
199
199
  ${s?"bg-hover scale-95":""}
200
- `,style:{touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},onTouchStart:S,onTouchMove:E,onTouchEnd:L,onTouchCancel:A,disabled:t,children:T.jsx(Yb,{width:20,height:20})}),s&&T.jsxs("div",{className:"fixed inset-0 z-50",style:{touchAction:"none"},onTouchMove:E,onTouchEnd:L,onTouchCancel:A,children:[T.jsx("div",{className:"absolute inset-0 bg-black/20"}),T.jsxs("div",{className:"absolute",style:{left:o.x,top:o.y,transform:"translate(-50%, -50%)"},children:[T.jsxs("div",{className:"relative rounded-full bg-black/40 backdrop-blur-md border-2 border-white/20",style:{width:Us*2,height:Us*2},children:[M.map(({dir:D,angle:N,label:H})=>T.jsx("div",{className:`
200
+ `,style:{touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},onTouchStart:S,onTouchMove:E,onTouchEnd:L,onTouchCancel:A,disabled:t,children:T.jsx(Yb,{width:20,height:20})}),s&&T.jsxs("div",{className:"fixed inset-0 z-50",style:{touchAction:"none"},onTouchMove:E,onTouchEnd:L,onTouchCancel:A,children:[T.jsx("div",{className:"absolute inset-0 bg-black/20"}),T.jsxs("div",{className:"absolute",style:{left:o.x,top:o.y,transform:"translate(-50%, -50%)"},children:[T.jsxs("div",{className:"relative rounded-full bg-black/40 backdrop-blur-md border-2 border-white/20",style:{width:Us*2,height:Us*2},children:[M.map(({dir:D,angle:O,label:H})=>T.jsx("div",{className:`
201
201
  absolute text-2xl font-bold
202
202
  transition-all duration-75
203
203
  ${l===D?"text-accent scale-125":"text-white/60"}
204
204
  `,style:{left:"50%",top:"50%",transform:`
205
205
  translate(-50%, -50%)
206
- rotate(${N}deg)
206
+ rotate(${O}deg)
207
207
  translateX(${Us-25}px)
208
- rotate(${-N}deg)
208
+ rotate(${-O}deg)
209
209
  `},children:H},D)),T.jsx("div",{className:`
210
210
  absolute w-12 h-12 rounded-full
211
211
  bg-white/90 shadow-lg
212
212
  border-2 transition-colors duration-75
213
213
  ${l?"border-accent bg-accent/20":"border-white/40"}
214
- `,style:{left:"50%",top:"50%",transform:`translate(calc(-50% + ${g.x}px), calc(-50% + ${g.y}px))`},children:T.jsx("div",{className:"absolute inset-2 rounded-full bg-white/50"})})]}),l&&T.jsx("div",{className:"absolute -bottom-8 left-1/2 -translate-x-1/2 text-white text-sm font-medium bg-black/50 px-3 py-1 rounded-full",children:l.toUpperCase()})]})]})]})}const XT=150,si=56,oi=48,Tr=6,Io=8,YT=20+Tr+2,Vh=3*si+2*Tr+2*Io,hw=3*oi+2*Tr+2*Io+YT;function cu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}const dw=[["7","8","9"],["4","5","6"],["1","2","3"]];function JT(e,t,r){var y;const n=r.x-Vh/2,s=r.y-hw/2,a=e-n-Io,l=t-s-Io,i=3*si+2*Tr,o=3*oi+2*Tr;if(a<0||a>i||l<0||l>o)return null;const c=Math.floor(a/(si+Tr)),g=Math.floor(l/(oi+Tr));if(c<0||c>2||g<0||g>2)return null;const u=c*(si+Tr),p=g*(oi+Tr);return a>u+si||l>p+oi?null:((y=dw[g])==null?void 0:y[c])||null}function QT({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[s,a]=k.useState(!1),[l,i]=k.useState(null),[o,c]=k.useState({x:0,y:0}),g=k.useRef(null),u=k.useRef(!1),p=k.useRef(!1),_=k.useCallback(()=>{a(!1),i(null),p.current=!1,u.current&&(r==null||r())},[r]),y=k.useCallback(m=>{if(t)return;m.preventDefault(),m.stopPropagation();const w=m.touches[0];u.current=(n==null?void 0:n())??!1,p.current=!1,g.current=setTimeout(()=>{cu(15);const b=10;let x=w.clientX,C=w.clientY-120;x=Math.max(b+Vh/2,Math.min(window.innerWidth-b-Vh/2,x)),C=Math.max(b+hw/2,C),c({x,y:C}),a(!0)},XT)},[t,n]),v=k.useCallback((m,w)=>JT(m,w,o),[o]),h=k.useCallback(m=>{if(m.preventDefault(),m.stopPropagation(),!s)return;const w=m.touches[0],b=v(w.clientX,w.clientY);b!==l&&(i(b),b&&cu(5))},[s,l,v]),f=k.useCallback(m=>{m.preventDefault(),m.stopPropagation(),g.current&&(clearTimeout(g.current),g.current=null),s&&l&&!p.current&&(cu(10),e(l),p.current=!0),_()},[s,l,e,_]),d=k.useCallback(m=>{m.preventDefault(),g.current&&(clearTimeout(g.current),g.current=null),_()},[_]);return k.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button",className:`
214
+ `,style:{left:"50%",top:"50%",transform:`translate(calc(-50% + ${g.x}px), calc(-50% + ${g.y}px))`},children:T.jsx("div",{className:"absolute inset-2 rounded-full bg-white/50"})})]}),l&&T.jsx("div",{className:"absolute -bottom-8 left-1/2 -translate-x-1/2 text-white text-sm font-medium bg-black/50 px-3 py-1 rounded-full",children:l.toUpperCase()})]})]})]})}const YT=150,si=56,oi=48,Tr=6,Io=8,JT=20+Tr+2,Vh=3*si+2*Tr+2*Io,hw=3*oi+2*Tr+2*Io+JT;function cu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}const dw=[["7","8","9"],["4","5","6"],["1","2","3"]];function QT(e,t,r){var y;const n=r.x-Vh/2,s=r.y-hw/2,a=e-n-Io,l=t-s-Io,i=3*si+2*Tr,o=3*oi+2*Tr;if(a<0||a>i||l<0||l>o)return null;const c=Math.floor(a/(si+Tr)),g=Math.floor(l/(oi+Tr));if(c<0||c>2||g<0||g>2)return null;const u=c*(si+Tr),p=g*(oi+Tr);return a>u+si||l>p+oi?null:((y=dw[g])==null?void 0:y[c])||null}function ZT({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[s,a]=k.useState(!1),[l,i]=k.useState(null),[o,c]=k.useState({x:0,y:0}),g=k.useRef(null),u=k.useRef(!1),p=k.useRef(!1),_=k.useCallback(()=>{a(!1),i(null),p.current=!1,u.current&&(r==null||r())},[r]),y=k.useCallback(m=>{if(t)return;m.preventDefault(),m.stopPropagation();const w=m.touches[0];u.current=(n==null?void 0:n())??!1,p.current=!1,g.current=setTimeout(()=>{cu(15);const b=10;let x=w.clientX,C=w.clientY-120;x=Math.max(b+Vh/2,Math.min(window.innerWidth-b-Vh/2,x)),C=Math.max(b+hw/2,C),c({x,y:C}),a(!0)},YT)},[t,n]),v=k.useCallback((m,w)=>QT(m,w,o),[o]),h=k.useCallback(m=>{if(m.preventDefault(),m.stopPropagation(),!s)return;const w=m.touches[0],b=v(w.clientX,w.clientY);b!==l&&(i(b),b&&cu(5))},[s,l,v]),f=k.useCallback(m=>{m.preventDefault(),m.stopPropagation(),g.current&&(clearTimeout(g.current),g.current=null),s&&l&&!p.current&&(cu(10),e(l),p.current=!0),_()},[s,l,e,_]),d=k.useCallback(m=>{m.preventDefault(),g.current&&(clearTimeout(g.current),g.current=null),_()},[_]);return k.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button",className:`
215
215
  terminal-key
216
216
  flex items-center justify-center
217
217
  h-11 min-w-[2.75rem] px-2.5
@@ -229,13 +229,13 @@ void main() {
229
229
  select-none
230
230
  transition-all duration-75
231
231
  ${l===m?"bg-accent text-white scale-110":"bg-white/90 text-gray-800"}
232
- `,style:{width:si,height:oi,WebkitUserSelect:"none",userSelect:"none"},children:m},w):T.jsx("div",{style:{width:si,height:oi}},w))}),T.jsx("div",{className:"text-center text-white text-sm font-medium select-none h-5",style:{marginTop:Tr+2},children:l?`Release to send "${l}"`:" "})]})})]})]})}const ZT=T.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:T.jsx("path",{d:"M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7.07L2.4 12l4.66-7H22v14zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"})}),eD=T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),T.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"})]}),tD=T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",ry:"2"}),T.jsx("line",{x1:"6",y1:"8",x2:"6",y2:"8"}),T.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"8"}),T.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"8"}),T.jsx("line",{x1:"18",y1:"8",x2:"18",y2:"8"}),T.jsx("line",{x1:"6",y1:"12",x2:"6",y2:"12"}),T.jsx("line",{x1:"10",y1:"12",x2:"10",y2:"12"}),T.jsx("line",{x1:"14",y1:"12",x2:"14",y2:"12"}),T.jsx("line",{x1:"18",y1:"12",x2:"18",y2:"12"}),T.jsx("line",{x1:"7",y1:"16",x2:"17",y2:"16"})]}),rD=[{label:"esc",key:"\x1B"}],nD=[{label:ZT,key:"",ariaLabel:"Delete word"},{label:T.jsx(jb,{width:18,height:18}),key:"\r",grow:!0,className:"bg-accent/20 text-accent border-accent/40",ariaLabel:"Enter"}];function Gn(){"vibrate"in navigator&&navigator.vibrate(10)}function uu(e,t){if(!t||e.length!==1)return{output:e,consumeCtrl:!1};const r=e.toUpperCase().charCodeAt(0);return r>=65&&r<=90?{output:String.fromCharCode(r-64),consumeCtrl:!0}:{output:e,consumeCtrl:!0}}const iD={working:"bg-working",waiting:"bg-waiting",permission:"bg-approval",unknown:"bg-muted"};function sD({onSendKey:e,disabled:t=!1,sessions:r,currentSessionId:n,onSelectSession:s,hideSessionSwitcher:a=!1,onRefocus:l,isKeyboardVisible:i,onEnterTextMode:o}){const[c,g]=k.useState(!1),[u,p]=k.useState(""),[_,y]=k.useState(!1),[v,h]=k.useState(!1),f=k.useRef(null),d=k.useRef(null),m=k.useRef(0),w=k.useRef(null);k.useEffect(()=>{c&&f.current&&f.current.focus()},[c]),k.useEffect(()=>{const F=w.current;if(!F)return;const $=O=>{t||F.contains(O.target)&&i!=null&&i()&&O.preventDefault()};return F.addEventListener("touchstart",$,{passive:!1,capture:!0}),()=>{F.removeEventListener("touchstart",$,{capture:!0})}},[t,i]),k.useEffect(()=>{if(!v||t||typeof document>"u")return;const F=$=>{const{output:O,consumeCtrl:R}=uu($.key,!0);R&&($.preventDefault(),$.stopPropagation(),Gn(),e(O),h(!1))};return document.addEventListener("keydown",F,{capture:!0}),()=>{document.removeEventListener("keydown",F,{capture:!0})}},[v,t,e]),k.useEffect(()=>{if(!c)return;const F=d.current;if(!F)return;const $=async O=>{var P;const R=(P=O.clipboardData)==null?void 0:P.items;if(R){for(const B of R)if(B.type.startsWith("image/")){O.preventDefault();const j=B.getAsFile();if(!j)continue;y(!0);try{const W=new FormData;W.append("image",j,`paste.${B.type.split("/")[1]||"png"}`);const K=await fetch("/api/paste-image",{method:"POST",body:W});if(K.ok){const{path:ee}=await K.json();e(ee),g(!1),p(""),l==null||l()}}finally{y(!1)}return}}};return F.addEventListener("paste",$),()=>F.removeEventListener("paste",$)},[c,e,l]);const b=F=>{if(t)return;const $=(i==null?void 0:i())??!1;Gn();const{output:O,consumeCtrl:R}=uu(F,v);R&&h(!1),e(O),$&&(l==null||l())},x=()=>{t||(Gn(),h(!v))},C=F=>{const{output:$,consumeCtrl:O}=uu(F,v);O&&h(!1),e($)},S=async()=>{if(t)return;const F=(i==null?void 0:i())??!1;Gn();try{const $=await navigator.clipboard.read();for(const O of $){const R=O.types.find(P=>P.startsWith("image/"));if(R){const P=await O.getType(R),B=new FormData;B.append("image",P,`paste.${R.split("/")[1]||"png"}`);const j=await fetch("/api/paste-image",{method:"POST",body:B});if(j.ok){const{path:W}=await j.json();e(W),F&&(l==null||l());return}}if(O.types.includes("text/plain")){const B=await(await O.getType("text/plain")).text();if(B){e(B),F&&(l==null||l());return}}}}catch{try{const $=await navigator.clipboard.readText();if($){e($),F&&(l==null||l());return}}catch{}}g(!0),p("")},E=()=>{u&&(Gn(),e(u)),g(!1),p(""),l==null||l()},L=()=>{g(!1),p(""),l==null||l()},A=F=>{Gn(),s(F)},M=()=>{t||(Gn(),i!=null&&i()?document.activeElement instanceof HTMLElement&&document.activeElement.blur():o==null||o())},D=r.length>1&&!a,N=F=>$=>{t||($.preventDefault(),$.stopPropagation(),m.current=Date.now(),F())},H=F=>()=>{t||Date.now()-m.current<700||F()};return T.jsxs("div",{ref:w,className:`terminal-controls flex flex-col gap-1.5 px-2 py-2.5 bg-elevated border-t border-border ${zo()?"":"md:hidden"}`,children:[D&&T.jsxs("div",{className:"relative -mx-2",children:[T.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-3 bg-gradient-to-r from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-3 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 px-3 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:r.map((F,$)=>{const O=F.id===n;return T.jsxs("button",{type:"button",className:`
232
+ `,style:{width:si,height:oi,WebkitUserSelect:"none",userSelect:"none"},children:m},w):T.jsx("div",{style:{width:si,height:oi}},w))}),T.jsx("div",{className:"text-center text-white text-sm font-medium select-none h-5",style:{marginTop:Tr+2},children:l?`Release to send "${l}"`:" "})]})})]})]})}const eD=T.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:T.jsx("path",{d:"M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7.07L2.4 12l4.66-7H22v14zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"})}),tD=T.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),T.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",ry:"1"})]}),rD=T.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",ry:"2"}),T.jsx("line",{x1:"6",y1:"8",x2:"6",y2:"8"}),T.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"8"}),T.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"8"}),T.jsx("line",{x1:"18",y1:"8",x2:"18",y2:"8"}),T.jsx("line",{x1:"6",y1:"12",x2:"6",y2:"12"}),T.jsx("line",{x1:"10",y1:"12",x2:"10",y2:"12"}),T.jsx("line",{x1:"14",y1:"12",x2:"14",y2:"12"}),T.jsx("line",{x1:"18",y1:"12",x2:"18",y2:"12"}),T.jsx("line",{x1:"7",y1:"16",x2:"17",y2:"16"})]}),nD=[{label:"esc",key:"\x1B"}],iD=[{label:eD,key:"",ariaLabel:"Delete word"},{label:T.jsx(jb,{width:18,height:18}),key:"\r",grow:!0,className:"bg-accent/20 text-accent border-accent/40",ariaLabel:"Enter"}];function Gn(){"vibrate"in navigator&&navigator.vibrate(10)}function uu(e,t){if(!t||e.length!==1)return{output:e,consumeCtrl:!1};const r=e.toUpperCase().charCodeAt(0);return r>=65&&r<=90?{output:String.fromCharCode(r-64),consumeCtrl:!0}:{output:e,consumeCtrl:!0}}const sD={working:"bg-working",waiting:"bg-waiting",permission:"bg-approval",unknown:"bg-muted"};function oD({onSendKey:e,disabled:t=!1,sessions:r,currentSessionId:n,onSelectSession:s,hideSessionSwitcher:a=!1,onRefocus:l,isKeyboardVisible:i,onEnterTextMode:o}){const[c,g]=k.useState(!1),[u,p]=k.useState(""),[_,y]=k.useState(!1),[v,h]=k.useState(!1),f=k.useRef(null),d=k.useRef(null),m=k.useRef(0),w=k.useRef(null);k.useEffect(()=>{c&&f.current&&f.current.focus()},[c]),k.useEffect(()=>{const F=w.current;if(!F)return;const $=N=>{t||F.contains(N.target)&&i!=null&&i()&&N.preventDefault()};return F.addEventListener("touchstart",$,{passive:!1,capture:!0}),()=>{F.removeEventListener("touchstart",$,{capture:!0})}},[t,i]),k.useEffect(()=>{if(!v||t||typeof document>"u")return;const F=$=>{const{output:N,consumeCtrl:R}=uu($.key,!0);R&&($.preventDefault(),$.stopPropagation(),Gn(),e(N),h(!1))};return document.addEventListener("keydown",F,{capture:!0}),()=>{document.removeEventListener("keydown",F,{capture:!0})}},[v,t,e]),k.useEffect(()=>{if(!c)return;const F=d.current;if(!F)return;const $=async N=>{var P;const R=(P=N.clipboardData)==null?void 0:P.items;if(R){for(const B of R)if(B.type.startsWith("image/")){N.preventDefault();const j=B.getAsFile();if(!j)continue;y(!0);try{const W=new FormData;W.append("image",j,`paste.${B.type.split("/")[1]||"png"}`);const K=await fetch("/api/paste-image",{method:"POST",body:W});if(K.ok){const{path:Z}=await K.json();e(Z),g(!1),p(""),l==null||l()}}finally{y(!1)}return}}};return F.addEventListener("paste",$),()=>F.removeEventListener("paste",$)},[c,e,l]);const b=F=>{if(t)return;const $=(i==null?void 0:i())??!1;Gn();const{output:N,consumeCtrl:R}=uu(F,v);R&&h(!1),e(N),$&&(l==null||l())},x=()=>{t||(Gn(),h(!v))},C=F=>{const{output:$,consumeCtrl:N}=uu(F,v);N&&h(!1),e($)},S=async()=>{if(t)return;const F=(i==null?void 0:i())??!1;Gn();try{const $=await navigator.clipboard.read();for(const N of $){const R=N.types.find(P=>P.startsWith("image/"));if(R){const P=await N.getType(R),B=new FormData;B.append("image",P,`paste.${R.split("/")[1]||"png"}`);const j=await fetch("/api/paste-image",{method:"POST",body:B});if(j.ok){const{path:W}=await j.json();e(W),F&&(l==null||l());return}}if(N.types.includes("text/plain")){const B=await(await N.getType("text/plain")).text();if(B){e(B),F&&(l==null||l());return}}}}catch{try{const $=await navigator.clipboard.readText();if($){e($),F&&(l==null||l());return}}catch{}}g(!0),p("")},E=()=>{u&&(Gn(),e(u)),g(!1),p(""),l==null||l()},L=()=>{g(!1),p(""),l==null||l()},A=F=>{Gn(),s(F)},M=()=>{t||(Gn(),i!=null&&i()?document.activeElement instanceof HTMLElement&&document.activeElement.blur():o==null||o())},D=r.length>1&&!a,O=F=>$=>{t||($.preventDefault(),$.stopPropagation(),m.current=Date.now(),F())},H=F=>()=>{t||Date.now()-m.current<700||F()};return T.jsxs("div",{ref:w,className:`terminal-controls flex flex-col gap-1.5 px-2 py-2.5 bg-elevated border-t border-border ${zo()?"":"md:hidden"}`,children:[D&&T.jsxs("div",{className:"relative -mx-2",children:[T.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-3 bg-gradient-to-r from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-3 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 px-3 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:r.map((F,$)=>{const N=F.id===n;return T.jsxs("button",{type:"button",className:`
233
233
  terminal-key flex items-center justify-center gap-1.5 shrink-0 snap-start
234
234
  h-8 min-w-[3rem] px-2.5 text-xs font-medium rounded-md
235
235
  active:scale-95 transition-transform duration-75
236
236
  select-none touch-manipulation
237
- ${O?"bg-accent/20 text-accent border border-accent/40":"bg-surface border border-border text-secondary"}
238
- `,onClick:()=>A(F.id),children:[T.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${iD[F.status]}`}),T.jsx("span",{className:"truncate",children:$+1})]},F.id)})})]}),T.jsxs("div",{className:"flex items-center gap-1.5",children:[T.jsx("button",{type:"button",className:`
237
+ ${N?"bg-accent/20 text-accent border border-accent/40":"bg-surface border border-border text-secondary"}
238
+ `,onClick:()=>A(F.id),children:[T.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${sD[F.status]}`}),T.jsx("span",{className:"truncate",children:$+1})]},F.id)})})]}),T.jsxs("div",{className:"flex items-center gap-1.5",children:[T.jsx("button",{type:"button",className:`
239
239
  terminal-key
240
240
  flex items-center justify-center
241
241
  h-11 min-w-[2.75rem] px-2.5
@@ -246,7 +246,7 @@ void main() {
246
246
  select-none touch-manipulation
247
247
  ${v?"bg-accent/20 text-accent border border-accent/40":"bg-surface border border-border text-secondary"}
248
248
  ${t?"opacity-50":""}
249
- `,onMouseDown:F=>F.preventDefault(),onTouchStart:N(x),onClick:H(x),disabled:t,children:"ctrl"}),rD.map((F,$)=>T.jsx("button",{type:"button",className:`
249
+ `,onMouseDown:F=>F.preventDefault(),onTouchStart:O(x),onClick:H(x),disabled:t,children:"ctrl"}),nD.map((F,$)=>T.jsx("button",{type:"button",className:`
250
250
  terminal-key
251
251
  flex items-center justify-center
252
252
  h-11 min-w-[2.75rem] px-2.5
@@ -258,7 +258,7 @@ void main() {
258
258
  ${F.grow?"flex-1":""}
259
259
  ${F.className??"text-secondary"}
260
260
  ${t?"opacity-50":""}
261
- `,onMouseDown:O=>O.preventDefault(),onTouchStart:N(()=>b(F.key)),onClick:H(()=>b(F.key)),disabled:t,children:F.label},`left-${$}`)),T.jsx(QT,{onSendKey:C,disabled:t,onRefocus:l,isKeyboardVisible:i}),T.jsx(qT,{onSendKey:C,disabled:t,onRefocus:l,isKeyboardVisible:i}),nD.map((F,$)=>T.jsx("button",{type:"button","aria-label":F.ariaLabel,className:`
261
+ `,onMouseDown:N=>N.preventDefault(),onTouchStart:O(()=>b(F.key)),onClick:H(()=>b(F.key)),disabled:t,children:F.label},`left-${$}`)),T.jsx(ZT,{onSendKey:C,disabled:t,onRefocus:l,isKeyboardVisible:i}),T.jsx(XT,{onSendKey:C,disabled:t,onRefocus:l,isKeyboardVisible:i}),iD.map((F,$)=>T.jsx("button",{type:"button","aria-label":F.ariaLabel,className:`
262
262
  terminal-key
263
263
  flex items-center justify-center
264
264
  h-11 min-w-[2.75rem] px-2.5
@@ -270,7 +270,7 @@ void main() {
270
270
  ${F.grow?"flex-1":""}
271
271
  ${F.className??"text-secondary"}
272
272
  ${t?"opacity-50":""}
273
- `,onMouseDown:O=>O.preventDefault(),onTouchStart:N(()=>b(F.key)),onClick:H(()=>b(F.key)),disabled:t,children:F.label},`right-${$}`)),T.jsx("button",{type:"button","aria-label":"Paste",className:`
273
+ `,onMouseDown:N=>N.preventDefault(),onTouchStart:O(()=>b(F.key)),onClick:H(()=>b(F.key)),disabled:t,children:F.label},`right-${$}`)),T.jsx("button",{type:"button","aria-label":"Paste",className:`
274
274
  terminal-key
275
275
  flex items-center justify-center
276
276
  h-11 min-w-[2.75rem] px-2.5
@@ -281,7 +281,7 @@ void main() {
281
281
  select-none touch-manipulation
282
282
  text-secondary
283
283
  ${t?"opacity-50":""}
284
- `,onMouseDown:F=>F.preventDefault(),onTouchStart:N(()=>{S()}),onClick:H(()=>{S()}),disabled:t,children:eD}),T.jsx("button",{type:"button","aria-label":"Show keyboard",className:`
284
+ `,onMouseDown:F=>F.preventDefault(),onTouchStart:O(()=>{S()}),onClick:H(()=>{S()}),disabled:t,children:tD}),T.jsx("button",{type:"button","aria-label":"Show keyboard",className:`
285
285
  terminal-key
286
286
  flex items-center justify-center
287
287
  h-11 min-w-[2.75rem] px-2.5
@@ -292,10 +292,10 @@ void main() {
292
292
  select-none touch-manipulation
293
293
  text-secondary
294
294
  ${t?"opacity-50":""}
295
- `,onMouseDown:F=>F.preventDefault(),onTouchStart:N(M),onClick:H(M),disabled:t,children:tD})]}),c&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{ref:d,className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-1 text-balance",children:"Paste"}),T.jsx("p",{className:"text-xs text-muted mb-3 text-pretty",children:"Text or image (long-press → Paste)"}),_?T.jsx("div",{className:"w-full h-11 flex items-center justify-center bg-surface border border-border rounded-md text-secondary",children:"Uploading image..."}):T.jsx("input",{ref:f,type:"text",value:u,onChange:F=>p(F.target.value),onKeyDown:F=>{F.key==="Enter"?(F.preventDefault(),E()):F.key==="Escape"&&(F.preventDefault(),L())},placeholder:"Paste here...",className:"w-full h-11 px-3 text-[16px] bg-surface border border-border rounded-md text-primary placeholder:text-muted outline-none focus:border-accent",style:{fontSize:"16px"}}),T.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[T.jsx("button",{type:"button",onClick:L,className:"px-4 py-2 text-sm font-medium text-secondary bg-surface border border-border rounded-md active:scale-95 transition-transform",children:"Cancel"}),T.jsx("button",{type:"button",onClick:E,disabled:_,className:"px-4 py-2 text-sm font-medium bg-accent text-white rounded-md active:scale-95 transition-transform disabled:opacity-50",children:"Send"})]})]})})]})}function oD({isOpen:e,onClose:t,sessions:r,inactiveSessions:n=[],selectedSessionId:s,onSelect:a,onRename:l,onResume:i,onSetPinned:o,onNewSession:c,loading:g,error:u}){const p=v1(),_=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{if(!e)return;const f=d=>{d.key==="Escape"&&(d.preventDefault(),t())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,t]),k.useEffect(()=>{var f;e?(y.current=document.activeElement,(f=_.current)==null||f.focus()):y.current&&(y.current.focus(),y.current=null)},[e]),k.useEffect(()=>{if(!e)return;const f=_.current;if(!f)return;const d=50,m=1.5;let w=0,b=0;const x=S=>{const E=S.touches[0];w=E.clientX,b=E.clientY},C=S=>{const E=S.changedTouches[0],L=w-E.clientX,A=Math.abs(E.clientY-b);L>=d&&L>A*m&&("vibrate"in navigator&&navigator.vibrate(10),t())};return f.addEventListener("touchstart",x,{passive:!0}),f.addEventListener("touchend",C,{passive:!0}),()=>{f.removeEventListener("touchstart",x),f.removeEventListener("touchend",C)}},[e,t]);const v=f=>{a(f),t()},h=p?{transition:"none"}:void 0;return T.jsxs(T.Fragment,{children:[T.jsx("div",{className:`session-drawer-backdrop ${e?"open":""}`,style:h,onClick:t,"aria-hidden":"true"}),T.jsxs("div",{ref:_,className:`session-drawer ${e?"open":""}`,style:h,role:"dialog","aria-modal":"true","aria-label":"Session list",tabIndex:-1,children:[T.jsx(z1,{sessions:r,inactiveSessions:n,selectedSessionId:s,onSelect:v,onRename:l,onResume:i,onSetPinned:o,loading:g,error:u}),T.jsx("div",{className:"shrink-0 border-t border-border px-2 pt-2",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom, 0.5rem))"},children:T.jsx("button",{onClick:()=>{c(),t()},className:"btn btn-primary w-full py-2 text-sm",children:"New Session"})})]})]})}const aD={working:"Working",waiting:"Waiting",permission:"Needs Input",unknown:"Unknown"},lD={working:"text-working",waiting:"text-waiting",permission:"text-approval",unknown:"text-muted"},cD={working:"bg-green-500/35 text-white",waiting:"bg-blue-500/35 text-white",permission:"bg-amber-500/35 text-white",unknown:"bg-gray-500/35 text-white"},uD={working:"bg-working text-white",waiting:"bg-waiting text-white",permission:"bg-approval text-white",unknown:"bg-muted text-white"};function nv(){"vibrate"in navigator&&navigator.vibrate(10)}function hD({session:e,sessions:t,inactiveSessions:r=[],connectionStatus:n,sendMessage:s,subscribe:a,onClose:l,onSelectSession:i,onNewSession:o,onKillSession:c,onRenameSession:g,onResumeSession:u,onSetPinned:p,onOpenSettings:_,loading:y=!1,error:v=null}){const h=Ol(te=>te.theme),f=$T[h],d=de(te=>te.useWebGL),m=de(te=>te.fontSize),w=de(te=>te.lineHeight),b=de(te=>te.letterSpacing),x=de(te=>te.fontOption),C=de(te=>te.customFontFamily),S=Rb(x,C),E=de(te=>te.shortcutModifier),L=Yi(Uo(E)),A=zo(),M=OT(),[D,N]=k.useState(!1),[H,F]=k.useState(!1),[$,O]=k.useState(!1),[R,P]=k.useState(!1),[B,j]=k.useState(!1),[W,K]=k.useState(!1),[ee,Z]=k.useState(""),z=k.useRef(!1),I=k.useRef(null),V=k.useRef(null),U=k.useRef(null),J=k.useRef(null),X=(e==null?void 0:e.remote)===!0,me=We(te=>te.remoteAllowControl),ce=We(te=>te.remoteAllowAttach),fe=X&&!ce,Ee=!X||me&&(e==null?void 0:e.source)==="managed",{containerRef:ae,terminalRef:Te,inTmuxCopyModeRef:je,setTmuxCopyMode:pe}=BT({sessionId:(e==null?void 0:e.id)??null,tmuxTarget:(e==null?void 0:e.tmuxWindow)??null,allowAttach:!fe,sendMessage:s,subscribe:a,theme:f,fontSize:m,lineHeight:w,letterSpacing:b,fontFamily:S,useWebGL:d,onScrollChange:te=>{N(!te)}}),_e=k.useCallback(()=>{var te;!e||fe||(s({type:"tmux-cancel-copy-mode",sessionId:e.id}),pe(!1),(te=Te.current)==null||te.scrollToBottom())},[e,fe,s,pe,Te]),ke=k.useCallback(()=>{j(!0),nv()},[]),se=FT({enabled:M||A,isOpen:B,onOpen:ke});k.useEffect(()=>{!M&&!A&&B&&j(!1)},[B,M,A]);const be=k.useCallback(()=>P(!1),[]);NT(V,R,be),k.useEffect(()=>{W&&U.current&&(U.current.focus(),U.current.select())},[W]),k.useEffect(()=>{$&&J.current&&J.current.focus()},[$]);const oe=k.useCallback(()=>O(!1),[]);jT($,oe);const he=()=>{e&&(c(e.id),O(!1))},Le=()=>{e&&(Z(e.agentSessionName||e.name),K(!0),P(!1))},Re=()=>{if(!e)return;const te=ee.trim(),ue=e.agentSessionName||e.name;te&&te!==ue&&g(e.id,te),K(!1)},Ce=te=>{te.key==="Enter"?(te.preventDefault(),Re()):te.key==="Escape"&&(te.preventDefault(),K(!1))};k.useEffect(()=>{if(!A||!e){F(!1);return}const te=ae.current;if(!te)return;const ue=we=>{const Ae=te.querySelector(".xterm-accessibility-tree");if(!Ae)return!1;const Ke=we.anchorNode,Ge=we.focusNode;return!!Ke&&Ae.contains(Ke)||!!Ge&&Ae.contains(Ge)},Oe=()=>{const we=te.querySelector(".xterm-accessibility"),Ae=te.querySelector(".xterm-accessibility-tree");!we||!Ae||(we.style.setProperty("opacity","0"),Ae.style.setProperty("opacity","0"),we.style.setProperty("-webkit-user-select","none"),we.style.setProperty("user-select","none"),Ae.style.setProperty("-webkit-user-select","none"),Ae.style.setProperty("user-select","none"),we.offsetHeight,requestAnimationFrame(()=>{we.style.removeProperty("opacity"),Ae.style.removeProperty("opacity"),we.style.removeProperty("-webkit-user-select"),we.style.removeProperty("user-select"),Ae.style.removeProperty("-webkit-user-select"),Ae.style.removeProperty("user-select")}))},Fe=()=>{var Ae;z.current=!1;const we=window.getSelection();try{we==null||we.removeAllRanges()}catch{}(Ae=Te.current)==null||Ae.clearSelection(),Oe(),F(!1)};I.current=Fe;const De=()=>{const we=window.getSelection();if(!we||we.rangeCount===0||we.isCollapsed){z.current?Fe():F(Ge=>Ge&&!1);return}const Ae=ue(we);if(!Ae&&z.current){Fe();return}z.current=Ae;const Ke=Ae;F(Ge=>Ge!==Ke?Ke:Ge)},Be=()=>{const we=window.getSelection();!we||we.isCollapsed||ue(we)&&setTimeout(Fe,0)},Pe=10;let Ue=null,Me=!1;const ze=we=>{if(we.touches.length===1){const Ae=we.touches[0];Ue={x:Ae.clientX,y:Ae.clientY},Me=!1}},Je=we=>{if(Me||!Ue||we.touches.length!==1)return;const Ae=we.touches[0],Ke=Math.abs(Ae.clientX-Ue.x),Ge=Math.abs(Ae.clientY-Ue.y);(Ke>Pe||Ge>Pe)&&(Me=!0)},nt=we=>{const Ae=Me;Ue=null,Me=!1;const Ke=window.getSelection();if(!Ke||Ke.rangeCount===0||Ke.isCollapsed){F(!1);return}const Ge=te.querySelector(".xterm-accessibility-tree");if(!Ge)return;if(!ue(Ke)){F(!1);return}if(Ae)return;const lt=we.target,xt=lt?Ge.contains(lt):!1;let dt=!1;if(xt&&lt)try{dt=Ke.containsNode(lt,!0)}catch{dt=!1}(!xt||!dt)&&setTimeout(Fe,0)};return document.addEventListener("selectionchange",De),document.addEventListener("copy",Be),document.addEventListener("touchstart",ze,{passive:!0}),document.addEventListener("touchmove",Je,{passive:!0}),document.addEventListener("touchend",nt,{passive:!0}),()=>{document.removeEventListener("selectionchange",De),document.removeEventListener("copy",Be),document.removeEventListener("touchstart",ze),document.removeEventListener("touchmove",Je),document.removeEventListener("touchend",nt),I.current=null,z.current=!1}},[ae,A,e==null?void 0:e.id]),k.useEffect(()=>{var Be;if(!A)return;const te=ae.current;if(!te)return;const ue=()=>{const Pe=Te.current,Ue=te.querySelector(".xterm");if(!Pe||!Ue)return;const Me=Ue.querySelector(".xterm-screen"),ze=Ue.querySelector(".xterm-accessibility"),Je=Ue.querySelector(".xterm-accessibility-tree");if(!Me||!ze||!Je)return;const nt=Ue.getBoundingClientRect(),we=Me.getBoundingClientRect(),Ae=we.left-nt.left,Ke=we.top-nt.top;Object.assign(ze.style,{left:`${Ae}px`,top:`${Ke}px`,right:"auto",bottom:"auto",width:`${we.width}px`,height:`${we.height}px`});const Ge=we.width/Pe.cols,lt=we.height/Pe.rows,xt=document.createElement("span");xt.textContent="0".repeat(200),xt.style.cssText="position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px",Je.appendChild(xt);const dt=xt.getBoundingClientRect().width/200;xt.remove();const Wt=Math.max(-2,Math.min(2,Ge-dt));te.style.setProperty("--xterm-font-size",`${Pe.options.fontSize}px`),te.style.setProperty("--xterm-cell-height",`${lt}px`),te.style.setProperty("--xterm-a11y-letter-spacing",`${Wt}px`)};ue();const Oe=window.requestAnimationFrame(ue),Fe=window.setTimeout(ue,100),De=()=>window.requestAnimationFrame(ue);return(Be=window.visualViewport)==null||Be.addEventListener("resize",De),window.addEventListener("orientationchange",De),()=>{var Pe;window.cancelAnimationFrame(Oe),window.clearTimeout(Fe),(Pe=window.visualViewport)==null||Pe.removeEventListener("resize",De),window.removeEventListener("orientationchange",De)}},[ae,m,A,e==null?void 0:e.id,Te]);const q=k.useRef(H);k.useEffect(()=>{q.current=H},[H]);const Q=k.useRef(e==null?void 0:e.id);k.useEffect(()=>{Q.current=e==null?void 0:e.id},[e==null?void 0:e.id]);const ge=k.useRef(s);k.useEffect(()=>{ge.current=s},[s]);const He=k.useRef(!1);k.useEffect(()=>{const te=ae.current;if(!te||!(e!=null&&e.id)||!M&&!A)return;const ue=6,Oe=350;let Fe={x:0,y:0},De=0,Be=!1,Pe=null,Ue=0,Me=0,ze=0,Je=Math.round(m*w),nt=null;const we=()=>{const bt=window.getComputedStyle(te).getPropertyValue("--xterm-cell-height").trim(),Ct=Number.parseFloat(bt);return!Number.isNaN(Ct)&&Ct>0?Ct:Math.round(m*w)},Ae=()=>te.querySelector(".xterm-helper-textarea"),Ke=()=>{const Ie=Ae();Ie&&document.activeElement!==Ie&&(Ie.disabled=!0)},Ge=()=>{const Ie=Ae();Ie&&(Ie.disabled=!1)};Ke();const lt=()=>{if(je.current)return;const Ie=Ae();Ie&&(Ie.disabled=!1,Ie.focus())},xt=()=>{nt!==null&&(cancelAnimationFrame(nt),nt=null),Me=0},dt=Ie=>{const bt=Q.current;if(!bt||Ie===0)return!1;const Ct=Te.current,Gr=(Ct==null?void 0:Ct.cols)??80,Si=(Ct==null?void 0:Ct.rows)??24,xi=Math.floor(Gr/2),zn=Math.floor(Si/2),Un=Ie>0?65:64,Wn=Math.abs(Ie),dn=Ie<0;for(let qr=0;qr<Wn;qr++)ge.current({type:"terminal-input",sessionId:bt,data:`\x1B[<${Un};${xi};${zn}M`});return dn&&pe(!0),dn},Wt=()=>{Pe=null,Me=0,ze=0},Wr=()=>{if(!A)return!1;const Ie=window.getSelection();if(!Ie||Ie.isCollapsed)return!1;const bt=te.querySelector(".xterm-accessibility-tree");if(!bt)return!1;const Ct=Ie.anchorNode,Gr=Ie.focusNode;return!!Ct&&bt.contains(Ct)||!!Gr&&bt.contains(Gr)},xs=()=>{var Ie;!A||!z.current||Wr()||(Ie=I.current)==null||Ie.call(I)},Zo=Ie=>{if(xt(),xs(),se.current||B){Wt();return}if(q.current){Wt();return}if(Ie.touches.length===1){const bt=Ie.touches[0];Fe={x:bt.clientX,y:bt.clientY},De=performance.now(),Be=!1,Pe=bt.clientY,Ue=De,Me=0,ze=0,Je=we(),Ge()}},ea=Ie=>{if(Ie.touches.length!==1||Pe===null)return;if(xs(),se.current||B){Wt();return}if(q.current||Wr()){Wt();return}Ie.preventDefault(),Ie.stopPropagation();const bt=performance.now(),Ct=Ie.touches[0],Gr=Ct.clientX,Si=Ct.clientY,xi=Math.abs(Gr-Fe.x),zn=Math.abs(Si-Fe.y);!Be&&(xi>ue||zn>ue)&&(Be=!0,Ke());const Un=Pe-Si,Wn=bt-Ue;if(Pe=Si,Ue=bt,Wn>0){const fc=Un/Wn;Me=Me*.7+fc*.3}ze+=Un;const dn=Math.max(6,Je*.6),qr=Math.trunc(ze/dn);qr!==0&&(dt(qr),ze-=qr*dn)},Y=Ie=>{var xi;const bt=Me,Ct=performance.now()-De;if(Wt(),se.current||B)return;const Gr=Wr();if(q.current&&!Gr&&((xi=I.current)==null||xi.call(I)),q.current||Gr){je.current&&(He.current=!0);return}if(!Be){if(A&&Ct>=Oe)return;if(je.current){Ie.preventDefault(),Ie.stopPropagation(),He.current=!0;return}lt();return}if(Math.abs(bt)>.12){let zn=bt,Un=performance.now();const Wn=()=>{const dn=performance.now(),qr=dn-Un;Un=dn;const fc=zn*qr;ze+=fc;const sp=Math.max(6,Je*.6),pc=Math.trunc(ze/sp);pc!==0&&(dt(pc),ze-=pc*sp),zn*=Math.pow(.95,qr/16.67),Math.abs(zn)>.02?nt=requestAnimationFrame(Wn):nt=null};nt=requestAnimationFrame(Wn)}},Qe=Ie=>{He.current&&(Ie.preventDefault(),Ie.stopPropagation(),He.current=!1)},Vr={passive:!0,capture:!0},Kr={passive:!1,capture:!0},wi={passive:!1,capture:!0},ip={capture:!0};return te.addEventListener("touchstart",Zo,Vr),te.addEventListener("touchmove",ea,Kr),te.addEventListener("touchend",Y,wi),te.addEventListener("mousedown",Qe,ip),()=>{te.removeEventListener("touchstart",Zo,Vr),te.removeEventListener("touchmove",ea,Kr),te.removeEventListener("touchend",Y,wi),te.removeEventListener("mousedown",Qe,ip);const Ie=Ae();Ie&&(Ie.disabled=!1)}},[e==null?void 0:e.id,ae,Te,A,M,B,m,w]);const ie=k.useCallback(te=>{!e||fe||s({type:"terminal-input",sessionId:e.id,data:te})},[e,fe,s]),G=k.useCallback(()=>{const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-helper-textarea");ue&&(ue.removeAttribute("disabled"),ue.focus())},[ae]),re=k.useCallback(()=>{if(!e||fe)return;je.current&&(s({type:"tmux-cancel-copy-mode",sessionId:e.id}),pe(!1));const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-helper-textarea");ue&&(ue.removeAttribute("disabled"),ue.focus())},[e,fe,s,ae,je,pe]),le=k.useCallback(()=>{var Be,Pe;if(typeof document>"u")return!1;const te=ae.current;if(!te)return!1;const ue=te.querySelector(".xterm-helper-textarea");if(ue&&document.activeElement===ue)return!0;const Oe=document.activeElement,Fe=typeof HTMLInputElement<"u"&&Oe instanceof HTMLInputElement,De=typeof HTMLTextAreaElement<"u"&&Oe instanceof HTMLTextAreaElement;return Fe||De||Oe&&Oe.isContentEditable?!1:!!((Pe=(Be=document.documentElement)==null?void 0:Be.classList)!=null&&Pe.contains("keyboard-visible"))},[ae]);return k.useEffect(()=>{if(!A)return;const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-accessibility"),Oe=te.querySelector(".xterm-accessibility-tree");if(!ue||!Oe)return;const Fe=()=>{const De=te.querySelector(".xterm-helper-textarea");(De?document.activeElement===De:!1)&&!q.current?(ue.style.pointerEvents="none",Oe.style.pointerEvents="none"):(ue.style.removeProperty("pointer-events"),Oe.style.removeProperty("pointer-events"))};return Fe(),document.addEventListener("focusin",Fe),document.addEventListener("focusout",Fe),()=>{document.removeEventListener("focusin",Fe),document.removeEventListener("focusout",Fe)}},[ae,A,H]),T.jsxs("section",{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${A?"ios-native-term-selection":""}`,"data-testid":"terminal-panel",children:[T.jsxs("div",{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3 ${e?"":"md:hidden"}`,children:[T.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[T.jsx("button",{onClick:()=>j(!0),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all md:hidden shrink-0","aria-label":"Open session menu",children:T.jsx(qb,{width:16,height:16})}),e&&Ee&&T.jsx("button",{onClick:()=>O(!0),className:"hidden md:flex h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all shrink-0",title:`Kill session (${L}X)`,"aria-label":"Kill session",children:T.jsx(mh,{width:16,height:16})}),e?T.jsxs("div",{className:"flex items-baseline gap-3 min-w-0",children:[W?T.jsx("input",{ref:U,type:"text",value:ee,onChange:te=>Z(te.target.value),onBlur:Re,onKeyDown:Ce,className:"w-full max-w-[200px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"text-sm font-medium text-primary truncate",children:e.agentSessionName||e.name}),T.jsx("span",{className:`text-xs shrink-0 ${lD[e.status]}`,children:aD[e.status]})]}):T.jsx("span",{className:"text-sm font-medium text-primary md:hidden",children:"Sessions"})]}),T.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n!=="connected"&&T.jsx("span",{className:"text-xs text-approval",children:n}),T.jsx("button",{onClick:o,className:"flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all md:hidden",title:`New session (${L}N)`,"aria-label":"New session",children:T.jsx(O0,{width:16,height:16})}),e&&Ee&&T.jsx("button",{onClick:()=>O(!0),className:"flex md:hidden h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all",title:`Kill session (${L}X)`,"aria-label":"Kill session",children:T.jsx(mh,{width:16,height:16})}),e&&T.jsxs("div",{className:"relative md:hidden",ref:V,children:[T.jsx("button",{onClick:()=>P(!R),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all",title:"More options","aria-label":"More options",children:T.jsx($b,{width:16,height:16})}),R&&T.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1",children:[Ee&&T.jsxs("button",{onClick:Le,className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(I0,{width:14,height:14}),"Rename"]}),T.jsxs("button",{onClick:()=>{_(),P(!1)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(eC,{width:14,height:14}),"Settings"]})]})]})]})]}),e&&t.length>1&&T.jsxs("div",{className:"relative overflow-hidden bg-elevated border-b border-border md:hidden",children:[T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 pl-5 pr-3 py-1.5 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:t.map((te,ue)=>{const Oe=te.id===e.id;return T.jsx("button",{type:"button",className:`
295
+ `,onMouseDown:F=>F.preventDefault(),onTouchStart:O(M),onClick:H(M),disabled:t,children:rD})]}),c&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{ref:d,className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-1 text-balance",children:"Paste"}),T.jsx("p",{className:"text-xs text-muted mb-3 text-pretty",children:"Text or image (long-press → Paste)"}),_?T.jsx("div",{className:"w-full h-11 flex items-center justify-center bg-surface border border-border rounded-md text-secondary",children:"Uploading image..."}):T.jsx("input",{ref:f,type:"text",value:u,onChange:F=>p(F.target.value),onKeyDown:F=>{F.key==="Enter"?(F.preventDefault(),E()):F.key==="Escape"&&(F.preventDefault(),L())},placeholder:"Paste here...",className:"w-full h-11 px-3 text-[16px] bg-surface border border-border rounded-md text-primary placeholder:text-muted outline-none focus:border-accent",style:{fontSize:"16px"}}),T.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[T.jsx("button",{type:"button",onClick:L,className:"px-4 py-2 text-sm font-medium text-secondary bg-surface border border-border rounded-md active:scale-95 transition-transform",children:"Cancel"}),T.jsx("button",{type:"button",onClick:E,disabled:_,className:"px-4 py-2 text-sm font-medium bg-accent text-white rounded-md active:scale-95 transition-transform disabled:opacity-50",children:"Send"})]})]})})]})}function aD({isOpen:e,onClose:t,sessions:r,inactiveSessions:n=[],selectedSessionId:s,onSelect:a,onRename:l,onResume:i,onSetPinned:o,onNewSession:c,loading:g,error:u}){const p=v1(),_=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{if(!e)return;const f=d=>{d.key==="Escape"&&(d.preventDefault(),t())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,t]),k.useEffect(()=>{var f;e?(y.current=document.activeElement,(f=_.current)==null||f.focus()):y.current&&(y.current.focus(),y.current=null)},[e]),k.useEffect(()=>{if(!e)return;const f=_.current;if(!f)return;const d=50,m=1.5;let w=0,b=0;const x=S=>{const E=S.touches[0];w=E.clientX,b=E.clientY},C=S=>{const E=S.changedTouches[0],L=w-E.clientX,A=Math.abs(E.clientY-b);L>=d&&L>A*m&&("vibrate"in navigator&&navigator.vibrate(10),t())};return f.addEventListener("touchstart",x,{passive:!0}),f.addEventListener("touchend",C,{passive:!0}),()=>{f.removeEventListener("touchstart",x),f.removeEventListener("touchend",C)}},[e,t]);const v=f=>{a(f),t()},h=p?{transition:"none"}:void 0;return T.jsxs(T.Fragment,{children:[T.jsx("div",{className:`session-drawer-backdrop ${e?"open":""}`,style:h,onClick:t,"aria-hidden":"true"}),T.jsxs("div",{ref:_,className:`session-drawer ${e?"open":""}`,style:h,role:"dialog","aria-modal":"true","aria-label":"Session list",tabIndex:-1,children:[T.jsx(z1,{sessions:r,inactiveSessions:n,selectedSessionId:s,onSelect:v,onRename:l,onResume:i,onSetPinned:o,loading:g,error:u}),T.jsx("div",{className:"shrink-0 border-t border-border px-2 pt-2",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom, 0.5rem))"},children:T.jsx("button",{onClick:()=>{c(),t()},className:"btn btn-primary w-full py-2 text-sm",children:"New Session"})})]})]})}const lD={working:"Working",waiting:"Waiting",permission:"Needs Input",unknown:"Unknown"},cD={working:"text-working",waiting:"text-waiting",permission:"text-approval",unknown:"text-muted"},uD={working:"bg-green-500/35 text-white",waiting:"bg-blue-500/35 text-white",permission:"bg-amber-500/35 text-white",unknown:"bg-gray-500/35 text-white"},hD={working:"bg-working text-white",waiting:"bg-waiting text-white",permission:"bg-approval text-white",unknown:"bg-muted text-white"};function nv(){"vibrate"in navigator&&navigator.vibrate(10)}function dD({session:e,sessions:t,inactiveSessions:r=[],connectionStatus:n,sendMessage:s,subscribe:a,onClose:l,onSelectSession:i,onNewSession:o,onKillSession:c,onRenameSession:g,onResumeSession:u,onSetPinned:p,onOpenSettings:_,loading:y=!1,error:v=null}){const h=Ol(te=>te.theme),f=HT[h],d=de(te=>te.useWebGL),m=de(te=>te.fontSize),w=de(te=>te.lineHeight),b=de(te=>te.letterSpacing),x=de(te=>te.fontOption),C=de(te=>te.customFontFamily),S=Rb(x,C),E=de(te=>te.shortcutModifier),L=Yi(Uo(E)),A=zo(),M=NT(),[D,O]=k.useState(!1),[H,F]=k.useState(!1),[$,N]=k.useState(!1),[R,P]=k.useState(!1),[B,j]=k.useState(!1),[W,K]=k.useState(!1),[Z,ee]=k.useState(""),z=k.useRef(!1),I=k.useRef(null),V=k.useRef(null),U=k.useRef(null),J=k.useRef(null),X=(e==null?void 0:e.remote)===!0,me=We(te=>te.remoteAllowControl),ce=We(te=>te.remoteAllowAttach),fe=X&&!ce,Ee=!X||me&&(e==null?void 0:e.source)==="managed",{containerRef:ae,terminalRef:Te,inTmuxCopyModeRef:je,setTmuxCopyMode:pe}=OT({sessionId:(e==null?void 0:e.id)??null,tmuxTarget:(e==null?void 0:e.tmuxWindow)??null,allowAttach:!fe,sendMessage:s,subscribe:a,theme:f,fontSize:m,lineHeight:w,letterSpacing:b,fontFamily:S,useWebGL:d,onScrollChange:te=>{O(!te)}}),_e=k.useCallback(()=>{var te;!e||fe||(s({type:"tmux-cancel-copy-mode",sessionId:e.id}),pe(!1),(te=Te.current)==null||te.scrollToBottom())},[e,fe,s,pe,Te]),ke=k.useCallback(()=>{j(!0),nv()},[]),se=$T({enabled:M||A,isOpen:B,onOpen:ke});k.useEffect(()=>{!M&&!A&&B&&j(!1)},[B,M,A]);const be=k.useCallback(()=>P(!1),[]);jT(V,R,be),k.useEffect(()=>{W&&U.current&&(U.current.focus(),U.current.select())},[W]),k.useEffect(()=>{$&&J.current&&J.current.focus()},[$]);const oe=k.useCallback(()=>N(!1),[]);FT($,oe);const he=()=>{e&&(c(e.id),N(!1))},Le=()=>{e&&(ee(e.agentSessionName||e.name),K(!0),P(!1))},Re=()=>{if(!e)return;const te=Z.trim(),ue=e.agentSessionName||e.name;te&&te!==ue&&g(e.id,te),K(!1)},Ce=te=>{te.key==="Enter"?(te.preventDefault(),Re()):te.key==="Escape"&&(te.preventDefault(),K(!1))};k.useEffect(()=>{if(!A||!e){F(!1);return}const te=ae.current;if(!te)return;const ue=we=>{const Ae=te.querySelector(".xterm-accessibility-tree");if(!Ae)return!1;const Ke=we.anchorNode,Ge=we.focusNode;return!!Ke&&Ae.contains(Ke)||!!Ge&&Ae.contains(Ge)},Oe=()=>{const we=te.querySelector(".xterm-accessibility"),Ae=te.querySelector(".xterm-accessibility-tree");!we||!Ae||(we.style.setProperty("opacity","0"),Ae.style.setProperty("opacity","0"),we.style.setProperty("-webkit-user-select","none"),we.style.setProperty("user-select","none"),Ae.style.setProperty("-webkit-user-select","none"),Ae.style.setProperty("user-select","none"),we.offsetHeight,requestAnimationFrame(()=>{we.style.removeProperty("opacity"),Ae.style.removeProperty("opacity"),we.style.removeProperty("-webkit-user-select"),we.style.removeProperty("user-select"),Ae.style.removeProperty("-webkit-user-select"),Ae.style.removeProperty("user-select")}))},Fe=()=>{var Ae;z.current=!1;const we=window.getSelection();try{we==null||we.removeAllRanges()}catch{}(Ae=Te.current)==null||Ae.clearSelection(),Oe(),F(!1)};I.current=Fe;const De=()=>{const we=window.getSelection();if(!we||we.rangeCount===0||we.isCollapsed){z.current?Fe():F(Ge=>Ge&&!1);return}const Ae=ue(we);if(!Ae&&z.current){Fe();return}z.current=Ae;const Ke=Ae;F(Ge=>Ge!==Ke?Ke:Ge)},Be=()=>{const we=window.getSelection();!we||we.isCollapsed||ue(we)&&setTimeout(Fe,0)},Pe=10;let Ue=null,Me=!1;const ze=we=>{if(we.touches.length===1){const Ae=we.touches[0];Ue={x:Ae.clientX,y:Ae.clientY},Me=!1}},Je=we=>{if(Me||!Ue||we.touches.length!==1)return;const Ae=we.touches[0],Ke=Math.abs(Ae.clientX-Ue.x),Ge=Math.abs(Ae.clientY-Ue.y);(Ke>Pe||Ge>Pe)&&(Me=!0)},nt=we=>{const Ae=Me;Ue=null,Me=!1;const Ke=window.getSelection();if(!Ke||Ke.rangeCount===0||Ke.isCollapsed){F(!1);return}const Ge=te.querySelector(".xterm-accessibility-tree");if(!Ge)return;if(!ue(Ke)){F(!1);return}if(Ae)return;const lt=we.target,xt=lt?Ge.contains(lt):!1;let dt=!1;if(xt&&lt)try{dt=Ke.containsNode(lt,!0)}catch{dt=!1}(!xt||!dt)&&setTimeout(Fe,0)};return document.addEventListener("selectionchange",De),document.addEventListener("copy",Be),document.addEventListener("touchstart",ze,{passive:!0}),document.addEventListener("touchmove",Je,{passive:!0}),document.addEventListener("touchend",nt,{passive:!0}),()=>{document.removeEventListener("selectionchange",De),document.removeEventListener("copy",Be),document.removeEventListener("touchstart",ze),document.removeEventListener("touchmove",Je),document.removeEventListener("touchend",nt),I.current=null,z.current=!1}},[ae,A,e==null?void 0:e.id]),k.useEffect(()=>{var Be;if(!A)return;const te=ae.current;if(!te)return;const ue=()=>{const Pe=Te.current,Ue=te.querySelector(".xterm");if(!Pe||!Ue)return;const Me=Ue.querySelector(".xterm-screen"),ze=Ue.querySelector(".xterm-accessibility"),Je=Ue.querySelector(".xterm-accessibility-tree");if(!Me||!ze||!Je)return;const nt=Ue.getBoundingClientRect(),we=Me.getBoundingClientRect(),Ae=we.left-nt.left,Ke=we.top-nt.top;Object.assign(ze.style,{left:`${Ae}px`,top:`${Ke}px`,right:"auto",bottom:"auto",width:`${we.width}px`,height:`${we.height}px`});const Ge=we.width/Pe.cols,lt=we.height/Pe.rows,xt=document.createElement("span");xt.textContent="0".repeat(200),xt.style.cssText="position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px",Je.appendChild(xt);const dt=xt.getBoundingClientRect().width/200;xt.remove();const Wt=Math.max(-2,Math.min(2,Ge-dt));te.style.setProperty("--xterm-font-size",`${Pe.options.fontSize}px`),te.style.setProperty("--xterm-cell-height",`${lt}px`),te.style.setProperty("--xterm-a11y-letter-spacing",`${Wt}px`)};ue();const Oe=window.requestAnimationFrame(ue),Fe=window.setTimeout(ue,100),De=()=>window.requestAnimationFrame(ue);return(Be=window.visualViewport)==null||Be.addEventListener("resize",De),window.addEventListener("orientationchange",De),()=>{var Pe;window.cancelAnimationFrame(Oe),window.clearTimeout(Fe),(Pe=window.visualViewport)==null||Pe.removeEventListener("resize",De),window.removeEventListener("orientationchange",De)}},[ae,m,A,e==null?void 0:e.id,Te]);const q=k.useRef(H);k.useEffect(()=>{q.current=H},[H]);const Q=k.useRef(e==null?void 0:e.id);k.useEffect(()=>{Q.current=e==null?void 0:e.id},[e==null?void 0:e.id]);const ge=k.useRef(s);k.useEffect(()=>{ge.current=s},[s]);const He=k.useRef(!1);k.useEffect(()=>{const te=ae.current;if(!te||!(e!=null&&e.id)||!M&&!A)return;const ue=6,Oe=350;let Fe={x:0,y:0},De=0,Be=!1,Pe=null,Ue=0,Me=0,ze=0,Je=Math.round(m*w),nt=null;const we=()=>{const bt=window.getComputedStyle(te).getPropertyValue("--xterm-cell-height").trim(),Ct=Number.parseFloat(bt);return!Number.isNaN(Ct)&&Ct>0?Ct:Math.round(m*w)},Ae=()=>te.querySelector(".xterm-helper-textarea"),Ke=()=>{const Ie=Ae();Ie&&document.activeElement!==Ie&&(Ie.disabled=!0)},Ge=()=>{const Ie=Ae();Ie&&(Ie.disabled=!1)};Ke();const lt=()=>{if(je.current)return;const Ie=Ae();Ie&&(Ie.disabled=!1,Ie.focus())},xt=()=>{nt!==null&&(cancelAnimationFrame(nt),nt=null),Me=0},dt=Ie=>{const bt=Q.current;if(!bt||Ie===0)return!1;const Ct=Te.current,Gr=(Ct==null?void 0:Ct.cols)??80,Si=(Ct==null?void 0:Ct.rows)??24,xi=Math.floor(Gr/2),zn=Math.floor(Si/2),Un=Ie>0?65:64,Wn=Math.abs(Ie),dn=Ie<0;for(let qr=0;qr<Wn;qr++)ge.current({type:"terminal-input",sessionId:bt,data:`\x1B[<${Un};${xi};${zn}M`});return dn&&pe(!0),dn},Wt=()=>{Pe=null,Me=0,ze=0},Wr=()=>{if(!A)return!1;const Ie=window.getSelection();if(!Ie||Ie.isCollapsed)return!1;const bt=te.querySelector(".xterm-accessibility-tree");if(!bt)return!1;const Ct=Ie.anchorNode,Gr=Ie.focusNode;return!!Ct&&bt.contains(Ct)||!!Gr&&bt.contains(Gr)},xs=()=>{var Ie;!A||!z.current||Wr()||(Ie=I.current)==null||Ie.call(I)},Zo=Ie=>{if(xt(),xs(),se.current||B){Wt();return}if(q.current){Wt();return}if(Ie.touches.length===1){const bt=Ie.touches[0];Fe={x:bt.clientX,y:bt.clientY},De=performance.now(),Be=!1,Pe=bt.clientY,Ue=De,Me=0,ze=0,Je=we(),Ge()}},ea=Ie=>{if(Ie.touches.length!==1||Pe===null)return;if(xs(),se.current||B){Wt();return}if(q.current||Wr()){Wt();return}Ie.preventDefault(),Ie.stopPropagation();const bt=performance.now(),Ct=Ie.touches[0],Gr=Ct.clientX,Si=Ct.clientY,xi=Math.abs(Gr-Fe.x),zn=Math.abs(Si-Fe.y);!Be&&(xi>ue||zn>ue)&&(Be=!0,Ke());const Un=Pe-Si,Wn=bt-Ue;if(Pe=Si,Ue=bt,Wn>0){const fc=Un/Wn;Me=Me*.7+fc*.3}ze+=Un;const dn=Math.max(6,Je*.6),qr=Math.trunc(ze/dn);qr!==0&&(dt(qr),ze-=qr*dn)},Y=Ie=>{var xi;const bt=Me,Ct=performance.now()-De;if(Wt(),se.current||B)return;const Gr=Wr();if(q.current&&!Gr&&((xi=I.current)==null||xi.call(I)),q.current||Gr){je.current&&(He.current=!0);return}if(!Be){if(A&&Ct>=Oe)return;if(je.current){Ie.preventDefault(),Ie.stopPropagation(),He.current=!0;return}lt();return}if(Math.abs(bt)>.12){let zn=bt,Un=performance.now();const Wn=()=>{const dn=performance.now(),qr=dn-Un;Un=dn;const fc=zn*qr;ze+=fc;const sp=Math.max(6,Je*.6),pc=Math.trunc(ze/sp);pc!==0&&(dt(pc),ze-=pc*sp),zn*=Math.pow(.95,qr/16.67),Math.abs(zn)>.02?nt=requestAnimationFrame(Wn):nt=null};nt=requestAnimationFrame(Wn)}},Qe=Ie=>{He.current&&(Ie.preventDefault(),Ie.stopPropagation(),He.current=!1)},Vr={passive:!0,capture:!0},Kr={passive:!1,capture:!0},wi={passive:!1,capture:!0},ip={capture:!0};return te.addEventListener("touchstart",Zo,Vr),te.addEventListener("touchmove",ea,Kr),te.addEventListener("touchend",Y,wi),te.addEventListener("mousedown",Qe,ip),()=>{te.removeEventListener("touchstart",Zo,Vr),te.removeEventListener("touchmove",ea,Kr),te.removeEventListener("touchend",Y,wi),te.removeEventListener("mousedown",Qe,ip);const Ie=Ae();Ie&&(Ie.disabled=!1)}},[e==null?void 0:e.id,ae,Te,A,M,B,m,w]);const ie=k.useCallback(te=>{!e||fe||s({type:"terminal-input",sessionId:e.id,data:te})},[e,fe,s]),G=k.useCallback(()=>{const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-helper-textarea");ue&&(ue.removeAttribute("disabled"),ue.focus())},[ae]),re=k.useCallback(()=>{if(!e||fe)return;je.current&&(s({type:"tmux-cancel-copy-mode",sessionId:e.id}),pe(!1));const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-helper-textarea");ue&&(ue.removeAttribute("disabled"),ue.focus())},[e,fe,s,ae,je,pe]),le=k.useCallback(()=>{var Be,Pe;if(typeof document>"u")return!1;const te=ae.current;if(!te)return!1;const ue=te.querySelector(".xterm-helper-textarea");if(ue&&document.activeElement===ue)return!0;const Oe=document.activeElement,Fe=typeof HTMLInputElement<"u"&&Oe instanceof HTMLInputElement,De=typeof HTMLTextAreaElement<"u"&&Oe instanceof HTMLTextAreaElement;return Fe||De||Oe&&Oe.isContentEditable?!1:!!((Pe=(Be=document.documentElement)==null?void 0:Be.classList)!=null&&Pe.contains("keyboard-visible"))},[ae]);return k.useEffect(()=>{if(!A)return;const te=ae.current;if(!te)return;const ue=te.querySelector(".xterm-accessibility"),Oe=te.querySelector(".xterm-accessibility-tree");if(!ue||!Oe)return;const Fe=()=>{const De=te.querySelector(".xterm-helper-textarea");(De?document.activeElement===De:!1)&&!q.current?(ue.style.pointerEvents="none",Oe.style.pointerEvents="none"):(ue.style.removeProperty("pointer-events"),Oe.style.removeProperty("pointer-events"))};return Fe(),document.addEventListener("focusin",Fe),document.addEventListener("focusout",Fe),()=>{document.removeEventListener("focusin",Fe),document.removeEventListener("focusout",Fe)}},[ae,A,H]),T.jsxs("section",{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${A?"ios-native-term-selection":""}`,"data-testid":"terminal-panel",children:[T.jsxs("div",{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3 ${e?"":"md:hidden"}`,children:[T.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[T.jsx("button",{onClick:()=>j(!0),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all md:hidden shrink-0","aria-label":"Open session menu",children:T.jsx(qb,{width:16,height:16})}),e&&Ee&&T.jsx("button",{onClick:()=>N(!0),className:"hidden md:flex h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all shrink-0",title:`Kill session (${L}X)`,"aria-label":"Kill session",children:T.jsx(mh,{width:16,height:16})}),e?T.jsxs("div",{className:"flex items-baseline gap-3 min-w-0",children:[W?T.jsx("input",{ref:U,type:"text",value:Z,onChange:te=>ee(te.target.value),onBlur:Re,onKeyDown:Ce,className:"w-full max-w-[200px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"text-sm font-medium text-primary truncate",children:e.agentSessionName||e.name}),T.jsx("span",{className:`text-xs shrink-0 ${cD[e.status]}`,children:lD[e.status]})]}):T.jsx("span",{className:"text-sm font-medium text-primary md:hidden",children:"Sessions"})]}),T.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n!=="connected"&&T.jsx("span",{className:"text-xs text-approval",children:n}),T.jsx("button",{onClick:o,className:"flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all md:hidden",title:`New session (${L}N)`,"aria-label":"New session",children:T.jsx(O0,{width:16,height:16})}),e&&Ee&&T.jsx("button",{onClick:()=>N(!0),className:"flex md:hidden h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all",title:`Kill session (${L}X)`,"aria-label":"Kill session",children:T.jsx(mh,{width:16,height:16})}),e&&T.jsxs("div",{className:"relative md:hidden",ref:V,children:[T.jsx("button",{onClick:()=>P(!R),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all",title:"More options","aria-label":"More options",children:T.jsx($b,{width:16,height:16})}),R&&T.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1",children:[Ee&&T.jsxs("button",{onClick:Le,className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(I0,{width:14,height:14}),"Rename"]}),T.jsxs("button",{onClick:()=>{_(),P(!1)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(eC,{width:14,height:14}),"Settings"]})]})]})]})]}),e&&t.length>1&&T.jsxs("div",{className:"relative overflow-hidden bg-elevated border-b border-border md:hidden",children:[T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 pl-5 pr-3 py-1.5 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:t.map((te,ue)=>{const Oe=te.id===e.id;return T.jsx("button",{type:"button",className:`
296
296
  flex items-center justify-center shrink-0 snap-start
297
297
  h-8 w-8 text-sm font-extrabold rounded-lg
298
298
  active:scale-95 transition-all duration-75
299
299
  select-none touch-manipulation
300
- ${Oe?uD[te.status]:cD[te.status]}
301
- `,onClick:()=>{nv(),i(te.id)},children:ue+1},te.id)})})]}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx("div",{ref:ae,className:"absolute inset-0"}),!e&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted",children:"Select a session to view terminal"}),e&&fe&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-center text-sm text-muted",children:"Remote session (read-only). Use SSH to attach on the host."}),D&&e&&!H&&T.jsxs("button",{onClick:_e,className:"absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all",style:{transform:"translateX(-50%)"},title:"Scroll to bottom","aria-label":"Scroll to bottom",children:[T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),T.jsx("span",{className:"text-sm font-medium",children:"Jump to bottom"})]})]}),e&&T.jsx(sD,{onSendKey:ie,disabled:n!=="connected"||fe,sessions:t.map(te=>({id:te.id,name:te.name,status:te.status})),currentSessionId:e.id,onSelectSession:i,hideSessionSwitcher:!0,onRefocus:G,isKeyboardVisible:le,onEnterTextMode:re}),(M||A)&&T.jsx(oD,{isOpen:B,onClose:()=>j(!1),sessions:t,inactiveSessions:r,selectedSessionId:(e==null?void 0:e.id)??null,onSelect:i,onRename:g,onResume:u,onSetPinned:p,onNewSession:o,loading:y,error:v}),$&&e&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-2 text-balance",children:"Kill Session"}),T.jsxs("p",{className:"text-sm text-secondary mb-4 text-pretty",children:['Kill "',e.agentSessionName||e.name,'"? The process will be terminated. Conversation history is preserved in logs.']}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx("button",{onClick:()=>O(!1),className:"btn py-1.5 px-3 text-sm",children:"Cancel"}),T.jsx("button",{ref:J,onClick:he,className:"btn btn-danger py-1.5 px-3 text-sm",children:"Kill Session"})]})]})})]})}function dD({onSelect:e,onCancel:t,initialPath:r}){const[n,s]=k.useState(r||"~"),[a,l]=k.useState(null),[i,o]=k.useState(null),[c,g]=k.useState(!0),[u,p]=k.useState(-1),_=k.useRef(null),y=de(m=>m.recentPaths),v=k.useCallback(async m=>{var x;(x=_.current)==null||x.abort();const w=new AbortController;_.current=w;const{signal:b}=w;g(!0),o(null),l(null),p(-1),s(m);try{const C=await fetch(`/api/directories?path=${encodeURIComponent(m)}`,{signal:b});if(!C.ok){const E=await C.json();throw new Error(E.message||"Failed to load directory")}const S=await C.json();if(_.current!==w)return;l(S),s(S.path)}catch(C){if(_.current!==w)return;const S=C;(S==null?void 0:S.name)!=="AbortError"&&o((S==null?void 0:S.message)||"Failed to load directory")}finally{_.current===w&&g(!1)}},[]);k.useEffect(()=>(v(r||"~"),()=>{var m;(m=_.current)==null||m.abort()}),[v,r]);const h=(a==null?void 0:a.directories)??[],f=(a==null?void 0:a.path)||n,d=a==null?void 0:a.parent;return k.useEffect(()=>{const m=w=>{if(w.key==="Escape"){w.preventDefault(),t();return}if(!c){if(w.key==="ArrowDown"){w.preventDefault(),p(b=>h.length===0?-1:b<0?0:Math.min(b+1,h.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),p(b=>h.length===0?-1:b<0?h.length-1:Math.max(b-1,0));return}if(w.key==="Enter"){w.preventDefault();const b=h[u];b?v(b.path):f&&e(f);return}w.key==="Backspace"&&d&&(w.preventDefault(),v(d))}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[h,f,v,u,c,t,e,d]),T.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Directory browser",className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onClick:m=>{m.target===m.currentTarget&&t()},"data-testid":"directory-browser",children:T.jsxs("div",{className:"w-full max-w-lg border border-border bg-elevated p-4",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border pb-2",children:[T.jsx("button",{type:"button",className:"btn",onClick:()=>{d&&v(d)},disabled:!d||c,children:"Up"}),T.jsx("div",{className:"min-w-0 flex-1 truncate text-xs font-mono text-secondary",title:f,"data-testid":"directory-current-path",children:f})]}),T.jsx("div",{className:"mt-3 max-h-60 overflow-y-auto border border-border bg-surface",children:c?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-loading",children:"Loading directories..."}):i?T.jsxs("div",{className:"px-3 py-4 text-xs","data-testid":"directory-error",children:[T.jsx("p",{className:"text-danger",children:i}),T.jsx("button",{type:"button",className:"btn mt-3",onClick:()=>v(n),children:"Retry"})]}):h.length===0?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-empty",children:"No subdirectories"}):T.jsx("div",{className:"py-1",children:h.map((m,w)=>T.jsxs("button",{type:"button",onClick:()=>v(m.path),onMouseEnter:()=>p(w),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${w===u?"bg-hover text-primary":"text-secondary"}`,"data-testid":"directory-entry","data-entry-name":m.name,"data-entry-path":m.path,children:[T.jsx(Wb,{width:14,height:14,className:"shrink-0 text-muted","aria-hidden":"true"}),T.jsx("span",{className:"truncate",children:m.name})]},m.path))})}),a!=null&&a.truncated?T.jsx("p",{className:"mt-2 text-[10px] text-muted",children:"Showing first 200 directories."}):null,T.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[T.jsx("div",{className:"text-[10px] uppercase tracking-wider text-secondary",children:"Recent"}),y.length===0?T.jsx("p",{className:"mt-2 text-xs text-muted",children:"No recent paths yet."}):T.jsx("div",{className:"mt-2 space-y-1",children:y.map(m=>T.jsx("button",{type:"button",className:"block w-full truncate text-left text-xs text-secondary hover:text-primary",onClick:()=>v(m),title:m,"data-testid":"directory-recent","data-recent-path":m,children:m},m))})]}),T.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>{f&&e(f)},className:"btn btn-primary",disabled:c||!f,children:"Select"})]})]})})}function fD({isOpen:e,onClose:t,onCreate:r,defaultProjectDir:n,commandPresets:s,defaultPresetId:a,lastProjectPath:l,activeProjectPath:i,remoteHosts:o=[],remoteAllowControl:c=!1,initialHost:g,initialPath:u,initialCommand:p}){const[_,y]=k.useState(""),[v,h]=k.useState(""),[f,d]=k.useState(null),[m,w]=k.useState(""),[b,x]=k.useState(!1),[C,S]=k.useState(""),E=k.useRef(null),L=k.useRef(null),A=k.useRef(null),M=c&&o.length>0;if(k.useEffect(()=>{if(!e){y(""),h(""),d(null),w(""),x(!1),S(g??""),setTimeout(()=>{if(typeof document>"u"||typeof document.querySelector!="function")return;const W=document.querySelector(".xterm-helper-textarea");W&&(W.removeAttribute("disabled"),W.focus())},300);return}if(typeof document<"u"&&typeof document.querySelector=="function"){const W=document.querySelector(".xterm-helper-textarea");W&&typeof W.setAttribute=="function"&&(typeof W.blur=="function"&&W.blur(),W.setAttribute("disabled","true"))}const B=(u==null?void 0:u.trim())||(i==null?void 0:i.trim())||l||n||"";y(B),h(""),S(g??"");const j=p==null?void 0:p.trim();if(j){const W=s.find(K=>Ms(K)===j);W?(d(W.id),w(Ms(W))):(d(null),w(j))}else{const W=s.find(K=>K.id===a);W?(d(a),w(Ms(W))):s.length>0?(d(s[0].id),w(Ms(s[0]))):(d(null),w(""))}setTimeout(()=>{var W;if((W=A.current)==null||W.focus(),L.current){const K=L.current;K.scrollLeft=K.scrollWidth}},50)},[i,s,a,n,e,l,g,u,p]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const B=()=>E.current?Array.from(E.current.querySelectorAll('input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]')):[],j=W=>{var K,ee;if(!b){if(W.key==="Escape"){typeof W.stopPropagation=="function"&&W.stopPropagation(),t();return}if(W.key==="Enter"){const Z=document.activeElement;if(!Z||Z.tagName==="INPUT"||Z.closest('[data-testid="host-select"]')||!Z.closest('[data-testid="command-select"]'))return;W.preventDefault(),typeof W.stopPropagation=="function"&&W.stopPropagation(),(K=E.current)==null||K.requestSubmit();return}if(W.key==="Tab"){W.preventDefault(),typeof W.stopPropagation=="function"&&W.stopPropagation();const Z=B();if(Z.length===0)return;const z=document.activeElement,I=Z.indexOf(z);let V;I===-1?V=W.shiftKey?Z.length-1:0:W.shiftKey?V=I<=0?Z.length-1:I-1:V=I>=Z.length-1?0:I+1,(ee=Z[V])==null||ee.focus()}}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[e,t,b]),!e)return null;const D=B=>{const j=s.find(W=>W.id===B);j&&(d(B),w(Ms(j)))},N=()=>{d(null),w("")},H=f===null,F=C!=="",$=B=>{B.preventDefault();const j=_.trim();if(!j)return;const W=m.trim();r(j,v.trim()||void 0,W||void 0,F?C:void 0),t()},O=[...s.map(B=>({id:B.id,label:B.label,isCustom:!1,agentType:B.agentType,command:B.command})),{id:"custom",label:"Custom",isCustom:!0,agentType:void 0,command:void 0}],R=[{id:"",label:"Local",ok:!0,error:void 0},...o.map(B=>({id:B.host,label:B.host,ok:B.ok,error:B.error}))],P=_.trim()||"~";return T.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"new-session-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:B=>{B.target===B.currentTarget&&t()},children:[T.jsxs("form",{ref:E,onSubmit:$,className:"w-full max-w-md border border-border bg-elevated p-6",children:[T.jsx("h2",{id:"new-session-title",className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"New Session"}),T.jsxs("div",{className:"mt-4 space-y-4",children:[M&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Host"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Host","data-testid":"host-select",children:R.map((B,j)=>{const W=C===B.id,K=!B.ok&&!W;return T.jsx("button",{type:"button",role:"radio","aria-checked":W,"aria-label":B.label,title:B.ok?void 0:B.error||"Unreachable",tabIndex:W?0:-1,onClick:()=>S(B.id),onKeyDown:ee=>{var U;let Z=j;if(ee.key==="ArrowRight"||ee.key==="ArrowDown")ee.preventDefault(),Z=(j+1)%R.length;else if(ee.key==="ArrowLeft"||ee.key==="ArrowUp")ee.preventDefault(),Z=(j-1+R.length)%R.length;else return;const z=R[Z];S(z.id);const I=ee.currentTarget.parentElement,V=I==null?void 0:I.querySelectorAll('[role="radio"]');(U=V==null?void 0:V[Z])==null||U.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${W?"btn-primary":""} ${K?"opacity-60":""}`,children:B.label},B.id||"local")})})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Command"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Command preset","data-testid":"command-select",children:O.map((B,j)=>{const W=B.isCustom?H:f===B.id;return T.jsxs("button",{ref:W?A:void 0,type:"button",role:"radio","aria-checked":W,tabIndex:W?0:-1,onClick:()=>{B.isCustom?N():D(B.id)},onKeyDown:K=>{var V;let ee=j;if(K.key==="ArrowRight"||K.key==="ArrowDown")K.preventDefault(),ee=(j+1)%O.length;else if(K.key==="ArrowLeft"||K.key==="ArrowUp")K.preventDefault(),ee=(j-1+O.length)%O.length;else return;const Z=O[ee];Z.isCustom?N():D(Z.id);const z=K.currentTarget.parentElement,I=z==null?void 0:z.querySelectorAll('[role="radio"]');(V=I==null?void 0:I[ee])==null||V.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${W?"btn-primary":""}`,children:[T.jsx(dc,{agentType:B.agentType,command:B.command,className:"inline-block h-3.5 w-3.5 shrink-0"}),B.label]},B.id)})}),T.jsx("input",{value:m,onChange:B=>w(B.target.value),placeholder:"Enter command...",className:"input mt-2 font-mono text-xs"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Project Path"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("input",{ref:L,value:_,onChange:B=>y(B.target.value),placeholder:F?"/home/user/project":i||l||n||"/Users/you/code/my-project",className:"input flex-1 text-sm"}),!F&&T.jsx("button",{type:"button",className:"btn",onClick:()=>x(!0),children:"Browse"})]})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Display Name"}),T.jsx("input",{value:v,onChange:B=>h(B.target.value),placeholder:"auto-generated",className:"input text-sm placeholder:italic"})]})]}),T.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Create"})]})]}),b&&!F&&T.jsx(dD,{initialPath:P,onSelect:B=>{y(B),x(!1)},onCancel:()=>x(!1)})]})}const hu=1,du=168;function pD({controlled:e,default:t,name:r,state:n="value"}){const{current:s}=k.useRef(e!==void 0),[a,l]=k.useState(t),i=s?e:a,o=k.useCallback(c=>{s||l(c)},[]);return[i,o]}const iv={};function Jo(e,t){const r=k.useRef(iv);return r.current===iv&&(r.current=e(t)),r}const fu=Lv[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],mD=fu&&fu!==k.useLayoutEffect?fu:e=>e();function Ft(e){const t=Jo(gD).current;return t.next=e,mD(t.effect),t.trampoline}function gD(){const e={next:void 0,callback:vD,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function vD(){}function Kh(e,t,r,n){const s=Jo(fw).current;return yD(s,e,t,r,n)&&pw(s,[e,t,r,n]),s.callback}function _D(e){const t=Jo(fw).current;return wD(t,e)&&pw(t,e),t.callback}function fw(){return{callback:null,cleanup:null,refs:[]}}function yD(e,t,r,n,s){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==n||e.refs[3]!==s}function wD(e,t){return e.refs.length!==t.length||e.refs.some((r,n)=>r!==t[n])}function pw(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const n=Array(t.length).fill(null);for(let s=0;s<t.length;s+=1){const a=t[s];if(a!=null)switch(typeof a){case"function":{const l=a(r);typeof l=="function"&&(n[s]=l);break}case"object":{a.current=r;break}}}e.cleanup=()=>{for(let s=0;s<t.length;s+=1){const a=t[s];if(a!=null)switch(typeof a){case"function":{const l=n[s];typeof l=="function"?l():a(null);break}case"object":{a.current=null;break}}}}}}}const SD=()=>{},lr=typeof document<"u"?k.useLayoutEffect:SD,Gf={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function _i(e,...t){const r=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Base UI error #${e}; visit ${r} for the full message.`}const xD=parseInt(k.version,10);function mw(e){return xD>=e}function sv(e){if(!k.isValidElement(e))return null;const t=e,r=t.props;return(mw(19)?r==null?void 0:r.ref:t.ref)??null}function Gh(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function bD(e,t){const r={};for(const n in e){const s=e[n];if(t!=null&&t.hasOwnProperty(n)){const a=t[n](s);a!=null&&Object.assign(r,a);continue}s===!0?r[`data-${n.toLowerCase()}`]="":s&&(r[`data-${n.toLowerCase()}`]=s.toString())}return r}function CD(e,t){return typeof e=="function"?e(t):e}function ED(e,t){return typeof e=="function"?e(t):e}const ao={};function qf(e,t,r,n,s){let a={...qh(e,ao)};return t&&(a=Za(a,t)),r&&(a=Za(a,r)),n&&(a=Za(a,n)),a}function kD(e){if(e.length===0)return ao;if(e.length===1)return qh(e[0],ao);let t={...qh(e[0],ao)};for(let r=1;r<e.length;r+=1)t=Za(t,e[r]);return t}function Za(e,t){return gw(t)?t(e):LD(e,t)}function LD(e,t){if(!t)return e;for(const r in t){const n=t[r];switch(r){case"style":{e[r]=Gh(e.style,n);break}case"className":{e[r]=vw(e.className,n);break}default:RD(r,n)?e[r]=TD(e[r],n):e[r]=n}}return e}function RD(e,t){const r=e.charCodeAt(0),n=e.charCodeAt(1),s=e.charCodeAt(2);return r===111&&n===110&&s>=65&&s<=90&&(typeof t=="function"||typeof t>"u")}function gw(e){return typeof e=="function"}function qh(e,t){return gw(e)?e(t):e??ao}function TD(e,t){return t?e?r=>{if(DD(r)){const s=r;Xh(s);const a=t(s);return s.baseUIHandlerPrevented||e==null||e(s),a}const n=t(r);return e==null||e(r),n}:t:e}function Xh(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function vw(e,t){return t?e?t+" "+e:t:e}function DD(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Dr(){}const en=Object.freeze({});function yi(e,t,r={}){const n=t.render,s=MD(t,r);if(r.enabled===!1)return null;const a=r.state??en;return AD(e,n,s,a)}function MD(e,t={}){const{className:r,style:n,render:s}=e,{state:a=en,ref:l,props:i,stateAttributesMapping:o,enabled:c=!0}=t,g=c?CD(r,a):void 0,u=c?ED(n,a):void 0,p=c?bD(a,o):en,_=c?Gh(p,Array.isArray(i)?kD(i):i)??en:en;return typeof document<"u"&&(c?Array.isArray(l)?_.ref=_D([_.ref,sv(s),...l]):_.ref=Kh(_.ref,sv(s),l):Kh(null,null)),c?(g!==void 0&&(_.className=vw(_.className,g)),u!==void 0&&(_.style=Gh(_.style,u)),_):en}function AD(e,t,r,n){if(t){if(typeof t=="function")return t(r,n);const s=qf(r,t.props);return s.ref=r.ref,k.cloneElement(t,s)}if(e&&typeof e=="string")return PD(e,r);throw new Error(_i(8))}function PD(e,t){return e==="button"?k.createElement("button",{type:"button",...t,key:t.key}):e==="img"?k.createElement("img",{alt:"",...t,key:t.key}):k.createElement(e,t)}const ID={...Lv};let ov=0;function BD(e,t="mui"){const[r,n]=k.useState(e),s=e||r;return k.useEffect(()=>{r==null&&(ov+=1,n(`${t}-${ov}`))},[r,t]),s}const av=ID.useId;function Xf(e,t){if(av!==void 0){const r=av();return e??(t?`${t}-${r}`:r)}return BD(e,t)}function _w(e){return Xf(e,"base-ui")}function Yf(){return typeof window<"u"}function Bo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function OD(e){return Yf()?e instanceof Element||e instanceof Bo(e).Element:!1}function ND(e){return Yf()?e instanceof HTMLElement||e instanceof Bo(e).HTMLElement:!1}function jD(e){return!Yf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bo(e).ShadowRoot}const FD=k.createContext(void 0);function $D(e=!1){const t=k.useContext(FD);if(t===void 0&&!e)throw new Error(_i(16));return t}function HD(e){const{focusableWhenDisabled:t,disabled:r,composite:n=!1,tabIndex:s=0,isNativeButton:a}=e,l=n&&t!==!1,i=n&&t===!1;return{props:k.useMemo(()=>{const c={onKeyDown(g){r&&t&&g.key!=="Tab"&&g.preventDefault()}};return n||(c.tabIndex=s,!a&&r&&(c.tabIndex=t?s:-1)),(a&&(t||l)||!a&&r)&&(c["aria-disabled"]=r),a&&(!t||i)&&(c.disabled=r),c},[n,r,t,l,i,a,s])}}function yw(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:n=0,native:s=!0}=e,a=k.useRef(null),l=$D(!0)!==void 0,i=Ft(()=>{const p=a.current;return!!((p==null?void 0:p.tagName)==="A"&&(p!=null&&p.href))}),{props:o}=HD({focusableWhenDisabled:r,disabled:t,composite:l,tabIndex:n,isNativeButton:s}),c=k.useCallback(()=>{const p=a.current;zD(p)&&l&&t&&o.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,o.disabled,l]);lr(c,[c]);const g=k.useCallback((p={})=>{const{onClick:_,onMouseDown:y,onKeyUp:v,onKeyDown:h,onPointerDown:f,...d}=p;return qf({type:s?"button":void 0,onClick(w){if(t){w.preventDefault();return}_==null||_(w)},onMouseDown(w){t||y==null||y(w)},onKeyDown(w){if(t||(Xh(w),h==null||h(w)),w.baseUIHandlerPrevented)return;const b=w.target===w.currentTarget&&!s&&!i()&&!t,x=w.key==="Enter",C=w.key===" ";b&&((C||x)&&w.preventDefault(),x&&(_==null||_(w)))},onKeyUp(w){t||(Xh(w),v==null||v(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!s&&!t&&w.key===" "&&(_==null||_(w))},onPointerDown(w){if(t){w.preventDefault();return}f==null||f(w)}},s?void 0:{role:"button"},o,d)},[t,o,s,i]),u=Ft(p=>{a.current=p,c()});return{getButtonProps:g,buttonRef:u}}function zD(e){return ND(e)&&e.tagName==="BUTTON"}const ww=k.createContext(void 0);function UD(){const e=k.useContext(ww);if(e===void 0)throw new Error(_i(63));return e}let lv=function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const WD={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},VD={valid(e){return e===null?null:e?{[lv.valid]:""}:{[lv.invalid]:""}}};let cv=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Sw={...VD,checked(e){return e?{[cv.checked]:""}:{[cv.unchecked]:""}}};function KD(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const GD=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Dr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function xw(){return k.useContext(GD)}const qD=k.createContext({invalid:void 0,name:void 0,validityData:{state:WD,errors:[],error:"",value:"",initialValue:null},setValidityData:Dr,disabled:void 0,touched:!1,setTouched:Dr,dirty:!1,setDirty:Dr,filled:!1,setFilled:Dr,focused:!1,setFocused:Dr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=en)=>e,getInputValidationProps:(e=en)=>e,inputRef:{current:null},commit:async()=>{}}});function Jf(e=!0){const t=k.useContext(qD);if(t.setValidityData===Dr&&!e)throw new Error(_i(28));return t}function XD(e){const{enabled:t=!0,value:r,id:n,name:s,controlRef:a,commit:l}=e,{formRef:i}=xw(),{invalid:o,markedDirtyRef:c,validityData:g,setValidityData:u}=Jf(),p=Ft(e.getValue);lr(()=>{if(!t)return;let _=r;_===void 0&&(_=p()),g.initialValue===null&&_!==null&&u(y=>({...y,initialValue:_}))},[t,u,r,g.initialValue,p]),lr(()=>{!t||!n||i.current.fields.set(n,{getValue:p,name:s,controlRef:a,validityData:KD(g,o),validate(){let _=r;_===void 0&&(_=p()),c.current=!0,jr.flushSync(()=>l(_))}})},[l,a,t,i,p,n,o,c,s,g,r]),lr(()=>{const _=i.current.fields;return()=>{n&&_.delete(n)}},[i,n])}const YD=k.createContext({controlId:void 0,setControlId:Dr,labelId:void 0,setLabelId:Dr,messageIds:[],setMessageIds:Dr,getDescriptionProps:e=>e});function bw(){return k.useContext(YD)}function JD(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:s,setControlId:a}=bw(),l=_w(t);return lr(()=>{if(!(!r&&!t||a===Dr)){if(r){const i=n==null?void 0:n.current;OD(i)&&i.closest("label")!=null?a(t??null):a(s??l)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,n,s,a,r,l]),s??l}const QD="none";function ZD(e,t,r,n){let s=!1,a=!1;const l=en;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){a=!0},get isCanceled(){return s},get isPropagationAllowed(){return a},trigger:r,...l}}function eM(e,t){const r=k.useRef(e),n=Ft(t);lr(()=>{r.current!==e&&n(r.current)},[e,n]),lr(()=>{r.current=e},[e])}const tM=k.forwardRef(function(t,r){const{checked:n,className:s,defaultChecked:a,id:l,inputRef:i,name:o,nativeButton:c=!1,onCheckedChange:g,readOnly:u=!1,required:p=!1,disabled:_=!1,render:y,uncheckedValue:v,...h}=t,{clearErrors:f}=xw(),{state:d,setTouched:m,setDirty:w,validityData:b,setFilled:x,setFocused:C,shouldValidateOnChange:S,validationMode:E,disabled:L,name:A,validation:M}=Jf(),{labelId:D}=bw(),N=L||_,H=A??o,F=Ft(g),$=k.useRef(null),O=Kh($,i,M.inputRef),R=k.useRef(null),P=_w(),B=JD({id:l,implicit:!1,controlRef:R}),[j,W]=pD({controlled:n,default:!!a,name:"Switch",state:"checked"});XD({id:P,commit:M.commit,value:j,controlRef:R,name:H,getValue:()=>j}),lr(()=>{$.current&&x($.current.checked)},[$,x]),eM(j,()=>{f(H),w(j!==b.initialValue),x(j),S()?M.commit(j):M.commit(j,!0)});const{getButtonProps:K,buttonRef:ee}=yw({disabled:N,native:c}),Z={id:P,role:"switch","aria-checked":j,"aria-readonly":u||void 0,"aria-labelledby":D,onFocus(){N||C(!0)},onBlur(){const U=$.current;!U||N||(m(!0),C(!1),E==="onBlur"&&M.commit(U.checked))},onClick(U){var J;u||N||(U.preventDefault(),(J=$==null?void 0:$.current)==null||J.click())}},z=k.useMemo(()=>qf({checked:j,disabled:N,id:B,name:H,required:p,style:Gf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:O,onChange(U){if(U.nativeEvent.defaultPrevented)return;const J=U.target.checked,X=ZD(QD,U.nativeEvent);F==null||F(J,X),!X.isCanceled&&W(J)},onFocus(){var U;(U=R.current)==null||U.focus()}},M.getInputValidationProps),[j,N,O,B,H,F,p,W,M]),I=k.useMemo(()=>({...d,checked:j,disabled:N,readOnly:u,required:p}),[d,j,N,u,p]),V=yi("span",t,{state:I,ref:[r,R,ee],props:[Z,M.getValidationProps,h,K],stateAttributesMapping:Sw});return T.jsxs(ww.Provider,{value:I,children:[V,!j&&H&&v!==void 0&&T.jsx("input",{type:"hidden",name:H,value:v}),T.jsx("input",{...z})]})}),rM=k.forwardRef(function(t,r){const{render:n,className:s,...a}=t,{state:l}=Jf(),i=UD(),o={...l,...i};return yi("span",t,{state:o,ref:r,stateAttributesMapping:Sw,props:a})});function Cw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Cw(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function nM(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Cw(e))&&(n&&(n+=" "),n+=t);return n}const iM=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},sM=(e,t)=>({classGroupId:e,validator:t}),Ew=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Nl="-",uv=[],oM="arbitrary..",aM=e=>{const t=cM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return lM(l);const i=l.split(Nl),o=i[0]===""&&i.length>1?1:0;return kw(i,o,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const o=n[l],c=r[l];return o?c?iM(c,o):o:c||uv}return r[l]||uv}}},kw=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const c=kw(e,t+1,a);if(c)return c}const l=r.validators;if(l===null)return;const i=t===0?e.join(Nl):e.slice(t).join(Nl),o=l.length;for(let c=0;c<o;c++){const g=l[c];if(g.validator(i))return g.classGroupId}},lM=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?oM+n:void 0})(),cM=e=>{const{theme:t,classGroups:r}=e;return uM(r,t)},uM=(e,t)=>{const r=Ew();for(const n in e){const s=e[n];Qf(s,r,n,t)}return r},Qf=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];hM(l,t,r,n)}},hM=(e,t,r,n)=>{if(typeof e=="string"){dM(e,t,r);return}if(typeof e=="function"){fM(e,t,r,n);return}pM(e,t,r,n)},dM=(e,t,r)=>{const n=e===""?t:Lw(t,e);n.classGroupId=r},fM=(e,t,r,n)=>{if(mM(e)){Qf(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(sM(r,e))},pM=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[i,o]=s[l];Qf(o,Lw(t,i),r,n)}},Lw=(e,t)=>{let r=e;const n=t.split(Nl),s=n.length;for(let a=0;a<s;a++){const l=n[a];let i=r.nextPart.get(l);i||(i=Ew(),r.nextPart.set(l,i)),r=i}return r},mM=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return s(a,l),l},set(a,l){a in r?r[a]=l:s(a,l)}}},Yh="!",hv=":",vM=[],dv=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),_M=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let l=0,i=0,o=0,c;const g=s.length;for(let v=0;v<g;v++){const h=s[v];if(l===0&&i===0){if(h===hv){a.push(s.slice(o,v)),o=v+1;continue}if(h==="/"){c=v;continue}}h==="["?l++:h==="]"?l--:h==="("?i++:h===")"&&i--}const u=a.length===0?s:s.slice(o);let p=u,_=!1;u.endsWith(Yh)?(p=u.slice(0,-1),_=!0):u.startsWith(Yh)&&(p=u.slice(1),_=!0);const y=c&&c>o?c-o:void 0;return dv(a,_,p,y)};if(t){const s=t+hv,a=n;n=l=>l.startsWith(s)?a(l.slice(s.length)):dv(vM,!1,l,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},yM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",o=t.has(l);i||o?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(l)):s.push(l)}return s.length>0&&(s.sort(),n.push(...s)),n}},wM=e=>({cache:gM(e.cacheSize),parseClassName:_M(e),sortModifiers:yM(e),...aM(e)}),SM=/\s+/,xM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],i=e.trim().split(SM);let o="";for(let c=i.length-1;c>=0;c-=1){const g=i[c],{isExternal:u,modifiers:p,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:v}=r(g);if(u){o=g+(o.length>0?" "+o:o);continue}let h=!!v,f=n(h?y.substring(0,v):y);if(!f){if(!h){o=g+(o.length>0?" "+o:o);continue}if(f=n(y),!f){o=g+(o.length>0?" "+o:o);continue}h=!1}const d=p.length===0?"":p.length===1?p[0]:a(p).join(":"),m=_?d+Yh:d,w=m+f;if(l.indexOf(w)>-1)continue;l.push(w);const b=s(f,h);for(let x=0;x<b.length;++x){const C=b[x];l.push(m+C)}o=g+(o.length>0?" "+o:o)}return o},bM=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Rw(r))&&(s&&(s+=" "),s+=n);return s},Rw=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Rw(e[n]))&&(r&&(r+=" "),r+=t);return r},CM=(e,...t)=>{let r,n,s,a;const l=o=>{const c=t.reduce((g,u)=>u(g),e());return r=wM(c),n=r.cache.get,s=r.cache.set,a=i,i(o)},i=o=>{const c=n(o);if(c)return c;const g=xM(o,r);return s(o,g),g};return a=l,(...o)=>a(bM(...o))},EM=[],vt=e=>{const t=r=>r[e]||EM;return t.isThemeGetter=!0,t},Tw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kM=/^\d+\/\d+$/,LM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,TM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ei=e=>kM.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),pn=e=>!!e&&Number.isInteger(Number(e)),pu=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Yr=e=>LM.test(e),AM=()=>!0,PM=e=>RM.test(e)&&!TM.test(e),Mw=()=>!1,IM=e=>DM.test(e),BM=e=>MM.test(e),OM=e=>!Se(e)&&!xe(e),NM=e=>ws(e,Iw,Mw),Se=e=>Tw.test(e),qn=e=>ws(e,Bw,PM),mu=e=>ws(e,zM,Ne),fv=e=>ws(e,Aw,Mw),jM=e=>ws(e,Pw,BM),Ta=e=>ws(e,Ow,IM),xe=e=>Dw.test(e),Ps=e=>Ss(e,Bw),FM=e=>Ss(e,UM),pv=e=>Ss(e,Aw),$M=e=>Ss(e,Iw),HM=e=>Ss(e,Pw),Da=e=>Ss(e,Ow,!0),ws=(e,t,r)=>{const n=Tw.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ss=(e,t,r=!1)=>{const n=Dw.exec(e);return n?n[1]?t(n[1]):r:!1},Aw=e=>e==="position"||e==="percentage",Pw=e=>e==="image"||e==="url",Iw=e=>e==="length"||e==="size"||e==="bg-size",Bw=e=>e==="length",zM=e=>e==="number",UM=e=>e==="family-name",Ow=e=>e==="shadow",WM=()=>{const e=vt("color"),t=vt("font"),r=vt("text"),n=vt("font-weight"),s=vt("tracking"),a=vt("leading"),l=vt("breakpoint"),i=vt("container"),o=vt("spacing"),c=vt("radius"),g=vt("shadow"),u=vt("inset-shadow"),p=vt("text-shadow"),_=vt("drop-shadow"),y=vt("blur"),v=vt("perspective"),h=vt("aspect"),f=vt("ease"),d=vt("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],b=()=>[...w(),xe,Se],x=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],S=()=>[xe,Se,o],E=()=>[Ei,"full","auto",...S()],L=()=>[pn,"none","subgrid",xe,Se],A=()=>["auto",{span:["full",pn,xe,Se]},pn,xe,Se],M=()=>[pn,"auto",xe,Se],D=()=>["auto","min","max","fr",xe,Se],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...S()],$=()=>[Ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],O=()=>[e,xe,Se],R=()=>[...w(),pv,fv,{position:[xe,Se]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",$M,NM,{size:[xe,Se]}],j=()=>[pu,Ps,qn],W=()=>["","none","full",c,xe,Se],K=()=>["",Ne,Ps,qn],ee=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[Ne,pu,pv,fv],I=()=>["","none",y,xe,Se],V=()=>["none",Ne,xe,Se],U=()=>["none",Ne,xe,Se],J=()=>[Ne,xe,Se],X=()=>[Ei,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[AM],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[OM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",Ne],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ei,Se,xe,h]}],container:["container"],columns:[{columns:[Ne,Se,xe,i]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[pn,"auto",xe,Se]}],basis:[{basis:[Ei,"full","auto",i,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Ei,"auto","initial","none",Se]}],grow:[{grow:["",Ne,xe,Se]}],shrink:[{shrink:["",Ne,xe,Se]}],order:[{order:[pn,"first","last","none",xe,Se]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[i,"screen",...$()]}],"min-w":[{"min-w":[i,"screen","none",...$()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",r,Ps,qn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,xe,mu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pu,Se]}],"font-family":[{font:[FM,Se,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,xe,Se]}],"line-clamp":[{"line-clamp":[Ne,"none",xe,mu]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",xe,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",xe,qn]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Ne,"auto",xe,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pn,xe,Se],radial:["",xe,Se],conic:[pn,xe,Se]},HM,jM]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,xe,Se]}],"outline-w":[{outline:["",Ne,Ps,qn]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",g,Da,Ta]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",u,Da,Ta]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Ne,qn]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",p,Da,Ta]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Ne,xe,Se]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[xe,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,Se]}],filter:[{filter:["","none",xe,Se]}],blur:[{blur:I()}],brightness:[{brightness:[Ne,xe,Se]}],contrast:[{contrast:[Ne,xe,Se]}],"drop-shadow":[{"drop-shadow":["","none",_,Da,Ta]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Ne,xe,Se]}],"hue-rotate":[{"hue-rotate":[Ne,xe,Se]}],invert:[{invert:["",Ne,xe,Se]}],saturate:[{saturate:[Ne,xe,Se]}],sepia:[{sepia:["",Ne,xe,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,Se]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,xe,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,xe,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,xe,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,xe,Se]}],"backdrop-invert":[{"backdrop-invert":["",Ne,xe,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,xe,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,xe,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,xe,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",xe,Se]}],ease:[{ease:["linear","initial",f,xe,Se]}],delay:[{delay:[Ne,xe,Se]}],animate:[{animate:["none",d,xe,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,xe,Se]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[xe,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,Se]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Ne,Ps,qn,mu]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},VM=CM(WM);function jl(...e){return VM(nM(e))}function mn({checked:e,onCheckedChange:t,disabled:r,className:n}){return T.jsx(tM,{checked:e,onCheckedChange:t,disabled:r,className:jl("group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","bg-border data-[checked]:bg-accent","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base","disabled:cursor-not-allowed disabled:opacity-50",n),children:T.jsx(rM,{className:jl("pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform","translate-x-1 group-data-[checked]:translate-x-5")})})}let Lr=null,Zf=!1;const Fl={},Nw=500;function ep(){if(typeof window>"u")return null;if((Lr==null?void 0:Lr.state)==="closed"&&(Lr=null),!Lr){const e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Lr=new e}return Lr}function KM(){Lr&&(Lr.close().catch(()=>{}),Lr=null),ep()}function GM(){return Zf}function gu(){Lr&&(KM(),Zf=!0)}if(typeof window<"u"){window.addEventListener("pageshow",t=>{t.persisted&&gu()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&gu()});let e=Date.now();setInterval(()=>{const t=Date.now();t-e>15e3&&gu(),e=t},5e3)}async function Jh(){const e=ep();e&&e.state==="suspended"&&await e.resume().catch(()=>{}),Zf=!1}async function qM(e){e.state==="suspended"&&await e.resume().catch(()=>{})}async function jw(e){const t=ep();if(!t||(await qM(t),t.state!=="running"))return;const{frequencies:r,durationMs:n,attackMs:s,peakGain:a,type:l="sine"}=e,i=t.currentTime,o=n/1e3,c=s/1e3,g=t.createGain();g.connect(t.destination);const u=i+o*.7;g.gain.setValueAtTime(0,i),g.gain.linearRampToValueAtTime(a,i+c),g.gain.setValueAtTime(a,u),g.gain.linearRampToValueAtTime(0,i+o);const p=r.map(y=>{const v=t.createOscillator();return v.type=l,v.frequency.setValueAtTime(y,i),v.connect(g),v});for(const y of p)y.start(i),y.stop(i+o);const _=p[p.length-1];_.onended=()=>{for(const y of p)y.disconnect();g.disconnect()}}async function Qh(){const e=Date.now();if(!(e-(Fl.permission||0)<Nw)){Fl.permission=e;try{await jw({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:"sine"})}catch{}}}async function Zh(){const e=Date.now();if(!(e-(Fl.idle||0)<Nw)){Fl.idle=e;try{await jw({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:"sine"})}catch{}}}function XM({isOpen:e,onClose:t}){const r=de(Y=>Y.defaultProjectDir),n=de(Y=>Y.setDefaultProjectDir),s=de(Y=>Y.commandPresets),a=de(Y=>Y.setCommandPresets),l=de(Y=>Y.defaultPresetId),i=de(Y=>Y.setDefaultPresetId),o=de(Y=>Y.sessionSortMode),c=de(Y=>Y.setSessionSortMode),g=de(Y=>Y.sessionSortDirection),u=de(Y=>Y.setSessionSortDirection),p=de(Y=>Y.useWebGL),_=de(Y=>Y.setUseWebGL),y=de(Y=>Y.fontSize),v=de(Y=>Y.setFontSize),h=de(Y=>Y.lineHeight),f=de(Y=>Y.setLineHeight),d=de(Y=>Y.letterSpacing),m=de(Y=>Y.setLetterSpacing),w=de(Y=>Y.fontOption),b=de(Y=>Y.setFontOption),x=de(Y=>Y.customFontFamily),C=de(Y=>Y.setCustomFontFamily),S=de(Y=>Y.shortcutModifier),E=de(Y=>Y.setShortcutModifier),L=de(Y=>Y.showProjectName),A=de(Y=>Y.setShowProjectName),M=de(Y=>Y.showLastUserMessage),D=de(Y=>Y.setShowLastUserMessage),N=de(Y=>Y.showSessionIdPrefix),H=de(Y=>Y.setShowSessionIdPrefix),F=Ol(Y=>Y.theme),$=Ol(Y=>Y.setTheme),O=de(Y=>Y.soundOnPermission),R=de(Y=>Y.setSoundOnPermission),P=de(Y=>Y.soundOnIdle),B=de(Y=>Y.setSoundOnIdle),[j,W]=k.useState(r),[K,ee]=k.useState(s),[Z,z]=k.useState(l),[I,V]=k.useState(o),[U,J]=k.useState(g),[X,me]=k.useState(p),[ce,fe]=k.useState(y),[Ee,ae]=k.useState(h),[Te,je]=k.useState(d),[pe,_e]=k.useState(w),[ke,se]=k.useState(x),[be,oe]=k.useState(S),[he,Le]=k.useState(L),[Re,Ce]=k.useState(M),[q,Q]=k.useState(N),[ge,He]=k.useState(F),[ie,G]=k.useState(O),[re,le]=k.useState(P),[te,ue]=k.useState(!0),[Oe,Fe]=k.useState(!1),[De,Be]=k.useState(24),[Pe,Ue]=k.useState(!1),[Me,ze]=k.useState(!1),[Je,nt]=k.useState(""),[we,Ae]=k.useState(""),[Ke,Ge]=k.useState(""),lt=k.useRef(null);if(k.useEffect(()=>{if(lt.current&&(clearTimeout(lt.current),lt.current=null),e){if(W(r),ee(s),z(l),V(o),J(g),me(p),fe(y),ae(h),je(d),_e(w),se(x),oe(S),Le(L),Ce(M),Q(N),He(F),G(O),le(P),ze(!1),nt(""),Ae(""),Ge(""),fetch("/api/settings/tmux-mouse-mode").then(Y=>Y.json()).then(Y=>ue(Y.enabled)).catch(()=>{}),fetch("/api/settings/inactive-max-age-hours").then(Y=>Y.json()).then(Y=>Be(Y.hours)).catch(()=>{}),typeof document<"u"){const Y=document.querySelector(".xterm-helper-textarea");Y&&typeof Y.setAttribute=="function"&&(typeof Y.blur=="function"&&Y.blur(),Y.setAttribute("disabled","true"))}}else typeof document<"u"&&(lt.current=setTimeout(()=>{if(typeof document>"u")return;const Y=document.querySelector(".xterm-helper-textarea");Y&&(Y.removeAttribute("disabled"),Y.focus())},300));return()=>{lt.current&&(clearTimeout(lt.current),lt.current=null)}},[s,l,r,o,g,p,y,h,d,w,x,S,L,M,N,F,O,P,e]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const Y=Qe=>{Qe.key==="Escape"&&(typeof Qe.stopPropagation=="function"&&Qe.stopPropagation(),t())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e,t]),!e)return null;const xt=Y=>{Y.preventDefault();const Qe=j.trim(),Vr=X!==p;n(Qe||fh),a(K),i(Z),c(I),u(U),_(X),v(ce),f(Ee),m(Te),b(pe),C(ke),E(be),A(he),D(Re),H(q),$(ge),R(ie),B(re),t({webglChanged:Vr})},dt=(Y,Qe)=>{ee(Vr=>Vr.map(Kr=>Kr.id===Y?{...Kr,...Qe}:Kr))},Wt=Y=>{var Kr;const Qe=K.find(wi=>wi.id===Y);if(!Qe||Qe.isBuiltIn)return;const Vr=K.filter(wi=>wi.id!==Y);ee(Vr),Y===Z&&z(((Kr=Vr[0])==null?void 0:Kr.id)||"claude")},Wr=()=>{if(!Je.trim()||!we.trim()||K.length>=Xi)return;const Y={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:Je.trim(),command:we.trim(),isBuiltIn:!1,agentType:Ke||void 0};ee([...K,Y]),ze(!1),nt(""),Ae(""),Ge("")},xs=K.length<Xi,Zo=Y=>{Fe(!0),ue(Y),fetch("/api/settings/tmux-mouse-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:Y})}).catch(()=>ue(!Y)).finally(()=>Fe(!1))},ea=Y=>{const Qe=De;Ue(!0),Be(Y),fetch("/api/settings/inactive-max-age-hours",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:Y})}).catch(()=>Be(Qe)).finally(()=>Ue(!1))};return T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:Y=>{Y.target===Y.currentTarget&&t()},children:T.jsxs("form",{onSubmit:xt,className:"w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"p-6 pb-0",children:[T.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"Settings"}),T.jsx("p",{className:"mt-2 text-xs text-muted text-pretty",children:"Configure default directory, command presets, and display options."})]}),T.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4",children:T.jsxs("div",{className:"mt-5 space-y-4",children:[T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Default Project Directory"}),T.jsx("input",{value:j,onChange:Y=>W(Y.target.value),placeholder:fh,className:"input",autoFocus:!0})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsxs("div",{className:"flex items-center justify-between mb-2",children:[T.jsx("label",{className:"text-xs text-secondary",children:"Command Presets"}),T.jsx("select",{value:Z,onChange:Y=>z(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:K.map(Y=>T.jsx("option",{value:Y.id,children:Y.label},Y.id))})]}),T.jsx("p",{className:"text-[10px] text-muted mb-3",children:"Default preset is pre-selected when creating new sessions."}),T.jsx("div",{className:"space-y-3",children:K.map(Y=>T.jsxs("div",{className:"border border-border p-3 space-y-2",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsx("div",{className:"flex items-center gap-2",children:T.jsx("input",{value:Y.label,onChange:Qe=>dt(Y.id,{label:Qe.target.value}),className:"input text-sm py-1 px-2 w-32",placeholder:"Label"})}),!Y.isBuiltIn&&T.jsx("button",{type:"button",onClick:()=>Wt(Y.id),className:"btn text-xs px-2 py-1 text-error hover:bg-error/10",children:"Delete"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Command"}),T.jsx("input",{value:Y.command,onChange:Qe=>dt(Y.id,{command:Qe.target.value}),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"})]}),!Y.isBuiltIn&&T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Icon"}),T.jsxs("select",{value:Y.agentType||"",onChange:Qe=>dt(Y.id,{agentType:Qe.target.value||void 0}),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal"}),T.jsx("option",{value:"claude",children:"Claude"}),T.jsx("option",{value:"codex",children:"Codex"})]})]})]},Y.id))}),Me?T.jsxs("div",{className:"mt-3 border border-border p-3 space-y-2",children:[T.jsx("div",{className:"text-xs text-secondary mb-2",children:"New Preset"}),T.jsx("input",{value:Je,onChange:Y=>nt(Y.target.value),className:"input text-xs py-1 px-2 w-full",placeholder:"Label"}),T.jsx("input",{value:we,onChange:Y=>Ae(Y.target.value),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("select",{value:Ke,onChange:Y=>Ge(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal Icon"}),T.jsx("option",{value:"claude",children:"Claude Icon"}),T.jsx("option",{value:"codex",children:"Codex Icon"})]}),T.jsx("div",{className:"flex-1"}),T.jsx("button",{type:"button",onClick:()=>ze(!1),className:"btn text-xs px-2 py-1",children:"Cancel"}),T.jsx("button",{type:"button",onClick:Wr,disabled:!Je.trim()||!we.trim(),className:"btn btn-primary text-xs px-2 py-1",children:"Add"})]})]}):T.jsx("button",{type:"button",onClick:()=>ze(!0),disabled:!xs,className:"btn text-xs mt-3 w-full",children:xs?"+ Add Preset":`Max ${Xi} presets`})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Session List Order"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${I==="created"?"btn-primary":""}`,onClick:()=>V("created"),children:"Created"}),T.jsx("button",{type:"button",className:`btn flex-1 ${I==="status"?"btn-primary":""}`,onClick:()=>V("status"),children:"Status"}),T.jsx("button",{type:"button",className:`btn flex-1 ${I==="manual"?"btn-primary":""}`,onClick:()=>V("manual"),children:"Manual"})]}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:I==="status"?"Sessions auto-resort by status (waiting, working, unknown)":I==="manual"?"Drag sessions to reorder manually":"Sessions stay in creation order"})]}),I==="created"&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Sort Direction"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${U==="desc"?"btn-primary":""}`,onClick:()=>J("desc"),children:"Newest First"}),T.jsx("button",{type:"button",className:`btn flex-1 ${U==="asc"?"btn-primary":""}`,onClick:()=>J("asc"),children:"Oldest First"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Session List Details"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Project Name"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the project folder name under each session."})]}),T.jsx(mn,{checked:he,onCheckedChange:Le})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Last User Message"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the most recent user input next to the project name."})]}),T.jsx(mn,{checked:Re,onCheckedChange:Ce})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Session ID Prefix"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show first 5 characters of agent session IDs in the list."})]}),T.jsx(mn,{checked:q,onCheckedChange:Q})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Inactive Sessions Lookback"}),T.jsxs("div",{className:"text-[10px] text-muted",children:["Show inactive sessions from the last N hours (",hu,"-",du,")."]})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"number",min:hu,max:du,value:De,onChange:Y=>{const Qe=parseInt(Y.target.value,10);Qe>=hu&&Qe<=du&&ea(Qe)},disabled:Pe,className:"input text-xs py-1 px-2 w-16 text-center"}),T.jsx("span",{className:"text-xs text-muted",children:"hrs"})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Notifications"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Permission Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a ping when any session needs permission."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void Qh(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(mn,{checked:ie,onCheckedChange:Y=>{G(Y),Y&&Jh()}})]})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Idle Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a chime when a session finishes working."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void Zh(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(mn,{checked:re,onCheckedChange:Y=>{le(Y),Y&&Jh()}})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Terminal Rendering"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"WebGL Acceleration"}),T.jsx("div",{className:"text-[10px] text-muted",children:"GPU rendering for better performance. Turn off if text looks fuzzy or flickering."})]}),T.jsx(mn,{checked:X,onCheckedChange:me})]}),X!==p&&T.jsx("p",{className:"mt-2 text-[10px] text-approval",children:"Terminal will reload when saved"}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Mouse Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Enable tmux mouse mode for trackpad/scroll wheel support."})]}),T.jsx(mn,{checked:te,onCheckedChange:Zo,disabled:Oe})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Size"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal text size in pixels (6-24)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>fe(Math.max(6,ce-1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"−"})}),T.jsx("span",{className:"text-sm text-secondary w-6 text-center",children:ce}),T.jsx("button",{type:"button",onClick:()=>fe(Math.min(24,ce+1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"+"})})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Line Height"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Vertical spacing (1.0 = compact, 2.0 = spacious)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"1.0",max:"2.0",step:"0.1",value:Ee,onChange:Y=>ae(parseFloat(Y.target.value)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsx("span",{className:"text-xs text-secondary w-8 text-right",children:Ee.toFixed(1)})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Letter Spacing"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Horizontal spacing between characters in pixels"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"-3",max:"3",step:"1",value:Te,onChange:Y=>je(parseInt(Y.target.value,10)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsxs("span",{className:"text-xs text-secondary w-8 text-right",children:[Te,"px"]})]})]}),T.jsxs("div",{className:"mt-4",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Family"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal typeface"})]}),T.jsx("select",{value:pe,onChange:Y=>_e(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:ph.map(Y=>T.jsx("option",{value:Y.id,children:Y.label},Y.id))})]}),pe==="custom"&&T.jsx("input",{value:ke,onChange:Y=>se(Y.target.value),placeholder:'"Fira Code", monospace',className:"input text-xs mt-2 font-mono"})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Dark Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Switch between dark and light themes."})]}),T.jsx(mn,{checked:ge==="dark",onCheckedChange:Y=>He(Y?"dark":"light")})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Keyboard Shortcut Modifier"}),T.jsx("div",{className:"grid grid-cols-5 gap-1",children:["auto","ctrl-option","ctrl-shift","cmd-option","cmd-shift"].map(Y=>T.jsx("button",{type:"button",className:`btn text-xs px-2 ${be===Y?"btn-primary":""}`,onClick:()=>oe(Y),children:Y==="auto"?"Auto":Yi(Y)},Y))}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:be==="auto"?`Platform default: ${Yi(Uo("auto"))}`:`Shortcuts: ${Yi(be)}+[N/X/[/]]`})]})]})}),T.jsxs("div",{className:"flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated",children:[T.jsx("button",{type:"button",onClick:()=>t(),className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save"})]})]})})}function zi(e){return(e==null?void 0:e.ownerDocument)||document}let mv=0;function Fw(e){return mv+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${mv}`}const YM=[];function JM(e){k.useEffect(e,YM)}const Is=0;class $l{constructor(){ir(this,"currentId",Is);ir(this,"clear",()=>{this.currentId!==Is&&(clearTimeout(this.currentId),this.currentId=Is)});ir(this,"disposeEffect",()=>this.clear)}static create(){return new $l}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Is,r()},t)}isStarted(){return this.currentId!==Is}}const Qo=typeof navigator<"u",vu=r3(),QM=i3(),ZM=n3();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");vu.platform==="MacIntel"&&vu.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(vu.platform);const e3=Qo&&/apple/i.test(navigator.vendor);Qo&&QM.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const t3=ZM.includes("jsdom/");function r3(){if(!Qo)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function n3(){if(!Qo)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:r})=>`${t}/${r}`).join(" "):navigator.userAgent}function i3(){if(!Qo)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Hl(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function es(e,t){var n;if(!e||!t)return!1;const r=(n=t.getRootNode)==null?void 0:n.call(t);if(e.contains(t))return!0;if(r&&jD(r)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function ed(e){return"composedPath"in e?e.composedPath()[0]:e.target}function td(e){if(!e||t3)return!0;try{return e.matches(":focus-visible")}catch{return!0}}const tp=k.createContext(void 0);function rp(){const e=k.useContext(tp);if(!e)throw new Error(_i(73));return e}function _u(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const r=e(t);return typeof r=="string"?{description:r}:r}return e}const s3=function(t){const{children:r,timeout:n=5e3,limit:s=3,toastManager:a}=t,[l,i]=k.useState([]),[o,c]=k.useState(!1),[g,u]=k.useState(!1),[p,_]=k.useState(null);l.length===0&&(o&&c(!1),g&&u(!1));const y=o||g,v=k.useRef(new Map),h=k.useRef(null),f=k.useRef(!0),d=k.useRef(!1);function m(D){var O,R;const N=Hl(zi(h.current));if(!h.current||!es(h.current,N)||!td(N))return;const H=l.findIndex(P=>P.id===D);let F=null,$=H+1;for(;$<l.length;){if(l[$].transitionStatus!=="ending"){F=l[$];break}$+=1}if(!F)for($=H-1;$>=0;){if(l[$].transitionStatus!=="ending"){F=l[$];break}$-=1}F?(R=(O=F.ref)==null?void 0:O.current)==null||R.focus():p==null||p.focus({preventScroll:!0})}const w=Ft(()=>{d.current||(d.current=!0,v.current.forEach(D=>{if(D.timeout){D.timeout.clear();const N=Date.now()-D.start,H=D.delay-N;D.remaining=H>0?H:0}}))}),b=Ft(()=>{d.current&&(d.current=!1,v.current.forEach((D,N)=>{D.remaining=D.remaining>0?D.remaining:D.delay,D.timeout??(D.timeout=$l.create()),D.timeout.start(D.remaining,()=>{v.current.delete(N),D.callback()}),D.start=Date.now()}))}),x=Ft(D=>{var F;i($=>{const O=$.map(P=>P.id===D?{...P,transitionStatus:"ending",height:0}:P),R=O.filter(P=>P.transitionStatus!=="ending");return O.map(P=>{if(P.transitionStatus==="ending")return P;const B=R.indexOf(P)>=s;return{...P,limited:B}})});const N=v.current.get(D);N&&N.timeout&&(N.timeout.clear(),v.current.delete(D));const H=l.find($=>$.id===D);(F=H==null?void 0:H.onClose)==null||F.call(H),m(D),l.length===1&&(c(!1),u(!1))}),C=Ft(D=>{var H;i(F=>F.filter($=>$.id!==D));const N=l.find(F=>F.id===D);(H=N==null?void 0:N.onRemove)==null||H.call(N)}),S=Ft((D,N,H)=>{const F=Date.now(),$=f.current&&!o&&!g,O=$?$l.create():void 0;O==null||O.start(N,()=>{v.current.delete(D),H()}),v.current.set(D,{timeout:O,start:$?F:0,delay:N,remaining:N,callback:H})}),E=Ft(D=>{const N=D.id||Fw("toast"),H={...D,id:N,transitionStatus:"starting"};i($=>{const O=[H,...$],R=O.filter(P=>P.transitionStatus!=="ending");if(R.length>s){const P=R.length-s,B=R.slice(-P);return O.map(j=>B.some(W=>W.id===j.id)?{...j,limited:!0}:{...j,limited:!1})}return O.map(P=>({...P,limited:!1}))});const F=H.timeout??n;return H.type!=="loading"&&F>0&&S(N,F,()=>x(N)),(o||g||!f.current)&&w(),N}),L=Ft((D,N)=>{i(H=>H.map(F=>F.id===D?{...F,...N}:F))}),A=Ft((D,N)=>{const H=_u(N.loading),F=E({...H,type:"loading"}),$=D.then(O=>{const R=_u(N.success,O);L(F,{...R,type:"success"});const P=R.timeout??n;return P>0&&S(F,P,()=>x(F)),(o||g||!f.current)&&w(),O}).catch(O=>{const R=_u(N.error,O);L(F,{...R,type:"error"});const P=R.timeout??n;return P>0&&S(F,P,()=>x(F)),(o||g||!f.current)&&w(),Promise.reject(O)});return{}.hasOwnProperty.call(N,"setPromise")&&N.setPromise($),$});k.useEffect(function(){return a?a[" subscribe"](({action:H,options:F})=>{const $=F.id;H==="promise"&&F.promise?A(F.promise,F):H==="update"&&$?L($,F):H==="close"&&$?x($):E(F)}):void 0},[E,L,S,n,a,A,x]);const M=k.useMemo(()=>({toasts:l,setToasts:i,hovering:o,setHovering:c,focused:g,setFocused:u,expanded:y,add:E,close:x,remove:C,update:L,promise:A,pauseTimers:w,resumeTimers:b,prevFocusElement:p,setPrevFocusElement:_,viewportRef:h,scheduleTimer:S,windowFocusedRef:f}),[E,x,g,o,y,w,p,A,C,b,S,l,L]);return T.jsx(tp.Provider,{value:M,children:r})},yu=k.forwardRef(function(t,r){const[n,s]=k.useState();lr(()=>{e3&&s("button")},[]);const a={tabIndex:0,role:n};return T.jsx("span",{...t,ref:r,style:Gf,"aria-hidden":n?void 0:!0,...a,"data-base-ui-focus-guard":""})}),o3=k.createContext(void 0);let a3=function(e){return e.frontmostHeight="--toast-frontmost-height",e}({});const l3=k.forwardRef(function(t,r){var O;const{render:n,className:s,children:a,...l}=t,{toasts:i,pauseTimers:o,resumeTimers:c,setHovering:g,setFocused:u,viewportRef:p,windowFocusedRef:_,prevFocusElement:y,setPrevFocusElement:v,expanded:h,focused:f}=rp(),d=k.useRef(!1),m=k.useRef(!1),w=i.length,b=((O=i[0])==null?void 0:O.height)??0,x=k.useMemo(()=>i.some(R=>R.transitionStatus==="ending"),[i]);k.useEffect(()=>{if(!p.current)return;function R(B){var j;w!==0&&B.key==="F6"&&B.target!==p.current&&(B.preventDefault(),v(Hl(zi(p.current))),(j=p.current)==null||j.focus({preventScroll:!0}),o(),u(!0))}const P=Bo(p.current);return P.addEventListener("keydown",R),()=>{P.removeEventListener("keydown",R)}},[o,u,v,w,p]),k.useEffect(()=>{if(!p.current||!w)return;const R=Bo(p.current);function P(j){j.target===R&&(_.current=!1,o())}function B(j){if(j.relatedTarget||j.target===R)return;const W=ed(j),K=Hl(zi(p.current));(!es(p.current,W)||!td(K))&&c(),setTimeout(()=>{_.current=!0})}return R.addEventListener("blur",P,!0),R.addEventListener("focus",B,!0),()=>{R.removeEventListener("blur",P,!0),R.removeEventListener("focus",B,!0)}},[o,c,p,_,u,w]),k.useEffect(()=>{const R=p.current;if(!R||w===0)return;const P=zi(R);function B(j){if(j.pointerType!=="touch")return;const W=ed(j);es(R,W)||(c(),g(!1),u(!1))}return P.addEventListener("pointerdown",B,!0),()=>{P.removeEventListener("pointerdown",B,!0)}},[w,c,u,g,p]);function C(R){var P,B,j;p.current&&(d.current=!0,R.relatedTarget===p.current?(j=(B=(P=i[0])==null?void 0:P.ref)==null?void 0:B.current)==null||j.focus():y==null||y.focus({preventScroll:!0}))}function S(R){R.key==="Tab"&&R.shiftKey&&R.target===p.current&&(R.preventDefault(),y==null||y.focus({preventScroll:!0}),c())}k.useEffect(()=>{!_.current||x||!m.current||(c(),g(!1),m.current=!1)},[x,c,g,_]);function E(){o(),g(!0),m.current=!1}function L(){i.some(R=>R.transitionStatus==="ending")?m.current=!0:(c(),g(!1))}function A(){if(d.current){d.current=!1;return}f||td(zi(p.current).activeElement)&&(u(!0),o())}function M(R){!f||es(p.current,R.relatedTarget)||(u(!1),c())}const D={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:E,onMouseMove:E,onMouseLeave:L,onFocus:A,onBlur:M,onKeyDown:S,onClick:A},N=k.useMemo(()=>({expanded:h}),[h]),H=yi("div",t,{ref:[r,p],state:N,props:[D,{style:{[a3.frontmostHeight]:b?`${b}px`:void 0}},l,{children:T.jsxs(k.Fragment,{children:[w>0&&y&&T.jsx(yu,{onFocus:C}),a,w>0&&y&&T.jsx(yu,{onFocus:C})]})}]}),F=k.useMemo(()=>({viewportRef:p}),[p]),$=k.useMemo(()=>i.filter(R=>R.priority==="high"),[i]);return T.jsxs(o3.Provider,{value:F,children:[w>0&&y&&T.jsx(yu,{onFocus:C}),H,!f&&$.length>0&&T.jsx("div",{style:Gf,children:$.map(R=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:R.title}),T.jsx("div",{children:R.description})]},R.id))})]})});function c3(e){return mw(19)?e:e?"true":void 0}const $w=k.createContext(void 0);function Oo(){const e=k.useContext($w);if(!e)throw new Error(_i(66));return e}let Hw=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const u3={[Hw.startingStyle]:""},h3={[Hw.endingStyle]:""},d3={transitionStatus(e){return e==="starting"?u3:e==="ending"?h3:null}};function f3(e){const t=Jo(p3,e).current;return t.next=e,lr(t.effect),t}function p3(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Ma=null;class m3{constructor(){ir(this,"callbacks",[]);ir(this,"callbacksCount",0);ir(this,"nextId",1);ir(this,"startId",1);ir(this,"isScheduled",!1);ir(this,"tick",t=>{var s;this.isScheduled=!1;const r=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let a=0;a<r.length;a+=1)(s=r[a])==null||s.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const Aa=new m3;class np{constructor(){ir(this,"currentId",Ma);ir(this,"cancel",()=>{this.currentId!==Ma&&(Aa.cancel(this.currentId),this.currentId=Ma)});ir(this,"disposeEffect",()=>this.cancel)}static create(){return new np}static request(t){return Aa.request(t)}static cancel(t){return Aa.cancel(t)}request(t){this.cancel(),this.currentId=Aa.request(()=>{this.currentId=Ma,t()})}}function g3(){const e=Jo(np.create).current;return JM(e.disposeEffect),e}function v3(e){return e==null?e:"current"in e?e.current:e}function _3(e,t=!1,r=!0){const n=g3();return Ft((s,a=null)=>{n.cancel();const l=v3(e);l!=null&&(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?s():n.request(()=>{function i(){l&&Promise.all(l.getAnimations().map(o=>o.finished)).then(()=>{a!=null&&a.aborted||jr.flushSync(s)}).catch(()=>{if(r){if(a!=null&&a.aborted)return;jr.flushSync(s)}else l.getAnimations().length>0&&l.getAnimations().some(o=>o.pending||o.playState!=="finished")&&i()})}t?n.request(i):i()}))})}function y3(e){const{enabled:t=!0,open:r,ref:n,onComplete:s}=e,a=f3(r),l=Ft(s),i=_3(n,r);k.useEffect(()=>{t&&i(()=>{r===a.current&&l()})},[t,r,l,i,a])}let Xn=function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e}({});const w3={...d3,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Bs=40,S3=10,gn=.5,x3=1;function gv(e,t,r){switch(e){case"up":return-r;case"down":return r;case"left":return-t;case"right":return t;default:return 0}}function b3(e){const r=window.getComputedStyle(e).transform;let n=0,s=0,a=1;if(r&&r!=="none"){const l=r.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const i=l[1].split(", ").map(parseFloat);i.length===6?(n=i[4],s=i[5],a=Math.sqrt(i[0]*i[0]+i[1]*i[1])):i.length===16&&(n=i[12],s=i[13],a=i[0])}}return{x:n,y:s,scale:a}}const C3=k.forwardRef(function(t,r){var be;const{toast:n,render:s,className:a,swipeDirection:l=["down","right"],...i}=t,o=((be=n.positionerProps)==null?void 0:be.anchor)!==void 0;let c=[];o||(c=Array.isArray(l)?l:[l]);const g=c.length>0,{toasts:u,focused:p,close:_,remove:y,setToasts:v,pauseTimers:h,expanded:f,setHovering:d}=rp(),[m,w]=k.useState(void 0),[b,x]=k.useState(!1),[C,S]=k.useState(!1),[E,L]=k.useState(!1),[A,M]=k.useState({x:0,y:0}),[D,N]=k.useState({x:0,y:0,scale:1}),[H,F]=k.useState(),[$,O]=k.useState(),[R,P]=k.useState(null),B=k.useRef(null),j=k.useRef({x:0,y:0}),W=k.useRef({x:0,y:0,scale:1}),K=k.useRef(void 0),ee=k.useRef(0),Z=k.useRef(!1),z=k.useRef({x:0,y:0}),I=k.useRef(!1),V=k.useMemo(()=>u.indexOf(n),[n,u]),U=k.useMemo(()=>u.filter(oe=>oe.transitionStatus!=="ending").indexOf(n),[n,u]),J=k.useMemo(()=>u.slice(0,u.indexOf(n)).reduce((oe,he)=>oe+(he.height||0),0),[u,n]);y3({open:n.transitionStatus!=="ending",ref:B,onComplete(){n.transitionStatus==="ending"&&y(n.id)}});const X=Ft(()=>{const oe=B.current;if(!oe)return;const he=oe.style.height;oe.style.height="auto";const Le=oe.offsetHeight;oe.style.height=he,jr.flushSync(()=>{v(Re=>Re.map(Ce=>Ce.id===n.id?{...Ce,ref:B,height:Le,transitionStatus:void 0}:Ce))})});lr(X,[X]);function me(oe,he){let Le=oe,Re=he;return!c.includes("left")&&!c.includes("right")?Le=oe>0?oe**gn:-(Math.abs(oe)**gn):(!c.includes("right")&&oe>0&&(Le=oe**gn),!c.includes("left")&&oe<0&&(Le=-(Math.abs(oe)**gn))),!c.includes("up")&&!c.includes("down")?Re=he>0?he**gn:-(Math.abs(he)**gn):(!c.includes("down")&&he>0&&(Re=he**gn),!c.includes("up")&&he<0&&(Re=-(Math.abs(he)**gn))),{x:Le,y:Re}}function ce(oe){var Re;if(oe.button!==0)return;oe.pointerType==="touch"&&h();const he=ed(oe.nativeEvent);if(!(he&&he.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(Z.current=!1,K.current=void 0,ee.current=0,j.current={x:oe.clientX,y:oe.clientY},z.current=j.current,B.current){const Ce=b3(B.current);W.current=Ce,N(Ce),M({x:Ce.x,y:Ce.y})}d(!0),x(!0),S(!1),P(null),I.current=!0,(Re=B.current)==null||Re.setPointerCapture(oe.pointerId)}}function fe(oe){if(!b)return;oe.preventDefault(),I.current&&(j.current={x:oe.clientX,y:oe.clientY},I.current=!1);const{clientY:he,clientX:Le,movementX:Re,movementY:Ce}=oe;(Ce<0&&he>z.current.y||Ce>0&&he<z.current.y)&&(z.current={x:z.current.x,y:he}),(Re<0&&Le>z.current.x||Re>0&&Le<z.current.x)&&(z.current={x:Le,y:z.current.y});const q=Le-j.current.x,Q=he-j.current.y,ge=he-z.current.y,He=Le-z.current.x;if(!C&&Math.sqrt(q*q+Q*Q)>=x3&&(S(!0),R===null)){const ue=c.includes("left")||c.includes("right"),Oe=c.includes("up")||c.includes("down");if(ue&&Oe){const Fe=Math.abs(q),De=Math.abs(Q);P(Fe>De?"horizontal":"vertical")}}let ie;if(!K.current)R==="vertical"?Q>0?ie="down":Q<0&&(ie="up"):R==="horizontal"?q>0?ie="right":q<0&&(ie="left"):Math.abs(q)>=Math.abs(Q)?ie=q>0?"right":"left":ie=Q>0?"down":"up",ie&&c.includes(ie)&&(K.current=ie,ee.current=gv(ie,q,Q),w(ie));else{const te=K.current,ue=gv(te,He,ge);ue>Bs?(Z.current=!1,w(te)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&ee.current-ue>=S3&&(Z.current=!0)}const G=me(q,Q);let re=W.current.x,le=W.current.y;R==="horizontal"?(c.includes("left")||c.includes("right"))&&(re+=G.x):(R==="vertical"||(c.includes("left")||c.includes("right"))&&(re+=G.x),(c.includes("up")||c.includes("down"))&&(le+=G.y)),M({x:re,y:le})}function Ee(oe){var q;if(!b)return;if(x(!1),S(!1),P(null),(q=B.current)==null||q.releasePointerCapture(oe.pointerId),Z.current){M({x:D.x,y:D.y}),w(void 0);return}let he=!1;const Le=A.x-D.x,Re=A.y-D.y;let Ce;for(const Q of c){switch(Q){case"right":Le>Bs&&(he=!0,Ce="right");break;case"left":Le<-Bs&&(he=!0,Ce="left");break;case"down":Re>Bs&&(he=!0,Ce="down");break;case"up":Re<-Bs&&(he=!0,Ce="up");break}if(he)break}he?(w(Ce),L(!0),_(n.id)):(M({x:D.x,y:D.y}),w(void 0))}function ae(oe){if(oe.key==="Escape"){if(!B.current||!es(B.current,Hl(zi(B.current))))return;_(n.id)}}k.useEffect(()=>{if(!g)return;const oe=B.current;if(!oe)return;function he(Le){es(oe,Le.target)&&Le.preventDefault()}return oe.addEventListener("touchmove",he,{passive:!1}),()=>{oe.removeEventListener("touchmove",he)}},[g]);function Te(){if(!b&&A.x===D.x&&A.y===D.y&&!E)return{[Xn.swipeMovementX]:"0px",[Xn.swipeMovementY]:"0px"};const oe=A.x-D.x,he=A.y-D.y;return{transition:b?"none":void 0,transform:b?`translateX(${A.x}px) translateY(${A.y}px) scale(${D.scale})`:void 0,[Xn.swipeMovementX]:`${oe}px`,[Xn.swipeMovementY]:`${he}px`}}const je=n.priority==="high",pe={role:je?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":H,"aria-describedby":$,"aria-hidden":je&&!p?!0:void 0,onPointerDown:g?ce:void 0,onPointerMove:g?fe:void 0,onPointerUp:g?Ee:void 0,onKeyDown:ae,inert:c3(n.limited),style:{...Te(),[Xn.index]:n.transitionStatus==="ending"?V:U,[Xn.offsetY]:`${J}px`,[Xn.height]:n.height?`${n.height}px`:void 0}},_e=k.useMemo(()=>({rootRef:B,toast:n,titleId:H,setTitleId:F,descriptionId:$,setDescriptionId:O,swiping:b,swipeDirection:m,recalculateHeight:X,index:V,visibleIndex:U,expanded:f}),[n,H,$,b,m,X,V,U,f]),ke=k.useMemo(()=>({transitionStatus:n.transitionStatus,expanded:f,limited:n.limited||!1,type:n.type,swiping:_e.swiping,swipeDirection:_e.swipeDirection}),[f,n.transitionStatus,n.limited,n.type,_e.swiping,_e.swipeDirection]),se=yi("div",t,{ref:[r,_e.rootRef],state:ke,stateAttributesMapping:w3,props:[pe,i]});return T.jsx($w.Provider,{value:_e,children:se})}),E3=k.forwardRef(function(t,r){const{render:n,className:s,id:a,children:l,...i}=t,{toast:o}=Oo(),c=l??o.description,g=!!c,u=Xf(a),{setDescriptionId:p}=Oo();lr(()=>{if(g)return p(u),()=>{p(void 0)}},[g,u,p]);const _=k.useMemo(()=>({type:o.type}),[o.type]),y=yi("p",t,{ref:r,state:_,props:{...i,id:u,children:c}});return g?y:null}),k3=k.forwardRef(function(t,r){const{render:n,className:s,id:a,children:l,...i}=t,{toast:o}=Oo(),c=l??o.title,g=!!c,u=Xf(a),{setTitleId:p}=Oo();lr(()=>{if(g)return p(u),()=>{p(void 0)}},[g,u,p]);const _=k.useMemo(()=>({type:o.type}),[o.type]),y=yi("h2",t,{ref:r,state:_,props:{...i,id:u,children:c}});return g?y:null}),L3=k.forwardRef(function(t,r){const{render:n,className:s,disabled:a,nativeButton:l=!0,...i}=t,{close:o,expanded:c}=rp(),{toast:g}=Oo(),{getButtonProps:u,buttonRef:p}=yw({disabled:a,native:l}),_=k.useMemo(()=>({type:g.type}),[g.type]);return yi("button",t,{ref:[r,p],state:_,props:[{"aria-hidden":!c,onClick(){o(g.id)}},i,u]})});function R3(){const e=k.useContext(tp);if(!e)throw new Error(_i(73));const{toasts:t,add:r,close:n,update:s,promise:a}=e;return k.useMemo(()=>({toasts:t,add:r,close:n,update:s,promise:a}),[t,r,n,s,a])}function T3(){const e=[];function t(r){e.forEach(n=>n(r))}return{" subscribe":function(n){return e.push(n),()=>{const s=e.indexOf(n);s!==-1&&e.splice(s,1)}},add(r){const n=r.id||Fw("toast"),s={...r,id:n,transitionStatus:"starting"};return t({action:"add",options:s}),n},close(r){t({action:"close",options:{id:r}})},update(r,n){t({action:"update",options:{...n,id:r}})},promise(r,n){let s=r;return t({action:"promise",options:{...n,promise:r,setPromise(a){s=a}}}),s}}}const D3=5e3,zw=T3();function M3({toast:e}){return T.jsxs(C3,{toast:e,className:jl("relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg","data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]","data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]","data-[ending-style]:opacity-0","data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0","transition-all duration-200",e.type==="error"&&"border-error/50",e.type==="success"&&"border-approval/50",(!e.type||e.type==="info")&&"border-border"),children:[T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsx(k3,{className:jl("text-sm font-medium",e.type==="error"&&"text-error",e.type==="success"&&"text-approval",(!e.type||e.type==="info")&&"text-primary"),children:e.title}),e.description&&T.jsx(E3,{className:"mt-1 text-xs text-muted line-clamp-2",children:e.description})]}),T.jsx(L3,{className:"shrink-0 text-muted hover:text-primary transition-colors","aria-label":"Close",children:T.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function A3(){const{toasts:e}=R3();return T.jsx(T.Fragment,{children:e.map(t=>T.jsx(M3,{toast:t},t.id))})}function P3(){return T.jsxs(s3,{timeout:D3,toastManager:zw,children:[T.jsx(A3,{}),T.jsx(l3,{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2"})]})}class I3{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status="connecting",this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.manualClose=!1}connect(){if(this.ws)return;this.manualClose=!1,this.setStatus("connecting");const r=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new WebSocket(r);this.ws=n,n.onopen=()=>{this.reconnectAttempts=0,this.setStatus("connected")},n.onmessage=s=>{try{const a=JSON.parse(s.data);this.listeners.forEach(l=>l(a))}catch{}},n.onerror=()=>{this.setStatus("error","WebSocket error")},n.onclose=()=>{this.ws=null,this.manualClose?this.setStatus("disconnected"):this.scheduleReconnect()}}disconnect(){var t;this.manualClose=!0,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}send(t){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(t))}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}subscribeStatus(t){return this.statusListeners.add(t),t(this.status,this.error),()=>this.statusListeners.delete(t)}getStatus(){return this.status}setStatus(t,r=null){this.status=t,this.error=r,this.statusListeners.forEach(n=>n(t,r))}scheduleReconnect(){this.reconnectAttempts+=1;const t=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);this.setStatus("reconnecting"),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}}const Yn=new I3;function B3(){const e=We(l=>l.setConnectionStatus),t=We(l=>l.setConnectionError),[r,n]=k.useState(Yn.getStatus());k.useEffect(()=>{Yn.connect();const l=Yn.subscribeStatus((i,o)=>{n(i),e(i),t(o)});return()=>{l()}},[t,e]);const s=k.useMemo(()=>Yn.send.bind(Yn),[]),a=k.useMemo(()=>Yn.subscribe.bind(Yn),[]);return{status:r,sendMessage:s,subscribe:a}}const O3=100;function N3({viewport:e,win:t,doc:r}){if(!e)return!1;const n=Math.max(0,e.offsetTop||0),s=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+n),l=Math.max(0,a),i=Math.max(0,e.height||0),o=Math.max(0,e.width||0);return r.documentElement.style.setProperty("--keyboard-inset",`${l}px`),r.documentElement.style.setProperty("--viewport-offset-top",`${n}px`),r.documentElement.style.setProperty("--viewport-offset-left",`${s}px`),r.documentElement.style.setProperty("--visual-viewport-height",`${i}px`),r.documentElement.style.setProperty("--visual-viewport-width",`${o}px`),l>O3?r.documentElement.classList.add("keyboard-visible"):r.documentElement.classList.remove("keyboard-visible"),!0}function j3(e){e.documentElement.style.removeProperty("--keyboard-inset"),e.documentElement.style.removeProperty("--viewport-offset-top"),e.documentElement.style.removeProperty("--viewport-offset-left"),e.documentElement.style.removeProperty("--visual-viewport-height"),e.documentElement.style.removeProperty("--visual-viewport-width"),e.documentElement.classList.remove("keyboard-visible")}function F3(){k.useEffect(()=>{const e=window.visualViewport;if(!e)return;let t=null,r=null;const n=()=>{var v;const _=document.activeElement;if(!_)return!1;const y=(v=_.tagName)==null?void 0:v.toLowerCase();return y==="input"||y==="textarea"?!0:!!_.isContentEditable},s=()=>{N3({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!="function"){s();return}t!==null&&window.cancelAnimationFrame(t);const _=performance.now(),y=()=>{s(),performance.now()-_<1500?t=window.requestAnimationFrame(y):t=null};t=window.requestAnimationFrame(y)},l=()=>{if(!n()){o();return}s()},i=()=>{r!==null||typeof window.setInterval!="function"||(r=window.setInterval(l,250),l())},o=()=>{r===null||typeof window.clearInterval!="function"||(window.clearInterval(r),r=null)},c=()=>{n()?(a(),i(),s()):o()},g=()=>{c()},u=()=>{c()},p=()=>{a()};return s(),c(),e.addEventListener("resize",s),e.addEventListener("scroll",s),typeof window.addEventListener=="function"&&(window.addEventListener("resize",s),window.addEventListener("orientationchange",p)),typeof document.addEventListener=="function"&&(document.addEventListener("focusin",g),document.addEventListener("focusout",u),document.addEventListener("focus",g,!0),document.addEventListener("blur",u,!0)),()=>{e.removeEventListener("resize",s),e.removeEventListener("scroll",s),typeof window.removeEventListener=="function"&&(window.removeEventListener("resize",s),window.removeEventListener("orientationchange",p)),typeof document.removeEventListener=="function"&&(document.removeEventListener("focusin",g),document.removeEventListener("focusout",u),document.removeEventListener("focus",g,!0),document.removeEventListener("blur",u,!0)),t!==null&&typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(t),o(),j3(document)}},[])}function $3(){const[e,t]=k.useState(!1),[r,n]=k.useState(void 0),[s,a]=k.useState(void 0),[l,i]=k.useState(void 0),[o,c]=k.useState(!1),[g,u]=k.useState(null),[p,_]=k.useState(null),y=We(q=>q.sessions),v=We(q=>q.agentSessions),h=We(q=>q.selectedSessionId),f=We(q=>q.setSessions),d=We(q=>q.setAgentSessions),m=We(q=>q.setHostStatuses),w=We(q=>q.updateSession),b=We(q=>q.setSelectedSessionId),x=We(q=>q.hasLoaded),C=We(q=>q.connectionStatus),S=We(q=>q.connectionError),E=We(q=>q.clearExitingSession),L=We(q=>q.markSessionExiting),A=We(q=>q.setRemoteAllowControl),M=We(q=>q.setRemoteAllowAttach),D=We(q=>q.setHostLabel),N=We(q=>q.hostStatuses),H=We(q=>q.remoteAllowControl),F=We(q=>q.hostLabel),$=Ol(q=>q.theme),O=de(q=>q.defaultProjectDir),R=de(q=>q.commandPresets),P=de(q=>q.defaultPresetId),B=de(q=>q.lastProjectPath),j=de(q=>q.setLastProjectPath),W=de(q=>q.addRecentPath),K=de(q=>q.shortcutModifier),ee=de(q=>q.sidebarWidth),Z=de(q=>q.setSidebarWidth),z=de(q=>q.projectFilters),I=de(q=>q.hostFilters),V=de(q=>q.soundOnPermission),U=de(q=>q.soundOnIdle),{sendMessage:J,subscribe:X}=B3();F3(),k.useEffect(()=>{if(typeof document>"u"||!V&&!U)return;let q=!1;const Q=()=>{q&&!GM()||(q=!0,Jh())};return document.addEventListener("click",Q,{passive:!0}),document.addEventListener("keydown",Q,{passive:!0}),document.addEventListener("touchstart",Q,{passive:!0}),()=>{document.removeEventListener("click",Q),document.removeEventListener("keydown",Q),document.removeEventListener("touchstart",Q)}},[V,U]);const me=k.useRef(!1),ce=k.useCallback(q=>{q.preventDefault(),me.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);k.useEffect(()=>{if(typeof document>"u"||typeof document.addEventListener!="function")return;const q=ge=>{if(!me.current)return;const He=ge.clientX;Z(Math.max(M0,Math.min(A0,He)))},Q=()=>{me.current&&(me.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Q)}},[Z]),k.useEffect(()=>{const q=X(Q=>{var ge,He;if(Q.type==="sessions"){const ie=We.getState().sessions,{soundOnPermission:G,soundOnIdle:re}=de.getState();if(G||re)for(const le of Q.sessions){const te=ie.find(ue=>ue.id===le.id);te&&te.status!==le.status&&(te.status!=="permission"&&le.status==="permission"&&G&&Qh(),te.status==="working"&&le.status==="waiting"&&re&&Zh())}f(Q.sessions)}if(Q.type==="host-status"&&m(Q.hosts),Q.type==="server-config"&&(A(Q.remoteAllowControl),M(Q.remoteAllowAttach),D(Q.hostLabel)),Q.type==="session-update"){const G=We.getState().sessions.find(te=>te.id===Q.session.id),re=G==null?void 0:G.status,le=Q.session.status;if(w(Q.session),re){const{soundOnPermission:te,soundOnIdle:ue}=de.getState();re!=="permission"&&le==="permission"&&te&&Qh(),re==="working"&&le==="waiting"&&ue&&Zh()}}if(Q.type==="session-created"){const ie=We.getState().sessions;ie.some(le=>le.id===Q.session.id)||f([Q.session,...ie]),b(Q.session.id),W(Q.session.projectPath);const{projectFilters:G,setProjectFilters:re}=de.getState();G.length>0&&!G.includes(Q.session.projectPath)&&re([...G,Q.session.projectPath])}if(Q.type==="session-removed"){const ie=We.getState().sessions,G=ie.filter(re=>re.id!==Q.sessionId);G.length!==ie.length&&f(G)}if(Q.type==="agent-sessions"&&d(Q.active,Q.inactive),Q.type==="session-orphaned"){const ie=We.getState().sessions,G=ie.filter(re=>{var le;return((le=re.agentSessionId)==null?void 0:le.trim())!==Q.session.sessionId});G.length!==ie.length&&f(G)}if(Q.type==="session-resume-result")if(Q.ok&&Q.session){const ie=We.getState().sessions;ie.some(G=>G.id===Q.session.id)||f([Q.session,...ie]),b(Q.session.id)}else Q.ok||(u(`${(ge=Q.error)==null?void 0:ge.code}: ${(He=Q.error)==null?void 0:He.message}`),window.setTimeout(()=>u(null),6e3));Q.type==="terminal-error"&&(!Q.sessionId||Q.sessionId===h)&&(u(`${Q.code}: ${Q.message}`),window.setTimeout(()=>u(null),6e3)),Q.type==="terminal-ready"&&Q.sessionId===h&&u(null),Q.type==="error"&&(u(Q.message),window.setTimeout(()=>u(null),6e3)),Q.type==="kill-failed"&&(E(Q.sessionId),u(Q.message),window.setTimeout(()=>u(null),6e3)),Q.type==="session-pin-result"&&!Q.ok&&Q.error&&(u(Q.error),window.setTimeout(()=>u(null),6e3)),Q.type==="session-resurrection-failed"&&zw.add({title:"Session resurrection failed",description:`"${Q.displayName}" could not be resumed: ${Q.error}`,type:"error",timeout:8e3})});return()=>{q()}},[h,W,E,J,b,f,d,m,A,M,D,X,w]);const fe=k.useMemo(()=>y.find(q=>q.id===h)||null,[h,y]);k.useEffect(()=>{fe!=null&&fe.projectPath&&!fe.remote&&j(fe.projectPath)},[fe==null?void 0:fe.projectPath,fe==null?void 0:fe.remote,j]);const Ee=de(q=>q.sessionSortMode),ae=de(q=>q.sessionSortDirection),Te=de(q=>q.manualSessionOrder),je=k.useMemo(()=>Uf(y,{mode:Ee,direction:ae,manualOrder:Te}),[y,Ee,ae,Te]),pe=k.useMemo(()=>{let q=je;return z.length>0&&(q=q.filter(Q=>z.includes(Q.projectPath))),I.length>0&&(q=q.filter(Q=>I.includes(Q.host??""))),q},[je,z,I]);k.useEffect(()=>{h&&pe.length>0&&!pe.some(q=>q.id===h)&&b(pe[0].id)},[h,pe,b]),k.useEffect(()=>{window.matchMedia("(max-width: 767px)").matches&&x&&h===null&&je.length>0&&b(je[0].id)},[x,h,je,b]);const _e=k.useCallback(q=>{L(q),J({type:"session-kill",sessionId:q})},[L,J]);k.useEffect(()=>{const q=Uo(K),Q=ge=>{if(ge.defaultPrevented)return;const He=ge.code,ie=cC(ge,q);if(ie&&(He==="BracketLeft"||He==="BracketRight")){ge.preventDefault();const G=pe;if(G.length===0)return;const re=G.findIndex(ue=>ue.id===h);if(re===-1){b(G[0].id);return}const te=(re+(He==="BracketLeft"?-1:1)+G.length)%G.length;b(G[te].id);return}if(ie&&He==="KeyN"){ge.preventDefault(),e||t(!0);return}if(ie&&He==="KeyX"){ge.preventDefault(),h&&!e&&_e(h);return}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[e,h,b,pe,_e,K]);const ke=()=>{n(void 0),a(void 0),i(void 0),t(!0)},se=()=>c(!0),be=(q,Q,ge,He)=>{J({type:"session-create",projectPath:q,name:Q,command:ge,host:He}),He||j(q)},oe=q=>{J({type:"session-resume",sessionId:q})},he=(q,Q)=>{J({type:"session-rename",sessionId:q,newName:Q})},Le=k.useCallback(q=>{const Q=y.find(ge=>ge.id===q);Q&&J({type:"session-create",projectPath:Q.projectPath,command:Q.command||void 0,host:Q.remote&&Q.host?Q.host:void 0})},[y,J]),Re=k.useCallback((q,Q)=>{J({type:"session-pin",sessionId:q,isPinned:Q})},[J]);k.useEffect(()=>{document.documentElement.setAttribute("data-theme",$)},[$]),k.useEffect(()=>{fetch("/api/server-info").then(q=>q.json()).then(q=>_(q)).catch(()=>{})},[]);const Ce=k.useMemo(()=>F?N.filter(q=>q.host!==F):N,[N,F]);return T.jsxs("div",{className:"flex h-full overflow-hidden",children:[T.jsxs("div",{className:"hidden h-full flex-col md:flex md:shrink-0",style:{width:ee},children:[T.jsx(hC,{connectionStatus:C,onNewSession:ke,onOpenSettings:se,tailscaleIp:(p==null?void 0:p.tailscaleIp)??null}),T.jsx(z1,{sessions:y,inactiveSessions:v.inactive,selectedSessionId:h,onSelect:b,onRename:he,onResume:oe,onKill:_e,onDuplicate:Le,onSetPinned:Re,loading:!x,error:S||g})]}),T.jsx("div",{className:"hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20",onMouseDown:ce}),T.jsx(hD,{session:fe,sessions:pe,connectionStatus:C,sendMessage:J,subscribe:X,onClose:()=>b(null),onSelectSession:b,onNewSession:ke,onKillSession:_e,onRenameSession:he,onOpenSettings:se,onResumeSession:oe,onSetPinned:Re,inactiveSessions:v.inactive,loading:!x,error:S||g}),T.jsx(fD,{isOpen:e,onClose:()=>t(!1),onCreate:be,defaultProjectDir:O,commandPresets:R,defaultPresetId:P,lastProjectPath:B,activeProjectPath:fe&&!fe.remote?fe.projectPath:void 0,remoteHosts:Ce,remoteAllowControl:H,initialHost:r,initialPath:s,initialCommand:l}),T.jsx(XM,{isOpen:o,onClose:()=>c(!1)}),T.jsx(P3,{})]})}zo()&&document.documentElement.classList.add("ios");oC()&&document.documentElement.classList.add("ios-pwa");const Uw=document.getElementById("root");if(!Uw)throw new Error("Root element not found");D0(Uw).render(T.jsx(mt.StrictMode,{children:T.jsx($3,{})}));
300
+ ${Oe?hD[te.status]:uD[te.status]}
301
+ `,onClick:()=>{nv(),i(te.id)},children:ue+1},te.id)})})]}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx("div",{ref:ae,className:"absolute inset-0"}),!e&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted",children:"Select a session to view terminal"}),e&&fe&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-center text-sm text-muted",children:"Remote session (read-only). Use SSH to attach on the host."}),D&&e&&!H&&T.jsxs("button",{onClick:_e,className:"absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all",style:{transform:"translateX(-50%)"},title:"Scroll to bottom","aria-label":"Scroll to bottom",children:[T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),T.jsx("span",{className:"text-sm font-medium",children:"Jump to bottom"})]})]}),e&&T.jsx(oD,{onSendKey:ie,disabled:n!=="connected"||fe,sessions:t.map(te=>({id:te.id,name:te.name,status:te.status})),currentSessionId:e.id,onSelectSession:i,hideSessionSwitcher:!0,onRefocus:G,isKeyboardVisible:le,onEnterTextMode:re}),(M||A)&&T.jsx(aD,{isOpen:B,onClose:()=>j(!1),sessions:t,inactiveSessions:r,selectedSessionId:(e==null?void 0:e.id)??null,onSelect:i,onRename:g,onResume:u,onSetPinned:p,onNewSession:o,loading:y,error:v}),$&&e&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-2 text-balance",children:"Kill Session"}),T.jsxs("p",{className:"text-sm text-secondary mb-4 text-pretty",children:['Kill "',e.agentSessionName||e.name,'"? The process will be terminated. Conversation history is preserved in logs.']}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx("button",{onClick:()=>N(!1),className:"btn py-1.5 px-3 text-sm",children:"Cancel"}),T.jsx("button",{ref:J,onClick:he,className:"btn btn-danger py-1.5 px-3 text-sm",children:"Kill Session"})]})]})})]})}function fD({onSelect:e,onCancel:t,initialPath:r}){const[n,s]=k.useState(r||"~"),[a,l]=k.useState(null),[i,o]=k.useState(null),[c,g]=k.useState(!0),[u,p]=k.useState(-1),_=k.useRef(null),y=de(m=>m.recentPaths),v=k.useCallback(async m=>{var x;(x=_.current)==null||x.abort();const w=new AbortController;_.current=w;const{signal:b}=w;g(!0),o(null),l(null),p(-1),s(m);try{const C=await fetch(`/api/directories?path=${encodeURIComponent(m)}`,{signal:b});if(!C.ok){const E=await C.json();throw new Error(E.message||"Failed to load directory")}const S=await C.json();if(_.current!==w)return;l(S),s(S.path)}catch(C){if(_.current!==w)return;const S=C;(S==null?void 0:S.name)!=="AbortError"&&o((S==null?void 0:S.message)||"Failed to load directory")}finally{_.current===w&&g(!1)}},[]);k.useEffect(()=>(v(r||"~"),()=>{var m;(m=_.current)==null||m.abort()}),[v,r]);const h=(a==null?void 0:a.directories)??[],f=(a==null?void 0:a.path)||n,d=a==null?void 0:a.parent;return k.useEffect(()=>{const m=w=>{if(w.key==="Escape"){w.preventDefault(),t();return}if(!c){if(w.key==="ArrowDown"){w.preventDefault(),p(b=>h.length===0?-1:b<0?0:Math.min(b+1,h.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),p(b=>h.length===0?-1:b<0?h.length-1:Math.max(b-1,0));return}if(w.key==="Enter"){w.preventDefault();const b=h[u];b?v(b.path):f&&e(f);return}w.key==="Backspace"&&d&&(w.preventDefault(),v(d))}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[h,f,v,u,c,t,e,d]),T.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Directory browser",className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onClick:m=>{m.target===m.currentTarget&&t()},"data-testid":"directory-browser",children:T.jsxs("div",{className:"w-full max-w-lg border border-border bg-elevated p-4",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border pb-2",children:[T.jsx("button",{type:"button",className:"btn",onClick:()=>{d&&v(d)},disabled:!d||c,children:"Up"}),T.jsx("div",{className:"min-w-0 flex-1 truncate text-xs font-mono text-secondary",title:f,"data-testid":"directory-current-path",children:f})]}),T.jsx("div",{className:"mt-3 max-h-60 overflow-y-auto border border-border bg-surface",children:c?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-loading",children:"Loading directories..."}):i?T.jsxs("div",{className:"px-3 py-4 text-xs","data-testid":"directory-error",children:[T.jsx("p",{className:"text-danger",children:i}),T.jsx("button",{type:"button",className:"btn mt-3",onClick:()=>v(n),children:"Retry"})]}):h.length===0?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-empty",children:"No subdirectories"}):T.jsx("div",{className:"py-1",children:h.map((m,w)=>T.jsxs("button",{type:"button",onClick:()=>v(m.path),onMouseEnter:()=>p(w),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${w===u?"bg-hover text-primary":"text-secondary"}`,"data-testid":"directory-entry","data-entry-name":m.name,"data-entry-path":m.path,children:[T.jsx(Wb,{width:14,height:14,className:"shrink-0 text-muted","aria-hidden":"true"}),T.jsx("span",{className:"truncate",children:m.name})]},m.path))})}),a!=null&&a.truncated?T.jsx("p",{className:"mt-2 text-[10px] text-muted",children:"Showing first 200 directories."}):null,T.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[T.jsx("div",{className:"text-[10px] uppercase tracking-wider text-secondary",children:"Recent"}),y.length===0?T.jsx("p",{className:"mt-2 text-xs text-muted",children:"No recent paths yet."}):T.jsx("div",{className:"mt-2 space-y-1",children:y.map(m=>T.jsx("button",{type:"button",className:"block w-full truncate text-left text-xs text-secondary hover:text-primary",onClick:()=>v(m),title:m,"data-testid":"directory-recent","data-recent-path":m,children:m},m))})]}),T.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>{f&&e(f)},className:"btn btn-primary",disabled:c||!f,children:"Select"})]})]})})}function pD({isOpen:e,onClose:t,onCreate:r,defaultProjectDir:n,commandPresets:s,defaultPresetId:a,lastProjectPath:l,activeProjectPath:i,remoteHosts:o=[],remoteAllowControl:c=!1,initialHost:g,initialPath:u,initialCommand:p}){const[_,y]=k.useState(""),[v,h]=k.useState(""),[f,d]=k.useState(null),[m,w]=k.useState(""),[b,x]=k.useState(!1),[C,S]=k.useState(""),E=k.useRef(null),L=k.useRef(null),A=k.useRef(null),M=c&&o.length>0;if(k.useEffect(()=>{if(!e){y(""),h(""),d(null),w(""),x(!1),S(g??""),setTimeout(()=>{if(typeof document>"u"||typeof document.querySelector!="function")return;const W=document.querySelector(".xterm-helper-textarea");W&&(W.removeAttribute("disabled"),W.focus())},300);return}if(typeof document<"u"&&typeof document.querySelector=="function"){const W=document.querySelector(".xterm-helper-textarea");W&&typeof W.setAttribute=="function"&&(typeof W.blur=="function"&&W.blur(),W.setAttribute("disabled","true"))}const B=(u==null?void 0:u.trim())||(i==null?void 0:i.trim())||l||n||"";y(B),h(""),S(g??"");const j=p==null?void 0:p.trim();if(j){const W=s.find(K=>Ms(K)===j);W?(d(W.id),w(Ms(W))):(d(null),w(j))}else{const W=s.find(K=>K.id===a);W?(d(a),w(Ms(W))):s.length>0?(d(s[0].id),w(Ms(s[0]))):(d(null),w(""))}setTimeout(()=>{var W;if((W=A.current)==null||W.focus(),L.current){const K=L.current;K.scrollLeft=K.scrollWidth}},50)},[i,s,a,n,e,l,g,u,p]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const B=()=>E.current?Array.from(E.current.querySelectorAll('input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]')):[],j=W=>{var K,Z;if(!b){if(W.key==="Escape"){typeof W.stopPropagation=="function"&&W.stopPropagation(),t();return}if(W.key==="Enter"){const ee=document.activeElement;if(!ee||ee.tagName==="INPUT"||ee.closest('[data-testid="host-select"]')||!ee.closest('[data-testid="command-select"]'))return;W.preventDefault(),typeof W.stopPropagation=="function"&&W.stopPropagation(),(K=E.current)==null||K.requestSubmit();return}if(W.key==="Tab"){W.preventDefault(),typeof W.stopPropagation=="function"&&W.stopPropagation();const ee=B();if(ee.length===0)return;const z=document.activeElement,I=ee.indexOf(z);let V;I===-1?V=W.shiftKey?ee.length-1:0:W.shiftKey?V=I<=0?ee.length-1:I-1:V=I>=ee.length-1?0:I+1,(Z=ee[V])==null||Z.focus()}}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[e,t,b]),!e)return null;const D=B=>{const j=s.find(W=>W.id===B);j&&(d(B),w(Ms(j)))},O=()=>{d(null),w("")},H=f===null,F=C!=="",$=B=>{B.preventDefault();const j=_.trim();if(!j)return;const W=m.trim();r(j,v.trim()||void 0,W||void 0,F?C:void 0),t()},N=[...s.map(B=>({id:B.id,label:B.label,isCustom:!1,agentType:B.agentType,command:B.command})),{id:"custom",label:"Custom",isCustom:!0,agentType:void 0,command:void 0}],R=[{id:"",label:"Local",ok:!0,error:void 0},...o.map(B=>({id:B.host,label:B.host,ok:B.ok,error:B.error}))],P=_.trim()||"~";return T.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"new-session-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:B=>{B.target===B.currentTarget&&t()},children:[T.jsxs("form",{ref:E,onSubmit:$,className:"w-full max-w-md border border-border bg-elevated p-6",children:[T.jsx("h2",{id:"new-session-title",className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"New Session"}),T.jsxs("div",{className:"mt-4 space-y-4",children:[M&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Host"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Host","data-testid":"host-select",children:R.map((B,j)=>{const W=C===B.id,K=!B.ok&&!W;return T.jsx("button",{type:"button",role:"radio","aria-checked":W,"aria-label":B.label,title:B.ok?void 0:B.error||"Unreachable",tabIndex:W?0:-1,onClick:()=>S(B.id),onKeyDown:Z=>{var U;let ee=j;if(Z.key==="ArrowRight"||Z.key==="ArrowDown")Z.preventDefault(),ee=(j+1)%R.length;else if(Z.key==="ArrowLeft"||Z.key==="ArrowUp")Z.preventDefault(),ee=(j-1+R.length)%R.length;else return;const z=R[ee];S(z.id);const I=Z.currentTarget.parentElement,V=I==null?void 0:I.querySelectorAll('[role="radio"]');(U=V==null?void 0:V[ee])==null||U.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${W?"btn-primary":""} ${K?"opacity-60":""}`,children:B.label},B.id||"local")})})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Command"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Command preset","data-testid":"command-select",children:N.map((B,j)=>{const W=B.isCustom?H:f===B.id;return T.jsxs("button",{ref:W?A:void 0,type:"button",role:"radio","aria-checked":W,tabIndex:W?0:-1,onClick:()=>{B.isCustom?O():D(B.id)},onKeyDown:K=>{var V;let Z=j;if(K.key==="ArrowRight"||K.key==="ArrowDown")K.preventDefault(),Z=(j+1)%N.length;else if(K.key==="ArrowLeft"||K.key==="ArrowUp")K.preventDefault(),Z=(j-1+N.length)%N.length;else return;const ee=N[Z];ee.isCustom?O():D(ee.id);const z=K.currentTarget.parentElement,I=z==null?void 0:z.querySelectorAll('[role="radio"]');(V=I==null?void 0:I[Z])==null||V.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${W?"btn-primary":""}`,children:[T.jsx(dc,{agentType:B.agentType,command:B.command,className:"inline-block h-3.5 w-3.5 shrink-0"}),B.label]},B.id)})}),T.jsx("input",{value:m,onChange:B=>w(B.target.value),placeholder:"Enter command...",className:"input mt-2 font-mono text-xs"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Project Path"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("input",{ref:L,value:_,onChange:B=>y(B.target.value),placeholder:F?"/home/user/project":i||l||n||"/Users/you/code/my-project",className:"input flex-1 text-sm"}),!F&&T.jsx("button",{type:"button",className:"btn",onClick:()=>x(!0),children:"Browse"})]})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Display Name"}),T.jsx("input",{value:v,onChange:B=>h(B.target.value),placeholder:"auto-generated",className:"input text-sm placeholder:italic"})]})]}),T.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Create"})]})]}),b&&!F&&T.jsx(fD,{initialPath:P,onSelect:B=>{y(B),x(!1)},onCancel:()=>x(!1)})]})}const hu=1,du=168;function mD({controlled:e,default:t,name:r,state:n="value"}){const{current:s}=k.useRef(e!==void 0),[a,l]=k.useState(t),i=s?e:a,o=k.useCallback(c=>{s||l(c)},[]);return[i,o]}const iv={};function Jo(e,t){const r=k.useRef(iv);return r.current===iv&&(r.current=e(t)),r}const fu=Lv[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],gD=fu&&fu!==k.useLayoutEffect?fu:e=>e();function Ft(e){const t=Jo(vD).current;return t.next=e,gD(t.effect),t.trampoline}function vD(){const e={next:void 0,callback:_D,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function _D(){}function Kh(e,t,r,n){const s=Jo(fw).current;return wD(s,e,t,r,n)&&pw(s,[e,t,r,n]),s.callback}function yD(e){const t=Jo(fw).current;return SD(t,e)&&pw(t,e),t.callback}function fw(){return{callback:null,cleanup:null,refs:[]}}function wD(e,t,r,n,s){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==n||e.refs[3]!==s}function SD(e,t){return e.refs.length!==t.length||e.refs.some((r,n)=>r!==t[n])}function pw(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const n=Array(t.length).fill(null);for(let s=0;s<t.length;s+=1){const a=t[s];if(a!=null)switch(typeof a){case"function":{const l=a(r);typeof l=="function"&&(n[s]=l);break}case"object":{a.current=r;break}}}e.cleanup=()=>{for(let s=0;s<t.length;s+=1){const a=t[s];if(a!=null)switch(typeof a){case"function":{const l=n[s];typeof l=="function"?l():a(null);break}case"object":{a.current=null;break}}}}}}}const xD=()=>{},lr=typeof document<"u"?k.useLayoutEffect:xD,Gf={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function _i(e,...t){const r=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Base UI error #${e}; visit ${r} for the full message.`}const bD=parseInt(k.version,10);function mw(e){return bD>=e}function sv(e){if(!k.isValidElement(e))return null;const t=e,r=t.props;return(mw(19)?r==null?void 0:r.ref:t.ref)??null}function Gh(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function CD(e,t){const r={};for(const n in e){const s=e[n];if(t!=null&&t.hasOwnProperty(n)){const a=t[n](s);a!=null&&Object.assign(r,a);continue}s===!0?r[`data-${n.toLowerCase()}`]="":s&&(r[`data-${n.toLowerCase()}`]=s.toString())}return r}function ED(e,t){return typeof e=="function"?e(t):e}function kD(e,t){return typeof e=="function"?e(t):e}const ao={};function qf(e,t,r,n,s){let a={...qh(e,ao)};return t&&(a=Za(a,t)),r&&(a=Za(a,r)),n&&(a=Za(a,n)),a}function LD(e){if(e.length===0)return ao;if(e.length===1)return qh(e[0],ao);let t={...qh(e[0],ao)};for(let r=1;r<e.length;r+=1)t=Za(t,e[r]);return t}function Za(e,t){return gw(t)?t(e):RD(e,t)}function RD(e,t){if(!t)return e;for(const r in t){const n=t[r];switch(r){case"style":{e[r]=Gh(e.style,n);break}case"className":{e[r]=vw(e.className,n);break}default:TD(r,n)?e[r]=DD(e[r],n):e[r]=n}}return e}function TD(e,t){const r=e.charCodeAt(0),n=e.charCodeAt(1),s=e.charCodeAt(2);return r===111&&n===110&&s>=65&&s<=90&&(typeof t=="function"||typeof t>"u")}function gw(e){return typeof e=="function"}function qh(e,t){return gw(e)?e(t):e??ao}function DD(e,t){return t?e?r=>{if(MD(r)){const s=r;Xh(s);const a=t(s);return s.baseUIHandlerPrevented||e==null||e(s),a}const n=t(r);return e==null||e(r),n}:t:e}function Xh(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function vw(e,t){return t?e?t+" "+e:t:e}function MD(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Dr(){}const en=Object.freeze({});function yi(e,t,r={}){const n=t.render,s=AD(t,r);if(r.enabled===!1)return null;const a=r.state??en;return PD(e,n,s,a)}function AD(e,t={}){const{className:r,style:n,render:s}=e,{state:a=en,ref:l,props:i,stateAttributesMapping:o,enabled:c=!0}=t,g=c?ED(r,a):void 0,u=c?kD(n,a):void 0,p=c?CD(a,o):en,_=c?Gh(p,Array.isArray(i)?LD(i):i)??en:en;return typeof document<"u"&&(c?Array.isArray(l)?_.ref=yD([_.ref,sv(s),...l]):_.ref=Kh(_.ref,sv(s),l):Kh(null,null)),c?(g!==void 0&&(_.className=vw(_.className,g)),u!==void 0&&(_.style=Gh(_.style,u)),_):en}function PD(e,t,r,n){if(t){if(typeof t=="function")return t(r,n);const s=qf(r,t.props);return s.ref=r.ref,k.cloneElement(t,s)}if(e&&typeof e=="string")return ID(e,r);throw new Error(_i(8))}function ID(e,t){return e==="button"?k.createElement("button",{type:"button",...t,key:t.key}):e==="img"?k.createElement("img",{alt:"",...t,key:t.key}):k.createElement(e,t)}const BD={...Lv};let ov=0;function OD(e,t="mui"){const[r,n]=k.useState(e),s=e||r;return k.useEffect(()=>{r==null&&(ov+=1,n(`${t}-${ov}`))},[r,t]),s}const av=BD.useId;function Xf(e,t){if(av!==void 0){const r=av();return e??(t?`${t}-${r}`:r)}return OD(e,t)}function _w(e){return Xf(e,"base-ui")}function Yf(){return typeof window<"u"}function Bo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ND(e){return Yf()?e instanceof Element||e instanceof Bo(e).Element:!1}function jD(e){return Yf()?e instanceof HTMLElement||e instanceof Bo(e).HTMLElement:!1}function FD(e){return!Yf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bo(e).ShadowRoot}const $D=k.createContext(void 0);function HD(e=!1){const t=k.useContext($D);if(t===void 0&&!e)throw new Error(_i(16));return t}function zD(e){const{focusableWhenDisabled:t,disabled:r,composite:n=!1,tabIndex:s=0,isNativeButton:a}=e,l=n&&t!==!1,i=n&&t===!1;return{props:k.useMemo(()=>{const c={onKeyDown(g){r&&t&&g.key!=="Tab"&&g.preventDefault()}};return n||(c.tabIndex=s,!a&&r&&(c.tabIndex=t?s:-1)),(a&&(t||l)||!a&&r)&&(c["aria-disabled"]=r),a&&(!t||i)&&(c.disabled=r),c},[n,r,t,l,i,a,s])}}function yw(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:n=0,native:s=!0}=e,a=k.useRef(null),l=HD(!0)!==void 0,i=Ft(()=>{const p=a.current;return!!((p==null?void 0:p.tagName)==="A"&&(p!=null&&p.href))}),{props:o}=zD({focusableWhenDisabled:r,disabled:t,composite:l,tabIndex:n,isNativeButton:s}),c=k.useCallback(()=>{const p=a.current;UD(p)&&l&&t&&o.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,o.disabled,l]);lr(c,[c]);const g=k.useCallback((p={})=>{const{onClick:_,onMouseDown:y,onKeyUp:v,onKeyDown:h,onPointerDown:f,...d}=p;return qf({type:s?"button":void 0,onClick(w){if(t){w.preventDefault();return}_==null||_(w)},onMouseDown(w){t||y==null||y(w)},onKeyDown(w){if(t||(Xh(w),h==null||h(w)),w.baseUIHandlerPrevented)return;const b=w.target===w.currentTarget&&!s&&!i()&&!t,x=w.key==="Enter",C=w.key===" ";b&&((C||x)&&w.preventDefault(),x&&(_==null||_(w)))},onKeyUp(w){t||(Xh(w),v==null||v(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!s&&!t&&w.key===" "&&(_==null||_(w))},onPointerDown(w){if(t){w.preventDefault();return}f==null||f(w)}},s?void 0:{role:"button"},o,d)},[t,o,s,i]),u=Ft(p=>{a.current=p,c()});return{getButtonProps:g,buttonRef:u}}function UD(e){return jD(e)&&e.tagName==="BUTTON"}const ww=k.createContext(void 0);function WD(){const e=k.useContext(ww);if(e===void 0)throw new Error(_i(63));return e}let lv=function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const VD={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},KD={valid(e){return e===null?null:e?{[lv.valid]:""}:{[lv.invalid]:""}}};let cv=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Sw={...KD,checked(e){return e?{[cv.checked]:""}:{[cv.unchecked]:""}}};function GD(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const qD=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Dr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function xw(){return k.useContext(qD)}const XD=k.createContext({invalid:void 0,name:void 0,validityData:{state:VD,errors:[],error:"",value:"",initialValue:null},setValidityData:Dr,disabled:void 0,touched:!1,setTouched:Dr,dirty:!1,setDirty:Dr,filled:!1,setFilled:Dr,focused:!1,setFocused:Dr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=en)=>e,getInputValidationProps:(e=en)=>e,inputRef:{current:null},commit:async()=>{}}});function Jf(e=!0){const t=k.useContext(XD);if(t.setValidityData===Dr&&!e)throw new Error(_i(28));return t}function YD(e){const{enabled:t=!0,value:r,id:n,name:s,controlRef:a,commit:l}=e,{formRef:i}=xw(),{invalid:o,markedDirtyRef:c,validityData:g,setValidityData:u}=Jf(),p=Ft(e.getValue);lr(()=>{if(!t)return;let _=r;_===void 0&&(_=p()),g.initialValue===null&&_!==null&&u(y=>({...y,initialValue:_}))},[t,u,r,g.initialValue,p]),lr(()=>{!t||!n||i.current.fields.set(n,{getValue:p,name:s,controlRef:a,validityData:GD(g,o),validate(){let _=r;_===void 0&&(_=p()),c.current=!0,jr.flushSync(()=>l(_))}})},[l,a,t,i,p,n,o,c,s,g,r]),lr(()=>{const _=i.current.fields;return()=>{n&&_.delete(n)}},[i,n])}const JD=k.createContext({controlId:void 0,setControlId:Dr,labelId:void 0,setLabelId:Dr,messageIds:[],setMessageIds:Dr,getDescriptionProps:e=>e});function bw(){return k.useContext(JD)}function QD(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:s,setControlId:a}=bw(),l=_w(t);return lr(()=>{if(!(!r&&!t||a===Dr)){if(r){const i=n==null?void 0:n.current;ND(i)&&i.closest("label")!=null?a(t??null):a(s??l)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,n,s,a,r,l]),s??l}const ZD="none";function eM(e,t,r,n){let s=!1,a=!1;const l=en;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){a=!0},get isCanceled(){return s},get isPropagationAllowed(){return a},trigger:r,...l}}function tM(e,t){const r=k.useRef(e),n=Ft(t);lr(()=>{r.current!==e&&n(r.current)},[e,n]),lr(()=>{r.current=e},[e])}const rM=k.forwardRef(function(t,r){const{checked:n,className:s,defaultChecked:a,id:l,inputRef:i,name:o,nativeButton:c=!1,onCheckedChange:g,readOnly:u=!1,required:p=!1,disabled:_=!1,render:y,uncheckedValue:v,...h}=t,{clearErrors:f}=xw(),{state:d,setTouched:m,setDirty:w,validityData:b,setFilled:x,setFocused:C,shouldValidateOnChange:S,validationMode:E,disabled:L,name:A,validation:M}=Jf(),{labelId:D}=bw(),O=L||_,H=A??o,F=Ft(g),$=k.useRef(null),N=Kh($,i,M.inputRef),R=k.useRef(null),P=_w(),B=QD({id:l,implicit:!1,controlRef:R}),[j,W]=mD({controlled:n,default:!!a,name:"Switch",state:"checked"});YD({id:P,commit:M.commit,value:j,controlRef:R,name:H,getValue:()=>j}),lr(()=>{$.current&&x($.current.checked)},[$,x]),tM(j,()=>{f(H),w(j!==b.initialValue),x(j),S()?M.commit(j):M.commit(j,!0)});const{getButtonProps:K,buttonRef:Z}=yw({disabled:O,native:c}),ee={id:P,role:"switch","aria-checked":j,"aria-readonly":u||void 0,"aria-labelledby":D,onFocus(){O||C(!0)},onBlur(){const U=$.current;!U||O||(m(!0),C(!1),E==="onBlur"&&M.commit(U.checked))},onClick(U){var J;u||O||(U.preventDefault(),(J=$==null?void 0:$.current)==null||J.click())}},z=k.useMemo(()=>qf({checked:j,disabled:O,id:B,name:H,required:p,style:Gf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:N,onChange(U){if(U.nativeEvent.defaultPrevented)return;const J=U.target.checked,X=eM(ZD,U.nativeEvent);F==null||F(J,X),!X.isCanceled&&W(J)},onFocus(){var U;(U=R.current)==null||U.focus()}},M.getInputValidationProps),[j,O,N,B,H,F,p,W,M]),I=k.useMemo(()=>({...d,checked:j,disabled:O,readOnly:u,required:p}),[d,j,O,u,p]),V=yi("span",t,{state:I,ref:[r,R,Z],props:[ee,M.getValidationProps,h,K],stateAttributesMapping:Sw});return T.jsxs(ww.Provider,{value:I,children:[V,!j&&H&&v!==void 0&&T.jsx("input",{type:"hidden",name:H,value:v}),T.jsx("input",{...z})]})}),nM=k.forwardRef(function(t,r){const{render:n,className:s,...a}=t,{state:l}=Jf(),i=WD(),o={...l,...i};return yi("span",t,{state:o,ref:r,stateAttributesMapping:Sw,props:a})});function Cw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Cw(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function iM(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Cw(e))&&(n&&(n+=" "),n+=t);return n}const sM=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},oM=(e,t)=>({classGroupId:e,validator:t}),Ew=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Nl="-",uv=[],aM="arbitrary..",lM=e=>{const t=uM(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return cM(l);const i=l.split(Nl),o=i[0]===""&&i.length>1?1:0;return kw(i,o,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const o=n[l],c=r[l];return o?c?sM(c,o):o:c||uv}return r[l]||uv}}},kw=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const c=kw(e,t+1,a);if(c)return c}const l=r.validators;if(l===null)return;const i=t===0?e.join(Nl):e.slice(t).join(Nl),o=l.length;for(let c=0;c<o;c++){const g=l[c];if(g.validator(i))return g.classGroupId}},cM=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?aM+n:void 0})(),uM=e=>{const{theme:t,classGroups:r}=e;return hM(r,t)},hM=(e,t)=>{const r=Ew();for(const n in e){const s=e[n];Qf(s,r,n,t)}return r},Qf=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];dM(l,t,r,n)}},dM=(e,t,r,n)=>{if(typeof e=="string"){fM(e,t,r);return}if(typeof e=="function"){pM(e,t,r,n);return}mM(e,t,r,n)},fM=(e,t,r)=>{const n=e===""?t:Lw(t,e);n.classGroupId=r},pM=(e,t,r,n)=>{if(gM(e)){Qf(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(oM(r,e))},mM=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[i,o]=s[l];Qf(o,Lw(t,i),r,n)}},Lw=(e,t)=>{let r=e;const n=t.split(Nl),s=n.length;for(let a=0;a<s;a++){const l=n[a];let i=r.nextPart.get(l);i||(i=Ew(),r.nextPart.set(l,i)),r=i}return r},gM=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,vM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return s(a,l),l},set(a,l){a in r?r[a]=l:s(a,l)}}},Yh="!",hv=":",_M=[],dv=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),yM=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let l=0,i=0,o=0,c;const g=s.length;for(let v=0;v<g;v++){const h=s[v];if(l===0&&i===0){if(h===hv){a.push(s.slice(o,v)),o=v+1;continue}if(h==="/"){c=v;continue}}h==="["?l++:h==="]"?l--:h==="("?i++:h===")"&&i--}const u=a.length===0?s:s.slice(o);let p=u,_=!1;u.endsWith(Yh)?(p=u.slice(0,-1),_=!0):u.startsWith(Yh)&&(p=u.slice(1),_=!0);const y=c&&c>o?c-o:void 0;return dv(a,_,p,y)};if(t){const s=t+hv,a=n;n=l=>l.startsWith(s)?a(l.slice(s.length)):dv(_M,!1,l,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},wM=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",o=t.has(l);i||o?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(l)):s.push(l)}return s.length>0&&(s.sort(),n.push(...s)),n}},SM=e=>({cache:vM(e.cacheSize),parseClassName:yM(e),sortModifiers:wM(e),...lM(e)}),xM=/\s+/,bM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],i=e.trim().split(xM);let o="";for(let c=i.length-1;c>=0;c-=1){const g=i[c],{isExternal:u,modifiers:p,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:v}=r(g);if(u){o=g+(o.length>0?" "+o:o);continue}let h=!!v,f=n(h?y.substring(0,v):y);if(!f){if(!h){o=g+(o.length>0?" "+o:o);continue}if(f=n(y),!f){o=g+(o.length>0?" "+o:o);continue}h=!1}const d=p.length===0?"":p.length===1?p[0]:a(p).join(":"),m=_?d+Yh:d,w=m+f;if(l.indexOf(w)>-1)continue;l.push(w);const b=s(f,h);for(let x=0;x<b.length;++x){const C=b[x];l.push(m+C)}o=g+(o.length>0?" "+o:o)}return o},CM=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Rw(r))&&(s&&(s+=" "),s+=n);return s},Rw=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Rw(e[n]))&&(r&&(r+=" "),r+=t);return r},EM=(e,...t)=>{let r,n,s,a;const l=o=>{const c=t.reduce((g,u)=>u(g),e());return r=SM(c),n=r.cache.get,s=r.cache.set,a=i,i(o)},i=o=>{const c=n(o);if(c)return c;const g=bM(o,r);return s(o,g),g};return a=l,(...o)=>a(CM(...o))},kM=[],vt=e=>{const t=r=>r[e]||kM;return t.isThemeGetter=!0,t},Tw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LM=/^\d+\/\d+$/,RM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ei=e=>LM.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),pn=e=>!!e&&Number.isInteger(Number(e)),pu=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Yr=e=>RM.test(e),PM=()=>!0,IM=e=>TM.test(e)&&!DM.test(e),Mw=()=>!1,BM=e=>MM.test(e),OM=e=>AM.test(e),NM=e=>!Se(e)&&!xe(e),jM=e=>ws(e,Iw,Mw),Se=e=>Tw.test(e),qn=e=>ws(e,Bw,IM),mu=e=>ws(e,UM,Ne),fv=e=>ws(e,Aw,Mw),FM=e=>ws(e,Pw,OM),Ta=e=>ws(e,Ow,BM),xe=e=>Dw.test(e),Ps=e=>Ss(e,Bw),$M=e=>Ss(e,WM),pv=e=>Ss(e,Aw),HM=e=>Ss(e,Iw),zM=e=>Ss(e,Pw),Da=e=>Ss(e,Ow,!0),ws=(e,t,r)=>{const n=Tw.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ss=(e,t,r=!1)=>{const n=Dw.exec(e);return n?n[1]?t(n[1]):r:!1},Aw=e=>e==="position"||e==="percentage",Pw=e=>e==="image"||e==="url",Iw=e=>e==="length"||e==="size"||e==="bg-size",Bw=e=>e==="length",UM=e=>e==="number",WM=e=>e==="family-name",Ow=e=>e==="shadow",VM=()=>{const e=vt("color"),t=vt("font"),r=vt("text"),n=vt("font-weight"),s=vt("tracking"),a=vt("leading"),l=vt("breakpoint"),i=vt("container"),o=vt("spacing"),c=vt("radius"),g=vt("shadow"),u=vt("inset-shadow"),p=vt("text-shadow"),_=vt("drop-shadow"),y=vt("blur"),v=vt("perspective"),h=vt("aspect"),f=vt("ease"),d=vt("animate"),m=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],b=()=>[...w(),xe,Se],x=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],S=()=>[xe,Se,o],E=()=>[Ei,"full","auto",...S()],L=()=>[pn,"none","subgrid",xe,Se],A=()=>["auto",{span:["full",pn,xe,Se]},pn,xe,Se],M=()=>[pn,"auto",xe,Se],D=()=>["auto","min","max","fr",xe,Se],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...S()],$=()=>[Ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],N=()=>[e,xe,Se],R=()=>[...w(),pv,fv,{position:[xe,Se]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",HM,jM,{size:[xe,Se]}],j=()=>[pu,Ps,qn],W=()=>["","none","full",c,xe,Se],K=()=>["",Ne,Ps,qn],Z=()=>["solid","dashed","dotted","double"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[Ne,pu,pv,fv],I=()=>["","none",y,xe,Se],V=()=>["none",Ne,xe,Se],U=()=>["none",Ne,xe,Se],J=()=>[Ne,xe,Se],X=()=>[Ei,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[PM],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[NM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",Ne],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ei,Se,xe,h]}],container:["container"],columns:[{columns:[Ne,Se,xe,i]}],"break-after":[{"break-after":m()}],"break-before":[{"break-before":m()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[pn,"auto",xe,Se]}],basis:[{basis:[Ei,"full","auto",i,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Ei,"auto","initial","none",Se]}],grow:[{grow:["",Ne,xe,Se]}],shrink:[{shrink:["",Ne,xe,Se]}],order:[{order:[pn,"first","last","none",xe,Se]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[i,"screen",...$()]}],"min-w":[{"min-w":[i,"screen","none",...$()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",r,Ps,qn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,xe,mu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pu,Se]}],"font-family":[{font:[$M,Se,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,xe,Se]}],"line-clamp":[{"line-clamp":[Ne,"none",xe,mu]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",xe,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",xe,qn]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Ne,"auto",xe,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pn,xe,Se],radial:["",xe,Se],conic:[pn,xe,Se]},zM,FM]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,xe,Se]}],"outline-w":[{outline:["",Ne,Ps,qn]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",g,Da,Ta]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,Da,Ta]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Ne,qn]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",p,Da,Ta]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Ne,xe,Se]}],"mix-blend":[{"mix-blend":[...ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[xe,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,Se]}],filter:[{filter:["","none",xe,Se]}],blur:[{blur:I()}],brightness:[{brightness:[Ne,xe,Se]}],contrast:[{contrast:[Ne,xe,Se]}],"drop-shadow":[{"drop-shadow":["","none",_,Da,Ta]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Ne,xe,Se]}],"hue-rotate":[{"hue-rotate":[Ne,xe,Se]}],invert:[{invert:["",Ne,xe,Se]}],saturate:[{saturate:[Ne,xe,Se]}],sepia:[{sepia:["",Ne,xe,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,Se]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,xe,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,xe,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,xe,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,xe,Se]}],"backdrop-invert":[{"backdrop-invert":["",Ne,xe,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,xe,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,xe,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,xe,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",xe,Se]}],ease:[{ease:["linear","initial",f,xe,Se]}],delay:[{delay:[Ne,xe,Se]}],animate:[{animate:["none",d,xe,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,xe,Se]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[xe,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:X()}],"translate-x":[{"translate-x":X()}],"translate-y":[{"translate-y":X()}],"translate-z":[{"translate-z":X()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,Se]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Ne,Ps,qn,mu]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},KM=EM(VM);function jl(...e){return KM(iM(e))}function mn({checked:e,onCheckedChange:t,disabled:r,className:n}){return T.jsx(rM,{checked:e,onCheckedChange:t,disabled:r,className:jl("group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","bg-border data-[checked]:bg-accent","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base","disabled:cursor-not-allowed disabled:opacity-50",n),children:T.jsx(nM,{className:jl("pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform","translate-x-1 group-data-[checked]:translate-x-5")})})}let Lr=null,Zf=!1;const Fl={},Nw=500;function ep(){if(typeof window>"u")return null;if((Lr==null?void 0:Lr.state)==="closed"&&(Lr=null),!Lr){const e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Lr=new e}return Lr}function GM(){Lr&&(Lr.close().catch(()=>{}),Lr=null),ep()}function qM(){return Zf}function gu(){Lr&&(GM(),Zf=!0)}if(typeof window<"u"){window.addEventListener("pageshow",t=>{t.persisted&&gu()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&gu()});let e=Date.now();setInterval(()=>{const t=Date.now();t-e>15e3&&gu(),e=t},5e3)}async function Jh(){const e=ep();e&&e.state==="suspended"&&await e.resume().catch(()=>{}),Zf=!1}async function XM(e){e.state==="suspended"&&await e.resume().catch(()=>{})}async function jw(e){const t=ep();if(!t||(await XM(t),t.state!=="running"))return;const{frequencies:r,durationMs:n,attackMs:s,peakGain:a,type:l="sine"}=e,i=t.currentTime,o=n/1e3,c=s/1e3,g=t.createGain();g.connect(t.destination);const u=i+o*.7;g.gain.setValueAtTime(0,i),g.gain.linearRampToValueAtTime(a,i+c),g.gain.setValueAtTime(a,u),g.gain.linearRampToValueAtTime(0,i+o);const p=r.map(y=>{const v=t.createOscillator();return v.type=l,v.frequency.setValueAtTime(y,i),v.connect(g),v});for(const y of p)y.start(i),y.stop(i+o);const _=p[p.length-1];_.onended=()=>{for(const y of p)y.disconnect();g.disconnect()}}async function Qh(){const e=Date.now();if(!(e-(Fl.permission||0)<Nw)){Fl.permission=e;try{await jw({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:"sine"})}catch{}}}async function Zh(){const e=Date.now();if(!(e-(Fl.idle||0)<Nw)){Fl.idle=e;try{await jw({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:"sine"})}catch{}}}function YM({isOpen:e,onClose:t}){const r=de(Y=>Y.defaultProjectDir),n=de(Y=>Y.setDefaultProjectDir),s=de(Y=>Y.commandPresets),a=de(Y=>Y.setCommandPresets),l=de(Y=>Y.defaultPresetId),i=de(Y=>Y.setDefaultPresetId),o=de(Y=>Y.sessionSortMode),c=de(Y=>Y.setSessionSortMode),g=de(Y=>Y.sessionSortDirection),u=de(Y=>Y.setSessionSortDirection),p=de(Y=>Y.useWebGL),_=de(Y=>Y.setUseWebGL),y=de(Y=>Y.fontSize),v=de(Y=>Y.setFontSize),h=de(Y=>Y.lineHeight),f=de(Y=>Y.setLineHeight),d=de(Y=>Y.letterSpacing),m=de(Y=>Y.setLetterSpacing),w=de(Y=>Y.fontOption),b=de(Y=>Y.setFontOption),x=de(Y=>Y.customFontFamily),C=de(Y=>Y.setCustomFontFamily),S=de(Y=>Y.shortcutModifier),E=de(Y=>Y.setShortcutModifier),L=de(Y=>Y.showProjectName),A=de(Y=>Y.setShowProjectName),M=de(Y=>Y.showLastUserMessage),D=de(Y=>Y.setShowLastUserMessage),O=de(Y=>Y.showSessionIdPrefix),H=de(Y=>Y.setShowSessionIdPrefix),F=Ol(Y=>Y.theme),$=Ol(Y=>Y.setTheme),N=de(Y=>Y.soundOnPermission),R=de(Y=>Y.setSoundOnPermission),P=de(Y=>Y.soundOnIdle),B=de(Y=>Y.setSoundOnIdle),[j,W]=k.useState(r),[K,Z]=k.useState(s),[ee,z]=k.useState(l),[I,V]=k.useState(o),[U,J]=k.useState(g),[X,me]=k.useState(p),[ce,fe]=k.useState(y),[Ee,ae]=k.useState(h),[Te,je]=k.useState(d),[pe,_e]=k.useState(w),[ke,se]=k.useState(x),[be,oe]=k.useState(S),[he,Le]=k.useState(L),[Re,Ce]=k.useState(M),[q,Q]=k.useState(O),[ge,He]=k.useState(F),[ie,G]=k.useState(N),[re,le]=k.useState(P),[te,ue]=k.useState(!0),[Oe,Fe]=k.useState(!1),[De,Be]=k.useState(24),[Pe,Ue]=k.useState(!1),[Me,ze]=k.useState(!1),[Je,nt]=k.useState(""),[we,Ae]=k.useState(""),[Ke,Ge]=k.useState(""),lt=k.useRef(null);if(k.useEffect(()=>{if(lt.current&&(clearTimeout(lt.current),lt.current=null),e){if(W(r),Z(s),z(l),V(o),J(g),me(p),fe(y),ae(h),je(d),_e(w),se(x),oe(S),Le(L),Ce(M),Q(O),He(F),G(N),le(P),ze(!1),nt(""),Ae(""),Ge(""),fetch("/api/settings/tmux-mouse-mode").then(Y=>Y.json()).then(Y=>ue(Y.enabled)).catch(()=>{}),fetch("/api/settings/inactive-max-age-hours").then(Y=>Y.json()).then(Y=>Be(Y.hours)).catch(()=>{}),typeof document<"u"){const Y=document.querySelector(".xterm-helper-textarea");Y&&typeof Y.setAttribute=="function"&&(typeof Y.blur=="function"&&Y.blur(),Y.setAttribute("disabled","true"))}}else typeof document<"u"&&(lt.current=setTimeout(()=>{if(typeof document>"u")return;const Y=document.querySelector(".xterm-helper-textarea");Y&&(Y.removeAttribute("disabled"),Y.focus())},300));return()=>{lt.current&&(clearTimeout(lt.current),lt.current=null)}},[s,l,r,o,g,p,y,h,d,w,x,S,L,M,O,F,N,P,e]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const Y=Qe=>{Qe.key==="Escape"&&(typeof Qe.stopPropagation=="function"&&Qe.stopPropagation(),t())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e,t]),!e)return null;const xt=Y=>{Y.preventDefault();const Qe=j.trim(),Vr=X!==p;n(Qe||fh),a(K),i(ee),c(I),u(U),_(X),v(ce),f(Ee),m(Te),b(pe),C(ke),E(be),A(he),D(Re),H(q),$(ge),R(ie),B(re),t({webglChanged:Vr})},dt=(Y,Qe)=>{Z(Vr=>Vr.map(Kr=>Kr.id===Y?{...Kr,...Qe}:Kr))},Wt=Y=>{var Kr;const Qe=K.find(wi=>wi.id===Y);if(!Qe||Qe.isBuiltIn)return;const Vr=K.filter(wi=>wi.id!==Y);Z(Vr),Y===ee&&z(((Kr=Vr[0])==null?void 0:Kr.id)||"claude")},Wr=()=>{if(!Je.trim()||!we.trim()||K.length>=Xi)return;const Y={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:Je.trim(),command:we.trim(),isBuiltIn:!1,agentType:Ke||void 0};Z([...K,Y]),ze(!1),nt(""),Ae(""),Ge("")},xs=K.length<Xi,Zo=Y=>{Fe(!0),ue(Y),fetch("/api/settings/tmux-mouse-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:Y})}).catch(()=>ue(!Y)).finally(()=>Fe(!1))},ea=Y=>{const Qe=De;Ue(!0),Be(Y),fetch("/api/settings/inactive-max-age-hours",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:Y})}).catch(()=>Be(Qe)).finally(()=>Ue(!1))};return T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:Y=>{Y.target===Y.currentTarget&&t()},children:T.jsxs("form",{onSubmit:xt,className:"w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"p-6 pb-0",children:[T.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"Settings"}),T.jsx("p",{className:"mt-2 text-xs text-muted text-pretty",children:"Configure default directory, command presets, and display options."})]}),T.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4",children:T.jsxs("div",{className:"mt-5 space-y-4",children:[T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Default Project Directory"}),T.jsx("input",{value:j,onChange:Y=>W(Y.target.value),placeholder:fh,className:"input",autoFocus:!0})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsxs("div",{className:"flex items-center justify-between mb-2",children:[T.jsx("label",{className:"text-xs text-secondary",children:"Command Presets"}),T.jsx("select",{value:ee,onChange:Y=>z(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:K.map(Y=>T.jsx("option",{value:Y.id,children:Y.label},Y.id))})]}),T.jsx("p",{className:"text-[10px] text-muted mb-3",children:"Default preset is pre-selected when creating new sessions."}),T.jsx("div",{className:"space-y-3",children:K.map(Y=>T.jsxs("div",{className:"border border-border p-3 space-y-2",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsx("div",{className:"flex items-center gap-2",children:T.jsx("input",{value:Y.label,onChange:Qe=>dt(Y.id,{label:Qe.target.value}),className:"input text-sm py-1 px-2 w-32",placeholder:"Label"})}),!Y.isBuiltIn&&T.jsx("button",{type:"button",onClick:()=>Wt(Y.id),className:"btn text-xs px-2 py-1 text-error hover:bg-error/10",children:"Delete"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Command"}),T.jsx("input",{value:Y.command,onChange:Qe=>dt(Y.id,{command:Qe.target.value}),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"})]}),!Y.isBuiltIn&&T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Icon"}),T.jsxs("select",{value:Y.agentType||"",onChange:Qe=>dt(Y.id,{agentType:Qe.target.value||void 0}),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal"}),T.jsx("option",{value:"claude",children:"Claude"}),T.jsx("option",{value:"codex",children:"Codex"})]})]})]},Y.id))}),Me?T.jsxs("div",{className:"mt-3 border border-border p-3 space-y-2",children:[T.jsx("div",{className:"text-xs text-secondary mb-2",children:"New Preset"}),T.jsx("input",{value:Je,onChange:Y=>nt(Y.target.value),className:"input text-xs py-1 px-2 w-full",placeholder:"Label"}),T.jsx("input",{value:we,onChange:Y=>Ae(Y.target.value),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("select",{value:Ke,onChange:Y=>Ge(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal Icon"}),T.jsx("option",{value:"claude",children:"Claude Icon"}),T.jsx("option",{value:"codex",children:"Codex Icon"})]}),T.jsx("div",{className:"flex-1"}),T.jsx("button",{type:"button",onClick:()=>ze(!1),className:"btn text-xs px-2 py-1",children:"Cancel"}),T.jsx("button",{type:"button",onClick:Wr,disabled:!Je.trim()||!we.trim(),className:"btn btn-primary text-xs px-2 py-1",children:"Add"})]})]}):T.jsx("button",{type:"button",onClick:()=>ze(!0),disabled:!xs,className:"btn text-xs mt-3 w-full",children:xs?"+ Add Preset":`Max ${Xi} presets`})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Session List Order"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${I==="created"?"btn-primary":""}`,onClick:()=>V("created"),children:"Created"}),T.jsx("button",{type:"button",className:`btn flex-1 ${I==="status"?"btn-primary":""}`,onClick:()=>V("status"),children:"Status"}),T.jsx("button",{type:"button",className:`btn flex-1 ${I==="manual"?"btn-primary":""}`,onClick:()=>V("manual"),children:"Manual"})]}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:I==="status"?"Sessions auto-resort by status (waiting, working, unknown)":I==="manual"?"Drag sessions to reorder manually":"Sessions stay in creation order"})]}),I==="created"&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Sort Direction"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${U==="desc"?"btn-primary":""}`,onClick:()=>J("desc"),children:"Newest First"}),T.jsx("button",{type:"button",className:`btn flex-1 ${U==="asc"?"btn-primary":""}`,onClick:()=>J("asc"),children:"Oldest First"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Session List Details"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Project Name"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the project folder name under each session."})]}),T.jsx(mn,{checked:he,onCheckedChange:Le})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Last User Message"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the most recent user input next to the project name."})]}),T.jsx(mn,{checked:Re,onCheckedChange:Ce})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Session ID Prefix"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show first 5 characters of agent session IDs in the list."})]}),T.jsx(mn,{checked:q,onCheckedChange:Q})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Inactive Sessions Lookback"}),T.jsxs("div",{className:"text-[10px] text-muted",children:["Show inactive sessions from the last N hours (",hu,"-",du,")."]})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"number",min:hu,max:du,value:De,onChange:Y=>{const Qe=parseInt(Y.target.value,10);Qe>=hu&&Qe<=du&&ea(Qe)},disabled:Pe,className:"input text-xs py-1 px-2 w-16 text-center"}),T.jsx("span",{className:"text-xs text-muted",children:"hrs"})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Notifications"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Permission Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a ping when any session needs permission."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void Qh(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(mn,{checked:ie,onCheckedChange:Y=>{G(Y),Y&&Jh()}})]})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Idle Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a chime when a session finishes working."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void Zh(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(mn,{checked:re,onCheckedChange:Y=>{le(Y),Y&&Jh()}})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Terminal Rendering"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"WebGL Acceleration"}),T.jsx("div",{className:"text-[10px] text-muted",children:"GPU rendering for better performance. Turn off if text looks fuzzy or flickering."})]}),T.jsx(mn,{checked:X,onCheckedChange:me})]}),X!==p&&T.jsx("p",{className:"mt-2 text-[10px] text-approval",children:"Terminal will reload when saved"}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Mouse Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Enable tmux mouse mode for trackpad/scroll wheel support."})]}),T.jsx(mn,{checked:te,onCheckedChange:Zo,disabled:Oe})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Size"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal text size in pixels (6-24)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>fe(Math.max(6,ce-1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"−"})}),T.jsx("span",{className:"text-sm text-secondary w-6 text-center",children:ce}),T.jsx("button",{type:"button",onClick:()=>fe(Math.min(24,ce+1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"+"})})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Line Height"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Vertical spacing (1.0 = compact, 2.0 = spacious)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"1.0",max:"2.0",step:"0.1",value:Ee,onChange:Y=>ae(parseFloat(Y.target.value)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsx("span",{className:"text-xs text-secondary w-8 text-right",children:Ee.toFixed(1)})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Letter Spacing"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Horizontal spacing between characters in pixels"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"-3",max:"3",step:"1",value:Te,onChange:Y=>je(parseInt(Y.target.value,10)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsxs("span",{className:"text-xs text-secondary w-8 text-right",children:[Te,"px"]})]})]}),T.jsxs("div",{className:"mt-4",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Family"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal typeface"})]}),T.jsx("select",{value:pe,onChange:Y=>_e(Y.target.value),className:"input text-xs py-1 px-2 w-auto",children:ph.map(Y=>T.jsx("option",{value:Y.id,children:Y.label},Y.id))})]}),pe==="custom"&&T.jsx("input",{value:ke,onChange:Y=>se(Y.target.value),placeholder:'"Fira Code", monospace',className:"input text-xs mt-2 font-mono"})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Dark Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Switch between dark and light themes."})]}),T.jsx(mn,{checked:ge==="dark",onCheckedChange:Y=>He(Y?"dark":"light")})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Keyboard Shortcut Modifier"}),T.jsx("div",{className:"grid grid-cols-5 gap-1",children:["auto","ctrl-option","ctrl-shift","cmd-option","cmd-shift"].map(Y=>T.jsx("button",{type:"button",className:`btn text-xs px-2 ${be===Y?"btn-primary":""}`,onClick:()=>oe(Y),children:Y==="auto"?"Auto":Yi(Y)},Y))}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:be==="auto"?`Platform default: ${Yi(Uo("auto"))}`:`Shortcuts: ${Yi(be)}+[N/X/[/]]`})]})]})}),T.jsxs("div",{className:"flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated",children:[T.jsx("button",{type:"button",onClick:()=>t(),className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save"})]})]})})}function zi(e){return(e==null?void 0:e.ownerDocument)||document}let mv=0;function Fw(e){return mv+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${mv}`}const JM=[];function QM(e){k.useEffect(e,JM)}const Is=0;class $l{constructor(){ir(this,"currentId",Is);ir(this,"clear",()=>{this.currentId!==Is&&(clearTimeout(this.currentId),this.currentId=Is)});ir(this,"disposeEffect",()=>this.clear)}static create(){return new $l}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Is,r()},t)}isStarted(){return this.currentId!==Is}}const Qo=typeof navigator<"u",vu=n3(),ZM=s3(),e3=i3();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");vu.platform==="MacIntel"&&vu.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(vu.platform);const t3=Qo&&/apple/i.test(navigator.vendor);Qo&&ZM.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const r3=e3.includes("jsdom/");function n3(){if(!Qo)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function i3(){if(!Qo)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:r})=>`${t}/${r}`).join(" "):navigator.userAgent}function s3(){if(!Qo)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Hl(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function es(e,t){var n;if(!e||!t)return!1;const r=(n=t.getRootNode)==null?void 0:n.call(t);if(e.contains(t))return!0;if(r&&FD(r)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function ed(e){return"composedPath"in e?e.composedPath()[0]:e.target}function td(e){if(!e||r3)return!0;try{return e.matches(":focus-visible")}catch{return!0}}const tp=k.createContext(void 0);function rp(){const e=k.useContext(tp);if(!e)throw new Error(_i(73));return e}function _u(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const r=e(t);return typeof r=="string"?{description:r}:r}return e}const o3=function(t){const{children:r,timeout:n=5e3,limit:s=3,toastManager:a}=t,[l,i]=k.useState([]),[o,c]=k.useState(!1),[g,u]=k.useState(!1),[p,_]=k.useState(null);l.length===0&&(o&&c(!1),g&&u(!1));const y=o||g,v=k.useRef(new Map),h=k.useRef(null),f=k.useRef(!0),d=k.useRef(!1);function m(D){var N,R;const O=Hl(zi(h.current));if(!h.current||!es(h.current,O)||!td(O))return;const H=l.findIndex(P=>P.id===D);let F=null,$=H+1;for(;$<l.length;){if(l[$].transitionStatus!=="ending"){F=l[$];break}$+=1}if(!F)for($=H-1;$>=0;){if(l[$].transitionStatus!=="ending"){F=l[$];break}$-=1}F?(R=(N=F.ref)==null?void 0:N.current)==null||R.focus():p==null||p.focus({preventScroll:!0})}const w=Ft(()=>{d.current||(d.current=!0,v.current.forEach(D=>{if(D.timeout){D.timeout.clear();const O=Date.now()-D.start,H=D.delay-O;D.remaining=H>0?H:0}}))}),b=Ft(()=>{d.current&&(d.current=!1,v.current.forEach((D,O)=>{D.remaining=D.remaining>0?D.remaining:D.delay,D.timeout??(D.timeout=$l.create()),D.timeout.start(D.remaining,()=>{v.current.delete(O),D.callback()}),D.start=Date.now()}))}),x=Ft(D=>{var F;i($=>{const N=$.map(P=>P.id===D?{...P,transitionStatus:"ending",height:0}:P),R=N.filter(P=>P.transitionStatus!=="ending");return N.map(P=>{if(P.transitionStatus==="ending")return P;const B=R.indexOf(P)>=s;return{...P,limited:B}})});const O=v.current.get(D);O&&O.timeout&&(O.timeout.clear(),v.current.delete(D));const H=l.find($=>$.id===D);(F=H==null?void 0:H.onClose)==null||F.call(H),m(D),l.length===1&&(c(!1),u(!1))}),C=Ft(D=>{var H;i(F=>F.filter($=>$.id!==D));const O=l.find(F=>F.id===D);(H=O==null?void 0:O.onRemove)==null||H.call(O)}),S=Ft((D,O,H)=>{const F=Date.now(),$=f.current&&!o&&!g,N=$?$l.create():void 0;N==null||N.start(O,()=>{v.current.delete(D),H()}),v.current.set(D,{timeout:N,start:$?F:0,delay:O,remaining:O,callback:H})}),E=Ft(D=>{const O=D.id||Fw("toast"),H={...D,id:O,transitionStatus:"starting"};i($=>{const N=[H,...$],R=N.filter(P=>P.transitionStatus!=="ending");if(R.length>s){const P=R.length-s,B=R.slice(-P);return N.map(j=>B.some(W=>W.id===j.id)?{...j,limited:!0}:{...j,limited:!1})}return N.map(P=>({...P,limited:!1}))});const F=H.timeout??n;return H.type!=="loading"&&F>0&&S(O,F,()=>x(O)),(o||g||!f.current)&&w(),O}),L=Ft((D,O)=>{i(H=>H.map(F=>F.id===D?{...F,...O}:F))}),A=Ft((D,O)=>{const H=_u(O.loading),F=E({...H,type:"loading"}),$=D.then(N=>{const R=_u(O.success,N);L(F,{...R,type:"success"});const P=R.timeout??n;return P>0&&S(F,P,()=>x(F)),(o||g||!f.current)&&w(),N}).catch(N=>{const R=_u(O.error,N);L(F,{...R,type:"error"});const P=R.timeout??n;return P>0&&S(F,P,()=>x(F)),(o||g||!f.current)&&w(),Promise.reject(N)});return{}.hasOwnProperty.call(O,"setPromise")&&O.setPromise($),$});k.useEffect(function(){return a?a[" subscribe"](({action:H,options:F})=>{const $=F.id;H==="promise"&&F.promise?A(F.promise,F):H==="update"&&$?L($,F):H==="close"&&$?x($):E(F)}):void 0},[E,L,S,n,a,A,x]);const M=k.useMemo(()=>({toasts:l,setToasts:i,hovering:o,setHovering:c,focused:g,setFocused:u,expanded:y,add:E,close:x,remove:C,update:L,promise:A,pauseTimers:w,resumeTimers:b,prevFocusElement:p,setPrevFocusElement:_,viewportRef:h,scheduleTimer:S,windowFocusedRef:f}),[E,x,g,o,y,w,p,A,C,b,S,l,L]);return T.jsx(tp.Provider,{value:M,children:r})},yu=k.forwardRef(function(t,r){const[n,s]=k.useState();lr(()=>{t3&&s("button")},[]);const a={tabIndex:0,role:n};return T.jsx("span",{...t,ref:r,style:Gf,"aria-hidden":n?void 0:!0,...a,"data-base-ui-focus-guard":""})}),a3=k.createContext(void 0);let l3=function(e){return e.frontmostHeight="--toast-frontmost-height",e}({});const c3=k.forwardRef(function(t,r){var N;const{render:n,className:s,children:a,...l}=t,{toasts:i,pauseTimers:o,resumeTimers:c,setHovering:g,setFocused:u,viewportRef:p,windowFocusedRef:_,prevFocusElement:y,setPrevFocusElement:v,expanded:h,focused:f}=rp(),d=k.useRef(!1),m=k.useRef(!1),w=i.length,b=((N=i[0])==null?void 0:N.height)??0,x=k.useMemo(()=>i.some(R=>R.transitionStatus==="ending"),[i]);k.useEffect(()=>{if(!p.current)return;function R(B){var j;w!==0&&B.key==="F6"&&B.target!==p.current&&(B.preventDefault(),v(Hl(zi(p.current))),(j=p.current)==null||j.focus({preventScroll:!0}),o(),u(!0))}const P=Bo(p.current);return P.addEventListener("keydown",R),()=>{P.removeEventListener("keydown",R)}},[o,u,v,w,p]),k.useEffect(()=>{if(!p.current||!w)return;const R=Bo(p.current);function P(j){j.target===R&&(_.current=!1,o())}function B(j){if(j.relatedTarget||j.target===R)return;const W=ed(j),K=Hl(zi(p.current));(!es(p.current,W)||!td(K))&&c(),setTimeout(()=>{_.current=!0})}return R.addEventListener("blur",P,!0),R.addEventListener("focus",B,!0),()=>{R.removeEventListener("blur",P,!0),R.removeEventListener("focus",B,!0)}},[o,c,p,_,u,w]),k.useEffect(()=>{const R=p.current;if(!R||w===0)return;const P=zi(R);function B(j){if(j.pointerType!=="touch")return;const W=ed(j);es(R,W)||(c(),g(!1),u(!1))}return P.addEventListener("pointerdown",B,!0),()=>{P.removeEventListener("pointerdown",B,!0)}},[w,c,u,g,p]);function C(R){var P,B,j;p.current&&(d.current=!0,R.relatedTarget===p.current?(j=(B=(P=i[0])==null?void 0:P.ref)==null?void 0:B.current)==null||j.focus():y==null||y.focus({preventScroll:!0}))}function S(R){R.key==="Tab"&&R.shiftKey&&R.target===p.current&&(R.preventDefault(),y==null||y.focus({preventScroll:!0}),c())}k.useEffect(()=>{!_.current||x||!m.current||(c(),g(!1),m.current=!1)},[x,c,g,_]);function E(){o(),g(!0),m.current=!1}function L(){i.some(R=>R.transitionStatus==="ending")?m.current=!0:(c(),g(!1))}function A(){if(d.current){d.current=!1;return}f||td(zi(p.current).activeElement)&&(u(!0),o())}function M(R){!f||es(p.current,R.relatedTarget)||(u(!1),c())}const D={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:E,onMouseMove:E,onMouseLeave:L,onFocus:A,onBlur:M,onKeyDown:S,onClick:A},O=k.useMemo(()=>({expanded:h}),[h]),H=yi("div",t,{ref:[r,p],state:O,props:[D,{style:{[l3.frontmostHeight]:b?`${b}px`:void 0}},l,{children:T.jsxs(k.Fragment,{children:[w>0&&y&&T.jsx(yu,{onFocus:C}),a,w>0&&y&&T.jsx(yu,{onFocus:C})]})}]}),F=k.useMemo(()=>({viewportRef:p}),[p]),$=k.useMemo(()=>i.filter(R=>R.priority==="high"),[i]);return T.jsxs(a3.Provider,{value:F,children:[w>0&&y&&T.jsx(yu,{onFocus:C}),H,!f&&$.length>0&&T.jsx("div",{style:Gf,children:$.map(R=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:R.title}),T.jsx("div",{children:R.description})]},R.id))})]})});function u3(e){return mw(19)?e:e?"true":void 0}const $w=k.createContext(void 0);function Oo(){const e=k.useContext($w);if(!e)throw new Error(_i(66));return e}let Hw=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const h3={[Hw.startingStyle]:""},d3={[Hw.endingStyle]:""},f3={transitionStatus(e){return e==="starting"?h3:e==="ending"?d3:null}};function p3(e){const t=Jo(m3,e).current;return t.next=e,lr(t.effect),t}function m3(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Ma=null;class g3{constructor(){ir(this,"callbacks",[]);ir(this,"callbacksCount",0);ir(this,"nextId",1);ir(this,"startId",1);ir(this,"isScheduled",!1);ir(this,"tick",t=>{var s;this.isScheduled=!1;const r=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let a=0;a<r.length;a+=1)(s=r[a])==null||s.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const Aa=new g3;class np{constructor(){ir(this,"currentId",Ma);ir(this,"cancel",()=>{this.currentId!==Ma&&(Aa.cancel(this.currentId),this.currentId=Ma)});ir(this,"disposeEffect",()=>this.cancel)}static create(){return new np}static request(t){return Aa.request(t)}static cancel(t){return Aa.cancel(t)}request(t){this.cancel(),this.currentId=Aa.request(()=>{this.currentId=Ma,t()})}}function v3(){const e=Jo(np.create).current;return QM(e.disposeEffect),e}function _3(e){return e==null?e:"current"in e?e.current:e}function y3(e,t=!1,r=!0){const n=v3();return Ft((s,a=null)=>{n.cancel();const l=_3(e);l!=null&&(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?s():n.request(()=>{function i(){l&&Promise.all(l.getAnimations().map(o=>o.finished)).then(()=>{a!=null&&a.aborted||jr.flushSync(s)}).catch(()=>{if(r){if(a!=null&&a.aborted)return;jr.flushSync(s)}else l.getAnimations().length>0&&l.getAnimations().some(o=>o.pending||o.playState!=="finished")&&i()})}t?n.request(i):i()}))})}function w3(e){const{enabled:t=!0,open:r,ref:n,onComplete:s}=e,a=p3(r),l=Ft(s),i=y3(n,r);k.useEffect(()=>{t&&i(()=>{r===a.current&&l()})},[t,r,l,i,a])}let Xn=function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e}({});const S3={...f3,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Bs=40,x3=10,gn=.5,b3=1;function gv(e,t,r){switch(e){case"up":return-r;case"down":return r;case"left":return-t;case"right":return t;default:return 0}}function C3(e){const r=window.getComputedStyle(e).transform;let n=0,s=0,a=1;if(r&&r!=="none"){const l=r.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const i=l[1].split(", ").map(parseFloat);i.length===6?(n=i[4],s=i[5],a=Math.sqrt(i[0]*i[0]+i[1]*i[1])):i.length===16&&(n=i[12],s=i[13],a=i[0])}}return{x:n,y:s,scale:a}}const E3=k.forwardRef(function(t,r){var be;const{toast:n,render:s,className:a,swipeDirection:l=["down","right"],...i}=t,o=((be=n.positionerProps)==null?void 0:be.anchor)!==void 0;let c=[];o||(c=Array.isArray(l)?l:[l]);const g=c.length>0,{toasts:u,focused:p,close:_,remove:y,setToasts:v,pauseTimers:h,expanded:f,setHovering:d}=rp(),[m,w]=k.useState(void 0),[b,x]=k.useState(!1),[C,S]=k.useState(!1),[E,L]=k.useState(!1),[A,M]=k.useState({x:0,y:0}),[D,O]=k.useState({x:0,y:0,scale:1}),[H,F]=k.useState(),[$,N]=k.useState(),[R,P]=k.useState(null),B=k.useRef(null),j=k.useRef({x:0,y:0}),W=k.useRef({x:0,y:0,scale:1}),K=k.useRef(void 0),Z=k.useRef(0),ee=k.useRef(!1),z=k.useRef({x:0,y:0}),I=k.useRef(!1),V=k.useMemo(()=>u.indexOf(n),[n,u]),U=k.useMemo(()=>u.filter(oe=>oe.transitionStatus!=="ending").indexOf(n),[n,u]),J=k.useMemo(()=>u.slice(0,u.indexOf(n)).reduce((oe,he)=>oe+(he.height||0),0),[u,n]);w3({open:n.transitionStatus!=="ending",ref:B,onComplete(){n.transitionStatus==="ending"&&y(n.id)}});const X=Ft(()=>{const oe=B.current;if(!oe)return;const he=oe.style.height;oe.style.height="auto";const Le=oe.offsetHeight;oe.style.height=he,jr.flushSync(()=>{v(Re=>Re.map(Ce=>Ce.id===n.id?{...Ce,ref:B,height:Le,transitionStatus:void 0}:Ce))})});lr(X,[X]);function me(oe,he){let Le=oe,Re=he;return!c.includes("left")&&!c.includes("right")?Le=oe>0?oe**gn:-(Math.abs(oe)**gn):(!c.includes("right")&&oe>0&&(Le=oe**gn),!c.includes("left")&&oe<0&&(Le=-(Math.abs(oe)**gn))),!c.includes("up")&&!c.includes("down")?Re=he>0?he**gn:-(Math.abs(he)**gn):(!c.includes("down")&&he>0&&(Re=he**gn),!c.includes("up")&&he<0&&(Re=-(Math.abs(he)**gn))),{x:Le,y:Re}}function ce(oe){var Re;if(oe.button!==0)return;oe.pointerType==="touch"&&h();const he=ed(oe.nativeEvent);if(!(he&&he.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(ee.current=!1,K.current=void 0,Z.current=0,j.current={x:oe.clientX,y:oe.clientY},z.current=j.current,B.current){const Ce=C3(B.current);W.current=Ce,O(Ce),M({x:Ce.x,y:Ce.y})}d(!0),x(!0),S(!1),P(null),I.current=!0,(Re=B.current)==null||Re.setPointerCapture(oe.pointerId)}}function fe(oe){if(!b)return;oe.preventDefault(),I.current&&(j.current={x:oe.clientX,y:oe.clientY},I.current=!1);const{clientY:he,clientX:Le,movementX:Re,movementY:Ce}=oe;(Ce<0&&he>z.current.y||Ce>0&&he<z.current.y)&&(z.current={x:z.current.x,y:he}),(Re<0&&Le>z.current.x||Re>0&&Le<z.current.x)&&(z.current={x:Le,y:z.current.y});const q=Le-j.current.x,Q=he-j.current.y,ge=he-z.current.y,He=Le-z.current.x;if(!C&&Math.sqrt(q*q+Q*Q)>=b3&&(S(!0),R===null)){const ue=c.includes("left")||c.includes("right"),Oe=c.includes("up")||c.includes("down");if(ue&&Oe){const Fe=Math.abs(q),De=Math.abs(Q);P(Fe>De?"horizontal":"vertical")}}let ie;if(!K.current)R==="vertical"?Q>0?ie="down":Q<0&&(ie="up"):R==="horizontal"?q>0?ie="right":q<0&&(ie="left"):Math.abs(q)>=Math.abs(Q)?ie=q>0?"right":"left":ie=Q>0?"down":"up",ie&&c.includes(ie)&&(K.current=ie,Z.current=gv(ie,q,Q),w(ie));else{const te=K.current,ue=gv(te,He,ge);ue>Bs?(ee.current=!1,w(te)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&Z.current-ue>=x3&&(ee.current=!0)}const G=me(q,Q);let re=W.current.x,le=W.current.y;R==="horizontal"?(c.includes("left")||c.includes("right"))&&(re+=G.x):(R==="vertical"||(c.includes("left")||c.includes("right"))&&(re+=G.x),(c.includes("up")||c.includes("down"))&&(le+=G.y)),M({x:re,y:le})}function Ee(oe){var q;if(!b)return;if(x(!1),S(!1),P(null),(q=B.current)==null||q.releasePointerCapture(oe.pointerId),ee.current){M({x:D.x,y:D.y}),w(void 0);return}let he=!1;const Le=A.x-D.x,Re=A.y-D.y;let Ce;for(const Q of c){switch(Q){case"right":Le>Bs&&(he=!0,Ce="right");break;case"left":Le<-Bs&&(he=!0,Ce="left");break;case"down":Re>Bs&&(he=!0,Ce="down");break;case"up":Re<-Bs&&(he=!0,Ce="up");break}if(he)break}he?(w(Ce),L(!0),_(n.id)):(M({x:D.x,y:D.y}),w(void 0))}function ae(oe){if(oe.key==="Escape"){if(!B.current||!es(B.current,Hl(zi(B.current))))return;_(n.id)}}k.useEffect(()=>{if(!g)return;const oe=B.current;if(!oe)return;function he(Le){es(oe,Le.target)&&Le.preventDefault()}return oe.addEventListener("touchmove",he,{passive:!1}),()=>{oe.removeEventListener("touchmove",he)}},[g]);function Te(){if(!b&&A.x===D.x&&A.y===D.y&&!E)return{[Xn.swipeMovementX]:"0px",[Xn.swipeMovementY]:"0px"};const oe=A.x-D.x,he=A.y-D.y;return{transition:b?"none":void 0,transform:b?`translateX(${A.x}px) translateY(${A.y}px) scale(${D.scale})`:void 0,[Xn.swipeMovementX]:`${oe}px`,[Xn.swipeMovementY]:`${he}px`}}const je=n.priority==="high",pe={role:je?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":H,"aria-describedby":$,"aria-hidden":je&&!p?!0:void 0,onPointerDown:g?ce:void 0,onPointerMove:g?fe:void 0,onPointerUp:g?Ee:void 0,onKeyDown:ae,inert:u3(n.limited),style:{...Te(),[Xn.index]:n.transitionStatus==="ending"?V:U,[Xn.offsetY]:`${J}px`,[Xn.height]:n.height?`${n.height}px`:void 0}},_e=k.useMemo(()=>({rootRef:B,toast:n,titleId:H,setTitleId:F,descriptionId:$,setDescriptionId:N,swiping:b,swipeDirection:m,recalculateHeight:X,index:V,visibleIndex:U,expanded:f}),[n,H,$,b,m,X,V,U,f]),ke=k.useMemo(()=>({transitionStatus:n.transitionStatus,expanded:f,limited:n.limited||!1,type:n.type,swiping:_e.swiping,swipeDirection:_e.swipeDirection}),[f,n.transitionStatus,n.limited,n.type,_e.swiping,_e.swipeDirection]),se=yi("div",t,{ref:[r,_e.rootRef],state:ke,stateAttributesMapping:S3,props:[pe,i]});return T.jsx($w.Provider,{value:_e,children:se})}),k3=k.forwardRef(function(t,r){const{render:n,className:s,id:a,children:l,...i}=t,{toast:o}=Oo(),c=l??o.description,g=!!c,u=Xf(a),{setDescriptionId:p}=Oo();lr(()=>{if(g)return p(u),()=>{p(void 0)}},[g,u,p]);const _=k.useMemo(()=>({type:o.type}),[o.type]),y=yi("p",t,{ref:r,state:_,props:{...i,id:u,children:c}});return g?y:null}),L3=k.forwardRef(function(t,r){const{render:n,className:s,id:a,children:l,...i}=t,{toast:o}=Oo(),c=l??o.title,g=!!c,u=Xf(a),{setTitleId:p}=Oo();lr(()=>{if(g)return p(u),()=>{p(void 0)}},[g,u,p]);const _=k.useMemo(()=>({type:o.type}),[o.type]),y=yi("h2",t,{ref:r,state:_,props:{...i,id:u,children:c}});return g?y:null}),R3=k.forwardRef(function(t,r){const{render:n,className:s,disabled:a,nativeButton:l=!0,...i}=t,{close:o,expanded:c}=rp(),{toast:g}=Oo(),{getButtonProps:u,buttonRef:p}=yw({disabled:a,native:l}),_=k.useMemo(()=>({type:g.type}),[g.type]);return yi("button",t,{ref:[r,p],state:_,props:[{"aria-hidden":!c,onClick(){o(g.id)}},i,u]})});function T3(){const e=k.useContext(tp);if(!e)throw new Error(_i(73));const{toasts:t,add:r,close:n,update:s,promise:a}=e;return k.useMemo(()=>({toasts:t,add:r,close:n,update:s,promise:a}),[t,r,n,s,a])}function D3(){const e=[];function t(r){e.forEach(n=>n(r))}return{" subscribe":function(n){return e.push(n),()=>{const s=e.indexOf(n);s!==-1&&e.splice(s,1)}},add(r){const n=r.id||Fw("toast"),s={...r,id:n,transitionStatus:"starting"};return t({action:"add",options:s}),n},close(r){t({action:"close",options:{id:r}})},update(r,n){t({action:"update",options:{...n,id:r}})},promise(r,n){let s=r;return t({action:"promise",options:{...n,promise:r,setPromise(a){s=a}}}),s}}}const M3=5e3,zw=D3();function A3({toast:e}){return T.jsxs(E3,{toast:e,className:jl("relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg","data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]","data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]","data-[ending-style]:opacity-0","data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0","transition-all duration-200",e.type==="error"&&"border-error/50",e.type==="success"&&"border-approval/50",(!e.type||e.type==="info")&&"border-border"),children:[T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsx(L3,{className:jl("text-sm font-medium",e.type==="error"&&"text-error",e.type==="success"&&"text-approval",(!e.type||e.type==="info")&&"text-primary"),children:e.title}),e.description&&T.jsx(k3,{className:"mt-1 text-xs text-muted line-clamp-2",children:e.description})]}),T.jsx(R3,{className:"shrink-0 text-muted hover:text-primary transition-colors","aria-label":"Close",children:T.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function P3(){const{toasts:e}=T3();return T.jsx(T.Fragment,{children:e.map(t=>T.jsx(A3,{toast:t},t.id))})}function I3(){return T.jsxs(o3,{timeout:M3,toastManager:zw,children:[T.jsx(P3,{}),T.jsx(c3,{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2"})]})}class B3{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status="connecting",this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.manualClose=!1}connect(){if(this.ws)return;this.manualClose=!1,this.setStatus("connecting");const r=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new WebSocket(r);this.ws=n,n.onopen=()=>{this.reconnectAttempts=0,this.setStatus("connected")},n.onmessage=s=>{try{const a=JSON.parse(s.data);this.listeners.forEach(l=>l(a))}catch{}},n.onerror=()=>{this.setStatus("error","WebSocket error")},n.onclose=()=>{this.ws=null,this.manualClose?this.setStatus("disconnected"):this.scheduleReconnect()}}disconnect(){var t;this.manualClose=!0,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}send(t){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(t))}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}subscribeStatus(t){return this.statusListeners.add(t),t(this.status,this.error),()=>this.statusListeners.delete(t)}getStatus(){return this.status}setStatus(t,r=null){this.status=t,this.error=r,this.statusListeners.forEach(n=>n(t,r))}scheduleReconnect(){this.reconnectAttempts+=1;const t=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);this.setStatus("reconnecting"),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}}const Yn=new B3;function O3(){const e=We(l=>l.setConnectionStatus),t=We(l=>l.setConnectionError),[r,n]=k.useState(Yn.getStatus());k.useEffect(()=>{Yn.connect();const l=Yn.subscribeStatus((i,o)=>{n(i),e(i),t(o)});return()=>{l()}},[t,e]);const s=k.useMemo(()=>Yn.send.bind(Yn),[]),a=k.useMemo(()=>Yn.subscribe.bind(Yn),[]);return{status:r,sendMessage:s,subscribe:a}}const N3=100;function j3({viewport:e,win:t,doc:r}){if(!e)return!1;const n=Math.max(0,e.offsetTop||0),s=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+n),l=Math.max(0,a),i=Math.max(0,e.height||0),o=Math.max(0,e.width||0);return r.documentElement.style.setProperty("--keyboard-inset",`${l}px`),r.documentElement.style.setProperty("--viewport-offset-top",`${n}px`),r.documentElement.style.setProperty("--viewport-offset-left",`${s}px`),r.documentElement.style.setProperty("--visual-viewport-height",`${i}px`),r.documentElement.style.setProperty("--visual-viewport-width",`${o}px`),l>N3?r.documentElement.classList.add("keyboard-visible"):r.documentElement.classList.remove("keyboard-visible"),!0}function F3(e){e.documentElement.style.removeProperty("--keyboard-inset"),e.documentElement.style.removeProperty("--viewport-offset-top"),e.documentElement.style.removeProperty("--viewport-offset-left"),e.documentElement.style.removeProperty("--visual-viewport-height"),e.documentElement.style.removeProperty("--visual-viewport-width"),e.documentElement.classList.remove("keyboard-visible")}function $3(){k.useEffect(()=>{const e=window.visualViewport;if(!e)return;let t=null,r=null;const n=()=>{var v;const _=document.activeElement;if(!_)return!1;const y=(v=_.tagName)==null?void 0:v.toLowerCase();return y==="input"||y==="textarea"?!0:!!_.isContentEditable},s=()=>{j3({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!="function"){s();return}t!==null&&window.cancelAnimationFrame(t);const _=performance.now(),y=()=>{s(),performance.now()-_<1500?t=window.requestAnimationFrame(y):t=null};t=window.requestAnimationFrame(y)},l=()=>{if(!n()){o();return}s()},i=()=>{r!==null||typeof window.setInterval!="function"||(r=window.setInterval(l,250),l())},o=()=>{r===null||typeof window.clearInterval!="function"||(window.clearInterval(r),r=null)},c=()=>{n()?(a(),i(),s()):o()},g=()=>{c()},u=()=>{c()},p=()=>{a()};return s(),c(),e.addEventListener("resize",s),e.addEventListener("scroll",s),typeof window.addEventListener=="function"&&(window.addEventListener("resize",s),window.addEventListener("orientationchange",p)),typeof document.addEventListener=="function"&&(document.addEventListener("focusin",g),document.addEventListener("focusout",u),document.addEventListener("focus",g,!0),document.addEventListener("blur",u,!0)),()=>{e.removeEventListener("resize",s),e.removeEventListener("scroll",s),typeof window.removeEventListener=="function"&&(window.removeEventListener("resize",s),window.removeEventListener("orientationchange",p)),typeof document.removeEventListener=="function"&&(document.removeEventListener("focusin",g),document.removeEventListener("focusout",u),document.removeEventListener("focus",g,!0),document.removeEventListener("blur",u,!0)),t!==null&&typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(t),o(),F3(document)}},[])}function H3(){const[e,t]=k.useState(!1),[r,n]=k.useState(void 0),[s,a]=k.useState(void 0),[l,i]=k.useState(void 0),[o,c]=k.useState(!1),[g,u]=k.useState(null),[p,_]=k.useState(null),y=We(q=>q.sessions),v=We(q=>q.agentSessions),h=We(q=>q.selectedSessionId),f=We(q=>q.setSessions),d=We(q=>q.setAgentSessions),m=We(q=>q.setHostStatuses),w=We(q=>q.updateSession),b=We(q=>q.setSelectedSessionId),x=We(q=>q.hasLoaded),C=We(q=>q.connectionStatus),S=We(q=>q.connectionError),E=We(q=>q.clearExitingSession),L=We(q=>q.markSessionExiting),A=We(q=>q.setRemoteAllowControl),M=We(q=>q.setRemoteAllowAttach),D=We(q=>q.setHostLabel),O=We(q=>q.hostStatuses),H=We(q=>q.remoteAllowControl),F=We(q=>q.hostLabel),$=Ol(q=>q.theme),N=de(q=>q.defaultProjectDir),R=de(q=>q.commandPresets),P=de(q=>q.defaultPresetId),B=de(q=>q.lastProjectPath),j=de(q=>q.setLastProjectPath),W=de(q=>q.addRecentPath),K=de(q=>q.shortcutModifier),Z=de(q=>q.sidebarWidth),ee=de(q=>q.setSidebarWidth),z=de(q=>q.projectFilters),I=de(q=>q.hostFilters),V=de(q=>q.soundOnPermission),U=de(q=>q.soundOnIdle),{sendMessage:J,subscribe:X}=O3();$3(),k.useEffect(()=>{if(typeof document>"u"||!V&&!U)return;let q=!1;const Q=()=>{q&&!qM()||(q=!0,Jh())};return document.addEventListener("click",Q,{passive:!0}),document.addEventListener("keydown",Q,{passive:!0}),document.addEventListener("touchstart",Q,{passive:!0}),()=>{document.removeEventListener("click",Q),document.removeEventListener("keydown",Q),document.removeEventListener("touchstart",Q)}},[V,U]);const me=k.useRef(!1),ce=k.useCallback(q=>{q.preventDefault(),me.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);k.useEffect(()=>{if(typeof document>"u"||typeof document.addEventListener!="function")return;const q=ge=>{if(!me.current)return;const He=ge.clientX;ee(Math.max(M0,Math.min(A0,He)))},Q=()=>{me.current&&(me.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",q),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",Q)}},[ee]),k.useEffect(()=>{const q=X(Q=>{var ge,He;if(Q.type==="sessions"){const ie=We.getState().sessions,{soundOnPermission:G,soundOnIdle:re}=de.getState();if(G||re)for(const le of Q.sessions){const te=ie.find(ue=>ue.id===le.id);te&&te.status!==le.status&&(te.status!=="permission"&&le.status==="permission"&&G&&Qh(),te.status==="working"&&le.status==="waiting"&&re&&Zh())}f(Q.sessions)}if(Q.type==="host-status"&&m(Q.hosts),Q.type==="server-config"&&(A(Q.remoteAllowControl),M(Q.remoteAllowAttach),D(Q.hostLabel)),Q.type==="session-update"){const G=We.getState().sessions.find(te=>te.id===Q.session.id),re=G==null?void 0:G.status,le=Q.session.status;if(w(Q.session),re){const{soundOnPermission:te,soundOnIdle:ue}=de.getState();re!=="permission"&&le==="permission"&&te&&Qh(),re==="working"&&le==="waiting"&&ue&&Zh()}}if(Q.type==="session-created"){const ie=We.getState().sessions;ie.some(le=>le.id===Q.session.id)||f([Q.session,...ie]),b(Q.session.id),W(Q.session.projectPath);const{projectFilters:G,setProjectFilters:re}=de.getState();G.length>0&&!G.includes(Q.session.projectPath)&&re([...G,Q.session.projectPath])}if(Q.type==="session-removed"){const ie=We.getState().sessions,G=ie.filter(re=>re.id!==Q.sessionId);G.length!==ie.length&&f(G)}if(Q.type==="agent-sessions"&&d(Q.active,Q.inactive),Q.type==="session-orphaned"){const ie=We.getState().sessions,G=ie.filter(re=>{var le;return((le=re.agentSessionId)==null?void 0:le.trim())!==Q.session.sessionId});G.length!==ie.length&&f(G)}if(Q.type==="session-resume-result")if(Q.ok&&Q.session){const ie=We.getState().sessions;ie.some(G=>G.id===Q.session.id)||f([Q.session,...ie]),b(Q.session.id)}else Q.ok||(u(`${(ge=Q.error)==null?void 0:ge.code}: ${(He=Q.error)==null?void 0:He.message}`),window.setTimeout(()=>u(null),6e3));Q.type==="terminal-error"&&(!Q.sessionId||Q.sessionId===h)&&(u(`${Q.code}: ${Q.message}`),window.setTimeout(()=>u(null),6e3)),Q.type==="terminal-ready"&&Q.sessionId===h&&u(null),Q.type==="error"&&(u(Q.message),window.setTimeout(()=>u(null),6e3)),Q.type==="kill-failed"&&(E(Q.sessionId),u(Q.message),window.setTimeout(()=>u(null),6e3)),Q.type==="session-pin-result"&&!Q.ok&&Q.error&&(u(Q.error),window.setTimeout(()=>u(null),6e3)),Q.type==="session-resurrection-failed"&&zw.add({title:"Session resurrection failed",description:`"${Q.displayName}" could not be resumed: ${Q.error}`,type:"error",timeout:8e3})});return()=>{q()}},[h,W,E,J,b,f,d,m,A,M,D,X,w]);const fe=k.useMemo(()=>y.find(q=>q.id===h)||null,[h,y]);k.useEffect(()=>{fe!=null&&fe.projectPath&&!fe.remote&&j(fe.projectPath)},[fe==null?void 0:fe.projectPath,fe==null?void 0:fe.remote,j]);const Ee=de(q=>q.sessionSortMode),ae=de(q=>q.sessionSortDirection),Te=de(q=>q.manualSessionOrder),je=k.useMemo(()=>Uf(y,{mode:Ee,direction:ae,manualOrder:Te}),[y,Ee,ae,Te]),pe=k.useMemo(()=>{let q=je;return z.length>0&&(q=q.filter(Q=>z.includes(Q.projectPath))),I.length>0&&(q=q.filter(Q=>I.includes(Q.host??""))),q},[je,z,I]);k.useEffect(()=>{h&&pe.length>0&&!pe.some(q=>q.id===h)&&b(pe[0].id)},[h,pe,b]),k.useEffect(()=>{window.matchMedia("(max-width: 767px)").matches&&x&&h===null&&je.length>0&&b(je[0].id)},[x,h,je,b]);const _e=k.useCallback(q=>{L(q),J({type:"session-kill",sessionId:q})},[L,J]);k.useEffect(()=>{const q=Uo(K),Q=ge=>{if(ge.defaultPrevented)return;const He=ge.code,ie=cC(ge,q);if(ie&&(He==="BracketLeft"||He==="BracketRight")){ge.preventDefault();const G=pe;if(G.length===0)return;const re=G.findIndex(ue=>ue.id===h);if(re===-1){b(G[0].id);return}const te=(re+(He==="BracketLeft"?-1:1)+G.length)%G.length;b(G[te].id);return}if(ie&&He==="KeyN"){ge.preventDefault(),e||t(!0);return}if(ie&&He==="KeyX"){ge.preventDefault(),h&&!e&&_e(h);return}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[e,h,b,pe,_e,K]);const ke=()=>{n(void 0),a(void 0),i(void 0),t(!0)},se=()=>c(!0),be=(q,Q,ge,He)=>{J({type:"session-create",projectPath:q,name:Q,command:ge,host:He}),He||j(q)},oe=q=>{J({type:"session-resume",sessionId:q})},he=(q,Q)=>{J({type:"session-rename",sessionId:q,newName:Q})},Le=k.useCallback(q=>{const Q=y.find(ge=>ge.id===q);Q&&J({type:"session-create",projectPath:Q.projectPath,command:Q.command||void 0,host:Q.remote&&Q.host?Q.host:void 0})},[y,J]),Re=k.useCallback((q,Q)=>{J({type:"session-pin",sessionId:q,isPinned:Q})},[J]);k.useEffect(()=>{document.documentElement.setAttribute("data-theme",$)},[$]),k.useEffect(()=>{fetch("/api/server-info").then(q=>q.json()).then(q=>_(q)).catch(()=>{})},[]);const Ce=k.useMemo(()=>F?O.filter(q=>q.host!==F):O,[O,F]);return T.jsxs("div",{className:"flex h-full overflow-hidden",children:[T.jsxs("div",{className:"hidden h-full flex-col md:flex md:shrink-0",style:{width:Z},children:[T.jsx(hC,{connectionStatus:C,onNewSession:ke,onOpenSettings:se,tailscaleIp:(p==null?void 0:p.tailscaleIp)??null}),T.jsx(z1,{sessions:y,inactiveSessions:v.inactive,selectedSessionId:h,onSelect:b,onRename:he,onResume:oe,onKill:_e,onDuplicate:Le,onSetPinned:Re,loading:!x,error:S||g})]}),T.jsx("div",{className:"hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20",onMouseDown:ce}),T.jsx(dD,{session:fe,sessions:pe,connectionStatus:C,sendMessage:J,subscribe:X,onClose:()=>b(null),onSelectSession:b,onNewSession:ke,onKillSession:_e,onRenameSession:he,onOpenSettings:se,onResumeSession:oe,onSetPinned:Re,inactiveSessions:v.inactive,loading:!x,error:S||g}),T.jsx(pD,{isOpen:e,onClose:()=>t(!1),onCreate:be,defaultProjectDir:N,commandPresets:R,defaultPresetId:P,lastProjectPath:B,activeProjectPath:fe&&!fe.remote?fe.projectPath:void 0,remoteHosts:Ce,remoteAllowControl:H,initialHost:r,initialPath:s,initialCommand:l}),T.jsx(YM,{isOpen:o,onClose:()=>c(!1)}),T.jsx(I3,{})]})}zo()&&document.documentElement.classList.add("ios");oC()&&document.documentElement.classList.add("ios-pwa");const Uw=document.getElementById("root");if(!Uw)throw new Error("Root element not found");D0(Uw).render(T.jsx(mt.StrictMode,{children:T.jsx(H3,{})}));