@minimalcorp/tsunagi 0.1.4 → 0.1.5
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.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0dg0i1g._.js → [root-of-the-server]__092mq4r._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__12yece_._.js → [root-of-the-server]__0_p.e.m._.js} +15 -15
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0qw6wy3._.js → [root-of-the-server]__12vhk8e._.js} +14 -14
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0g.cd6a._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_[id]_page_tsx_0jshsm2._.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_07.c491._.js → node_modules_0-31hvv._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0t3_1om._.js → node_modules_00je7te._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_02~gcwc._.js → node_modules_08zu-qy._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0gpuu-x._.js → node_modules_0f5l4h2._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_12qdm6m._.js → node_modules_0m9gy6q._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0cphr_r._.js → node_modules_0o0.qfb._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0-4t5u4._.js → node_modules_0yo5dp5._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_055srxz._.js → node_modules_0zdgon0._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{0bulq7i0gcc02.js → 06h0.7cz1a2pw.js} +13 -13
- package/.next/standalone/apps/web/.next/static/chunks/0g.gfve6-xixo.css +4 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0x7qsr~cuotr_.js → 0u1x2j.2fd983.js} +7 -7
- package/.next/standalone/apps/web/.next/static/chunks/0wd663tqvi2ts.js +3 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0lvd32c5czli~.js → 0zi97fcrx3u_8.js} +12 -12
- package/dist/cli.js +75 -0
- package/dist/server/generated/prisma/commonInputTypes.d.ts +36 -36
- package/dist/server/generated/prisma/internal/class.js +2 -2
- package/dist/server/generated/prisma/models/Tab.d.ts +0 -7
- package/dist/server/generated/prisma/models/Task.d.ts +32 -25
- package/dist/server/lib/repositories/task.d.ts +4 -2
- package/dist/server/lib/repositories/task.js +8 -6
- package/dist/server/lib/services/task-service.js +27 -17
- package/dist/server/routes/tasks.js +2 -2
- package/package.json +2 -1
- package/prisma/migrations/20260413000000_make_task_order_non_nullable/migration.sql +47 -0
- package/prisma/schema.prisma +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0b8.3al6nvw3d.css +0 -4
- package/.next/standalone/apps/web/.next/static/chunks/12r3ashx0krmo.js +0 -3
- /package/.next/standalone/apps/web/.next/static/{WKHKhVSNPtIYKtVKANGvu → 3spyaOCz0ow4ijl7Dvjpb}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{WKHKhVSNPtIYKtVKANGvu → 3spyaOCz0ow4ijl7Dvjpb}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{WKHKhVSNPtIYKtVKANGvu → 3spyaOCz0ow4ijl7Dvjpb}/_ssgManifest.js +0 -0
|
@@ -8,25 +8,25 @@ ${e.themeCSS}`),void 0!==e.fontFamily&&(r+=`
|
|
|
8
8
|
|
|
9
9
|
If you want to hide the \`${i.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
10
10
|
|
|
11
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${i.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ug=({contentRef:e,descriptionId:i})=>{let r=uf("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return m.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");i&&r&&(document.getElementById(i)||console.warn(n))},[n,e,i]),null},um=Symbol.for("react.lazy"),u_=m[" use ".trim().toString()];function uv(e){var i;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===um&&"_payload"in e&&"object"==typeof(i=e._payload)&&null!==i&&"then"in i}var uy=Symbol("radix.slottable");function ub(e){return m.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===uy}var uS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,i)=>{var r,n;let s,o,a,l=(n=r=`Primitive.${i}`,(s=m.forwardRef((e,i)=>{let{children:r,...n}=e;if(uv(r)&&"function"==typeof u_&&(r=u_(r._payload)),m.isValidElement(r)){var s;let e,o,a=(s=r,(o=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(o=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),l=function(e,i){let r={...i};for(let n in i){let s=e[n],o=i[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...e)=>{let i=o(...e);return s(...e),i}:s&&(r[n]=s):"style"===n?r[n]={...s,...o}:"className"===n&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==m.Fragment&&(l.ref=i?cB(i,a):a),m.cloneElement(r,l)}return m.Children.count(r)>1?m.Children.only(null):null})).displayName=`${n}.SlotClone`,o=s,(a=m.forwardRef((e,i)=>{let{children:r,...n}=e;uv(r)&&"function"==typeof u_&&(r=u_(r._payload));let s=m.Children.toArray(r),a=s.find(ub);if(a){let e=a.props.children,r=s.map(i=>i!==a?i:m.Children.count(e)>1?m.Children.only(null):m.isValidElement(e)?e.props.children:null);return(0,g.jsx)(o,{...n,ref:i,children:m.isValidElement(e)?m.cloneElement(e,void 0,r):null})}return(0,g.jsx)(o,{...n,ref:i,children:r})})).displayName=`${r}.Slot`,a),c=m.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(n?l:i,{...s,ref:r})});return c.displayName=`Primitive.${i}`,{...e,[i]:c}},{}),uw='[cmdk-group=""]',ux='[cmdk-group-items=""]',uC='[cmdk-item=""]',uk=`${uC}:not([aria-disabled="true"])`,uE="cmdk-item-select",uR="data-value",uT=(e,i,r)=>{var n;return n=e,function e(i,r,n,s,o,a,l){if(a===r.length)return o===i.length?1:.99;var c=`${o},${a}`;if(void 0!==l[c])return l[c];for(var h,u,d,f,p=s.charAt(a),g=n.indexOf(p,o),m=0;g>=0;)(h=e(i,r,n,s,g+1,a+1,l))>m&&(g===o?h*=1:cT.test(i.charAt(g-1))?(h*=.8,(d=i.slice(o,g-1).match(cD))&&o>0&&(h*=Math.pow(.999,d.length))):cL.test(i.charAt(g-1))?(h*=.9,(f=i.slice(o,g-1).match(cA))&&o>0&&(h*=Math.pow(.999,f.length))):(h*=.17,o>0&&(h*=Math.pow(.999,g-o))),i.charAt(g)!==r.charAt(a)&&(h*=.9999)),(h<.1&&n.charAt(g-1)===s.charAt(a+1)||s.charAt(a+1)===s.charAt(a)&&n.charAt(g-1)!==s.charAt(a))&&.1*(u=e(i,r,n,s,g+1,a+2,l))>h&&(h=.1*u),h>m&&(m=h),g=n.indexOf(p,g+1);return l[c]=m,m}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,i,cM(n),cM(i),0,0,{})},uD=m.createContext(void 0),uL=m.createContext(void 0),uA=m.createContext(void 0),uM=m.forwardRef((e,i)=>{let r=uW(()=>{var i,r;return{search:"",value:null!=(r=null!=(i=e.value)?i:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=uW(()=>new Set),s=uW(()=>new Map),o=uW(()=>new Map),a=uW(()=>new Set),l=uH(e),{label:c,children:h,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=cH(),S=cH(),w=cH(),x=m.useRef(null),C=uq();uj(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,k.emit()}},[u]),uj(()=>{C(6,A)},[]);let k=m.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,i,n)=>{var s,o,a,c;if(!Object.is(r.current[e],i)){if(r.current[e]=i,"search"===e)L(),T(),C(1,D);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(s=document.getElementById(b))||s.focus()}if(C(7,()=>{var e;r.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),n||C(5,A),(null==(o=l.current)?void 0:o.value)!==void 0){null==(c=(a=l.current).onValueChange)||c.call(a,null!=i?i:"");return}}k.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),E=m.useMemo(()=>({value:(e,i,n)=>{var s;i!==(null==(s=o.current.get(e))?void 0:s.value)&&(o.current.set(e,{value:i,keywords:n}),r.current.filtered.items.set(e,R(i,n)),C(2,()=>{T(),k.emit()}))},item:(e,i)=>(n.current.add(e),i&&(s.current.has(i)?s.current.get(i).add(e):s.current.set(i,new Set([e]))),C(3,()=>{L(),T(),r.current.value||D(),k.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let i=M();C(4,()=>{L(),(null==i?void 0:i.getAttribute("id"))===e&&D(),k.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:S,listInnerRef:x}),[]);function R(e,i){var n,s;let o=null!=(s=null==(n=l.current)?void 0:n.filter)?s:uT;return e?o(e,r.current.search,i):0}function T(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,i=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),o=0;n.forEach(i=>{o=Math.max(e.get(i),o)}),i.push([r,o])});let n=x.current;P().sort((i,r)=>{var n,s;let o=i.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(s=e.get(o))?s:0)}).forEach(e=>{let i=e.closest(ux);i?i.appendChild(e.parentElement===i?e:e.closest(`${ux} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${ux} > *`))}),i.sort((e,i)=>i[1]-e[1]).forEach(e=>{var i;let r=null==(i=x.current)?void 0:i.querySelector(`${uw}[${uR}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function D(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),i=null==e?void 0:e.getAttribute(uR);k.setState("value",i||void 0)}function L(){var e,i,a,c;if(!r.current.search||!1===l.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let h=0;for(let s of n.current){let n=R(null!=(i=null==(e=o.current.get(s))?void 0:e.value)?i:"",null!=(c=null==(a=o.current.get(s))?void 0:a.keywords)?c:[]);r.current.filtered.items.set(s,n),n>0&&h++}for(let[e,i]of s.current)for(let n of i)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=h}function A(){var e,i,r;let n=M();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(i=n.closest(uw))?void 0:i.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=x.current)?void 0:e.querySelector(`${uC}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=x.current)?void 0:e.querySelectorAll(uk))||[])}function O(e){let i=P()[e];i&&k.setState("value",i.getAttribute(uR))}function B(e){var i;let r=M(),n=P(),s=n.findIndex(e=>e===r),o=n[s+e];null!=(i=l.current)&&i.loop&&(o=s+e<0?n[n.length-1]:s+e===n.length?n[0]:n[s+e]),o&&k.setState("value",o.getAttribute(uR))}function N(e){let i=M(),r=null==i?void 0:i.closest(uw),n;for(;r&&!n;)n=null==(r=e>0?function(e,i){let r=e.nextElementSibling;for(;r;){if(r.matches(i))return r;r=r.nextElementSibling}}(r,uw):function(e,i){let r=e.previousElementSibling;for(;r;){if(r.matches(i))return r;r=r.previousElementSibling}}(r,uw))?void 0:r.querySelector(uk);n?k.setState("value",n.getAttribute(uR)):B(e)}let I=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?I():e.altKey?N(1):B(1)},z=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?N(-1):B(-1)};return m.createElement(uS.div,{ref:i,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var i;null==(i=y.onKeyDown)||i.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":v&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":v&&e.ctrlKey&&z(e);break;case"ArrowUp":z(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),I();break;case"Enter":{e.preventDefault();let i=M();if(i){let e=new Event(uE);i.dispatchEvent(e)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:uK},c),uV(e,e=>m.createElement(uL.Provider,{value:k},m.createElement(uD.Provider,{value:E},e))))}),uP=m.forwardRef((e,i)=>{var r,n;let s=cH(),o=m.useRef(null),a=m.useContext(uA),l=m.useContext(uD),c=uH(e),h=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;uj(()=>{if(!h)return l.item(s,null==a?void 0:a.id)},[h]);let u=uU(s,o,[e.value,e.children,o],e.keywords),d=m.useContext(uL),f=u$(e=>e.value&&e.value===u.current),p=u$(e=>!!h||!1===l.filter()||!e.search||e.filtered.items.get(s)>0);function g(){var e,i;_(),null==(i=(e=c.current).onSelect)||i.call(e,u.current)}function _(){d.setState("value",u.current,!0)}if(m.useEffect(()=>{let i=o.current;if(!(!i||e.disabled))return i.addEventListener(uE,g),()=>i.removeEventListener(uE,g)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:v,value:y,onSelect:b,forceMount:S,keywords:w,...x}=e;return m.createElement(uS.div,{ref:cB(o,i),...x,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:_,onClick:v?void 0:g},e.children)}),uO=m.forwardRef((e,i)=>{let{heading:r,children:n,forceMount:s,...o}=e,a=cH(),l=m.useRef(null),c=m.useRef(null),h=cH(),u=m.useContext(uD),d=u$(e=>!!s||!1===u.filter()||!e.search||e.filtered.groups.has(a));uj(()=>u.group(a),[]),uU(a,l,[e.value,e.heading,c]);let f=m.useMemo(()=>({id:a,forceMount:s}),[s]);return m.createElement(uS.div,{ref:cB(l,i),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&m.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),uV(e,e=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},m.createElement(uA.Provider,{value:f},e))))}),uB=m.forwardRef((e,i)=>{let{alwaysRender:r,...n}=e,s=m.useRef(null),o=u$(e=>!e.search);return r||o?m.createElement(uS.div,{ref:cB(s,i),...n,"cmdk-separator":"",role:"separator"}):null}),uN=m.forwardRef((e,i)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=m.useContext(uL),a=u$(e=>e.search),l=u$(e=>e.selectedItemId),c=m.useContext(uD);return m.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),m.createElement(uS.input,{ref:i,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:a,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),uI=m.forwardRef((e,i)=>{let{children:r,label:n="Suggestions",...s}=e,o=m.useRef(null),a=m.useRef(null),l=u$(e=>e.selectedItemId),c=m.useContext(uD);return m.useEffect(()=>{if(a.current&&o.current){let e=a.current,i=o.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;i.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),m.createElement(uS.div,{ref:cB(o,i),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},uV(e,e=>m.createElement("div",{ref:cB(a,c.listInnerRef),"cmdk-list-sizer":""},e)))}),uF=m.forwardRef((e,i)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:a,...l}=e;return m.createElement(h2,{open:r,onOpenChange:n},m.createElement(h9,{container:a},m.createElement(h7,{"cmdk-overlay":"",className:s}),m.createElement(ur,{"aria-label":e.label,"cmdk-dialog":"",className:o},m.createElement(uM,{ref:i,...l}))))}),uz=Object.assign(uM,{List:uI,Item:uP,Input:uN,Group:uO,Separator:uB,Dialog:uF,Empty:m.forwardRef((e,i)=>u$(e=>0===e.filtered.count)?m.createElement(uS.div,{ref:i,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:m.forwardRef((e,i)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return m.createElement(uS.div,{ref:i,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},uV(e,e=>m.createElement("div",{"aria-hidden":!0},e)))})});function uH(e){let i=m.useRef(e);return uj(()=>{i.current=e}),i}var uj="u"<typeof window?m.useEffect:m.useLayoutEffect;function uW(e){let i=m.useRef();return void 0===i.current&&(i.current=e()),i}function u$(e){let i=m.useContext(uL),r=()=>e(i.snapshot());return m.useSyncExternalStore(i.subscribe,r,r)}function uU(e,i,r,n=[]){let s=m.useRef(),o=m.useContext(uD);return uj(()=>{var a;let l=(()=>{var e;for(let i of r){if("string"==typeof i)return i.trim();if("object"==typeof i&&"current"in i)return i.current?null==(e=i.current.textContent)?void 0:e.trim():s.current}})(),c=n.map(e=>e.trim());o.value(e,l,c),null==(a=i.current)||a.setAttribute(uR,l),s.current=l}),s}var uq=()=>{let[e,i]=m.useState(),r=uW(()=>new Map);return uj(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),i({})}};function uV({asChild:e,children:i},r){let n;return e&&m.isValidElement(i)?m.cloneElement("function"==typeof(n=i.type)?n(i.props):"render"in n?n.render(i.props):i,{ref:i.ref},r(i.props.children)):r(i)}var uK={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};e.i(69068);var uY=e.i(25913),uX=e.i(10012);function uG({className:e,...i}){return(0,g.jsx)("textarea",{"data-slot":"textarea",className:(0,cC.cn)("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...i})}function uJ({className:e,...i}){return(0,g.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,cC.cn)("group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...i})}let uZ=(0,uY.cva)("flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]","block-start":"order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function uQ({className:e,align:i="inline-start",...r}){return(0,g.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":i,className:(0,cC.cn)(uZ({align:i}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}(0,uY.cva)("flex items-center gap-2 rounded-md text-xs/relaxed shadow-none",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"gap-1","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-7 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});let u0=(0,r0.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",0,u0],54943);var u1=e.i(78745);e.s(["CheckIcon",()=>u1.default],78784);var u1=u1;function u2({className:e,...i}){return(0,g.jsx)(uz,{"data-slot":"command",className:(0,cC.cn)("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground",e),...i})}function u5({className:e,...i}){return(0,g.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,g.jsxs)(uJ,{className:"h-8! bg-input/20 dark:bg-input/30",children:[(0,g.jsx)(uz.Input,{"data-slot":"command-input",className:(0,cC.cn)("w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...i}),(0,g.jsx)(uQ,{children:(0,g.jsx)(u0,{className:"size-3.5 shrink-0 opacity-50"})})]})})}function u3({className:e,...i}){return(0,g.jsx)(uz.List,{"data-slot":"command-list",className:(0,cC.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...i})}function u4({className:e,...i}){return(0,g.jsx)(uz.Empty,{"data-slot":"command-empty",className:(0,cC.cn)("py-6 text-center text-xs/relaxed",e),...i})}function u6({className:e,...i}){return(0,g.jsx)(uz.Group,{"data-slot":"command-group",className:(0,cC.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...i})}function u9({className:e,children:i,...r}){return(0,g.jsxs)(uz.Item,{"data-slot":"command-item",className:(0,cC.cn)("group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-selected:*:[svg]:text-foreground",e),...r,children:[i,(0,g.jsx)(u1.default,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function u8({options:e,value:i,onChange:r,placeholder:n="Select option",disabled:s=!1,className:o="",allowCustomValue:a=!1,multiple:l=!1,onClear:c,showClearButton:h=!1}){let[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(""),_=(0,m.useRef)(null),v=(0,m.useMemo)(()=>Array.isArray(i)?i:[i],[i]),y=(0,m.useMemo)(()=>{if(l){if(1===v.length&&"all"===v[0]){let i=e.find(e=>"all"===e.value);return i?.label||""}return v.filter(e=>"all"!==e).map(i=>e.find(e=>e.value===i)?.label).filter(Boolean).join(", ")}return v.map(i=>e.find(e=>e.value===i)?.label).filter(Boolean).join(", ")},[v,e,l]),b=(0,m.useMemo)(()=>{let i={};for(let r of e){let e=r.group||"Other";i[e]||(i[e]=[]),i[e].push(r)}return i},[e]),S=(0,m.useMemo)(()=>Object.keys(b).length>1||!b.Other,[b]),w=e=>{if(l){let i=[...v],n=i.indexOf(e);n>=0?i.splice(n,1):i.push(e),r(i.length>0?i:[])}else r(e),d(!1)},x=()=>{a&&f&&!l&&(r(f),d(!1))};return(0,g.jsxs)(ck,{open:u,onOpenChange:e=>{d(e),e||p("")},children:[(0,g.jsxs)("div",{className:`relative ${o}`,children:[(0,g.jsx)(cE,{ref:_,disabled:s,className:`flex h-9 w-full items-center justify-between pl-3 ${h?"pr-16":"pr-10"} border border-input rounded-md text-sm bg-input/20 dark:bg-input/30 text-foreground transition-colors outline-none hover:border-ring focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 data-[state=open]:border-ring data-[state=open]:ring-2 data-[state=open]:ring-ring/30 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-left shadow-xs`,children:(0,g.jsx)("span",{className:"truncate",children:y||(0,g.jsx)("span",{className:"text-muted-foreground",children:n})})}),h&&c&&(0,g.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:"absolute right-8 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors cursor-pointer z-10","aria-label":"Clear selection",children:(0,g.jsx)(ad.X,{className:"w-4 h-4"})}),(0,g.jsx)(au,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]}),(0,g.jsx)(cR,{className:"w-[var(--anchor-width)] p-0",align:"start",sideOffset:4,children:(0,g.jsxs)(u2,{filter:(i,r)=>{let n=e.find(e=>e.value===i);return n?+!!`${n.label} ${n.group||""}`.toLowerCase().includes(r.toLowerCase()):0},children:[(0,g.jsx)(u5,{placeholder:"Search...",value:f,onValueChange:p,onKeyDown:e=>{"Enter"===e.key&&a&&x()}}),(0,g.jsxs)(u3,{children:[(0,g.jsx)(u4,{children:a&&f?(0,g.jsxs)("button",{type:"button",className:"w-full px-2 py-1.5 text-left text-xs cursor-pointer hover:bg-accent rounded",onClick:x,children:['Use "',f,'"']}):"No options found"}),S?Object.entries(b).map(([e,i])=>(0,g.jsx)(u6,{heading:e,children:i.map(e=>(0,g.jsx)(u9,{value:e.value,"data-checked":v.includes(e.value),onSelect:()=>w(e.value),children:(0,g.jsx)("span",{className:"truncate",children:e.label})},e.value))},e)):(0,g.jsx)(u6,{children:e.map(e=>(0,g.jsx)(u9,{value:e.value,"data-checked":v.includes(e.value),onSelect:()=>w(e.value),children:(0,g.jsx)("span",{className:"truncate",children:e.label})},e.value))})]})]})})]})}let u7=(0,r0.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var de=e.i(86536),dt=e.i(70935);function di({value:e,onChange:i,editorRef:r,theme:n,activeTab:s,onTabChange:o,disabled:a,onFocusChange:l}){let c=(0,m.useCallback)(e=>{i(e??"")},[i]),h=(0,g.jsx)("div",{className:"border border-border rounded overflow-hidden h-full",children:(0,g.jsx)(_.Editor,{height:"100%",defaultLanguage:"markdown",value:e,onChange:c,onMount:e=>{r.current=e,e.layout(),e.onDidFocusEditorText(()=>l?.(!0)),e.onDidBlurEditorText(()=>l?.(!1))},options:{minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1,readOnly:a},theme:"dark"===n?"vs-dark":"vs-light"})}),u=(0,g.jsx)("div",{className:"border border-border rounded overflow-y-auto h-full p-4 prose prose-sm prose-slate dark:prose-invert max-w-none",children:e?(0,g.jsx)(iW,{remarkPlugins:[rQ],components:as,children:e}):(0,g.jsx)("p",{className:"text-muted-foreground italic",children:"No content"})});return(0,g.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,g.jsxs)("div",{className:"flex gap-1 mb-2 md:hidden flex-shrink-0",children:[(0,g.jsxs)(r3.Button,{type:"button",variant:"editor"===s?"default":"outline",size:"sm",onClick:()=>o("editor"),children:[(0,g.jsx)(u7,{className:"w-4 h-4 mr-1"}),"Editor"]}),(0,g.jsxs)(r3.Button,{type:"button",variant:"preview"===s?"default":"outline",size:"sm",onClick:()=>o("preview"),children:[(0,g.jsx)(de.Eye,{className:"w-4 h-4 mr-1"}),"Preview"]})]}),(0,g.jsxs)("div",{className:"hidden md:grid md:grid-cols-2 md:gap-4 flex-1 min-h-0",children:[h,u]}),(0,g.jsx)("div",{className:"md:hidden flex-1 min-h-0",children:"editor"===s?h:u})]})}e.s(["TaskDialog",0,function({mode:e,isOpen:i,onClose:r,repositories:n=[],task:s,onUpdate:o}){let a=ac(),[l,c]=(0,m.useState)(""),[h,u]=(0,m.useState)([]),[d,f]=(0,m.useState)(""),[p,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(""),[b,S]=(0,m.useState)({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),[w,x]=(0,m.useState)(!1),[C,k]=(0,m.useState)({}),[E,R]=(0,m.useState)("editor"),[T,D]=(0,m.useState)(!1),L=(0,m.useRef)(null),{effectiveTheme:A}=(0,ao.useTheme)();(0,m.useEffect)(()=>{"edit"===e&&s&&S({title:s.title,description:s.description,owner:s.owner,repo:s.repo,branch:s.branch,baseBranch:"",status:s.status,effort:s.effort,order:s.order})},[e,s,i]);let M=(0,m.useMemo)(()=>n.map(e=>({value:`${e.owner}/${e.repo}`,label:`${e.owner}/${e.repo}`})),[n]),P=(0,m.useMemo)(()=>h.map(e=>({value:e,label:e===d?`${e} (default)`:e})),[h,d]);(0,m.useEffect)(()=>{if("create"===e){if(!l){u([]),f(""),S(e=>({...e,baseBranch:""}));return}(async()=>{_(!0),y("");try{let[e,i]=l.split("/"),r=await fetch((0,dt.apiUrl)(`/api/repos/${e}/${i}/branches`));if(!r.ok)throw Error("Failed to fetch branches");let n=await r.json();u(n.data.branches),f(n.data.defaultBranch),S(e=>({...e,baseBranch:n.data.defaultBranch}))}catch(e){console.error("Failed to fetch branches:",e),y("Failed to load branches. Repository may not be initialized."),u([]),f("")}finally{_(!1)}})()}},[l,e]);let O=async i=>{if(i.preventDefault(),k({}),"create"===e){x(!0);try{let e=await fetch((0,dt.apiUrl)("/api/tasks/validate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:b.title,owner:b.owner,repo:b.repo,branch:b.branch})}),i=await e.json();if(!i.valid){let e={};i.errors.forEach(i=>{e[i.field]=i.message}),k(e),x(!1);return}let n={title:b.title,description:b.description,owner:b.owner,repo:b.repo,branch:b.branch,baseBranch:b.baseBranch};r(),c(""),S({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),x(!1);let s=a.loading("Creating task...",n.title);try{if(!(await fetch((0,dt.apiUrl)("/api/tasks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).ok)throw Error("Failed to create task");a.dismiss(s)}catch(i){let e=i instanceof Error?i.message:"Unknown error";a.error(s,"Failed to create task",e)}}catch(i){x(!1);let e=i instanceof Error?i.message:"Validation failed";a.error(void 0,"Validation failed",e)}}else if("edit"===e&&o&&s){x(!0);try{let e=await o(s.id,{title:b.title,description:b.description,status:b.status,effort:b.effort,order:b.order});if(e.success)r();else if(e.errors){let i={};e.errors.forEach(e=>{i[e.field]=e.message}),k(i)}}catch(e){console.error("Failed to update task:",e),k({global:e instanceof Error?e.message:"Failed to update task. Please try again."})}finally{x(!1)}}},B="create"===e,N=B?"Add New Task":"Edit Task",I=B?"Create":"Save";return(0,g.jsxs)(ah.Dialog,{open:i,onOpenChange:e=>{e.open||w||r()},title:N,maxWidth:B?"2xl":"6xl",fullScreen:!B,showCloseButton:!w,dismissOnEsc:!T,children:[w&&(0,g.jsx)("div",{className:"absolute inset-0 bg-card bg-opacity-90 rounded-lg flex items-center justify-center z-10",children:(0,g.jsx)(aa.LoadingSpinner,{size:"lg",message:B?"Creating task...":"Saving task..."})}),C.global&&(0,g.jsx)("div",{className:"mb-4 p-3 bg-destructive/10 border border-destructive/50 rounded text-destructive text-sm",children:C.global}),(0,g.jsxs)("form",{onSubmit:O,className:B?"space-y-4":"flex flex-col gap-4 flex-1 min-h-0 overflow-hidden",children:[B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Repository *"}),(0,g.jsx)(u8,{options:M,value:l,onChange:e=>{let i=Array.isArray(e)?e[0]||"":e;if(c(i),i){let[e,r]=i.split("/");S(i=>({...i,owner:e,repo:r,baseBranch:""}))}else S(e=>({...e,owner:"",repo:"",baseBranch:""}))},placeholder:"Select repository",disabled:w})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Title *"}),(0,g.jsx)(uX.Input,{type:"text",required:!0,maxLength:200,value:b.title,onChange:e=>S({...b,title:e.target.value}),className:"w-full",disabled:w})]}),!B&&s&&(0,g.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 p-3 bg-muted/50 rounded-md text-sm",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Repository"}),(0,g.jsxs)("p",{className:"text-muted-foreground",children:[s.owner,"/",s.repo]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Branch"}),(0,g.jsx)("p",{className:"text-muted-foreground",children:s.branch})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Base Branch"}),(0,g.jsx)("p",{className:"text-muted-foreground",children:s.baseBranch||"N/A"})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Worktree"}),(0,g.jsx)("p",{className:"text-muted-foreground capitalize",children:s.worktreeStatus})]})]}),(0,g.jsxs)("div",{className:B?"":"flex flex-col flex-1 min-h-0",children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground flex-shrink-0",children:"Description"}),B?(0,g.jsx)(uG,{maxLength:5e3,value:b.description,onChange:e=>S({...b,description:e.target.value}),className:"min-h-24 w-full",disabled:w}):(0,g.jsx)(di,{value:b.description,onChange:e=>S(i=>({...i,description:e})),editorRef:L,theme:A,activeTab:E,onTabChange:R,disabled:w,onFocusChange:D})]}),!B&&(0,g.jsxs)("div",{className:"grid grid-cols-3 gap-4 flex-shrink-0",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Status"}),(0,g.jsxs)("select",{value:b.status,onChange:e=>S({...b,status:e.target.value}),className:"w-full h-9 pl-3 pr-10 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs text-foreground",disabled:w,children:[(0,g.jsx)("option",{value:"backlog",children:"Backlog"}),(0,g.jsx)("option",{value:"planning",children:"Planning"}),(0,g.jsx)("option",{value:"tasking",children:"Tasking"}),(0,g.jsx)("option",{value:"coding",children:"Coding"}),(0,g.jsx)("option",{value:"reviewing",children:"Reviewing"}),(0,g.jsx)("option",{value:"done",children:"Done"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Effort (h)"}),(0,g.jsx)(uX.Input,{type:"number",step:"0.5",min:"0.5",max:"40",value:b.effort??"",onChange:e=>S({...b,effort:parseFloat(e.target.value)||void 0}),className:"w-full",placeholder:"2.5",disabled:w})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Order"}),(0,g.jsx)(uX.Input,{type:"number",min:"0",value:b.order??"",onChange:e=>S({...b,order:parseInt(e.target.value)||void 0}),className:"w-full",placeholder:"0",disabled:w})]})]}),B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Base Branch *"}),p?(0,g.jsxs)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-muted-foreground flex items-center gap-2",children:[(0,g.jsx)(aa.LoadingSpinner,{size:"sm"}),(0,g.jsx)("span",{className:"text-xs",children:"Loading branches..."})]}):h.length>0?(0,g.jsx)(u8,{options:P,value:b.baseBranch,onChange:e=>{let i=Array.isArray(e)?e[0]||"":e;S({...b,baseBranch:i})},placeholder:"Select base branch",disabled:w}):(0,g.jsx)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-sm text-muted-foreground flex items-center",children:v||"Select repository first"}),(0,g.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Your new branch will be created from this branch"})]}),B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"New Branch Name *"}),(0,g.jsx)(uX.Input,{type:"text",required:!0,maxLength:255,value:b.branch,onChange:e=>S({...b,branch:e.target.value}),className:`w-full ${C.branch?"border-destructive":""}`,placeholder:"feature/new-feature",disabled:w,"aria-invalid":!!C.branch}),C.branch&&(0,g.jsx)("p",{className:"text-xs text-destructive mt-1",children:C.branch}),!C.branch&&(0,g.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Will be created from ",b.baseBranch||"base branch"]})]}),(0,g.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,g.jsx)(r3.Button,{type:"button",variant:"outline",size:"lg",onClick:r,className:"active:scale-95",disabled:w,children:"Cancel"}),(0,g.jsx)(r3.Button,{type:"submit",size:"lg",className:"active:scale-95",disabled:w||B&&p,children:I})]})]})]})}],10483)},48214,31245,68054,57212,e=>{"use strict";var i=e.i(75254);let r=(0,i.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);e.s(["CirclePause",0,r],48214);let n=(0,i.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["Bot",0,n],31245);let s=(0,i.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,s],68054);let o=(0,i.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["WifiOff",0,o],57212)},95468,73884,e=>{"use strict";var i=e.i(23287);e.s(["CheckCircle2",()=>i.default],95468);let r=(0,e.i(75254).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,r],73884)},86311,e=>{"use strict";let i=(0,e.i(75254).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,i],86311)},30939,99894,93309,96085,31343,10031,e=>{"use strict";let i,r,n,s,o,a,l,c,h,u,d,f,p,g,m;var _,v,y=e.i(18050),b=e.i(71645),S=e.i(37727),w=e.i(31278),x=e.i(48214),C=e.i(31245),k=e.i(68054),E=e.i(63209),R=e.i(57212),T=e.i(95468),D=e.i(73884),L=e.i(86311),A=e.i(68995),M=e.i(85902);function P({entry:e}){if(!e||"idle"===e.terminal)return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,y.jsx)(x.CirclePause,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"idle"})]});if("connecting"===e.terminal)return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,y.jsx)(w.Loader2,{className:"w-3 h-3 animate-spin"}),(0,y.jsx)("span",{children:"connecting"})]});if("error"===e.terminal)return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,y.jsx)(E.AlertCircle,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"error"})]});if("exited"===e.terminal||"paused"===e.terminal)return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,y.jsx)(R.WifiOff,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:e.terminal})]});switch(e.claude){case"running":return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-primary",children:[(0,y.jsx)(w.Loader2,{className:"w-3 h-3 animate-spin"}),(0,y.jsx)("span",{children:"running"})]});case"waiting":return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-warning",children:[(0,y.jsx)(L.MessageSquare,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"waiting"})]});case"success":return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-success",children:[(0,y.jsx)(T.CheckCircle2,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"success"})]});case"failure":case"error":return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,y.jsx)(D.XCircle,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"failure"===e.claude?"failure":"error"})]});default:return(0,y.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,y.jsx)(x.CirclePause,{className:"w-3 h-3"}),(0,y.jsx)("span",{children:"idle"})]})}}e.s(["SessionTabs",0,function({tabs:e,activeTabId:i,onTabChange:r,onTabCreateTerminal:n,onTabCreateClaude:s,onTabDelete:o,tabStatusMap:a}){let l=(0,b.useRef)([]),[c,h]=(0,b.useState)({left:0,width:0}),[u,d]=(0,b.useState)(null);return(0,b.useEffect)(()=>{let r=e.findIndex(e=>e.tab_id===i);if(-1!==r&&l.current[r]){let e=l.current[r];e&&h({left:e.offsetLeft,width:e.offsetWidth})}},[i,e]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(A.ConfirmDialog,{open:null!==u,onOpenChange:e=>{e.open||d(null)},title:"Delete Tab",message:u?.isRunning?"This tab is running. Are you sure you want to delete it?":"Delete this tab?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{u&&o(u.tabId)},variant:"danger"}),(0,y.jsxs)("div",{className:"relative flex items-center gap-2 overflow-x-auto border-b border-border pb-1",children:[e.map((n,s)=>{let o=i===n.tab_id,c=a?.get(n.tab_id),h=(c?.claude==="running"||c?.claude==="waiting")&&c?.terminal==="connected";return(0,y.jsxs)("div",{ref:e=>{l.current[s]=e},onClick:()=>r(n.tab_id),className:`
|
|
11
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${i.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ug=({contentRef:e,descriptionId:i})=>{let r=uf("DialogDescriptionWarning"),n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return m.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");i&&r&&(document.getElementById(i)||console.warn(n))},[n,e,i]),null},um=Symbol.for("react.lazy"),u_=m[" use ".trim().toString()];function uv(e){var i;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===um&&"_payload"in e&&"object"==typeof(i=e._payload)&&null!==i&&"then"in i}var uy=Symbol("radix.slottable");function ub(e){return m.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===uy}var uS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,i)=>{var r,n;let s,o,a,l=(n=r=`Primitive.${i}`,(s=m.forwardRef((e,i)=>{let{children:r,...n}=e;if(uv(r)&&"function"==typeof u_&&(r=u_(r._payload)),m.isValidElement(r)){var s;let e,o,a=(s=r,(o=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(o=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),l=function(e,i){let r={...i};for(let n in i){let s=e[n],o=i[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...e)=>{let i=o(...e);return s(...e),i}:s&&(r[n]=s):"style"===n?r[n]={...s,...o}:"className"===n&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==m.Fragment&&(l.ref=i?cB(i,a):a),m.cloneElement(r,l)}return m.Children.count(r)>1?m.Children.only(null):null})).displayName=`${n}.SlotClone`,o=s,(a=m.forwardRef((e,i)=>{let{children:r,...n}=e;uv(r)&&"function"==typeof u_&&(r=u_(r._payload));let s=m.Children.toArray(r),a=s.find(ub);if(a){let e=a.props.children,r=s.map(i=>i!==a?i:m.Children.count(e)>1?m.Children.only(null):m.isValidElement(e)?e.props.children:null);return(0,g.jsx)(o,{...n,ref:i,children:m.isValidElement(e)?m.cloneElement(e,void 0,r):null})}return(0,g.jsx)(o,{...n,ref:i,children:r})})).displayName=`${r}.Slot`,a),c=m.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(n?l:i,{...s,ref:r})});return c.displayName=`Primitive.${i}`,{...e,[i]:c}},{}),uw='[cmdk-group=""]',ux='[cmdk-group-items=""]',uC='[cmdk-item=""]',uk=`${uC}:not([aria-disabled="true"])`,uE="cmdk-item-select",uR="data-value",uT=(e,i,r)=>{var n;return n=e,function e(i,r,n,s,o,a,l){if(a===r.length)return o===i.length?1:.99;var c=`${o},${a}`;if(void 0!==l[c])return l[c];for(var h,u,d,f,p=s.charAt(a),g=n.indexOf(p,o),m=0;g>=0;)(h=e(i,r,n,s,g+1,a+1,l))>m&&(g===o?h*=1:cT.test(i.charAt(g-1))?(h*=.8,(d=i.slice(o,g-1).match(cD))&&o>0&&(h*=Math.pow(.999,d.length))):cL.test(i.charAt(g-1))?(h*=.9,(f=i.slice(o,g-1).match(cA))&&o>0&&(h*=Math.pow(.999,f.length))):(h*=.17,o>0&&(h*=Math.pow(.999,g-o))),i.charAt(g)!==r.charAt(a)&&(h*=.9999)),(h<.1&&n.charAt(g-1)===s.charAt(a+1)||s.charAt(a+1)===s.charAt(a)&&n.charAt(g-1)!==s.charAt(a))&&.1*(u=e(i,r,n,s,g+1,a+2,l))>h&&(h=.1*u),h>m&&(m=h),g=n.indexOf(p,g+1);return l[c]=m,m}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,i,cM(n),cM(i),0,0,{})},uD=m.createContext(void 0),uL=m.createContext(void 0),uA=m.createContext(void 0),uM=m.forwardRef((e,i)=>{let r=uW(()=>{var i,r;return{search:"",value:null!=(r=null!=(i=e.value)?i:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=uW(()=>new Set),s=uW(()=>new Map),o=uW(()=>new Map),a=uW(()=>new Set),l=uH(e),{label:c,children:h,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=cH(),S=cH(),w=cH(),x=m.useRef(null),C=uq();uj(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,k.emit()}},[u]),uj(()=>{C(6,A)},[]);let k=m.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,i,n)=>{var s,o,a,c;if(!Object.is(r.current[e],i)){if(r.current[e]=i,"search"===e)L(),T(),C(1,D);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(s=document.getElementById(b))||s.focus()}if(C(7,()=>{var e;r.current.selectedItemId=null==(e=M())?void 0:e.id,k.emit()}),n||C(5,A),(null==(o=l.current)?void 0:o.value)!==void 0){null==(c=(a=l.current).onValueChange)||c.call(a,null!=i?i:"");return}}k.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),E=m.useMemo(()=>({value:(e,i,n)=>{var s;i!==(null==(s=o.current.get(e))?void 0:s.value)&&(o.current.set(e,{value:i,keywords:n}),r.current.filtered.items.set(e,R(i,n)),C(2,()=>{T(),k.emit()}))},item:(e,i)=>(n.current.add(e),i&&(s.current.has(i)?s.current.get(i).add(e):s.current.set(i,new Set([e]))),C(3,()=>{L(),T(),r.current.value||D(),k.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let i=M();C(4,()=>{L(),(null==i?void 0:i.getAttribute("id"))===e&&D(),k.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:S,listInnerRef:x}),[]);function R(e,i){var n,s;let o=null!=(s=null==(n=l.current)?void 0:n.filter)?s:uT;return e?o(e,r.current.search,i):0}function T(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,i=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),o=0;n.forEach(i=>{o=Math.max(e.get(i),o)}),i.push([r,o])});let n=x.current;P().sort((i,r)=>{var n,s;let o=i.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(s=e.get(o))?s:0)}).forEach(e=>{let i=e.closest(ux);i?i.appendChild(e.parentElement===i?e:e.closest(`${ux} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${ux} > *`))}),i.sort((e,i)=>i[1]-e[1]).forEach(e=>{var i;let r=null==(i=x.current)?void 0:i.querySelector(`${uw}[${uR}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function D(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),i=null==e?void 0:e.getAttribute(uR);k.setState("value",i||void 0)}function L(){var e,i,a,c;if(!r.current.search||!1===l.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let h=0;for(let s of n.current){let n=R(null!=(i=null==(e=o.current.get(s))?void 0:e.value)?i:"",null!=(c=null==(a=o.current.get(s))?void 0:a.keywords)?c:[]);r.current.filtered.items.set(s,n),n>0&&h++}for(let[e,i]of s.current)for(let n of i)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=h}function A(){var e,i,r;let n=M();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(i=n.closest(uw))?void 0:i.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function M(){var e;return null==(e=x.current)?void 0:e.querySelector(`${uC}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=x.current)?void 0:e.querySelectorAll(uk))||[])}function O(e){let i=P()[e];i&&k.setState("value",i.getAttribute(uR))}function B(e){var i;let r=M(),n=P(),s=n.findIndex(e=>e===r),o=n[s+e];null!=(i=l.current)&&i.loop&&(o=s+e<0?n[n.length-1]:s+e===n.length?n[0]:n[s+e]),o&&k.setState("value",o.getAttribute(uR))}function N(e){let i=M(),r=null==i?void 0:i.closest(uw),n;for(;r&&!n;)n=null==(r=e>0?function(e,i){let r=e.nextElementSibling;for(;r;){if(r.matches(i))return r;r=r.nextElementSibling}}(r,uw):function(e,i){let r=e.previousElementSibling;for(;r;){if(r.matches(i))return r;r=r.previousElementSibling}}(r,uw))?void 0:r.querySelector(uk);n?k.setState("value",n.getAttribute(uR)):B(e)}let I=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?I():e.altKey?N(1):B(1)},z=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?N(-1):B(-1)};return m.createElement(uS.div,{ref:i,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var i;null==(i=y.onKeyDown)||i.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":v&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":v&&e.ctrlKey&&z(e);break;case"ArrowUp":z(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),I();break;case"Enter":{e.preventDefault();let i=M();if(i){let e=new Event(uE);i.dispatchEvent(e)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:uK},c),uV(e,e=>m.createElement(uL.Provider,{value:k},m.createElement(uD.Provider,{value:E},e))))}),uP=m.forwardRef((e,i)=>{var r,n;let s=cH(),o=m.useRef(null),a=m.useContext(uA),l=m.useContext(uD),c=uH(e),h=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;uj(()=>{if(!h)return l.item(s,null==a?void 0:a.id)},[h]);let u=uU(s,o,[e.value,e.children,o],e.keywords),d=m.useContext(uL),f=u$(e=>e.value&&e.value===u.current),p=u$(e=>!!h||!1===l.filter()||!e.search||e.filtered.items.get(s)>0);function g(){var e,i;_(),null==(i=(e=c.current).onSelect)||i.call(e,u.current)}function _(){d.setState("value",u.current,!0)}if(m.useEffect(()=>{let i=o.current;if(!(!i||e.disabled))return i.addEventListener(uE,g),()=>i.removeEventListener(uE,g)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:v,value:y,onSelect:b,forceMount:S,keywords:w,...x}=e;return m.createElement(uS.div,{ref:cB(o,i),...x,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:_,onClick:v?void 0:g},e.children)}),uO=m.forwardRef((e,i)=>{let{heading:r,children:n,forceMount:s,...o}=e,a=cH(),l=m.useRef(null),c=m.useRef(null),h=cH(),u=m.useContext(uD),d=u$(e=>!!s||!1===u.filter()||!e.search||e.filtered.groups.has(a));uj(()=>u.group(a),[]),uU(a,l,[e.value,e.heading,c]);let f=m.useMemo(()=>({id:a,forceMount:s}),[s]);return m.createElement(uS.div,{ref:cB(l,i),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&m.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),uV(e,e=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},m.createElement(uA.Provider,{value:f},e))))}),uB=m.forwardRef((e,i)=>{let{alwaysRender:r,...n}=e,s=m.useRef(null),o=u$(e=>!e.search);return r||o?m.createElement(uS.div,{ref:cB(s,i),...n,"cmdk-separator":"",role:"separator"}):null}),uN=m.forwardRef((e,i)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=m.useContext(uL),a=u$(e=>e.search),l=u$(e=>e.selectedItemId),c=m.useContext(uD);return m.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),m.createElement(uS.input,{ref:i,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:a,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),uI=m.forwardRef((e,i)=>{let{children:r,label:n="Suggestions",...s}=e,o=m.useRef(null),a=m.useRef(null),l=u$(e=>e.selectedItemId),c=m.useContext(uD);return m.useEffect(()=>{if(a.current&&o.current){let e=a.current,i=o.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;i.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),m.createElement(uS.div,{ref:cB(o,i),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},uV(e,e=>m.createElement("div",{ref:cB(a,c.listInnerRef),"cmdk-list-sizer":""},e)))}),uF=m.forwardRef((e,i)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:a,...l}=e;return m.createElement(h2,{open:r,onOpenChange:n},m.createElement(h9,{container:a},m.createElement(h7,{"cmdk-overlay":"",className:s}),m.createElement(ur,{"aria-label":e.label,"cmdk-dialog":"",className:o},m.createElement(uM,{ref:i,...l}))))}),uz=Object.assign(uM,{List:uI,Item:uP,Input:uN,Group:uO,Separator:uB,Dialog:uF,Empty:m.forwardRef((e,i)=>u$(e=>0===e.filtered.count)?m.createElement(uS.div,{ref:i,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:m.forwardRef((e,i)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return m.createElement(uS.div,{ref:i,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},uV(e,e=>m.createElement("div",{"aria-hidden":!0},e)))})});function uH(e){let i=m.useRef(e);return uj(()=>{i.current=e}),i}var uj="u"<typeof window?m.useEffect:m.useLayoutEffect;function uW(e){let i=m.useRef();return void 0===i.current&&(i.current=e()),i}function u$(e){let i=m.useContext(uL),r=()=>e(i.snapshot());return m.useSyncExternalStore(i.subscribe,r,r)}function uU(e,i,r,n=[]){let s=m.useRef(),o=m.useContext(uD);return uj(()=>{var a;let l=(()=>{var e;for(let i of r){if("string"==typeof i)return i.trim();if("object"==typeof i&&"current"in i)return i.current?null==(e=i.current.textContent)?void 0:e.trim():s.current}})(),c=n.map(e=>e.trim());o.value(e,l,c),null==(a=i.current)||a.setAttribute(uR,l),s.current=l}),s}var uq=()=>{let[e,i]=m.useState(),r=uW(()=>new Map);return uj(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),i({})}};function uV({asChild:e,children:i},r){let n;return e&&m.isValidElement(i)?m.cloneElement("function"==typeof(n=i.type)?n(i.props):"render"in n?n.render(i.props):i,{ref:i.ref},r(i.props.children)):r(i)}var uK={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};e.i(69068);var uY=e.i(25913),uX=e.i(10012);function uG({className:e,...i}){return(0,g.jsx)("textarea",{"data-slot":"textarea",className:(0,cC.cn)("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...i})}function uJ({className:e,...i}){return(0,g.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,cC.cn)("group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...i})}let uZ=(0,uY.cva)("flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]","block-start":"order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function uQ({className:e,align:i="inline-start",...r}){return(0,g.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":i,className:(0,cC.cn)(uZ({align:i}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}(0,uY.cva)("flex items-center gap-2 rounded-md text-xs/relaxed shadow-none",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"gap-1","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-7 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});let u0=(0,r0.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",0,u0],54943);var u1=e.i(78745);e.s(["CheckIcon",()=>u1.default],78784);var u1=u1;function u2({className:e,...i}){return(0,g.jsx)(uz,{"data-slot":"command",className:(0,cC.cn)("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground",e),...i})}function u5({className:e,...i}){return(0,g.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,g.jsxs)(uJ,{className:"h-8! bg-input/20 dark:bg-input/30",children:[(0,g.jsx)(uz.Input,{"data-slot":"command-input",className:(0,cC.cn)("w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...i}),(0,g.jsx)(uQ,{children:(0,g.jsx)(u0,{className:"size-3.5 shrink-0 opacity-50"})})]})})}function u3({className:e,...i}){return(0,g.jsx)(uz.List,{"data-slot":"command-list",className:(0,cC.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...i})}function u4({className:e,...i}){return(0,g.jsx)(uz.Empty,{"data-slot":"command-empty",className:(0,cC.cn)("py-6 text-center text-xs/relaxed",e),...i})}function u6({className:e,...i}){return(0,g.jsx)(uz.Group,{"data-slot":"command-group",className:(0,cC.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...i})}function u9({className:e,children:i,...r}){return(0,g.jsxs)(uz.Item,{"data-slot":"command-item",className:(0,cC.cn)("group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-selected:*:[svg]:text-foreground",e),...r,children:[i,(0,g.jsx)(u1.default,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function u8({options:e,value:i,onChange:r,placeholder:n="Select option",disabled:s=!1,className:o="",allowCustomValue:a=!1,multiple:l=!1,onClear:c,showClearButton:h=!1}){let[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(""),_=(0,m.useRef)(null),v=(0,m.useMemo)(()=>Array.isArray(i)?i:[i],[i]),y=(0,m.useMemo)(()=>{if(l){if(1===v.length&&"all"===v[0]){let i=e.find(e=>"all"===e.value);return i?.label||""}return v.filter(e=>"all"!==e).map(i=>e.find(e=>e.value===i)?.label).filter(Boolean).join(", ")}return v.map(i=>e.find(e=>e.value===i)?.label).filter(Boolean).join(", ")},[v,e,l]),b=(0,m.useMemo)(()=>{let i={};for(let r of e){let e=r.group||"Other";i[e]||(i[e]=[]),i[e].push(r)}return i},[e]),S=(0,m.useMemo)(()=>Object.keys(b).length>1||!b.Other,[b]),w=e=>{if(l){let i=[...v],n=i.indexOf(e);n>=0?i.splice(n,1):i.push(e),r(i.length>0?i:[])}else r(e),d(!1)},x=()=>{a&&f&&!l&&(r(f),d(!1))};return(0,g.jsxs)(ck,{open:u,onOpenChange:e=>{d(e),e||p("")},children:[(0,g.jsxs)("div",{className:`relative ${o}`,children:[(0,g.jsx)(cE,{ref:_,disabled:s,className:`flex h-9 w-full items-center justify-between pl-3 ${h?"pr-16":"pr-10"} border border-input rounded-md text-sm bg-input/20 dark:bg-input/30 text-foreground transition-colors outline-none hover:border-ring focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 data-[state=open]:border-ring data-[state=open]:ring-2 data-[state=open]:ring-ring/30 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-left shadow-xs`,children:(0,g.jsx)("span",{className:"truncate",children:y||(0,g.jsx)("span",{className:"text-muted-foreground",children:n})})}),h&&c&&(0,g.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:"absolute right-8 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors cursor-pointer z-10","aria-label":"Clear selection",children:(0,g.jsx)(ad.X,{className:"w-4 h-4"})}),(0,g.jsx)(au,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]}),(0,g.jsx)(cR,{className:"w-[var(--anchor-width)] p-0",align:"start",sideOffset:4,children:(0,g.jsxs)(u2,{filter:(i,r)=>{let n=e.find(e=>e.value===i);return n?+!!`${n.label} ${n.group||""}`.toLowerCase().includes(r.toLowerCase()):0},children:[(0,g.jsx)(u5,{placeholder:"Search...",value:f,onValueChange:p,onKeyDown:e=>{"Enter"===e.key&&a&&x()}}),(0,g.jsxs)(u3,{children:[(0,g.jsx)(u4,{children:a&&f?(0,g.jsxs)("button",{type:"button",className:"w-full px-2 py-1.5 text-left text-xs cursor-pointer hover:bg-accent rounded",onClick:x,children:['Use "',f,'"']}):"No options found"}),S?Object.entries(b).map(([e,i])=>(0,g.jsx)(u6,{heading:e,children:i.map(e=>(0,g.jsx)(u9,{value:e.value,"data-checked":v.includes(e.value),onSelect:()=>w(e.value),children:(0,g.jsx)("span",{className:"truncate",children:e.label})},e.value))},e)):(0,g.jsx)(u6,{children:e.map(e=>(0,g.jsx)(u9,{value:e.value,"data-checked":v.includes(e.value),onSelect:()=>w(e.value),children:(0,g.jsx)("span",{className:"truncate",children:e.label})},e.value))})]})]})})]})}let u7=(0,r0.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var de=e.i(86536),dt=e.i(70935);function di({value:e,onChange:i,editorRef:r,theme:n,activeTab:s,onTabChange:o,disabled:a,onFocusChange:l}){let c=(0,m.useCallback)(e=>{i(e??"")},[i]),h=(0,g.jsx)("div",{className:"border border-border rounded overflow-hidden h-full",children:(0,g.jsx)(_.Editor,{height:"100%",defaultLanguage:"markdown",value:e,onChange:c,onMount:e=>{r.current=e,e.layout(),e.onDidFocusEditorText(()=>l?.(!0)),e.onDidBlurEditorText(()=>l?.(!1))},options:{minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1,readOnly:a},theme:"dark"===n?"vs-dark":"vs-light"})}),u=(0,g.jsx)("div",{className:"border border-border rounded overflow-y-auto h-full p-4 prose prose-sm prose-slate dark:prose-invert max-w-none",children:e?(0,g.jsx)(iW,{remarkPlugins:[rQ],components:as,children:e}):(0,g.jsx)("p",{className:"text-muted-foreground italic",children:"No content"})});return(0,g.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,g.jsxs)("div",{className:"flex gap-1 mb-2 md:hidden flex-shrink-0",children:[(0,g.jsxs)(r3.Button,{type:"button",variant:"editor"===s?"default":"outline",size:"sm",onClick:()=>o("editor"),children:[(0,g.jsx)(u7,{className:"w-4 h-4 mr-1"}),"Editor"]}),(0,g.jsxs)(r3.Button,{type:"button",variant:"preview"===s?"default":"outline",size:"sm",onClick:()=>o("preview"),children:[(0,g.jsx)(de.Eye,{className:"w-4 h-4 mr-1"}),"Preview"]})]}),(0,g.jsxs)("div",{className:"hidden md:grid md:grid-cols-2 md:gap-4 flex-1 min-h-0",children:[h,u]}),(0,g.jsx)("div",{className:"md:hidden flex-1 min-h-0",children:"editor"===s?h:u})]})}e.s(["TaskDialog",0,function({mode:e,isOpen:i,onClose:r,repositories:n=[],task:s,onUpdate:o}){let a=ac(),[l,c]=(0,m.useState)(""),[h,u]=(0,m.useState)([]),[d,f]=(0,m.useState)(""),[p,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(""),[b,S]=(0,m.useState)({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),[w,x]=(0,m.useState)(!1),[C,k]=(0,m.useState)({}),[E,R]=(0,m.useState)("editor"),[T,D]=(0,m.useState)(!1),L=(0,m.useRef)(null),{effectiveTheme:A}=(0,ao.useTheme)();(0,m.useEffect)(()=>{"edit"===e&&s&&S({title:s.title,description:s.description,owner:s.owner,repo:s.repo,branch:s.branch,baseBranch:"",status:s.status,effort:s.effort,order:s.order})},[e,s,i]);let M=(0,m.useMemo)(()=>n.map(e=>({value:`${e.owner}/${e.repo}`,label:`${e.owner}/${e.repo}`})),[n]),P=(0,m.useMemo)(()=>h.map(e=>({value:e,label:e===d?`${e} (default)`:e})),[h,d]);(0,m.useEffect)(()=>{if("create"===e){if(!l){u([]),f(""),S(e=>({...e,baseBranch:""}));return}(async()=>{_(!0),y("");try{let[e,i]=l.split("/"),r=await fetch((0,dt.apiUrl)(`/api/repos/${e}/${i}/branches`));if(!r.ok)throw Error("Failed to fetch branches");let n=await r.json();u(n.data.branches),f(n.data.defaultBranch),S(e=>({...e,baseBranch:n.data.defaultBranch}))}catch(e){console.error("Failed to fetch branches:",e),y("Failed to load branches. Repository may not be initialized."),u([]),f("")}finally{_(!1)}})()}},[l,e]);let O=async i=>{if(i.preventDefault(),k({}),"create"===e){x(!0);try{let e=await fetch((0,dt.apiUrl)("/api/tasks/validate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:b.title,owner:b.owner,repo:b.repo,branch:b.branch})}),i=await e.json();if(!i.valid){let e={};i.errors.forEach(i=>{e[i.field]=i.message}),k(e),x(!1);return}let n={title:b.title,description:b.description,owner:b.owner,repo:b.repo,branch:b.branch,baseBranch:b.baseBranch};r(),c(""),S({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),x(!1);let s=a.loading("Creating task...",n.title);try{if(!(await fetch((0,dt.apiUrl)("/api/tasks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})).ok)throw Error("Failed to create task");a.dismiss(s)}catch(i){let e=i instanceof Error?i.message:"Unknown error";a.error(s,"Failed to create task",e)}}catch(i){x(!1);let e=i instanceof Error?i.message:"Validation failed";a.error(void 0,"Validation failed",e)}}else if("edit"===e&&o&&s){x(!0);try{let e=await o(s.id,{title:b.title,description:b.description,status:b.status,effort:b.effort,order:b.order});if(e.success)r();else if(e.errors){let i={};e.errors.forEach(e=>{i[e.field]=e.message}),k(i)}}catch(e){console.error("Failed to update task:",e),k({global:e instanceof Error?e.message:"Failed to update task. Please try again."})}finally{x(!1)}}},B="create"===e,N=B?"Add New Task":"Edit Task",I=B?"Create":"Save";return(0,g.jsxs)(ah.Dialog,{open:i,onOpenChange:e=>{e.open||w||r()},title:N,maxWidth:B?"2xl":"6xl",fullScreen:!B,showCloseButton:!w,dismissOnEsc:!T,children:[w&&(0,g.jsx)("div",{className:"absolute inset-0 bg-card bg-opacity-90 rounded-lg flex items-center justify-center z-10",children:(0,g.jsx)(aa.LoadingSpinner,{size:"lg",message:B?"Creating task...":"Saving task..."})}),C.global&&(0,g.jsx)("div",{className:"mb-4 p-3 bg-destructive/10 border border-destructive/50 rounded text-destructive text-sm",children:C.global}),(0,g.jsxs)("form",{onSubmit:O,className:B?"space-y-4":"flex flex-col gap-4 flex-1 min-h-0 overflow-hidden",children:[B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Repository *"}),(0,g.jsx)(u8,{options:M,value:l,onChange:e=>{let i=Array.isArray(e)?e[0]||"":e;if(c(i),i){let[e,r]=i.split("/");S(i=>({...i,owner:e,repo:r,baseBranch:""}))}else S(e=>({...e,owner:"",repo:"",baseBranch:""}))},placeholder:"Select repository",disabled:w})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Title *"}),(0,g.jsx)(uX.Input,{type:"text",required:!0,maxLength:200,value:b.title,onChange:e=>S({...b,title:e.target.value}),className:"w-full",disabled:w})]}),!B&&s&&(0,g.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 p-3 bg-muted/50 rounded-md text-sm",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Repository"}),(0,g.jsxs)("p",{className:"text-muted-foreground",children:[s.owner,"/",s.repo]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Branch"}),(0,g.jsx)("p",{className:"text-muted-foreground",children:s.branch})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Base Branch"}),(0,g.jsx)("p",{className:"text-muted-foreground",children:s.baseBranch||"N/A"})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:"Worktree"}),(0,g.jsx)("p",{className:"text-muted-foreground capitalize",children:s.worktreeStatus})]})]}),(0,g.jsxs)("div",{className:B?"":"flex flex-col flex-1 min-h-0",children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground flex-shrink-0",children:"Description"}),B?(0,g.jsx)(uG,{maxLength:5e3,value:b.description,onChange:e=>S({...b,description:e.target.value}),className:"min-h-24 w-full",disabled:w}):(0,g.jsx)(di,{value:b.description,onChange:e=>S(i=>({...i,description:e})),editorRef:L,theme:A,activeTab:E,onTabChange:R,disabled:w,onFocusChange:D})]}),!B&&(0,g.jsxs)("div",{className:"grid grid-cols-3 gap-4 flex-shrink-0",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Status"}),(0,g.jsxs)("select",{value:b.status,onChange:e=>S({...b,status:e.target.value}),className:"w-full h-9 pl-3 pr-10 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs text-foreground",disabled:w,children:[(0,g.jsx)("option",{value:"backlog",children:"Backlog"}),(0,g.jsx)("option",{value:"planning",children:"Planning"}),(0,g.jsx)("option",{value:"tasking",children:"Tasking"}),(0,g.jsx)("option",{value:"coding",children:"Coding"}),(0,g.jsx)("option",{value:"reviewing",children:"Reviewing"}),(0,g.jsx)("option",{value:"done",children:"Done"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Effort (h)"}),(0,g.jsx)(uX.Input,{type:"number",step:"0.5",min:"0.5",max:"40",value:b.effort??"",onChange:e=>S({...b,effort:parseFloat(e.target.value)||void 0}),className:"w-full",placeholder:"2.5",disabled:w})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Order"}),(0,g.jsx)(uX.Input,{type:"number",min:"0",value:b.order??"",onChange:e=>S({...b,order:parseInt(e.target.value)||void 0}),className:"w-full",placeholder:"0",disabled:w})]})]}),B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Base Branch *"}),p?(0,g.jsxs)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-muted-foreground flex items-center gap-2",children:[(0,g.jsx)(aa.LoadingSpinner,{size:"sm"}),(0,g.jsx)("span",{className:"text-xs",children:"Loading branches..."})]}):h.length>0?(0,g.jsx)(u8,{options:P,value:b.baseBranch,onChange:e=>{let i=Array.isArray(e)?e[0]||"":e;S({...b,baseBranch:i})},placeholder:"Select base branch",disabled:w}):(0,g.jsx)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-sm text-muted-foreground flex items-center",children:v||"Select repository first"}),(0,g.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Your new branch will be created from this branch"})]}),B&&(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"New Branch Name *"}),(0,g.jsx)(uX.Input,{type:"text",required:!0,maxLength:255,value:b.branch,onChange:e=>S({...b,branch:e.target.value}),className:`w-full ${C.branch?"border-destructive":""}`,placeholder:"feature/new-feature",disabled:w,"aria-invalid":!!C.branch}),C.branch&&(0,g.jsx)("p",{className:"text-xs text-destructive mt-1",children:C.branch}),!C.branch&&(0,g.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Will be created from ",b.baseBranch||"base branch"]})]}),(0,g.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,g.jsx)(r3.Button,{type:"button",variant:"outline",size:"lg",onClick:r,className:"active:scale-95",disabled:w,children:"Cancel"}),(0,g.jsx)(r3.Button,{type:"submit",size:"lg",className:"active:scale-95",disabled:w||B&&p,children:I})]})]})]})}],10483)},96085,e=>{"use strict";let i,r,n,s=Object.create(null);s.open="0",s.close="1",s.ping="2",s.pong="3",s.message="4",s.upgrade="5",s.noop="6";let o=Object.create(null);Object.keys(s).forEach(e=>{o[s[e]]=e});let a={type:"error",data:"parser error"},l="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),c="function"==typeof ArrayBuffer,h=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,u=({type:e,data:i},r,n)=>{if(l&&i instanceof Blob)if(r)return n(i);else return d(i,n);if(c&&(i instanceof ArrayBuffer||h(i)))if(r)return n(i);else return d(new Blob([i]),n);return n(s[e]+(i||""))},d=(e,i)=>{let r=new FileReader;return r.onload=function(){i("b"+(r.result.split(",")[1]||""))},r.readAsDataURL(e)};function f(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<p.length;e++)g[p.charCodeAt(e)]=e;let m="function"==typeof ArrayBuffer,_=(e,i)=>{if("string"!=typeof e)return{type:"message",data:y(e,i)};let r=e.charAt(0);return"b"===r?{type:"message",data:v(e.substring(1),i)}:o[r]?e.length>1?{type:o[r],data:e.substring(1)}:{type:o[r]}:a},v=(e,i)=>m?y((e=>{let i=.75*e.length,r=e.length,n,s=0,o,a,l,c;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);let h=new ArrayBuffer(i),u=new Uint8Array(h);for(n=0;n<r;n+=4)o=g[e.charCodeAt(n)],a=g[e.charCodeAt(n+1)],l=g[e.charCodeAt(n+2)],c=g[e.charCodeAt(n+3)],u[s++]=o<<2|a>>4,u[s++]=(15&a)<<4|l>>2,u[s++]=(3&l)<<6|63&c;return h})(e),i):{base64:!0,data:e},y=(e,i)=>"blob"===i?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function b(e){return e.reduce((e,i)=>e+i.length,0)}function S(e,i){if(e[0].length===i)return e.shift();let r=new Uint8Array(i),n=0;for(let s=0;s<i;s++)r[s]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),r}function w(e){if(e){var i=e;for(var r in w.prototype)i[r]=w.prototype[r];return i}}w.prototype.on=w.prototype.addEventListener=function(e,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(i),this},w.prototype.once=function(e,i){function r(){this.off(e,r),i.apply(this,arguments)}return r.fn=i,this.on(e,r),this},w.prototype.off=w.prototype.removeListener=w.prototype.removeAllListeners=w.prototype.removeEventListener=function(e,i){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===i||r.fn===i){n.splice(s,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},w.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var i=Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)i[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,i)}return this},w.prototype.emitReserved=w.prototype.emit,w.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},w.prototype.hasListeners=function(e){return!!this.listeners(e).length};let x="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,i)=>i(e,0),C="u">typeof self?self:"u">typeof window?window:Function("return this")();function k(e,...i){return i.reduce((i,r)=>(e.hasOwnProperty(r)&&(i[r]=e[r]),i),{})}let E=C.setTimeout,R=C.clearTimeout;function T(e,i){i.useNativeTimers?(e.setTimeoutFn=E.bind(C),e.clearTimeoutFn=R.bind(C)):(e.setTimeoutFn=C.setTimeout.bind(C),e.clearTimeoutFn=C.clearTimeout.bind(C))}function D(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class L extends Error{constructor(e,i,r){super(e),this.description=i,this.context=r,this.type="TransportError"}}class A extends w{constructor(e){super(),this.writable=!1,T(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,i,r){return super.emitReserved("error",new L(e,i,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let i=_(e,this.socket.binaryType);this.onPacket(i)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,i={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let i=function(e){let i="";for(let r in e)e.hasOwnProperty(r)&&(i.length&&(i+="&"),i+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return i}(e);return i.length?"?"+i:""}}class M extends A{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let i=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||i()})),this.writable||(e++,this.once("drain",function(){--e||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let i=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};((e,i)=>{let r=e.split("\x1e"),n=[];for(let e=0;e<r.length;e++){let s=_(r[e],i);if(n.push(s),"error"===s.type)break}return n})(e,this.socket.binaryType).forEach(i),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){var i;let r,n,s;this.writable=!1,i=e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})},n=Array(r=e.length),s=0,e.forEach((e,o)=>{u(e,!1,e=>{n[o]=e,++s===r&&i(n.join("\x1e"))})})}uri(){let e=this.opts.secure?"https":"http",i=this.query||{};return!1!==this.opts.timestampRequests&&(i[this.opts.timestampParam]=D()),this.supportsBinary||i.sid||(i.b64=1),this.createUri(e,i)}}let P=!1;try{P="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let O=P;function B(){}class N extends M{constructor(e){if(super(e),"u">typeof location){const i="https:"===location.protocol;let r=location.port;r||(r=i?"443":"80"),this.xd="u">typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,i){let r=this.request({method:"POST",data:e});r.on("success",i),r.on("error",(e,i)=>{this.onError("xhr post error",e,i)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=e}}class I extends w{constructor(e,i,r){super(),this.createRequest=e,T(this,r),this._opts=r,this._method=r.method||"GET",this._uri=i,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;let i=k(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(i);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"u">typeof document&&(this._index=I.requestsCount++,I.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=B,e)try{this._xhr.abort()}catch(e){}"u">typeof document&&delete I.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function F(){for(let e in I.requests)I.requests.hasOwnProperty(e)&&I.requests[e].abort()}I.requestsCount=0,I.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",F):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",F,!1));let z=(n=H({xdomain:!1}))&&null!==n.responseType;function H(e){let i=e.xdomain;try{if("u">typeof XMLHttpRequest&&(!i||O))return new XMLHttpRequest}catch(e){}if(!i)try{return new C[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let j="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class W extends A{get name(){return"websocket"}doOpen(){let e=this.uri(),i=this.opts.protocols,r=j?{}:k(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,i,r)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let i=0;i<e.length;i++){let r=e[i],n=i===e.length-1;u(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}n&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=D()),this.supportsBinary||(i.b64=1),this.createUri(e,i)}}let $=C.WebSocket||C.MozWebSocket,U={websocket:class extends W{createSocket(e,i,r){return j?new $(e,i,r):i?new $(e,i):new $(e)}doWrite(e,i){this.ws.send(i)}},webtransport:class extends A{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{var n,s;let o,d,p,g,m=(n=Number.MAX_SAFE_INTEGER,s=this.socket.binaryType,r||(r=new TextDecoder),o=[],d=0,p=-1,g=!1,new TransformStream({transform(e,i){for(o.push(e);;){if(0===d){if(1>b(o))break;let e=S(o,1);g=(128&e[0])==128,d=(p=127&e[0])<126?3:126===p?1:2}else if(1===d){if(2>b(o))break;let e=S(o,2);p=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),d=3}else if(2===d){if(8>b(o))break;let e=S(o,8),r=new DataView(e.buffer,e.byteOffset,e.length),n=r.getUint32(0);if(n>2097151){i.enqueue(a);break}p=0x100000000*n+r.getUint32(4),d=3}else{if(b(o)<p)break;let e=S(o,p);i.enqueue(_(g?e:r.decode(e),s)),d=0}if(0===p||p>n){i.enqueue(a);break}}}})),v=e.readable.pipeThrough(m).getReader(),y=new TransformStream({transform(e,r){var n;n=i=>{let n,s=i.length;if(s<126)new DataView((n=new Uint8Array(1)).buffer).setUint8(0,s);else if(s<65536){let e=new DataView((n=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,s)}else{let e=new DataView((n=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(n[0]|=128),r.enqueue(n),r.enqueue(i)},l&&e.data instanceof Blob?e.data.arrayBuffer().then(f).then(n):c&&(e.data instanceof ArrayBuffer||h(e.data))?n(f(e.data)):u(e,!1,e=>{i||(i=new TextEncoder),n(i.encode(e))})}});y.readable.pipeTo(e.writable),this._writer=y.writable.getWriter();let w=()=>{v.read().then(({done:e,value:i})=>{e||(this.onPacket(i),w())}).catch(e=>{})};w();let x={type:"open"};this.query.sid&&(x.data=`{"sid":"${this.query.sid}"}`),this._writer.write(x).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let i=0;i<e.length;i++){let r=e[i],n=i===e.length-1;this._writer.write(r).then(()=>{n&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}},polling:class extends N{constructor(e){super(e);const i=e&&e.forceBase64;this.supportsBinary=z&&!i}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new I(H,this.uri(),e)}}},q=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,V=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function K(e){var i,r;let n,s;if(e.length>8e3)throw"URI too long";let o=e,a=e.indexOf("["),l=e.indexOf("]");-1!=a&&-1!=l&&(e=e.substring(0,a)+e.substring(a,l).replace(/:/g,";")+e.substring(l,e.length));let c=q.exec(e||""),h={},u=14;for(;u--;)h[V[u]]=c[u]||"";return -1!=a&&-1!=l&&(h.source=o,h.host=h.host.substring(1,h.host.length-1).replace(/;/g,":"),h.authority=h.authority.replace("[","").replace("]","").replace(/;/g,":"),h.ipv6uri=!0),n=(i=h.path).replace(/\/{2,9}/g,"/").split("/"),("/"==i.slice(0,1)||0===i.length)&&n.splice(0,1),"/"==i.slice(-1)&&n.splice(n.length-1,1),h.pathNames=n,r=h.query,s={},r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,i,r){i&&(s[i]=r)}),h.queryKey=s,h}let Y="function"==typeof addEventListener&&"function"==typeof removeEventListener,X=[];Y&&addEventListener("offline",()=>{X.forEach(e=>e())},!1);class G extends w{constructor(e,i){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(i=e,e=null),e){const r=K(e);i.hostname=r.host,i.secure="https"===r.protocol||"wss"===r.protocol,i.port=r.port,r.query&&(i.query=r.query)}else i.host&&(i.hostname=K(i.host).host);T(this,i),this.secure=null!=i.secure?i.secure:"u">typeof location&&"https:"===location.protocol,i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||("u">typeof location?location.hostname:"localhost"),this.port=i.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(e=>{let i=e.prototype.name;this.transports.push(i),this._transportsByName[i]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let i={},r=e.split("&");for(let e=0,n=r.length;e<n;e++){let n=r[e].split("=");i[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return i}(this.opts.query)),Y&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},X.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=4,i.transport=e,this.id&&(i.sid=this.id);let r=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&G.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",G.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let i=0;i<this.writeBuffer.length;i++){let r=this.writeBuffer[i].data;if(r&&(e+="string"==typeof r?function(e){let i=0,r=0;for(let n=0,s=e.length;n<s;n++)(i=e.charCodeAt(n))<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4);return r}(r):Math.ceil(1.33*(r.byteLength||r.size))),i>0&&e>this._maxPayload)return this.writeBuffer.slice(0,i);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,x(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,r){return this._sendPacket("message",e,i,r),this}send(e,i,r){return this._sendPacket("message",e,i,r),this}_sendPacket(e,i,r,n){if("function"==typeof i&&(n=i,i=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;let s={type:e,data:i,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},r=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(G.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Y&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=X.indexOf(this._offlineEventListener);-1!==e&&X.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}G.protocol=4;class J extends G{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let i=this.createTransport(e),r=!1;G.priorWebsocketSuccess=!1;let n=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;G.priorWebsocketSuccess="websocket"===i.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(h(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{let e=Error("probe error");e.transport=i.name,this.emitReserved("upgradeError",e)}}))};function s(){r||(r=!0,h(),i.close(),i=null)}let o=e=>{let r=Error("probe error: "+e);r.transport=i.name,s(),this.emitReserved("upgradeError",r)};function a(){o("transport closed")}function l(){o("socket closed")}function c(e){i&&e.name!==i.name&&s()}let h=()=>{i.removeListener("open",n),i.removeListener("error",o),i.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};i.once("open",n),i.once("error",o),i.once("close",a),this.once("close",l),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||i.open()},200):i.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let i=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&i.push(e[r]);return i}}class Z extends J{constructor(e,i={}){const r="object"==typeof e?e:i;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>U[e]).filter(e=>!!e)),super(e,r)}}Z.protocol;let Q="function"==typeof ArrayBuffer,ee=Object.prototype.toString,et="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===ee.call(Blob),ei="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===ee.call(File);function er(e){return Q&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||et&&e instanceof Blob||ei&&e instanceof File}let en=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(ed=ef||(ef={}))[ed.CONNECT=0]="CONNECT",ed[ed.DISCONNECT=1]="DISCONNECT",ed[ed.EVENT=2]="EVENT",ed[ed.ACK=3]="ACK",ed[ed.CONNECT_ERROR=4]="CONNECT_ERROR",ed[ed.BINARY_EVENT=5]="BINARY_EVENT",ed[ed.BINARY_ACK=6]="BINARY_ACK";class es extends w{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let i;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let r=(i=this.decodeString(e)).type===ef.BINARY_EVENT;r||i.type===ef.BINARY_ACK?(i.type=r?ef.EVENT:ef.ACK,this.reconstructor=new eo(i),0===i.attachments&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(er(e)||e.base64)if(this.reconstructor)(i=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+e)}decodeString(e){let i=0,r={type:Number(e.charAt(0))};if(void 0===ef[r.type])throw Error("unknown packet type "+r.type);if(r.type===ef.BINARY_EVENT||r.type===ef.BINARY_ACK){let n=i+1;for(;"-"!==e.charAt(++i)&&i!=e.length;);let s=e.substring(n,i);if(s!=Number(s)||"-"!==e.charAt(i))throw Error("Illegal attachments");let o=Number(s);if(!ea(o)||o<0)throw Error("Illegal attachments");if(o>this.opts.maxAttachments)throw Error("too many attachments");r.attachments=o}if("/"===e.charAt(i+1)){let n=i+1;for(;++i&&","!==e.charAt(i)&&i!==e.length;);r.nsp=e.substring(n,i)}else r.nsp="/";let n=e.charAt(i+1);if(""!==n&&Number(n)==n){let n=i+1;for(;++i;){let r=e.charAt(i);if(null==r||Number(r)!=r){--i;break}if(i===e.length)break}r.id=Number(e.substring(n,i+1))}if(e.charAt(++i)){let n=this.tryParse(e.substr(i));if(es.isPayloadValid(r.type,n))r.data=n;else throw Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,i){switch(e){case ef.CONNECT:return el(i);case ef.DISCONNECT:return void 0===i;case ef.CONNECT_ERROR:return"string"==typeof i||el(i);case ef.EVENT:case ef.BINARY_EVENT:return Array.isArray(i)&&("number"==typeof i[0]||"string"==typeof i[0]&&-1===en.indexOf(i[0]));case ef.ACK:case ef.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var i,r;let e=(i=this.reconPack,r=this.buffers,i.data=function e(i,r){if(!i)return i;if(i&&!0===i._placeholder){if("number"==typeof i.num&&i.num>=0&&i.num<r.length)return r[i.num];throw Error("illegal attachments")}if(Array.isArray(i))for(let n=0;n<i.length;n++)i[n]=e(i[n],r);else if("object"==typeof i)for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&(i[n]=e(i[n],r));return i}(i.data,r),delete i.attachments,i);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let ea=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function el(e){return"[object Object]"===Object.prototype.toString.call(e)}function ec(e,i,r){return e.on(i,r),function(){e.off(i,r)}}e.s(["Decoder",0,es,"Encoder",0,class{constructor(e){this.replacer=e}encode(e){return(e.type===ef.EVENT||e.type===ef.ACK)&&function e(i,r){if(!i||"object"!=typeof i)return!1;if(Array.isArray(i)){for(let r=0,n=i.length;r<n;r++)if(e(i[r]))return!0;return!1}if(er(i))return!0;if(i.toJSON&&"function"==typeof i.toJSON&&1==arguments.length)return e(i.toJSON(),!0);for(let r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&e(i[r]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===ef.EVENT?ef.BINARY_EVENT:ef.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let i=""+e.type;return(e.type===ef.BINARY_EVENT||e.type===ef.BINARY_ACK)&&(i+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(i+=e.nsp+","),null!=e.id&&(i+=e.id),null!=e.data&&(i+=JSON.stringify(e.data,this.replacer)),i}encodeAsBinary(e){let i,r,n=(i=[],r=e.data,e.data=function e(i,r){if(!i)return i;if(er(i)){let e={_placeholder:!0,num:r.length};return r.push(i),e}if(Array.isArray(i)){let n=Array(i.length);for(let s=0;s<i.length;s++)n[s]=e(i[s],r);return n}if("object"==typeof i&&!(i instanceof Date)){let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=e(i[s],r));return n}return i}(r,i),e.attachments=i.length,{packet:e,buffers:i}),s=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(s),o}},"PacketType",0,ef,"isPacketValid",0,function(e){var i;return"string"==typeof e.nsp&&(void 0===(i=e.id)||ea(i))&&function(e,i){switch(e){case ef.CONNECT:return void 0===i||el(i);case ef.DISCONNECT:return void 0===i;case ef.EVENT:return Array.isArray(i)&&("number"==typeof i[0]||"string"==typeof i[0]&&-1===en.indexOf(i[0]));case ef.ACK:return Array.isArray(i);case ef.CONNECT_ERROR:return"string"==typeof i||el(i);default:return!1}}(e.type,e.data)},"protocol",0,5],51890);let eh=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class eu extends w{constructor(e,i,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=i,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[ec(e,"open",this.onopen.bind(this)),ec(e,"packet",this.onpacket.bind(this)),ec(e,"error",this.onerror.bind(this)),ec(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...i){var r,n,s;if(eh.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(i.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;let o={type:ef.EVENT,data:i};if(o.options={},o.options.compress=!1!==this.flags.compress,"function"==typeof i[i.length-1]){let e=this.ids++,r=i.pop();this._registerAckCallback(e,r),o.id=e}let a=null==(n=null==(r=this.io.engine)?void 0:r.transport)?void 0:n.writable,l=this.connected&&!(null==(s=this.io.engine)?void 0:s._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,i){var r;let n=null!=(r=this.flags.timeout)?r:this._opts.ackTimeout;if(void 0===n){this.acks[e]=i;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);i.call(this,Error("operation has timed out"))},n),o=(...e)=>{this.io.clearTimeoutFn(s),i.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...i){return new Promise((r,n)=>{let s=(e,i)=>e?n(e):r(i);s.withError=!0,i.push(s),this.emit(e,...i)})}_addToQueue(e){let i;"function"==typeof e[e.length-1]&&(i=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...n)=>(this._queue[0],null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(e)):(this._queue.shift(),i&&i(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let i=this._queue[0];(!i.pending||e)&&(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ef.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ef.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ef.EVENT:case ef.BINARY_EVENT:this.onevent(e);break;case ef.ACK:case ef.BINARY_ACK:this.onack(e);break;case ef.DISCONNECT:this.ondisconnect();break;case ef.CONNECT_ERROR:this.destroy();let i=Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i)}}onevent(e){let i=e.data||[];null!=e.id&&i.push(this.ack(e.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let i of this._anyListeners.slice())i.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let i=this,r=!1;return function(...n){r||(r=!0,i.packet({type:ef.ACK,id:e,data:n}))}}onack(e){let i=this.acks[e.id];"function"==typeof i&&(delete this.acks[e.id],i.withError&&e.data.unshift(null),i.apply(this,e.data))}onconnect(e,i){this.id=e,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ef.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let i=this._anyListeners;for(let r=0;r<i.length;r++)if(e===i[r]){i.splice(r,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let i=this._anyOutgoingListeners;for(let r=0;r<i.length;r++)if(e===i[r]){i.splice(r,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let i of this._anyOutgoingListeners.slice())i.apply(this,e.data)}}var ed,ef,ep=e.i(51890);function eg(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}eg.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),r=Math.floor(i*this.jitter*e);e=(1&Math.floor(10*i))==0?e-r:e+r}return 0|Math.min(e,this.max)},eg.prototype.reset=function(){this.attempts=0},eg.prototype.setMin=function(e){this.ms=e},eg.prototype.setMax=function(e){this.max=e},eg.prototype.setJitter=function(e){this.jitter=e};class em extends w{constructor(e,i){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(i=e,e=void 0),(i=i||{}).path=i.path||"/socket.io",this.opts=i,T(this,i),this.reconnection(!1!==i.reconnection),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(r=i.randomizationFactor)?r:.5),this.backoff=new eg({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==i.timeout?2e4:i.timeout),this._readyState="closed",this.uri=e;const n=i.parser||ep;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==i.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var i;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null==(i=this.backoff)||i.setMin(e),this)}randomizationFactor(e){var i;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null==(i=this.backoff)||i.setJitter(e),this)}reconnectionDelayMax(e){var i;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null==(i=this.backoff)||i.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Z(this.uri,this.opts);let i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let n=ec(i,"open",function(){r.onopen(),e&&e()}),s=i=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",i),e?e(i):this.maybeReconnectOnOpen()},o=ec(i,"error",s);if(!1!==this._timeout){let e=this._timeout,r=this.setTimeoutFn(()=>{n(),s(Error("timeout")),i.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(n),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(ec(e,"ping",this.onping.bind(this)),ec(e,"data",this.ondata.bind(this)),ec(e,"error",this.onerror.bind(this)),ec(e,"close",this.onclose.bind(this)),ec(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){x(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,i){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new eu(this,e,i),this.nsps[e]=r),r}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let i=this.encoder.encode(e);for(let r=0;r<i.length;r++)this.engine.write(i[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,i){var r;this.cleanup(),null==(r=this.engine)||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let i=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},i);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let e_={};function ev(e,i){let r;"object"==typeof e&&(i=e,e=void 0);let n=function(e,i="",r){let n=e;r=r||"u">typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),n=K(e)),!n.port&&(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";let s=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port+i,n.href=n.protocol+"://"+s+(r&&r.port===n.port?"":":"+n.port),n}(e,(i=i||{}).path||"/socket.io"),s=n.source,o=n.id,a=n.path,l=e_[o]&&a in e_[o].nsps;return i.forceNew||i["force new connection"]||!1===i.multiplex||l?r=new em(s,i):(e_[o]||(e_[o]=new em(s,i)),r=e_[o]),n.query&&!i.query&&(i.query=n.queryKey),r.socket(n.path,i)}Object.assign(ev,{Manager:em,Socket:eu,io:ev,connect:ev}),e.s(["io",0,ev],96085)},2576,e=>{"use strict";var i=e.i(71645),r=e.i(96085),n=e.i(70935);e.s(["useTaskEvents",0,function(e){let s=(0,i.useRef)(null),o=(0,i.useRef)(e);(0,i.useLayoutEffect)(()=>{o.current=e}),(0,i.useEffect)(()=>{let e=(0,r.io)((0,n.getServerUrl)(),{transports:["websocket"]});return s.current=e,e.on("task:created",({task:e})=>{o.current.onTaskCreated(e)}),e.on("task:updated",({task:e})=>{o.current.onTaskUpdated(e)}),e.on("task:deleted",({taskId:e})=>{o.current.onTaskDeleted(e)}),()=>{e.disconnect(),s.current=null}},[])}])},48214,31245,68054,57212,e=>{"use strict";var i=e.i(75254);let r=(0,i.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);e.s(["CirclePause",0,r],48214);let n=(0,i.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["Bot",0,n],31245);let s=(0,i.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,s],68054);let o=(0,i.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["WifiOff",0,o],57212)},95468,73884,e=>{"use strict";var i=e.i(23287);e.s(["CheckCircle2",()=>i.default],95468);let r=(0,e.i(75254).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,r],73884)},86311,e=>{"use strict";let i=(0,e.i(75254).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,i],86311)},30939,99894,93309,e=>{"use strict";let i,r,n,s,o,a,l,c,h,u,d,f;var p=e.i(18050),g=e.i(71645),m=e.i(37727),_=e.i(31278),v=e.i(48214),y=e.i(31245),b=e.i(68054),S=e.i(63209),w=e.i(57212),x=e.i(95468),C=e.i(73884),k=e.i(86311),E=e.i(68995),R=e.i(85902);function T({entry:e}){if(!e||"idle"===e.terminal)return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,p.jsx)(v.CirclePause,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"idle"})]});if("connecting"===e.terminal)return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,p.jsx)(_.Loader2,{className:"w-3 h-3 animate-spin"}),(0,p.jsx)("span",{children:"connecting"})]});if("error"===e.terminal)return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,p.jsx)(S.AlertCircle,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"error"})]});if("exited"===e.terminal||"paused"===e.terminal)return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,p.jsx)(w.WifiOff,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:e.terminal})]});switch(e.claude){case"running":return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-primary",children:[(0,p.jsx)(_.Loader2,{className:"w-3 h-3 animate-spin"}),(0,p.jsx)("span",{children:"running"})]});case"waiting":return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-warning",children:[(0,p.jsx)(k.MessageSquare,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"waiting"})]});case"success":return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-success",children:[(0,p.jsx)(x.CheckCircle2,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"success"})]});case"failure":case"error":return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,p.jsx)(C.XCircle,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"failure"===e.claude?"failure":"error"})]});default:return(0,p.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,p.jsx)(v.CirclePause,{className:"w-3 h-3"}),(0,p.jsx)("span",{children:"idle"})]})}}e.s(["SessionTabs",0,function({tabs:e,activeTabId:i,onTabChange:r,onTabCreateTerminal:n,onTabCreateClaude:s,onTabDelete:o,tabStatusMap:a}){let l=(0,g.useRef)([]),[c,h]=(0,g.useState)({left:0,width:0}),[u,d]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let r=e.findIndex(e=>e.tab_id===i);if(-1!==r&&l.current[r]){let e=l.current[r];e&&h({left:e.offsetLeft,width:e.offsetWidth})}},[i,e]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(E.ConfirmDialog,{open:null!==u,onOpenChange:e=>{e.open||d(null)},title:"Delete Tab",message:u?.isRunning?"This tab is running. Are you sure you want to delete it?":"Delete this tab?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{u&&o(u.tabId)},variant:"danger"}),(0,p.jsxs)("div",{className:"relative flex items-center gap-2 overflow-x-auto border-b border-border pb-1",children:[e.map((n,s)=>{let o=i===n.tab_id,c=a?.get(n.tab_id),h=(c?.claude==="running"||c?.claude==="waiting")&&c?.terminal==="connected";return(0,p.jsxs)("div",{ref:e=>{l.current[s]=e},onClick:()=>r(n.tab_id),className:`
|
|
12
12
|
flex items-center gap-2 px-4 pt-1 pb-2 h-10 flex-shrink-0 transition-colors cursor-pointer
|
|
13
13
|
${o?"text-primary":h?"text-primary-light":"text-muted-foreground hover:text-foreground"}
|
|
14
|
-
`,children:[(0,
|
|
14
|
+
`,children:[(0,p.jsx)("div",{className:"font-medium flex items-center gap-2",children:(0,p.jsx)(T,{entry:c})}),e.length>1&&(0,p.jsx)(R.Button,{variant:"ghost",size:"icon-xs",onClick:e=>{e.stopPropagation(),d({tabId:n.tab_id,isRunning:h})},children:(0,p.jsx)(m.X,{className:"w-4 h-4"})})]},n.tab_id)}),(0,p.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[(0,p.jsx)("div",{className:"w-px self-stretch bg-theme"}),n&&(0,p.jsx)(R.Button,{size:"icon",onClick:n,title:"Open terminal",children:(0,p.jsx)(b.Terminal,{className:"w-4 h-4"})}),(0,p.jsx)(R.Button,{size:"icon",onClick:s,title:"Open terminal with Claude",children:(0,p.jsx)(y.Bot,{className:"w-4 h-4"})})]}),(0,p.jsx)("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-[left,width]",style:{left:`${c.left}px`,width:`${c.width}px`}})]})]})}],30939);var D=e.i(47167),L=Object.defineProperty,A=Object.getOwnPropertyDescriptor,M=(e,i,r,n)=>{for(var s,o=n>1?void 0:n?A(i,r):i,a=e.length-1;a>=0;a--)(s=e[a])&&(o=(n?s(i,r,o):s(o))||o);return n&&o&&L(i,r,o),o},P=(e,i)=>(r,n)=>i(r,n,e),O="Terminal input",B="Too much output to announce, navigate to rows manually to read";function N(e,i,r,n){var s;s=e=e.replace(/\r?\n/g,"\r"),e=r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+s+"\x1b[201~":s,r.triggerDataEvent(e,!0),i.value=""}function I(e,i,r){let n=r.getBoundingClientRect(),s=e.clientX-n.left-10,o=e.clientY-n.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${s}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function F(e,i,r,n,s){I(e,i,r),s&&n.rightClickSelect(e),i.value=n.selectionText,i.select()}function z(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function H(e,i=0,r=e.length){let n="";for(let s=i;s<r;++s){let i=e[s];i>65535?(i-=65536,n+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):n+=String.fromCharCode(i)}return n}var j=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let r=e.length;if(!r)return 0;let n=0,s=0;if(this._interim){let r=e.charCodeAt(s++);56320<=r&&r<=57343?i[n++]=(this._interim-55296)*1024+r-56320+65536:(i[n++]=this._interim,i[n++]=r),this._interim=0}for(let o=s;o<r;++o){let s=e.charCodeAt(o);if(55296<=s&&s<=56319){if(++o>=r)return this._interim=s,n;let a=e.charCodeAt(o);56320<=a&&a<=57343?i[n++]=(s-55296)*1024+a-56320+65536:(i[n++]=s,i[n++]=a);continue}65279!==s&&(i[n++]=s)}return n}},W=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let r=e.length;if(!r)return 0;let n=0,s,o,a,l,c=0,h=0;if(this.interim[0]){let s=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let a=0,l;for(;(l=63&this.interim[++a])&&a<4;)o<<=6,o|=l;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-a;for(;h<u;){if(h>=r)return 0;if((192&(l=e[h++]))!=128){h--,s=!0;break}this.interim[a++]=l,o<<=6,o|=63&l}s||(2===c?o<128?h--:i[n++]=o:3===c?o<2048||o>=55296&&o<=57343||65279===o||(i[n++]=o):o<65536||o>1114111||(i[n++]=o)),this.interim.fill(0)}let u=r-4,d=h;for(;d<r;){for(;d<u&&!(128&(s=e[d]))&&!(128&(o=e[d+1]))&&!(128&(a=e[d+2]))&&!(128&(l=e[d+3]));)i[n++]=s,i[n++]=o,i[n++]=a,i[n++]=l,d+=4;if((s=e[d++])<128)i[n++]=s;else if((224&s)==192){if(d>=r)return this.interim[0]=s,n;if((192&(o=e[d++]))!=128||(c=(31&s)<<6|63&o)<128){d--;continue}i[n++]=c}else if((240&s)==224){if(d>=r)return this.interim[0]=s,n;if((192&(o=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=s,this.interim[1]=o,n;if((192&(a=e[d++]))!=128){d--;continue}if((c=(15&s)<<12|(63&o)<<6|63&a)<2048||c>=55296&&c<=57343||65279===c)continue;i[n++]=c}else if((248&s)==240){if(d>=r)return this.interim[0]=s,n;if((192&(o=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=s,this.interim[1]=o,n;if((192&(a=e[d++]))!=128){d--;continue}if(d>=r)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=a,n;if((192&(l=e[d++]))!=128){d--;continue}if((c=(7&s)<<18|(63&o)<<12|(63&a)<<6|63&l)<65536||c>1114111)continue;i[n++]=c}}return n}},$=class e{constructor(){this.fg=0,this.bg=0,this.extended=new U}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},U=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},q=class e extends ${constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new U,this.combinedData=""}static fromCharData(i){let r=new e;return r.setFromCharData(i),r}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?z(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let n=e[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(r-55296)*1024+n-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},V="di$target",K="di$dependencies",Y=new Map;function X(e){if(Y.has(e))return Y.get(e);let i=function(e,r,n){var s,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");s=i,o=e,a=n,o[V]===o?o[K].push({id:s,index:a}):(o[K]=[{id:s,index:a}],o[V]=o)};return i._id=e,Y.set(e,i),i}var G=X("BufferService"),J=X("CoreMouseService"),Z=X("CoreService"),Q=X("CharsetService"),ee=X("InstantiationService"),et=X("LogService"),ei=X("OptionsService"),er=X("OscLinkService"),en=X("UnicodeService"),es=X("DecorationService"),eo=class{constructor(e,i,r){this._bufferService=e,this._optionsService=i,this._oscLinkService=r}provideLinks(e,i){let r=this._bufferService.buffer.lines.get(e-1);if(!r)return void i(void 0);let n=[],s=this._optionsService.rawOptions.linkHandler,o=new q,a=r.getTrimmedLength(),l=-1,c=-1,h=!1;for(let i=0;i<a;i++)if(!(-1===c&&!r.hasContent(i))){if(r.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===c){c=i,l=o.extended.urlId;continue}else h=o.extended.urlId!==l;else -1!==c&&(h=!0);if(h||-1!==c&&i===a-1){let r=this._oscLinkService.getLinkData(l)?.uri;if(r){let o={start:{x:c+1,y:e},end:{x:i+ +(!h&&i===a-1),y:e}},l=!1;if(!s?.allowNonHttpProtocols)try{let e=new URL(r);["http:","https:"].includes(e.protocol)||(l=!0)}catch{l=!0}l||n.push({text:r,range:o,activate:(e,i)=>s?s.activate(e,i,o):function(e){if(confirm(`Do you want to navigate to ${e}?
|
|
15
15
|
|
|
16
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}(i),hover:(e,i)=>s?.hover?.(e,i,o),leave:(e,i)=>s?.leave?.(e,i,o)})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=i,l=o.extended.urlId):(c=-1,l=-1)}}i(n)}};
|
|
16
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}(i),hover:(e,i)=>s?.hover?.(e,i,o),leave:(e,i)=>s?.leave?.(e,i,o)})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=i,l=o.extended.urlId):(c=-1,l=-1)}}i(n)}};eo=M([P(0,G),P(1,ei),P(2,er)],eo);var ea=X("CharSizeService"),el=X("CoreBrowserService"),ec=X("MouseService"),eh=X("RenderService"),eu=X("SelectionService"),ed=X("CharacterJoinerService"),ef=X("ThemeService"),ep=X("LinkProviderService"),eg=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ey.isErrorNoTelemetry(e)?new ey(e.message+`
|
|
17
17
|
|
|
18
18
|
`+e.stack):Error(e.message+`
|
|
19
19
|
|
|
20
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function eS(e){var i;(i=e)instanceof ex||i instanceof Error&&i.name===ew&&i.message===ew||eb.onUnexpectedError(e)}var ew="Canceled",ex=class extends Error{constructor(){super(ew),this.name=this.message}},eC=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(i){if(i instanceof e)return i;let r=new e;return r.message=i.message,r.stack=i.stack,r}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},ek=class e extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function eE(e,i=0){return e[e.length-(1+i)]}(e$=eU||={}).isLessThan=function(e){return e<0},e$.isLessThanOrEqual=function(e){return e<=0},e$.isGreaterThan=function(e){return e>0},e$.isNeitherLessOrGreaterThan=function(e){return 0===e},e$.greaterThan=1,e$.lessThan=-1,e$.neitherLessOrGreaterThan=0;var eR=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){let e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(i){return new e(e=>this.iterate(r=>!i(r)||e(r)))}map(i){return new e(e=>this.iterate(r=>e(i(r))))}some(e){let i=!1;return this.iterate(r=>!(i=e(r))),i}findFirst(e){let i;return this.iterate(r=>!e(r)||(i=r,!1)),i}findLast(e){let i;return this.iterate(r=>(e(r)&&(i=r),!0)),i}findLastMaxBy(e){let i,r=!0;return this.iterate(n=>((r||eU.isGreaterThan(e(n,i)))&&(r=!1,i=n),!0)),i}};eR.empty=new eR(e=>{});function eT(e){}function eD(e,i){}function eL(e){if(eq.is(e)){let i=[];for(let r of e)if(r)try{r.dispose()}catch(e){i.push(e)}if(1===i.length)throw i[0];if(i.length>1)throw AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function eA(e){let i={dispose:function(e,i){let r=this,n=!1,s;return function(){if(n)return s;if(n=!0,i)try{s=e.apply(r,arguments)}finally{i()}else s=e.apply(r,arguments);return s}}(()=>{eT(i),e()})};return i}(e=>{function i(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=i;let r=Object.freeze([]);function*n(e){yield e}e.empty=function(){return r},e.single=n,e.wrap=function(e){return i(e)?e:n(e)},e.from=function(e){return e||r},e.reverse=function*(e){for(let i=e.length-1;i>=0;i--)yield e[i]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,i){let r=0;for(let n of e)if(i(n,r++))return!0;return!1},e.find=function(e,i){for(let r of e)if(i(r))return r},e.filter=function*(e,i){for(let r of e)i(r)&&(yield r)},e.map=function*(e,i){let r=0;for(let n of e)yield i(n,r++)},e.flatMap=function*(e,i){let r=0;for(let n of e)yield*i(n,r++)},e.concat=function*(...e){for(let i of e)yield*i},e.reduce=function(e,i,r){let n=r;for(let r of e)n=i(n,r);return n},e.slice=function*(e,i,r=e.length){for(i<0&&(i+=e.length),r<0?r+=e.length:r>e.length&&(r=e.length);i<r;i++)yield e[i]},e.consume=function(i,r=1/0){let n=[];if(0===r)return[n,i];let s=i[Symbol.iterator]();for(let i=0;i<r;i++){let i=s.next();if(i.done)return[n,e.empty()];n.push(i.value)}return[n,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let i=[];for await(let r of e)i.push(r);return Promise.resolve(i)}})(eq||={});var eM=class e{constructor(){var e;this._toDispose=new Set,this._isDisposed=!1,e=this}dispose(){this._isDisposed||(eT(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{eL(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw Error("Cannot register a disposable on itself!");return eD(i,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(e){if(e){if(e===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),eD(e,null))}};eM.DISABLE_DISPOSED_WARNING=!1;var eP=eM,eO=class{constructor(){var e;this._store=new eP,e=this,eD(this._store,this)}dispose(){eT(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};eO.None=Object.freeze({dispose(){}});var eB=class{constructor(){var e;this._isDisposed=!1,e=this}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&eD(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,eT(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&eD(e,null),e}},eN="object"==typeof window?window:globalThis,eI=class e{constructor(i){this.element=i,this.next=e.Undefined,this.prev=e.Undefined}};eI.Undefined=new eI(void 0);var eF=class{constructor(){this._first=eI.Undefined,this._last=eI.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===eI.Undefined}clear(){let e=this._first;for(;e!==eI.Undefined;){let i=e.next;e.prev=eI.Undefined,e.next=eI.Undefined,e=i}this._first=eI.Undefined,this._last=eI.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new eI(e);if(this._first===eI.Undefined)this._first=r,this._last=r;else if(i){let e=this._last;this._last=r,r.prev=e,e.next=r}else{let e=this._first;this._first=r,r.next=e,e.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==eI.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==eI.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==eI.Undefined&&e.next!==eI.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===eI.Undefined&&e.next===eI.Undefined?(this._first=eI.Undefined,this._last=eI.Undefined):e.next===eI.Undefined?(this._last=this._last.prev,this._last.next=eI.Undefined):e.prev===eI.Undefined&&(this._first=this._first.next,this._first.prev=eI.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==eI.Undefined;)yield e.element,e=e.next}},ez=globalThis.performance&&"function"==typeof globalThis.performance.now,eH=class e{static create(i){return new e(i)}constructor(e){this._now=ez&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function i(e){}function r(e){return(i,r=null,n)=>{let s=!1,o;return o=e(e=>{if(!s)return o?o.dispose():s=!0,i.call(r,e)},null,n),s&&o.dispose(),o}}function n(e,i,r){return o((r,n=null,s)=>e(e=>r.call(n,i(e)),null,s),r)}function s(e,i,r){return o((r,n=null,s)=>e(e=>i(e)&&r.call(n,e),null,s),r)}function o(e,r){let n,s={onWillAddFirstListener(){n=e(o.fire,o)},onDidRemoveLastListener(){n?.dispose()}};r||i(s);let o=new eQ(s);return r?.add(o),o.event}function a(e,r,n=100,s=!1,o=!1,l,c){let h,u,d,f=0,p,g={leakWarningThreshold:l,onWillAddFirstListener(){h=e(e=>{f++,u=r(u,e),s&&!d&&(m.fire(u),u=void 0),p=()=>{let e=u;u=void 0,d=void 0,(!s||f>1)&&m.fire(e),f=0},"number"==typeof n?(clearTimeout(d),d=setTimeout(p,n)):void 0===d&&(d=0,queueMicrotask(p))})},onWillRemoveListener(){o&&f>0&&p?.()},onDidRemoveLastListener(){p=void 0,h.dispose()}};c||i(g);let m=new eQ(g);return c?.add(m),m.event}e.None=()=>eO.None,e.defer=function(e,i){return a(e,()=>{},0,void 0,!0,void 0,i)},e.once=r,e.map=n,e.forEach=function(e,i,r){return o((r,n=null,s)=>e(e=>{i(e),r.call(n,e)},null,s),r)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(i,r=null,n)=>{var s,o;return s=function(...e){let i=eA(()=>eL(e));return i}(...e.map(e=>e(e=>i.call(r,e)))),(o=n)instanceof Array?o.push(s):o&&o.add(s),s}},e.reduce=function(e,i,r,s){let o=r;return n(e,e=>o=i(o,e),s)},e.debounce=a,e.accumulate=function(i,r=0,n){return e.debounce(i,(e,i)=>e?(e.push(i),e):[i],r,void 0,!0,void 0,n)},e.latch=function(e,i=(e,i)=>e===i,r){let n=!0,o;return s(e,e=>{let r=n||!i(e,o);return n=!1,o=e,r},r)},e.split=function(i,r,n){return[e.filter(i,r,n),e.filter(i,e=>!r(e),n)]},e.buffer=function(e,i=!1,r=[],n){let s=r.slice(),o=e(e=>{s?s.push(e):l.fire(e)});n&&n.add(o);let a=()=>{s?.forEach(e=>l.fire(e)),s=null},l=new eQ({onWillAddFirstListener(){o||(o=e(e=>l.fire(e)),n&&n.add(o))},onDidAddFirstListener(){s&&(i?setTimeout(a):a())},onDidRemoveLastListener(){o&&o.dispose(),o=null}});return n&&n.add(l),l.event},e.chain=function(e,i){return(r,n,s)=>{let o=i(new c);return e(function(e){let i=o.evaluate(e);i!==l&&r.call(n,i)},void 0,s)}};let l=Symbol("HaltChainable");class c{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(i=>(e(i),i)),this}filter(e){return this.steps.push(i=>e(i)?i:l),this}reduce(e,i){let r=i;return this.steps.push(i=>r=e(r,i)),this}latch(e=(e,i)=>e===i){let i=!0,r;return this.steps.push(n=>{let s=i||!e(n,r);return i=!1,r=n,s?n:l}),this}evaluate(e){for(let i of this.steps)if((e=i(e))===l)break;return e}}e.fromNodeEventEmitter=function(e,i,r=e=>e){let n=(...e)=>s.fire(r(...e)),s=new eQ({onWillAddFirstListener:()=>e.on(i,n),onDidRemoveLastListener:()=>e.removeListener(i,n)});return s.event},e.fromDOMEventEmitter=function(e,i,r=e=>e){let n=(...e)=>s.fire(r(...e)),s=new eQ({onWillAddFirstListener:()=>e.addEventListener(i,n),onDidRemoveLastListener:()=>e.removeEventListener(i,n)});return s.event},e.toPromise=function(e){return new Promise(i=>r(e)(i))},e.fromPromise=function(e){let i=new eQ;return e.then(e=>{i.fire(e)},()=>{i.fire(void 0)}).finally(()=>{i.dispose()}),i.event},e.forward=function(e,i){return e(e=>i.fire(e))},e.runAndSubscribe=function(e,i,r){return i(r),e(e=>i(e))};class h{constructor(e,r){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};r||i(n),this.emitter=new eQ(n),r&&r.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,i){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,i){return new h(e,i).emitter.event},e.fromObservableLight=function(e){return(i,r,n)=>{let s=0,o=!1,a={beginUpdate(){s++},endUpdate(){0==--s&&(e.reportChanges(),o&&(o=!1,i.call(r)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();let l={dispose(){e.removeObserver(a)}};return n instanceof eP?n.add(l):Array.isArray(n)&&n.push(l),l}}})(eV||={});var ej=class e{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new eH,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ej.all=new Set,ej._idPool=0;var eW=class e{constructor(i,r,n=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*r;let[e,n]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${n}):`;console.warn(s),console.warn(e);let o=new eX(s,e);this._errorHandler(o)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,n]of this._stacks)(!e||i<n)&&(e=[r,n],i=n);return e}};eW._idPool=1;var e$,eU,eq,eV,eK,eY=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
|
|
20
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function em(e){var i;(i=e)instanceof ev||i instanceof Error&&i.name===e_&&i.message===e_||eg.onUnexpectedError(e)}var e_="Canceled",ev=class extends Error{constructor(){super(e_),this.name=this.message}},ey=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(i){if(i instanceof e)return i;let r=new e;return r.message=i.message,r.stack=i.stack,r}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},eb=class e extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function eS(e,i=0){return e[e.length-(1+i)]}(eF=ez||={}).isLessThan=function(e){return e<0},eF.isLessThanOrEqual=function(e){return e<=0},eF.isGreaterThan=function(e){return e>0},eF.isNeitherLessOrGreaterThan=function(e){return 0===e},eF.greaterThan=1,eF.lessThan=-1,eF.neitherLessOrGreaterThan=0;var ew=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){let e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(i){return new e(e=>this.iterate(r=>!i(r)||e(r)))}map(i){return new e(e=>this.iterate(r=>e(i(r))))}some(e){let i=!1;return this.iterate(r=>!(i=e(r))),i}findFirst(e){let i;return this.iterate(r=>!e(r)||(i=r,!1)),i}findLast(e){let i;return this.iterate(r=>(e(r)&&(i=r),!0)),i}findLastMaxBy(e){let i,r=!0;return this.iterate(n=>((r||ez.isGreaterThan(e(n,i)))&&(r=!1,i=n),!0)),i}};ew.empty=new ew(e=>{});function ex(e){}function eC(e,i){}function ek(e){if(eH.is(e)){let i=[];for(let r of e)if(r)try{r.dispose()}catch(e){i.push(e)}if(1===i.length)throw i[0];if(i.length>1)throw AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function eE(e){let i={dispose:function(e,i){let r=this,n=!1,s;return function(){if(n)return s;if(n=!0,i)try{s=e.apply(r,arguments)}finally{i()}else s=e.apply(r,arguments);return s}}(()=>{ex(i),e()})};return i}(e=>{function i(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=i;let r=Object.freeze([]);function*n(e){yield e}e.empty=function(){return r},e.single=n,e.wrap=function(e){return i(e)?e:n(e)},e.from=function(e){return e||r},e.reverse=function*(e){for(let i=e.length-1;i>=0;i--)yield e[i]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,i){let r=0;for(let n of e)if(i(n,r++))return!0;return!1},e.find=function(e,i){for(let r of e)if(i(r))return r},e.filter=function*(e,i){for(let r of e)i(r)&&(yield r)},e.map=function*(e,i){let r=0;for(let n of e)yield i(n,r++)},e.flatMap=function*(e,i){let r=0;for(let n of e)yield*i(n,r++)},e.concat=function*(...e){for(let i of e)yield*i},e.reduce=function(e,i,r){let n=r;for(let r of e)n=i(n,r);return n},e.slice=function*(e,i,r=e.length){for(i<0&&(i+=e.length),r<0?r+=e.length:r>e.length&&(r=e.length);i<r;i++)yield e[i]},e.consume=function(i,r=1/0){let n=[];if(0===r)return[n,i];let s=i[Symbol.iterator]();for(let i=0;i<r;i++){let i=s.next();if(i.done)return[n,e.empty()];n.push(i.value)}return[n,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let i=[];for await(let r of e)i.push(r);return Promise.resolve(i)}})(eH||={});var eR=class e{constructor(){var e;this._toDispose=new Set,this._isDisposed=!1,e=this}dispose(){this._isDisposed||(ex(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{ek(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw Error("Cannot register a disposable on itself!");return eC(i,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(e){if(e){if(e===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),eC(e,null))}};eR.DISABLE_DISPOSED_WARNING=!1;var eT=eR,eD=class{constructor(){var e;this._store=new eT,e=this,eC(this._store,this)}dispose(){ex(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};eD.None=Object.freeze({dispose(){}});var eL=class{constructor(){var e;this._isDisposed=!1,e=this}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&eC(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ex(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&eC(e,null),e}},eA="object"==typeof window?window:globalThis,eM=class e{constructor(i){this.element=i,this.next=e.Undefined,this.prev=e.Undefined}};eM.Undefined=new eM(void 0);var eP=class{constructor(){this._first=eM.Undefined,this._last=eM.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===eM.Undefined}clear(){let e=this._first;for(;e!==eM.Undefined;){let i=e.next;e.prev=eM.Undefined,e.next=eM.Undefined,e=i}this._first=eM.Undefined,this._last=eM.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new eM(e);if(this._first===eM.Undefined)this._first=r,this._last=r;else if(i){let e=this._last;this._last=r,r.prev=e,e.next=r}else{let e=this._first;this._first=r,r.next=e,e.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==eM.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==eM.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==eM.Undefined&&e.next!==eM.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===eM.Undefined&&e.next===eM.Undefined?(this._first=eM.Undefined,this._last=eM.Undefined):e.next===eM.Undefined?(this._last=this._last.prev,this._last.next=eM.Undefined):e.prev===eM.Undefined&&(this._first=this._first.next,this._first.prev=eM.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==eM.Undefined;)yield e.element,e=e.next}},eO=globalThis.performance&&"function"==typeof globalThis.performance.now,eB=class e{static create(i){return new e(i)}constructor(e){this._now=eO&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function i(e){}function r(e){return(i,r=null,n)=>{let s=!1,o;return o=e(e=>{if(!s)return o?o.dispose():s=!0,i.call(r,e)},null,n),s&&o.dispose(),o}}function n(e,i,r){return o((r,n=null,s)=>e(e=>r.call(n,i(e)),null,s),r)}function s(e,i,r){return o((r,n=null,s)=>e(e=>i(e)&&r.call(n,e),null,s),r)}function o(e,r){let n,s={onWillAddFirstListener(){n=e(o.fire,o)},onDidRemoveLastListener(){n?.dispose()}};r||i(s);let o=new eY(s);return r?.add(o),o.event}function a(e,r,n=100,s=!1,o=!1,l,c){let h,u,d,f=0,p,g={leakWarningThreshold:l,onWillAddFirstListener(){h=e(e=>{f++,u=r(u,e),s&&!d&&(m.fire(u),u=void 0),p=()=>{let e=u;u=void 0,d=void 0,(!s||f>1)&&m.fire(e),f=0},"number"==typeof n?(clearTimeout(d),d=setTimeout(p,n)):void 0===d&&(d=0,queueMicrotask(p))})},onWillRemoveListener(){o&&f>0&&p?.()},onDidRemoveLastListener(){p=void 0,h.dispose()}};c||i(g);let m=new eY(g);return c?.add(m),m.event}e.None=()=>eD.None,e.defer=function(e,i){return a(e,()=>{},0,void 0,!0,void 0,i)},e.once=r,e.map=n,e.forEach=function(e,i,r){return o((r,n=null,s)=>e(e=>{i(e),r.call(n,e)},null,s),r)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(i,r=null,n)=>{var s,o;return s=function(...e){let i=eE(()=>ek(e));return i}(...e.map(e=>e(e=>i.call(r,e)))),(o=n)instanceof Array?o.push(s):o&&o.add(s),s}},e.reduce=function(e,i,r,s){let o=r;return n(e,e=>o=i(o,e),s)},e.debounce=a,e.accumulate=function(i,r=0,n){return e.debounce(i,(e,i)=>e?(e.push(i),e):[i],r,void 0,!0,void 0,n)},e.latch=function(e,i=(e,i)=>e===i,r){let n=!0,o;return s(e,e=>{let r=n||!i(e,o);return n=!1,o=e,r},r)},e.split=function(i,r,n){return[e.filter(i,r,n),e.filter(i,e=>!r(e),n)]},e.buffer=function(e,i=!1,r=[],n){let s=r.slice(),o=e(e=>{s?s.push(e):l.fire(e)});n&&n.add(o);let a=()=>{s?.forEach(e=>l.fire(e)),s=null},l=new eY({onWillAddFirstListener(){o||(o=e(e=>l.fire(e)),n&&n.add(o))},onDidAddFirstListener(){s&&(i?setTimeout(a):a())},onDidRemoveLastListener(){o&&o.dispose(),o=null}});return n&&n.add(l),l.event},e.chain=function(e,i){return(r,n,s)=>{let o=i(new c);return e(function(e){let i=o.evaluate(e);i!==l&&r.call(n,i)},void 0,s)}};let l=Symbol("HaltChainable");class c{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(i=>(e(i),i)),this}filter(e){return this.steps.push(i=>e(i)?i:l),this}reduce(e,i){let r=i;return this.steps.push(i=>r=e(r,i)),this}latch(e=(e,i)=>e===i){let i=!0,r;return this.steps.push(n=>{let s=i||!e(n,r);return i=!1,r=n,s?n:l}),this}evaluate(e){for(let i of this.steps)if((e=i(e))===l)break;return e}}e.fromNodeEventEmitter=function(e,i,r=e=>e){let n=(...e)=>s.fire(r(...e)),s=new eY({onWillAddFirstListener:()=>e.on(i,n),onDidRemoveLastListener:()=>e.removeListener(i,n)});return s.event},e.fromDOMEventEmitter=function(e,i,r=e=>e){let n=(...e)=>s.fire(r(...e)),s=new eY({onWillAddFirstListener:()=>e.addEventListener(i,n),onDidRemoveLastListener:()=>e.removeEventListener(i,n)});return s.event},e.toPromise=function(e){return new Promise(i=>r(e)(i))},e.fromPromise=function(e){let i=new eY;return e.then(e=>{i.fire(e)},()=>{i.fire(void 0)}).finally(()=>{i.dispose()}),i.event},e.forward=function(e,i){return e(e=>i.fire(e))},e.runAndSubscribe=function(e,i,r){return i(r),e(e=>i(e))};class h{constructor(e,r){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};r||i(n),this.emitter=new eY(n),r&&r.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,i){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,i){return new h(e,i).emitter.event},e.fromObservableLight=function(e){return(i,r,n)=>{let s=0,o=!1,a={beginUpdate(){s++},endUpdate(){0==--s&&(e.reportChanges(),o&&(o=!1,i.call(r)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();let l={dispose(){e.removeObserver(a)}};return n instanceof eT?n.add(l):Array.isArray(n)&&n.push(l),l}}})(ej||={});var eN=class e{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new eB,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};eN.all=new Set,eN._idPool=0;var eI=class e{constructor(i,r,n=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*r;let[e,n]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${n}):`;console.warn(s),console.warn(e);let o=new eU(s,e);this._errorHandler(o)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,n]of this._stacks)(!e||i<n)&&(e=[r,n],i=n);return e}};eI._idPool=1;var eF,ez,eH,ej,eW,e$=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
|
|
21
21
|
`).slice(2).join(`
|
|
22
|
-
`))}},
|
|
22
|
+
`))}},eU=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},eq=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},eV=0,eK=class{constructor(e){this.value=e,this.id=eV++}},eY=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new eI(e?.onListenerError??em,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new eN(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,i,r)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let i=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],r=new eq(`${e}. HINT: Stack shows most frequent listener (${i[1]}-times)`,i[0]);return(this._options?.onListenerError||em)(r),eD.None}if(this._disposed)return eD.None;i&&(e=e.bind(i));let n=new eK(e),s;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(n.stack=e$.create(),s=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof eK?(this._deliveryQueue??=new eX,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=eE(()=>{eW?.unregister(o),s?.(),this._removeListener(n)});if(r instanceof eT?r.add(o):Array.isArray(r)&&r.push(o),eW){let e=Error().stack.split(`
|
|
23
23
|
`).slice(2,3).join(`
|
|
24
|
-
`).trim(),i=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);eK.register(o,i?.[2]??e,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(-1===r)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let n=this._deliveryQueue.current===this;if(2*this._size<=i.length){let e=0;for(let r=0;r<i.length;r++)i[r]?i[e++]=i[r]:n&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=e}}_deliver(e,i){if(!e)return;let r=this._options?.onListenerError||eS;try{e.value(i)}catch(e){r(e)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof eZ)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},e0=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},e1=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new eQ,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new eQ,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};e1.INSTANCE=new e1,e1.INSTANCE.onDidChangeZoomLevel,e1.INSTANCE.onDidChangeFullscreen;var e2="object"==typeof navigator?navigator.userAgent:"",e5=e2.indexOf("Firefox")>=0,e3=e2.indexOf("AppleWebKit")>=0,e4=e2.indexOf("Chrome")>=0,e6=!e4&&e2.indexOf("Safari")>=0;e2.indexOf("Electron/"),e2.indexOf("Android");var e9=!1;if("function"==typeof eN.matchMedia){let e=eN.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=eN.matchMedia("(display-mode: fullscreen)");e9=e.matches,e8=e,"string"==typeof e8&&(e8=eN.matchMedia(e8)),e8.addEventListener("change",({matches:e})=>{e9&&i.matches||(e9=e)})}var e8,e7,te,tt=!1,ti=!1,tr=!1,tn=!1,ts=!1,to="en",ta=globalThis;"u">typeof ta.vscode&&"u">typeof ta.vscode.process?te=ta.vscode.process:"u">typeof O.default&&"string"==typeof O.default?.versions?.node&&(te=O.default);var tl="string"==typeof te?.versions?.electron&&te?.type==="renderer";if("object"==typeof te){tt="win32"===te.platform,ti="darwin"===te.platform,(tr="linux"===te.platform)&&te.env.SNAP&&te.env.SNAP_REVISION,te.env.CI||te.env.BUILD_ARTIFACTSTAGINGDIRECTORY,to="en";let e=te.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,to=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}tn=!0}else"object"!=typeof navigator||tl?console.error("Unable to resolve platform."):(tt=(e7=navigator.userAgent).indexOf("Windows")>=0,ti=e7.indexOf("Macintosh")>=0,(e7.indexOf("Macintosh")>=0||e7.indexOf("iPad")>=0||e7.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,tr=e7.indexOf("Linux")>=0,e7?.indexOf("Mobi"),ts=!0,to=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var tc=tt,th=ti,tu=tr,td=tn;ts&&"function"==typeof ta.importScripts&&ta.origin;var tf,tp=e7,tg=to;(tk=tf||={}).value=function(){return tg},tk.isDefaultVariant=function(){return 2===tg.length?"en"===tg:tg.length>=3&&"e"===tg[0]&&"n"===tg[1]&&"-"===tg[2]},tk.isDefault=function(){return"en"===tg};var tm="function"==typeof ta.postMessage&&!ta.importScripts,t_=(()=>{if(tm){let e=[];ta.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,n=e.length;r<n;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let i=0;return r=>{let n=++i;e.push({id:n,callback:r}),ta.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),tv=!!(tp&&tp.indexOf("Chrome")>=0);tp&&tp.indexOf("Firefox"),!tv&&tp&&tp.indexOf("Safari"),tp&&tp.indexOf("Edg/"),tp&&tp.indexOf("Android");var ty="object"==typeof navigator?navigator:{};td||document.queryCommandSupported&&document.queryCommandSupported("copy")||ty&&ty.clipboard&&ty.clipboard.writeText,td||ty&&ty.clipboard&&ty.clipboard.readText,td||e9||ty.keyboard,"ontouchstart"in eN||ty.maxTouchPoints,eN.PointerEvent&&("ontouchstart"in eN||navigator.maxTouchPoints);var tb=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tS=new tb,tw=new tb,tx=new tb,tC=Array(230);(tE=tR||={}).toString=function(e){return tS.keyCodeToStr(e)},tE.fromString=function(e){return tS.strToKeyCode(e)},tE.toUserSettingsUS=function(e){return tw.keyCodeToStr(e)},tE.toUserSettingsGeneral=function(e){return tx.keyCodeToStr(e)},tE.fromUserSettings=function(e){return tw.strToKeyCode(e)||tx.strToKeyCode(e)},tE.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tS.keyCodeToStr(e)};var tk,tE,tR,tT,tD=class e{constructor(e,i,r,n,s){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=n,this.keyCode=s}equals(i){return i instanceof e&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${e}${i}${r}${n}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new tL([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},tL=class{constructor(e){if(0===e.length)throw function(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}("chords");this.chords=e}getHashCode(){let e="";for(let i=0,r=this.chords.length;i<r;i++)0!==i&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}},tA=th?256:2048,tM=th?2048:256,tP=class{constructor(e){this._standardKeyboardEventBrand=!0,this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=function(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return tR.fromString(i)}let i=e.keyCode;if(3===i)return 7;if(e5)switch(i){case 59:return 85;case 60:if(tu)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(th)return 57}else if(e3&&(th&&93===i||!th&&92===i))return 57;return tC[i]||0}(e),this.code=e.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=tA),this.altKey&&(i|=512),this.shiftKey&&(i|=1024),this.metaKey&&(i|=tM),i|=e}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new tD(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},tO=new WeakMap,tB=class{static getSameOriginWindowChain(e){let i=tO.get(e);if(!i){i=[],tO.set(e,i);let r=e,n;do(n=function(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,r=e.parent.location;if("null"!==i.origin&&"null"!==r.origin&&i.origin!==r.origin)return null}catch{return null}return e.parent}(r))?i.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):i.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let r=0,n=0;for(let s of this.getSameOriginWindowChain(e)){let e=s.window.deref();if(r+=e?.scrollY??0,n+=e?.scrollX??0,e===i||!s.iframeElement)break;let o=s.iframeElement.getBoundingClientRect();r+=o.top,n+=o.left}return{top:r,left:n}}},tN=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=0===i.button,this.middleButton=1===i.button,this.rightButton=2===i.button,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,"dblclick"===i.type&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,"number"==typeof i.pageX?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=tB.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},tI=class{constructor(e,i=0,r=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let n=!1;if(e4){let e=navigator.userAgent.match(/Chrome\/(\d+)/);n=(e?parseInt(e[1]):123)<=122}if(e){let i=e.view?.devicePixelRatio||1;"u">typeof e.wheelDeltaY?n?this.deltaY=e.wheelDeltaY/(120*i):this.deltaY=e.wheelDeltaY/120:"u">typeof e.VERTICAL_AXIS&&e.axis===e.VERTICAL_AXIS?this.deltaY=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?e5&&!th?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40),"u">typeof e.wheelDeltaX?e6&&tc?this.deltaX=-(e.wheelDeltaX/120):n?this.deltaX=e.wheelDeltaX/(120*i):this.deltaX=e.wheelDeltaX/120:"u">typeof e.HORIZONTAL_AXIS&&e.axis===e.HORIZONTAL_AXIS?this.deltaX=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?e5&&!th?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40),0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},tF=Object.freeze(function(e,i){let r=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(r)}}});(iL=tT||={}).isCancellationToken=function(e){return e===iL.None||e===iL.Cancelled||e instanceof tz||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},iL.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:eV.None}),iL.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tF});var tz=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?tF:(this._emitter||(this._emitter=new eQ),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay");var tH=class{constructor(e,i){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof i&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new ek("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new ek("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},tj=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new ek("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},i);this.disposable=eA(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(iA=iM||={}).settled=async function(e){let i,r=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return r},iA.withAsyncBody=function(e){return new Promise(async(i,r)=>{try{await e(i,r)}catch(e){r(e)}})};var tW=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new eQ,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await eV.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,r){return new e(async e=>{for await(let n of i)e.emitOne(r(n))})}map(i){return e.map(this,i)}static filter(i,r){return new e(async e=>{for await(let n of i)r(n)&&e.emitOne(n)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};tW.EMPTY=tW.fromArray([]);function t$(e,i){return(i<<5)-i+e|0}function tU(e,i){i=t$(149417,i);for(let r=0,n=e.length;r<n;r++)i=t$(e.charCodeAt(r),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:tq,getWindow:tV,getDocument:tK,getWindows:tY,getWindowsCount:tX,getWindowId:tG,getWindowById:tJ,hasWindow:tZ,onDidRegisterWindow:tQ,onWillUnregisterWindow:t0,onDidUnregisterWindow:t1}=(n=new Map,s={window:eN,disposables:new eP},n.set(eN.vscodeWindowId,s),o=new eQ,a=new eQ,l=new eQ,{onDidRegisterWindow:o.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:a.event,registerWindow(e){if(n.has(e.vscodeWindowId))return eO.None;let i=new eP,r={window:e,disposables:i.add(new eP)};return n.set(e.vscodeWindowId,r),i.add(eA(()=>{n.delete(e.vscodeWindowId),a.fire(e)})),i.add(t5(e,t8.BEFORE_UNLOAD,()=>{l.fire(e)})),o.fire(r),i},getWindows:()=>n.values(),getWindowsCount:()=>n.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>n.has(e),getWindowById:function(e,i){return("number"==typeof e?n.get(e):void 0)??(i?s:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:eN,getDocument:e=>tV(e).document}),t2=class{constructor(e,i,r,n){this._node=e,this._type=i,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function t5(e,i,r,n){return new t2(e,i,r,n)}var t3=function(e,i,r,n){var s;let o=r;return"click"===i||"mousedown"===i||"contextmenu"===i?(s=tV(e),o=function(e){return r(new tN(s,e))}):("keydown"===i||"keypress"===i||"keyup"===i)&&(o=function(e){return r(new tP(e))}),t5(e,i,o,n)},t4=class extends tj{constructor(e){super(),this.defaultTarget=e&&tV(e)}cancelAndSet(e,i,r){return super.cancelAndSet(e,i,r??this.defaultTarget)}},t6=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){eS(e)}}static sort(e,i){return i.priority-e.priority}};c=new Map,h=new Map,u=new Map,d=new Map,iP=(e,i,r=0)=>{let n=tG(e),s=new t6(i,r),o=c.get(n);return o||(o=[],c.set(n,o)),o.push(s),u.get(n)||(u.set(n,!0),e.requestAnimationFrame(()=>(e=>{u.set(e,!1);let i=c.get(e)??[];for(h.set(e,i),c.set(e,[]),d.set(e,!0);i.length>0;)i.sort(t6.sort),i.shift().execute();d.set(e,!1)})(n))),s};var t9=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,r=this.height){return i!==this.width||r!==this.height?new e(i,r):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};t9.None=new t9(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,r){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let s=function e(i,r){switch(typeof i){case"object":var n,s,o,a;return null===i?t$(349,r):Array.isArray(i)?(n=i,s=t$(104579,s=r),n.reduce((i,r)=>e(r,i),s)):(o=i,a=t$(181387,a=r),Object.keys(o).sort().reduce((i,r)=>(i=tU(r,i),e(o[r],i)),a));case"string":return tU(i,r);case"boolean":return t$(i?433:863,r);case"number":return t$(i,r);case"undefined":return t$(937,r);default:return t$(617,r)}}(r,0),o=n.get(s);if(o)o.users+=1;else{let a=new eQ,l=new MutationObserver(e=>a.fire(e));l.observe(e,r);let c=o={users:1,observer:l,onDidMutate:a.event};i.add(eA(()=>{c.users-=1,0===c.users&&(a.dispose(),l.disconnect(),n?.delete(s),n?.size===0&&this.mutationObservers.delete(e))})),n.set(s,o)}return o.onDidMutate}};var t8={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},t7=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let i=ie(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=ie(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=ie(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=ie(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=ie(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=ie(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=ie(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=ie(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=ie(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=ie(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=ie(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=ie(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=ie(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=ie(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ie(e){return"number"==typeof e?`${e}px`:e}function it(e){return new t7(e)}var ii=class{constructor(){this._hooks=new eP,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,n,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=s;let o=e;try{e.setPointerCapture(i),this._hooks.add(eA(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=tV(e)}this._hooks.add(t5(o,t8.POINTER_MOVE,e=>{e.buttons!==r?this.stopMonitoring(!0):(e.preventDefault(),this._pointerMoveCallback(e))})),this._hooks.add(t5(o,t8.POINTER_UP,e=>this.stopMonitoring(!0)))}};(f=iO||={}).Tap="-xterm-gesturetap",f.Change="-xterm-gesturechange",f.Start="-xterm-gesturestart",f.End="-xterm-gesturesend",f.Contextmenu="-xterm-gesturecontextmenu";var ir=class e extends eO{constructor(){super(),this.dispatched=!1,this.targets=new eF,this.ignoreTargets=new eF,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(eV.runAndSubscribe(tQ,({window:e,disposables:i})=>{i.add(t5(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),i.add(t5(e.document,"touchend",i=>this.onTouchEnd(e,i))),i.add(t5(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:eN,disposables:this._store}))}static addTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eA(e.INSTANCE.targets.push(i))):eO.None}static ignoreTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eA(e.INSTANCE.ignoreTargets.push(i))):eO.None}static isTouchDevice(){return"ontouchstart"in eN||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,n=e.targetTouches.length;r<n;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let s=this.newGestureEvent(iO.Start,n.target);s.pageX=n.pageX,s.pageY=n.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,r){let n=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,a=r.changedTouches.length;o<a;o++){let a=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<e.HOLD_DELAY&&30>Math.abs(l.initialPageX-eE(l.rollingPageX))&&30>Math.abs(l.initialPageY-eE(l.rollingPageY))){let e=this.newGestureEvent(iO.Tap,l.initialTarget);e.pageX=eE(l.rollingPageX),e.pageY=eE(l.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&30>Math.abs(l.initialPageX-eE(l.rollingPageX))&&30>Math.abs(l.initialPageY-eE(l.rollingPageY))){let e=this.newGestureEvent(iO.Contextmenu,l.initialTarget);e.pageX=eE(l.rollingPageX),e.pageY=eE(l.rollingPageY),this.dispatchEvent(e)}else if(1===s){let e=eE(l.rollingPageX),r=eE(l.rollingPageY),s=eE(l.rollingTimestamps)-l.rollingTimestamps[0],o=e-l.rollingPageX[0],a=r-l.rollingPageY[0],c=[...this.targets].filter(e=>l.initialTarget instanceof Node&&e.contains(l.initialTarget));this.inertia(i,c,n,Math.abs(o)/s,o>0?1:-1,e,Math.abs(a)/s,a>0?1:-1,r)}this.dispatchEvent(this.newGestureEvent(iO.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(i){if(i.type===iO.Tap){let r=new Date().getTime(),n=0;n=r-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=r,i.tapCount=n}else(i.type===iO.Change||i.type===iO.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(i.initialTarget))return;let e=[];for(let r of this.targets)if(r.contains(i.initialTarget)){let n=0,s=i.initialTarget;for(;s&&s!==r;)n++,s=s.parentElement;e.push([n,r])}for(let[r,n]of(e.sort((e,i)=>e[0]-i[0]),e))n.dispatchEvent(i),this.dispatched=!0}}inertia(i,r,n,s,o,a,l,c,h){this.handle=iP(i,()=>{let u=Date.now(),d=u-n,f=0,p=0,g=!0;s+=e.SCROLL_FRICTION*d,l+=e.SCROLL_FRICTION*d,s>0&&(g=!1,f=o*s*d),l>0&&(g=!1,p=c*l*d);let m=this.newGestureEvent(iO.Change);m.translationX=f,m.translationY=p,r.forEach(e=>e.dispatchEvent(m)),g||this.inertia(i,r,u,s,o,a+f,l,c,h+p)})}onTouchMove(e){let i=Date.now();for(let r=0,n=e.changedTouches.length;r<n;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let s=this.activeTouches[n.identifier],o=this.newGestureEvent(iO.Change,s.initialTarget);o.translationX=n.pageX-eE(s.rollingPageX),o.translationY=n.pageY-eE(s.rollingPageY),o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(n.pageX),s.rollingPageY.push(n.pageY),s.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};ir.SCROLL_FRICTION=-.005,ir.HOLD_DELAY=700,ir.CLEAR_TAP_COUNT_TIME=400,I([function(e,i,r){let n=null,s=null;if("function"==typeof r.value?(n="value",0!==(s=r.value).length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof r.get&&(n="get",s=r.get),!s)throw Error("not supported");let o=`$memoize$${i}`;r[n]=function(...e){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,e)}),this[o]}}],ir,"isTouchDevice",1);var is=class extends eO{onclick(e,i){this._register(t5(e,t8.CLICK,r=>i(new tN(tV(e),r))))}onmousedown(e,i){this._register(t5(e,t8.MOUSE_DOWN,r=>i(new tN(tV(e),r))))}onmouseover(e,i){this._register(t5(e,t8.MOUSE_OVER,r=>i(new tN(tV(e),r))))}onmouseleave(e,i){this._register(t5(e,t8.MOUSE_LEAVE,r=>i(new tN(tV(e),r))))}onkeydown(e,i){this._register(t5(e,t8.KEY_DOWN,e=>i(new tP(e))))}onkeyup(e,i){this._register(t5(e,t8.KEY_UP,e=>i(new tP(e))))}oninput(e,i){this._register(t5(e,t8.INPUT,i))}onblur(e,i){this._register(t5(e,t8.BLUR,i))}onfocus(e,i){this._register(t5(e,t8.FOCUS,i))}onchange(e,i){this._register(t5(e,t8.CHANGE,i))}ignoreGesture(e){return ir.ignoreTarget(e)}},io=class extends is{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px","u">typeof e.top&&(this.bgDomNode.style.top="0px"),"u">typeof e.left&&(this.bgDomNode.style.left="0px"),"u">typeof e.bottom&&(this.bgDomNode.style.bottom="0px"),"u">typeof e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px","u">typeof e.top&&(this.domNode.style.top=e.top+"px"),"u">typeof e.left&&(this.domNode.style.left=e.left+"px"),"u">typeof e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),"u">typeof e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ii),this._register(t3(this.bgDomNode,t8.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(t3(this.domNode,t8.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new t4),this._pointerdownScheduleRepeatTimer=this._register(new tH)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,tV(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ia=class e{constructor(e,i,r,n,s,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i|=0,r|=0,n|=0,s|=0,o|=0,a|=0),this.rawScrollLeft=n,this.rawScrollTop=a,i<0&&(i=0),n+i>r&&(n=r-i),n<0&&(n=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=n,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(i,r){return new e(this._forceIntegerValues,"u">typeof i.width?i.width:this.width,"u">typeof i.scrollWidth?i.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,"u">typeof i.height?i.height:this.height,"u">typeof i.scrollHeight?i.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new e(this._forceIntegerValues,this.width,this.scrollWidth,"u">typeof i.scrollLeft?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,"u">typeof i.scrollTop?i.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},il=class extends eO{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new eQ),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ia(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){let r;e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;r=i?new iu(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=iu.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},ic=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function ih(e,i){let r=i-e;return function(i){return e+r*(1-Math.pow(1-i,3))}}var iu=class e{constructor(e,i,r,n){this.from=e,this.to=i,this.duration=n,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){var n,s;let o,a;return e<i?(o=e+.75*r,a=i-.75*r):(o=e-.75*r,a=i+.75*r),n=ih(e,o),s=ih(a,i),function(e){return e<.33?n(e/.33):s((e-.33)/(1-.33))}}return ih(e,i)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;return i<1?new ic(this.scrollLeft(i),this.scrollTop(i),!1):new ic(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,r,n){return e.start(i,r,n)}static start(i,r,n){return n+=10,new e(i,r,Date.now()-10,n)}},id=class extends eO{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new tH)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},ip=class extends is{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new id(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ii),this._shouldRender=!0,this.domNode=it(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(t5(this.domNode.domNode,t8.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let i=this._register(new io(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,n){this.slider=it(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),"number"==typeof r&&this.slider.setWidth(r),"number"==typeof n&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(t5(this.slider.domNode,t8.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),n=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=n?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)i=e.offsetX,r=e.offsetY;else{var n;let s,o,a=(s=(n=this.domNode.domNode).getBoundingClientRect(),o=tV(n),{left:s.left+o.scrollX,top:s.top+o.scrollY,width:s.width,height:s.height});i=e.pageX-a.left,r=e.pageY-a.top}let s=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let s=Math.abs(this._sliderOrthogonalPointerPosition(e)-r);if(tc&&s>140)return void this._setDesiredScrollPositionNow(n.getScrollPosition());let o=this._sliderPointerPosition(e)-i;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},ig=class e{constructor(e,i,r,n,s,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i&&(this._visibleSize=i,this._refreshComputedValues(),!0)}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i&&(this._scrollSize=i,this._refreshComputedValues(),!0)}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i&&(this._scrollPosition=i,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,n,s){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),l=n>0&&n>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/n))),h=(a-c)/(n-r);return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(s*h)}}_refreshComputedValues(){let i=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){return this._computedIsNeeded?Math.round((e-this._arrowSize-this._computedSliderSize/2)/this._computedSliderRatio):0}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){return this._computedIsNeeded?Math.round((this._computedSliderPosition+e)/this._computedSliderRatio):0}},im=class extends ip{constructor(e,i,r){let n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ig(i.horizontalHasArrows?i.arrowSize:0,2===i.horizontal?0:i.horizontalScrollbarSize,2===i.vertical?0:i.verticalScrollbarSize,n.width,n.scrollWidth,s.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},i_=class extends ip{constructor(e,i,r){let n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ig(i.verticalHasArrows?i.arrowSize:0,2===i.vertical?0:i.verticalScrollbarSize,0,n.height,n.scrollHeight,s.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},iv=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},iy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,i=0,r=1,n=this._rear;for(;;){let s=n===this._front?e:Math.pow(2,-r);if(e-=s,i+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,r++}return i<=.5}acceptStandardWheelEvent(e){if(e4){var i;let r=(i=tV(e.browserEvent),e1.INSTANCE.getZoomFactor(i));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let n=null,s=new iv(e,i,r);-1===this._front&&-1===this._rear?(this._memory[0]=s,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,n)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(r+=.25),i){let n=Math.abs(e.deltaX),s=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(n,o),1),c=Math.max(Math.min(s,a),1),h=Math.max(s,a);Math.max(n,o)%l==0&&h%c==0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return .01>Math.abs(Math.round(e)-e)}};iy.INSTANCE=new iy;var ib=class extends is{constructor(e,i,r){super(),this._onScroll=this._register(new eQ),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new eQ),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let i={lazyRender:"u">typeof e.lazyRender&&e.lazyRender,className:"u">typeof e.className?e.className:"",useShadows:!("u">typeof e.useShadows)||e.useShadows,handleMouseWheel:!("u">typeof e.handleMouseWheel)||e.handleMouseWheel,flipAxes:"u">typeof e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:"u">typeof e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:"u">typeof e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:"u">typeof e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:"u">typeof e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:"u">typeof e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:!("u">typeof e.scrollPredominantAxis)||e.scrollPredominantAxis,mouseWheelSmoothScroll:!("u">typeof e.mouseWheelSmoothScroll)||e.mouseWheelSmoothScroll,arrowSize:"u">typeof e.arrowSize?e.arrowSize:11,listenOnDomNode:"u">typeof e.listenOnDomNode?e.listenOnDomNode:null,horizontal:"u">typeof e.horizontal?e.horizontal:1,horizontalScrollbarSize:"u">typeof e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:"u">typeof e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:"u">typeof e.horizontalHasArrows&&e.horizontalHasArrows,vertical:"u">typeof e.vertical?e.vertical:1,verticalScrollbarSize:"u">typeof e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:"u">typeof e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:"u">typeof e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:"u">typeof e.scrollByPage&&e.scrollByPage};return i.horizontalSliderSize="u">typeof e.horizontalSliderSize?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize="u">typeof e.verticalSliderSize?e.verticalSliderSize:i.verticalScrollbarSize,th&&(i.className+=" mac"),i}(i),this._scrollable=r,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let n={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new i_(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new im(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=it(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=it(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=it(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new tH),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=eL(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,th&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){"u">typeof e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),"u">typeof e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),"u">typeof e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),"u">typeof e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),"u">typeof e.horizontal&&(this._options.horizontal=e.horizontal),"u">typeof e.vertical&&(this._options.vertical=e.vertical),"u">typeof e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),"u">typeof e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),"u">typeof e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new tI(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=eL(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new tI(e))};this._mouseWheelToDispose.push(t5(this._listenOnDomNode,t8.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=iy.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+n===0?s=n=0:Math.abs(n)>=Math.abs(s)?s=0:n=0),this._options.flipAxes&&([n,s]=[s,n]);let o=!th&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!s&&(s=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,n*=this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(n){let e=50*n,i=a.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(l,i)}if(s){let e=50*s,i=a.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(l,i)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",s=i?" top":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${r||i?" top-left-corner":""}${s}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet(()=>this._hide(),500)}},iS=class extends ib{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},iw=class extends eO{constructor(e,i,r,n,s,o,a,l){super(),this._bufferService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new eQ),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new il({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>iP(n.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new iS(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(eV.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(eA(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(eA(()=>this._styleElement.remove())),this._register(eV.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
25
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;0!==r&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};iw=I([F(2,et),F(3,ef),F(4,ei),F(5,ev),F(6,ea),F(7,eg)],iw);var ix=class extends eO{constructor(e,i,r,n,s){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=n,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(eA(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;"right"===(e.options.anchor||"left")?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};ix=I([F(1,et),F(2,ef),F(3,eh),F(4,eg)],ix);var iC=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(i,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},ik={full:0,left:0,center:0,right:0},iE={full:0,left:0,center:0,right:0},iR={full:0,left:0,center:0,right:0},iT=class extends eO{constructor(e,i,r,n,s,o,a,l){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=n,this._renderService=s,this._optionsService=o,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new iC,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(eA(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);iE.full=this._canvas.width,iE.left=e,iE.center=i,iE.right=e,this._refreshDrawHeightConstants(),iR.full=1,iR.left=1,iR.center=1+iE.left,iR.right=1+iE.left+iE.center}_refreshDrawHeightConstants(){ik.full=Math.round(2*this._coreBrowserService.dpr);let e=Math.round(Math.max(Math.min(this._canvas.height/this._bufferService.buffer.lines.length,12),6)*this._coreBrowserService.dpr);ik.left=e,ik.center=e,ik.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ik.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ik.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ik.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ik.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(){for(let e of(this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear(),this._decorationService.decorations))this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)"full"!==i.position&&this._renderColorZone(i);for(let i of e)"full"===i.position&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(iR[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ik[e.position||"full"]/2),iE[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ik[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};iT=I([F(2,et),F(3,eh),F(4,eg),F(5,ea),F(6,ev),F(7,ef)],iT),(p=iB||={}).NUL="\0",p.SOH="\x01",p.STX="\x02",p.ETX="\x03",p.EOT="\x04",p.ENQ="\x05",p.ACK="\x06",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
|
|
26
|
-
`,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="\x0e",p.SI="\x0f",p.DLE="\x10",p.DC1="\x11",p.DC2="\x12",p.DC3="\x13",p.DC4="\x14",p.NAK="\x15",p.SYN="\x16",p.ETB="\x17",p.CAN="\x18",p.EM="\x19",p.SUB="\x1a",p.ESC="\x1b",p.FS="\x1c",p.GS="\x1d",p.RS="\x1e",p.US="\x1f",p.SP=" ",p.DEL="",(g=iN||={}).PAD="",g.HOP="",g.BPH="",g.NBH="",g.IND="",g.NEL="
",g.SSA="",g.ESA="",g.HTS="",g.HTJ="",g.VTS="",g.PLD="",g.PLU="",g.RI="",g.SS2="",g.SS3="",g.DCS="",g.PU1="",g.PU2="",g.STS="",g.CCH="",g.MW="",g.SPA="",g.EPA="",g.SOS="",g.SGCI="",g.SCI="",g.CSI="",g.ST="",g.OSC="",g.PM="",g.APC="",(iI||={}).ST=`${iB.ESC}\\`;var iD=class{constructor(e,i,r,n,s,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=n,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,(i=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start)).length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${iB.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};iD=I([F(2,et),F(3,ea),F(4,er),F(5,eg)],iD);var iL,iA,iM,iP,iO,iB,iN,iI,iF,iz=0,iH=0,ij=0,iW=0,i$={css:"#00000000",rgba:0};(nv=iF||={}).toCss=function(e,i,r,n){return void 0!==n?`#${iJ(e)}${iJ(i)}${iJ(r)}${iJ(n)}`:`#${iJ(e)}${iJ(i)}${iJ(r)}`},nv.toRgba=function(e,i,r,n=255){return(e<<24|i<<16|r<<8|n)>>>0},nv.toColor=function(e,i,r,n){return{css:nv.toCss(e,i,r,n),rgba:nv.toRgba(e,i,r,n)}};var iU=ny||={};function iq(e,i){return iW=Math.round(255*i),[iz,iH,ij]=nw.toChannels(e.rgba),{css:iF.toCss(iz,iH,ij,iW),rgba:iF.toRgba(iz,iH,ij,iW)}}iU.blend=function(e,i){if(1==(iW=(255&i.rgba)/255))return{css:i.css,rgba:i.rgba};let r=i.rgba>>24&255,n=i.rgba>>16&255,s=i.rgba>>8&255,o=e.rgba>>24&255,a=e.rgba>>16&255,l=e.rgba>>8&255;return iz=o+Math.round((r-o)*iW),iH=a+Math.round((n-a)*iW),ij=l+Math.round((s-l)*iW),{css:iF.toCss(iz,iH,ij),rgba:iF.toRgba(iz,iH,ij)}},iU.isOpaque=function(e){return(255&e.rgba)==255},iU.ensureContrastRatio=function(e,i,r){let n=nw.ensureContrastRatio(e.rgba,i.rgba,r);if(n)return iF.toColor(n>>24&255,n>>16&255,n>>8&255)},iU.opaque=function(e){let i=(255|e.rgba)>>>0;return[iz,iH,ij]=nw.toChannels(i),{css:iF.toCss(iz,iH,ij),rgba:i}},iU.opacity=iq,iU.multiplyOpacity=function(e,i){return iW=255&e.rgba,iq(e,iW*i/255)},iU.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let i,r;try{let e=document.createElement("canvas");e.width=1,e.height=1;let n=e.getContext("2d",{willReadFrequently:!0});n&&((i=n).globalCompositeOperation="copy",r=i.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return iz=parseInt(e.slice(1,2).repeat(2),16),iH=parseInt(e.slice(2,3).repeat(2),16),ij=parseInt(e.slice(3,4).repeat(2),16),iF.toColor(iz,iH,ij);case 5:return iz=parseInt(e.slice(1,2).repeat(2),16),iH=parseInt(e.slice(2,3).repeat(2),16),ij=parseInt(e.slice(3,4).repeat(2),16),iW=parseInt(e.slice(4,5).repeat(2),16),iF.toColor(iz,iH,ij,iW);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let n=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return iz=parseInt(n[1]),iH=parseInt(n[2]),ij=parseInt(n[3]),iW=Math.round((void 0===n[5]?1:parseFloat(n[5]))*255),iF.toColor(iz,iH,ij,iW);if(!i||!r||(i.fillStyle=r,i.fillStyle=e,"string"!=typeof i.fillStyle)||(i.fillRect(0,0,1,1),[iz,iH,ij,iW]=i.getImageData(0,0,1,1).data,255!==iW))throw Error("css.toColor: Unsupported css format");return{rgba:iF.toRgba(iz,iH,ij,iW),css:e}}})(nb||={});var iV=nS||={};function iK(e,i,r){let n=e/255,s=i/255,o=r/255;return .2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}iV.relativeLuminance=function(e){return iK(e>>16&255,e>>8&255,255&e)},iV.relativeLuminance2=iK;var iY=nw||={};function iX(e,i,r){let n=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,h=iZ(nS.relativeLuminance2(a,l,c),nS.relativeLuminance2(n,s,o));for(;h<r&&(a>0||l>0||c>0);)a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c-=Math.max(0,Math.ceil(.1*c)),h=iZ(nS.relativeLuminance2(a,l,c),nS.relativeLuminance2(n,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function iG(e,i,r){let n=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,h=iZ(nS.relativeLuminance2(a,l,c),nS.relativeLuminance2(n,s,o));for(;h<r&&(a<255||l<255||c<255);)a=Math.min(255,a+Math.ceil((255-a)*.1)),l=Math.min(255,l+Math.ceil((255-l)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),h=iZ(nS.relativeLuminance2(a,l,c),nS.relativeLuminance2(n,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function iJ(e){let i=e.toString(16);return i.length<2?"0"+i:i}function iZ(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}iY.blend=function(e,i){if(1==(iW=(255&i)/255))return i;let r=e>>24&255,n=e>>16&255,s=e>>8&255;return iz=r+Math.round(((i>>24&255)-r)*iW),iH=n+Math.round(((i>>16&255)-n)*iW),ij=s+Math.round(((i>>8&255)-s)*iW),iF.toRgba(iz,iH,ij)},iY.ensureContrastRatio=function(e,i,r){let n=nS.relativeLuminance(e>>8),s=nS.relativeLuminance(i>>8);if(iZ(n,s)<r){if(s<n){let s=iX(e,i,r),o=iZ(n,nS.relativeLuminance(s>>8));if(o<r){let a=iG(e,i,r);return o>iZ(n,nS.relativeLuminance(a>>8))?s:a}return s}let o=iG(e,i,r),a=iZ(n,nS.relativeLuminance(o>>8));if(a<r){let s=iX(e,i,r);return a>iZ(n,nS.relativeLuminance(s>>8))?o:s}return o}},iY.reduceLuminance=iX,iY.increaseLuminance=iG,iY.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var iQ=class extends Y{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},i0=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new G}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||0===i.length)return[];let r=[],n=i.translateToString(!0),s=0,o=0,a=0,l=i.getFg(0),c=i.getBg(0);for(let e=0;e<i.getTrimmedLength();e++)if(i.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(e-s>1){let e=this._getJoinedRanges(n,a,o,i,s);for(let i=0;i<e.length;i++)r.push(e[i])}s=e,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(this._bufferService.cols-s>1){let e=this._getJoinedRanges(n,a,o,i,s);for(let i=0;i<e.length;i++)r.push(e[i])}return r}_getJoinedRanges(e,i,r,n,s){let o=e.substring(i,r),a=[];try{a=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let i=this._characterJoiners[e].handler(o);for(let e=0;e<i.length;e++)i0._mergeRanges(a,i[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,n,s),a}_stringRangesToCellRanges(e,i,r){let n=0,s=!1,o=0,a=e[0];if(a){for(let l=r;l<this._bufferService.cols;l++){let r=i.getWidth(l),c=i.getString(l).length||1;if(0!==r){if(!s&&a[0]<=o&&(a[0]=l,s=!0),a[1]<=o){if(a[1]=l,!(a=e[++n]))break;a[0]<=o?(a[0]=l,s=!0):s=!1}o+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let r=!1;for(let n=0;n<e.length;n++){let s=e[n];if(r){if(i[1]<=s[0])return e[n-1][1]=i[1],e;if(i[1]<=s[1])return e[n-1][1]=Math.max(i[1],s[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(i[1]<=s[0])return e.splice(n,0,i),e;if(i[1]<=s[1])return s[0]=Math.min(i[0],s[0]),e;i[0]<s[1]&&(s[0]=Math.min(i[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=i[1]:e.push(i),e}};function i1(){return{width:0,height:0}}i0=I([F(0,et)],i0);var i2=class{constructor(e,i,r,n,s,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=n,this._coreService=s,this._decorationService=o,this._themeService=a,this._workCell=new G,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,n,s,o,a,l,c,h,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,g=e.getNoBgTrimmedLength();r&&g<o+1&&(g=o+1);let m,_=0,v="",y=0,b=0,S=0,w=0,x=!1,C=0,k=!1,E=0,R=0,T=[],D=-1!==h&&-1!==u;for(let L=0;L<g;L++){let g;e.loadCell(L,this._workCell);let A=this._workCell.getWidth();if(0===A)continue;let M=!1,P=L>=R,O=L,B=this._workCell;if(f.length>0&&L===f[0][0]&&P){let n=f.shift(),s=this._isCellInSelection(n[0],i);for(y=n[0]+1;y<n[1];y++)P&&=s===this._isCellInSelection(y,i);(P&&=!r||o<n[0]||o>=n[1])?(M=!0,B=new iQ(this._workCell,e.translateToString(!0,n[0],n[1]),n[1]-n[0]),O=n[1]-1,A=B.getWidth()):R=n[1]}let N=this._isCellInSelection(L,i),I=r&&L===o,F=D&&L>=h&&L<=u,z=!1;this._decorationService.forEachDecorationAtCell(L,i,void 0,e=>{z=!0});let H=B.getChars()||" ";if(" "===H&&(B.isUnderline()||B.isOverline())&&(H=" "),E=A*l-c.get(H,B.isBold(),B.isItalic()),m)if(_&&(N&&k||!N&&!k&&B.bg===b)&&(N&&k&&p.selectionForeground||B.fg===S)&&B.extended.ext===w&&F===x&&E===C&&!I&&!M&&!z&&P){B.isInvisible()?v+=" ":v+=H,_++;continue}else _&&(m.textContent=v),m=this._document.createElement("span"),_=0,v="";else m=this._document.createElement("span");if(b=B.bg,S=B.fg,w=B.extended.ext,x=F,C=E,k=N,M&&o>=L&&o<=O&&(o=L),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized){if(T.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&T.push("xterm-cursor-blink"),T.push("bar"===n?"xterm-cursor-bar":"underline"===n?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":T.push("xterm-cursor-outline");break;case"block":T.push("xterm-cursor-block");break;case"bar":T.push("xterm-cursor-bar");break;case"underline":T.push("xterm-cursor-underline")}}if(B.isBold()&&T.push("xterm-bold"),B.isItalic()&&T.push("xterm-italic"),B.isDim()&&T.push("xterm-dim"),v=B.isInvisible()?" ":B.getChars()||" ",B.isUnderline()&&(T.push(`xterm-underline-${B.extended.underlineStyle}`)," "===v&&(v=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${Y.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let e=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=p.ansi[e].css}B.isOverline()&&(T.push("xterm-overline")," "===v&&(v=" ")),B.isStrikethrough()&&T.push("xterm-strikethrough"),F&&(m.style.textDecoration="underline");let j=B.getFgColor(),W=B.getFgColorMode(),$=B.getBgColor(),U=B.getBgColorMode(),q=!!B.isInverse();if(q){let e=j;j=$,$=e;let i=W;W=U,U=i}let V,K,X=!1;switch(this._decorationService.forEachDecorationAtCell(L,i,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(U=0x3000000,$=e.backgroundColorRGB.rgba>>8&0xffffff,V=e.backgroundColorRGB),e.foregroundColorRGB&&(W=0x3000000,j=e.foregroundColorRGB.rgba>>8&0xffffff,K=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&N&&($=(V=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff,U=0x3000000,X=!0,p.selectionForeground&&(W=0x3000000,j=p.selectionForeground.rgba>>8&0xffffff,K=p.selectionForeground)),X&&T.push("xterm-decoration-top"),U){case 0x1000000:case 0x2000000:g=p.ansi[$],T.push(`xterm-bg-${$}`);break;case 0x3000000:g=iF.toColor($>>16,$>>8&255,255&$),this._addStyle(m,`background-color:#${i5(($>>>0).toString(16),"0",6)}`);break;default:q?(g=p.foreground,T.push("xterm-bg-257")):g=p.background}switch(V||B.isDim()&&(V=ny.multiplyOpacity(g,.5)),W){case 0x1000000:case 0x2000000:B.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(m,g,p.ansi[j],B,V,void 0)||T.push(`xterm-fg-${j}`);break;case 0x3000000:let G=iF.toColor(j>>16&255,j>>8&255,255&j);this._applyMinimumContrast(m,g,G,B,V,K)||this._addStyle(m,`color:#${i5(j.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(m,g,p.foreground,B,V,K)||q&&T.push("xterm-fg-257")}T.length&&(m.className=T.join(" "),T.length=0),I||M||z||!P?m.textContent=v:_++,E!==this.defaultSpacing&&(m.style.letterSpacing=`${E}px`),d.push(m),L=O}return m&&_&&(m.textContent=v),d}_applyMinimumContrast(e,i,r,n,s,o){var a,l,c;if(1===this._optionsService.rawOptions.minimumContrastRatio||57508<=(l=a=n.getCode())&&l<=57558||9472<=(c=a)&&c<=9631)return!1;let h=this._getContrastCache(n),u;if(s||o||(u=h.getColor(i.rgba,r.rgba)),void 0===u){let e=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);u=ny.ensureContrastRatio(s||i,o||r,e),h.setColor((s||i).rgba,(o||r).rgba,u??null)}return!!u&&(this._addStyle(e,`color:${u.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,n=this._selectionEnd;return!!r&&!!n&&(this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&i>=r[1]&&e<n[0]&&i<=n[1]:e<r[0]&&i>=r[1]&&e>=n[0]&&i<=n[1]:i>r[1]&&i<n[1]||r[1]===n[1]&&i===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&i===n[1]&&e<n[0]||r[1]<n[1]&&i===r[1]&&e>=r[0])}};function i5(e,i,r){for(;e.length<r;)e=i+e;return e}i2=I([F(1,e_),F(2,ea),F(3,ef),F(4,er),F(5,eh),F(6,ev)],i2);var i3=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,n,s,o],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,r,n){e===this._font&&i===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,i,r){let n=0;if(!i&&!r&&1===e.length&&(n=e.charCodeAt(0))<256){if(-9999!==this._flat[n])return this._flat[n];let i=this._measure(e,0);return i>0&&(this._flat[n]=i),i}let s=e;i&&(s+="B"),r&&(s+="I");let o=this._holey.get(s);if(void 0===o){let n=0;i&&(n|=1),r&&(n|=2),(o=this._measure(e,n))>0&&this._holey.set(s,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},i4=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,r,n=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1])return void this.clear();let s=e.buffers.active.ydisp,o=i[1]-s,a=r[1]-s,l=Math.max(o,0),c=Math.min(a,e.rows-1);l>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=i[0],this.endCol=r[0])}isCellSelected(e,i,r){return!!this.hasSelection&&(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol)}},i6="xterm-dom-renderer-owner-",i9="xterm-rows",i8="xterm-fg-",i7="xterm-bg-",re="xterm-focus",rt="xterm-selection",ri=1,rr=class extends eO{constructor(e,i,r,n,s,o,a,l,c,h,u,d,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=n,this._viewportElement=s,this._helperContainer=o,this._linkifier2=a,this._charSizeService=c,this._optionsService=h,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=ri++,this._rowElements=[],this._selectionRenderModel=new i4,this.onRequestRedraw=this._register(new eQ).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(i9),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(rt),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:i1(),cell:i1()},device:{canvas:i1(),cell:i1(),char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(i2,document),this._element.classList.add(i6+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(eA(()=>{this._element.classList.remove(i6+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new i3(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;for(let i of(this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this._rowElements))i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${i9} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${i9} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${i9} .xterm-dim { color: ${ny.multiplyOpacity(e.foreground,.5).css};}${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;for(let[o,a]of(i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}@keyframes ${n} { 50% { box-shadow: none; }}@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}${this._terminalSelector} .${i9}.${re} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${i9}.${re} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${i9}.${re} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${i9} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${i9} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${i9} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${i9} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${i9} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}${this._terminalSelector} .${rt} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rt} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rt} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`,e.ansi.entries()))i+=`${this._terminalSelector} .${i8}${o} { color: ${a.css}; }${this._terminalSelector} .${i8}${o}.xterm-dim { color: ${ny.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${i7}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${i8}257 { color: ${ny.opaque(e.background).css}; }${this._terminalSelector} .${i8}257.xterm-dim { color: ${ny.multiplyOpacity(ny.opaque(e.background),.5).css}; }${this._terminalSelector} .${i7}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let e=this._rowElements.length;e<=i;e++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(re),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(re),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let r=e[0]>i[0];l.appendChild(this._createSelectionElement(o,r?i[0]:e[0],r?e[0]:i[0],a-o+1))}else{let r=n===o?e[0]:0,c=o===s?i[0]:this._bufferService.cols;if(l.appendChild(this._createSelectionElement(o,r,c)),l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,a-o-1)),o!==a){let e=s===a?i[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,i,r,n=1){let s=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),s.style.height=`${n*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${a}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,n=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=i;c++){let e=c+r.ydisp,i=this._rowElements[c],h=r.lines.get(e);if(!i||!h)break;i.replaceChildren(...this._rowFactory.createRow(h,e,e===n,a,l,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${i6}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,s,o){r<0&&(e=0),n<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,h=Math.min(l.x,s-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=r;a<=n;++a){let p=a+l.ydisp,g=this._rowElements[a],m=l.lines.get(p);if(!g||!m)break;g.replaceChildren(...this._rowFactory.createRow(m,p,p===c,d,f,h,u,this.dimensions.css.cell.width,this._widthCache,o?a===r?e:0:-1,o?(a===n?i:s)-1:-1))}}};rr=I([F(7,es),F(8,ed),F(9,ea),F(10,et),F(11,er),F(12,ef),F(13,ev)],rr);var rn=class extends eO{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new eQ),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ra(this._optionsService))}catch{this._measureStrategy=this._register(new ro(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};rn=I([F(2,ea)],rn);var rs=class extends eO{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){void 0!==e&&e>0&&void 0!==i&&i>0&&(this._result.width=e,this._result.height=i)}},ro=class extends rs{constructor(e,i,r){super(),this._document=e,this._parentElement=i,this._optionsService=r,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}},ra=class extends rs{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},rl=class extends eO{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new rc(this._window)),this._onDprChange=this._register(new eQ),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new eQ),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(eV.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(t5(this._textarea,"focus",()=>this._isFocused=!0)),this._register(t5(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},rc=class extends eO{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new eB),this._onDprChange=this._register(new eQ),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(eA(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=t5(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},rh=class extends eO{constructor(){super(),this.linkProviders=[],this._register(eA(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);-1!==i&&this.linkProviders.splice(i,1)}}}};function ru(e,i,r){let n=r.getBoundingClientRect(),s=e.getComputedStyle(r),o=parseInt(s.getPropertyValue("padding-left")),a=parseInt(s.getPropertyValue("padding-top"));return[i.clientX-n.left-o,i.clientY-n.top-a]}var rd=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,n,s){return function(e,i,r,n,s,o,a,l,c){if(!o)return;let h=ru(e,i,r);return h[0]=Math.ceil((h[0]+(c?a/2:0))/a),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),n+ +!!c),h[1]=Math.min(Math.max(h[1],1),s),h}(window,e,i,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,i){let r=ru(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};rd=I([F(0,eg),F(1,ed)],rd);var rf=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},rp={},rg={getSafariVersion:()=>rx,isChromeOS:()=>rD,isFirefox:()=>rb,isIpad:()=>rk,isIphone:()=>rE,isLegacyEdge:()=>rS,isLinux:()=>rT,isMac:()=>rC,isNode:()=>r_,isSafari:()=>rw,isWindows:()=>rR};for(var rm in rg)B(rp,rm,{get:rg[rm],enumerable:!0});var r_="u">typeof O.default&&"title"in O.default,rv=r_?"node":navigator.userAgent,ry=r_?"node":navigator.platform,rb=rv.includes("Firefox"),rS=rv.includes("Edge"),rw=/^((?!chrome|android).)*safari/i.test(rv);function rx(){if(!rw)return 0;let e=rv.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var rC=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ry),rk="iPad"===ry,rE="iPhone"===ry,rR=["Windows","Win16","Win32","WinCE"].includes(ry),rT=ry.indexOf("Linux")>=0,rD=/\bCrOS\b/.test(rv),rL=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,r=0,n=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,1.5*(r=Math.max(i=Math.max(1,performance.now()-i),r))>(s=e.timeRemaining())){n-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-i))}ms`),this._start();return}n=s}this.clear()}},rA=class extends rL{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},rM=class extends rL{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rP=!r_&&"requestIdleCallback"in window?rM:rA,rO=class{constructor(){this._queue=new rP}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rB=class extends eO{constructor(e,i,r,n,s,o,a,l,c){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new eB),this._pausedResizeTask=new rO,this._observerDisposable=this._register(new eB),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 eQ),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new eQ),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new eQ),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new eQ),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new rf((e,i)=>this._renderRows(e,i),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(eA(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=eA(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),i=Math.max(i,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rB=I([F(2,ea),F(3,ed),F(4,er),F(5,eh),F(6,et),F(7,ef),F(8,ev)],rB);var rN=class{constructor(e,i,r){this._coreBrowserService=e,this._coreService=i,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function rI(e,i,r,n){return rj(Math.abs(e-rF(e,r)-(i-rF(i,r)))-function(e,i,r){let n=0,s=e-rF(e,r),o=i-rF(i,r);for(let a=0;a<Math.abs(s-o);a++){let o="A"===function(e,i){return e>i?"A":"B"}(e,i)?-1:1;r.buffer.lines.get(s+o*a)?.isWrapped&&n++}return n}(e,i,r),rH(e>i?"A":"B",n))}function rF(e,i){let r=0,n=i.buffer.lines.get(e),s=n?.isWrapped;for(;s&&e>=0&&e<i.rows;)r++,n=i.buffer.lines.get(--e),s=n?.isWrapped;return r}function rz(e,i,r,n,s,o){let a=e,l=i,c="";for(;(a!==r||l!==n)&&l>=0&&l<o.buffer.lines.length;)a+=s?1:-1,s&&a>o.cols-1?(c+=o.buffer.translateBufferLineToString(l,!1,e,a),a=0,e=0,l++):!s&&a<0&&(c+=o.buffer.translateBufferLineToString(l,!1,0,e+1),e=a=o.cols-1,l--);return c+o.buffer.translateBufferLineToString(l,!1,e,a)}function rH(e,i){return iB.ESC+(i?"O":"[")+e}function rj(e,i){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=i;return r}var rW=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!!e&&!!i&&(e[1]>i[1]||e[1]===i[1]&&e[0]>i[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function r$(e,i){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var rU=RegExp(" ","g"),rq=class extends eO{constructor(e,i,r,n,s,o,a,l,c){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=n,this._coreService=s,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new G,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new eQ),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new eQ),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new eQ),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new eQ),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new rW(this._bufferService),this._activeSelectionMode=0,this._register(eA(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1])}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(3===this._activeSelectionMode){if(e[0]===i[0])return"";let s=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let e=r.translateBufferLineToString(a,!0,s,o);n.push(e)}}else{let s=e[1]===i[1]?i[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let s=e[1]+1;s<=i[1]-1;s++){let e=r.lines.get(s),i=r.translateBufferLineToString(s,!0);e?.isWrapped?n[n.length-1]+=i:n.push(i)}if(e[1]!==i[1]){let e=r.lines.get(i[1]),s=r.translateBufferLineToString(i[1],!0,0,i[0]);e&&e.isWrapped?n[n.length-1]+=s:n.push(s)}}return n.map(e=>e.replace(rU," ")).join(rR?`\r
|
|
24
|
+
`).trim(),i=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);eW.register(o,i?.[2]??e,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(-1===r)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let n=this._deliveryQueue.current===this;if(2*this._size<=i.length){let e=0;for(let r=0;r<i.length;r++)i[r]?i[e++]=i[r]:n&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=e}}_deliver(e,i){if(!e)return;let r=this._options?.onListenerError||em;try{e.value(i)}catch(e){r(e)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof eK)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},eX=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eG=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new eY,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new eY,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};eG.INSTANCE=new eG,eG.INSTANCE.onDidChangeZoomLevel,eG.INSTANCE.onDidChangeFullscreen;var eJ="object"==typeof navigator?navigator.userAgent:"",eZ=eJ.indexOf("Firefox")>=0,eQ=eJ.indexOf("AppleWebKit")>=0,e0=eJ.indexOf("Chrome")>=0,e1=!e0&&eJ.indexOf("Safari")>=0;eJ.indexOf("Electron/"),eJ.indexOf("Android");var e2=!1;if("function"==typeof eA.matchMedia){let e=eA.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=eA.matchMedia("(display-mode: fullscreen)");e2=e.matches,e5=e,"string"==typeof e5&&(e5=eA.matchMedia(e5)),e5.addEventListener("change",({matches:e})=>{e2&&i.matches||(e2=e)})}var e5,e3,e4,e6=!1,e9=!1,e8=!1,e7=!1,te=!1,tt="en",ti=globalThis;"u">typeof ti.vscode&&"u">typeof ti.vscode.process?e4=ti.vscode.process:"u">typeof D.default&&"string"==typeof D.default?.versions?.node&&(e4=D.default);var tr="string"==typeof e4?.versions?.electron&&e4?.type==="renderer";if("object"==typeof e4){e6="win32"===e4.platform,e9="darwin"===e4.platform,(e8="linux"===e4.platform)&&e4.env.SNAP&&e4.env.SNAP_REVISION,e4.env.CI||e4.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tt="en";let e=e4.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,tt=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}e7=!0}else"object"!=typeof navigator||tr?console.error("Unable to resolve platform."):(e6=(e3=navigator.userAgent).indexOf("Windows")>=0,e9=e3.indexOf("Macintosh")>=0,(e3.indexOf("Macintosh")>=0||e3.indexOf("iPad")>=0||e3.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,e8=e3.indexOf("Linux")>=0,e3?.indexOf("Mobi"),te=!0,tt=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var tn=e6,ts=e9,to=e8,ta=e7;te&&"function"==typeof ti.importScripts&&ti.origin;var tl,tc=e3,th=tt;(tb=tl||={}).value=function(){return th},tb.isDefaultVariant=function(){return 2===th.length?"en"===th:th.length>=3&&"e"===th[0]&&"n"===th[1]&&"-"===th[2]},tb.isDefault=function(){return"en"===th};var tu="function"==typeof ti.postMessage&&!ti.importScripts,td=(()=>{if(tu){let e=[];ti.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,n=e.length;r<n;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let i=0;return r=>{let n=++i;e.push({id:n,callback:r}),ti.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})(),tf=!!(tc&&tc.indexOf("Chrome")>=0);tc&&tc.indexOf("Firefox"),!tf&&tc&&tc.indexOf("Safari"),tc&&tc.indexOf("Edg/"),tc&&tc.indexOf("Android");var tp="object"==typeof navigator?navigator:{};ta||document.queryCommandSupported&&document.queryCommandSupported("copy")||tp&&tp.clipboard&&tp.clipboard.writeText,ta||tp&&tp.clipboard&&tp.clipboard.readText,ta||e2||tp.keyboard,"ontouchstart"in eA||tp.maxTouchPoints,eA.PointerEvent&&("ontouchstart"in eA||navigator.maxTouchPoints);var tg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tm=new tg,t_=new tg,tv=new tg,ty=Array(230);(tS=tw||={}).toString=function(e){return tm.keyCodeToStr(e)},tS.fromString=function(e){return tm.strToKeyCode(e)},tS.toUserSettingsUS=function(e){return t_.keyCodeToStr(e)},tS.toUserSettingsGeneral=function(e){return tv.keyCodeToStr(e)},tS.fromUserSettings=function(e){return t_.strToKeyCode(e)||tv.strToKeyCode(e)},tS.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tm.keyCodeToStr(e)};var tb,tS,tw,tx,tC=class e{constructor(e,i,r,n,s){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=n,this.keyCode=s}equals(i){return i instanceof e&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${e}${i}${r}${n}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new tk([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},tk=class{constructor(e){if(0===e.length)throw function(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}("chords");this.chords=e}getHashCode(){let e="";for(let i=0,r=this.chords.length;i<r;i++)0!==i&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}},tE=ts?256:2048,tR=ts?2048:256,tT=class{constructor(e){this._standardKeyboardEventBrand=!0,this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=function(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return tw.fromString(i)}let i=e.keyCode;if(3===i)return 7;if(eZ)switch(i){case 59:return 85;case 60:if(to)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ts)return 57}else if(eQ&&(ts&&93===i||!ts&&92===i))return 57;return ty[i]||0}(e),this.code=e.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=tE),this.altKey&&(i|=512),this.shiftKey&&(i|=1024),this.metaKey&&(i|=tR),i|=e}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new tC(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},tD=new WeakMap,tL=class{static getSameOriginWindowChain(e){let i=tD.get(e);if(!i){i=[],tD.set(e,i);let r=e,n;do(n=function(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,r=e.parent.location;if("null"!==i.origin&&"null"!==r.origin&&i.origin!==r.origin)return null}catch{return null}return e.parent}(r))?i.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):i.push({window:new WeakRef(r),iframeElement:null}),r=n;while(r)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let r=0,n=0;for(let s of this.getSameOriginWindowChain(e)){let e=s.window.deref();if(r+=e?.scrollY??0,n+=e?.scrollX??0,e===i||!s.iframeElement)break;let o=s.iframeElement.getBoundingClientRect();r+=o.top,n+=o.left}return{top:r,left:n}}},tA=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=0===i.button,this.middleButton=1===i.button,this.rightButton=2===i.button,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,"dblclick"===i.type&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,"number"==typeof i.pageX?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=tL.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},tM=class{constructor(e,i=0,r=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let n=!1;if(e0){let e=navigator.userAgent.match(/Chrome\/(\d+)/);n=(e?parseInt(e[1]):123)<=122}if(e){let i=e.view?.devicePixelRatio||1;"u">typeof e.wheelDeltaY?n?this.deltaY=e.wheelDeltaY/(120*i):this.deltaY=e.wheelDeltaY/120:"u">typeof e.VERTICAL_AXIS&&e.axis===e.VERTICAL_AXIS?this.deltaY=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?eZ&&!ts?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40),"u">typeof e.wheelDeltaX?e1&&tn?this.deltaX=-(e.wheelDeltaX/120):n?this.deltaX=e.wheelDeltaX/(120*i):this.deltaX=e.wheelDeltaX/120:"u">typeof e.HORIZONTAL_AXIS&&e.axis===e.HORIZONTAL_AXIS?this.deltaX=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?eZ&&!ts?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40),0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},tP=Object.freeze(function(e,i){let r=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(r)}}});(ik=tx||={}).isCancellationToken=function(e){return e===ik.None||e===ik.Cancelled||e instanceof tO||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},ik.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ej.None}),ik.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tP});var tO=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?tP:(this._emitter||(this._emitter=new eY),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay");var tB=class{constructor(e,i){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof i&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new eb("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new eb("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},tN=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new eb("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},i);this.disposable=eE(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(iE=iR||={}).settled=async function(e){let i,r=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return r},iE.withAsyncBody=function(e){return new Promise(async(i,r)=>{try{await e(i,r)}catch(e){r(e)}})};var tI=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new eY,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ej.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,r){return new e(async e=>{for await(let n of i)e.emitOne(r(n))})}map(i){return e.map(this,i)}static filter(i,r){return new e(async e=>{for await(let n of i)r(n)&&e.emitOne(n)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};tI.EMPTY=tI.fromArray([]);function tF(e,i){return(i<<5)-i+e|0}function tz(e,i){i=tF(149417,i);for(let r=0,n=e.length;r<n;r++)i=tF(e.charCodeAt(r),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:tH,getWindow:tj,getDocument:tW,getWindows:t$,getWindowsCount:tU,getWindowId:tq,getWindowById:tV,hasWindow:tK,onDidRegisterWindow:tY,onWillUnregisterWindow:tX,onDidUnregisterWindow:tG}=(i=new Map,r={window:eA,disposables:new eT},i.set(eA.vscodeWindowId,r),n=new eY,s=new eY,o=new eY,{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:s.event,registerWindow(e){if(i.has(e.vscodeWindowId))return eD.None;let r=new eT,a={window:e,disposables:r.add(new eT)};return i.set(e.vscodeWindowId,a),r.add(eE(()=>{i.delete(e.vscodeWindowId),s.fire(e)})),r.add(tZ(e,t5.BEFORE_UNLOAD,()=>{o.fire(e)})),n.fire(a),r},getWindows:()=>i.values(),getWindowsCount:()=>i.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>i.has(e),getWindowById:function(e,n){return("number"==typeof e?i.get(e):void 0)??(n?r:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:eA,getDocument:e=>tj(e).document}),tJ=class{constructor(e,i,r,n){this._node=e,this._type=i,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function tZ(e,i,r,n){return new tJ(e,i,r,n)}var tQ=function(e,i,r,n){var s;let o=r;return"click"===i||"mousedown"===i||"contextmenu"===i?(s=tj(e),o=function(e){return r(new tA(s,e))}):("keydown"===i||"keypress"===i||"keyup"===i)&&(o=function(e){return r(new tT(e))}),tZ(e,i,o,n)},t0=class extends tN{constructor(e){super(),this.defaultTarget=e&&tj(e)}cancelAndSet(e,i,r){return super.cancelAndSet(e,i,r??this.defaultTarget)}},t1=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){em(e)}}static sort(e,i){return i.priority-e.priority}};a=new Map,l=new Map,c=new Map,h=new Map,iT=(e,i,r=0)=>{let n=tq(e),s=new t1(i,r),o=a.get(n);return o||(o=[],a.set(n,o)),o.push(s),c.get(n)||(c.set(n,!0),e.requestAnimationFrame(()=>(e=>{c.set(e,!1);let i=a.get(e)??[];for(l.set(e,i),a.set(e,[]),h.set(e,!0);i.length>0;)i.sort(t1.sort),i.shift().execute();h.set(e,!1)})(n))),s};var t2=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,r=this.height){return i!==this.width||r!==this.height?new e(i,r):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};t2.None=new t2(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,r){let n=this.mutationObservers.get(e);n||(n=new Map,this.mutationObservers.set(e,n));let s=function e(i,r){switch(typeof i){case"object":var n,s,o,a;return null===i?tF(349,r):Array.isArray(i)?(n=i,s=tF(104579,s=r),n.reduce((i,r)=>e(r,i),s)):(o=i,a=tF(181387,a=r),Object.keys(o).sort().reduce((i,r)=>(i=tz(r,i),e(o[r],i)),a));case"string":return tz(i,r);case"boolean":return tF(i?433:863,r);case"number":return tF(i,r);case"undefined":return tF(937,r);default:return tF(617,r)}}(r,0),o=n.get(s);if(o)o.users+=1;else{let a=new eY,l=new MutationObserver(e=>a.fire(e));l.observe(e,r);let c=o={users:1,observer:l,onDidMutate:a.event};i.add(eE(()=>{c.users-=1,0===c.users&&(a.dispose(),l.disconnect(),n?.delete(s),n?.size===0&&this.mutationObservers.delete(e))})),n.set(s,o)}return o.onDidMutate}};var t5={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},t3=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let i=t4(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=t4(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=t4(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=t4(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=t4(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=t4(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=t4(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=t4(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=t4(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=t4(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=t4(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=t4(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=t4(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=t4(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function t4(e){return"number"==typeof e?`${e}px`:e}function t6(e){return new t3(e)}var t9=class{constructor(){this._hooks=new eT,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,n,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=s;let o=e;try{e.setPointerCapture(i),this._hooks.add(eE(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=tj(e)}this._hooks.add(tZ(o,t5.POINTER_MOVE,e=>{e.buttons!==r?this.stopMonitoring(!0):(e.preventDefault(),this._pointerMoveCallback(e))})),this._hooks.add(tZ(o,t5.POINTER_UP,e=>this.stopMonitoring(!0)))}};(u=iD||={}).Tap="-xterm-gesturetap",u.Change="-xterm-gesturechange",u.Start="-xterm-gesturestart",u.End="-xterm-gesturesend",u.Contextmenu="-xterm-gesturecontextmenu";var t8=class e extends eD{constructor(){super(),this.dispatched=!1,this.targets=new eP,this.ignoreTargets=new eP,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ej.runAndSubscribe(tY,({window:e,disposables:i})=>{i.add(tZ(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),i.add(tZ(e.document,"touchend",i=>this.onTouchEnd(e,i))),i.add(tZ(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:eA,disposables:this._store}))}static addTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eE(e.INSTANCE.targets.push(i))):eD.None}static ignoreTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),eE(e.INSTANCE.ignoreTargets.push(i))):eD.None}static isTouchDevice(){return"ontouchstart"in eA||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,n=e.targetTouches.length;r<n;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let s=this.newGestureEvent(iD.Start,n.target);s.pageX=n.pageX,s.pageY=n.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,r){let n=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,a=r.changedTouches.length;o<a;o++){let a=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<e.HOLD_DELAY&&30>Math.abs(l.initialPageX-eS(l.rollingPageX))&&30>Math.abs(l.initialPageY-eS(l.rollingPageY))){let e=this.newGestureEvent(iD.Tap,l.initialTarget);e.pageX=eS(l.rollingPageX),e.pageY=eS(l.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&30>Math.abs(l.initialPageX-eS(l.rollingPageX))&&30>Math.abs(l.initialPageY-eS(l.rollingPageY))){let e=this.newGestureEvent(iD.Contextmenu,l.initialTarget);e.pageX=eS(l.rollingPageX),e.pageY=eS(l.rollingPageY),this.dispatchEvent(e)}else if(1===s){let e=eS(l.rollingPageX),r=eS(l.rollingPageY),s=eS(l.rollingTimestamps)-l.rollingTimestamps[0],o=e-l.rollingPageX[0],a=r-l.rollingPageY[0],c=[...this.targets].filter(e=>l.initialTarget instanceof Node&&e.contains(l.initialTarget));this.inertia(i,c,n,Math.abs(o)/s,o>0?1:-1,e,Math.abs(a)/s,a>0?1:-1,r)}this.dispatchEvent(this.newGestureEvent(iD.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(i){if(i.type===iD.Tap){let r=new Date().getTime(),n=0;n=r-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=r,i.tapCount=n}else(i.type===iD.Change||i.type===iD.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(i.initialTarget))return;let e=[];for(let r of this.targets)if(r.contains(i.initialTarget)){let n=0,s=i.initialTarget;for(;s&&s!==r;)n++,s=s.parentElement;e.push([n,r])}for(let[r,n]of(e.sort((e,i)=>e[0]-i[0]),e))n.dispatchEvent(i),this.dispatched=!0}}inertia(i,r,n,s,o,a,l,c,h){this.handle=iT(i,()=>{let u=Date.now(),d=u-n,f=0,p=0,g=!0;s+=e.SCROLL_FRICTION*d,l+=e.SCROLL_FRICTION*d,s>0&&(g=!1,f=o*s*d),l>0&&(g=!1,p=c*l*d);let m=this.newGestureEvent(iD.Change);m.translationX=f,m.translationY=p,r.forEach(e=>e.dispatchEvent(m)),g||this.inertia(i,r,u,s,o,a+f,l,c,h+p)})}onTouchMove(e){let i=Date.now();for(let r=0,n=e.changedTouches.length;r<n;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let s=this.activeTouches[n.identifier],o=this.newGestureEvent(iD.Change,s.initialTarget);o.translationX=n.pageX-eS(s.rollingPageX),o.translationY=n.pageY-eS(s.rollingPageY),o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(n.pageX),s.rollingPageY.push(n.pageY),s.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};t8.SCROLL_FRICTION=-.005,t8.HOLD_DELAY=700,t8.CLEAR_TAP_COUNT_TIME=400,M([function(e,i,r){let n=null,s=null;if("function"==typeof r.value?(n="value",0!==(s=r.value).length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof r.get&&(n="get",s=r.get),!s)throw Error("not supported");let o=`$memoize$${i}`;r[n]=function(...e){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,e)}),this[o]}}],t8,"isTouchDevice",1);var t7=class extends eD{onclick(e,i){this._register(tZ(e,t5.CLICK,r=>i(new tA(tj(e),r))))}onmousedown(e,i){this._register(tZ(e,t5.MOUSE_DOWN,r=>i(new tA(tj(e),r))))}onmouseover(e,i){this._register(tZ(e,t5.MOUSE_OVER,r=>i(new tA(tj(e),r))))}onmouseleave(e,i){this._register(tZ(e,t5.MOUSE_LEAVE,r=>i(new tA(tj(e),r))))}onkeydown(e,i){this._register(tZ(e,t5.KEY_DOWN,e=>i(new tT(e))))}onkeyup(e,i){this._register(tZ(e,t5.KEY_UP,e=>i(new tT(e))))}oninput(e,i){this._register(tZ(e,t5.INPUT,i))}onblur(e,i){this._register(tZ(e,t5.BLUR,i))}onfocus(e,i){this._register(tZ(e,t5.FOCUS,i))}onchange(e,i){this._register(tZ(e,t5.CHANGE,i))}ignoreGesture(e){return t8.ignoreTarget(e)}},ie=class extends t7{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px","u">typeof e.top&&(this.bgDomNode.style.top="0px"),"u">typeof e.left&&(this.bgDomNode.style.left="0px"),"u">typeof e.bottom&&(this.bgDomNode.style.bottom="0px"),"u">typeof e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px","u">typeof e.top&&(this.domNode.style.top=e.top+"px"),"u">typeof e.left&&(this.domNode.style.left=e.left+"px"),"u">typeof e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),"u">typeof e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new t9),this._register(tQ(this.bgDomNode,t5.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(tQ(this.domNode,t5.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new t0),this._pointerdownScheduleRepeatTimer=this._register(new tB)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,tj(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},it=class e{constructor(e,i,r,n,s,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i|=0,r|=0,n|=0,s|=0,o|=0,a|=0),this.rawScrollLeft=n,this.rawScrollTop=a,i<0&&(i=0),n+i>r&&(n=r-i),n<0&&(n=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=n,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(i,r){return new e(this._forceIntegerValues,"u">typeof i.width?i.width:this.width,"u">typeof i.scrollWidth?i.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,"u">typeof i.height?i.height:this.height,"u">typeof i.scrollHeight?i.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new e(this._forceIntegerValues,this.width,this.scrollWidth,"u">typeof i.scrollLeft?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,"u">typeof i.scrollTop?i.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},ii=class extends eD{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new eY),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new it(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){let r;e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;r=i?new io(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=io.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},ir=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function is(e,i){let r=i-e;return function(i){return e+r*(1-Math.pow(1-i,3))}}var io=class e{constructor(e,i,r,n){this.from=e,this.to=i,this.duration=n,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){var n,s;let o,a;return e<i?(o=e+.75*r,a=i-.75*r):(o=e-.75*r,a=i+.75*r),n=is(e,o),s=is(a,i),function(e){return e<.33?n(e/.33):s((e-.33)/(1-.33))}}return is(e,i)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;return i<1?new ir(this.scrollLeft(i),this.scrollTop(i),!1):new ir(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,r,n){return e.start(i,r,n)}static start(i,r,n){return n+=10,new e(i,r,Date.now()-10,n)}},ia=class extends eD{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new tB)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},il=class extends t7{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new ia(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new t9),this._shouldRender=!0,this.domNode=t6(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(tZ(this.domNode.domNode,t5.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let i=this._register(new ie(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,n){this.slider=t6(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),"number"==typeof r&&this.slider.setWidth(r),"number"==typeof n&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(tZ(this.slider.domNode,t5.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),n=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=n?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)i=e.offsetX,r=e.offsetY;else{var n;let s,o,a=(s=(n=this.domNode.domNode).getBoundingClientRect(),o=tj(n),{left:s.left+o.scrollX,top:s.top+o.scrollY,width:s.width,height:s.height});i=e.pageX-a.left,r=e.pageY-a.top}let s=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let s=Math.abs(this._sliderOrthogonalPointerPosition(e)-r);if(tn&&s>140)return void this._setDesiredScrollPositionNow(n.getScrollPosition());let o=this._sliderPointerPosition(e)-i;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},ic=class e{constructor(e,i,r,n,s,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i&&(this._visibleSize=i,this._refreshComputedValues(),!0)}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i&&(this._scrollSize=i,this._refreshComputedValues(),!0)}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i&&(this._scrollPosition=i,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,n,s){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),l=n>0&&n>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/n))),h=(a-c)/(n-r);return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:h,computedSliderPosition:Math.round(s*h)}}_refreshComputedValues(){let i=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){return this._computedIsNeeded?Math.round((e-this._arrowSize-this._computedSliderSize/2)/this._computedSliderRatio):0}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){return this._computedIsNeeded?Math.round((this._computedSliderPosition+e)/this._computedSliderRatio):0}},ih=class extends il{constructor(e,i,r){let n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ic(i.horizontalHasArrows?i.arrowSize:0,2===i.horizontal?0:i.horizontalScrollbarSize,2===i.vertical?0:i.verticalScrollbarSize,n.width,n.scrollWidth,s.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},iu=class extends il{constructor(e,i,r){let n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new ic(i.verticalHasArrows?i.arrowSize:0,2===i.vertical?0:i.verticalScrollbarSize,0,n.height,n.scrollHeight,s.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},id=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},ip=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,i=0,r=1,n=this._rear;for(;;){let s=n===this._front?e:Math.pow(2,-r);if(e-=s,i+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,r++}return i<=.5}acceptStandardWheelEvent(e){if(e0){var i;let r=(i=tj(e.browserEvent),eG.INSTANCE.getZoomFactor(i));this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let n=null,s=new id(e,i,r);-1===this._front&&-1===this._rear?(this._memory[0]=s,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,n)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(r+=.25),i){let n=Math.abs(e.deltaX),s=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(n,o),1),c=Math.max(Math.min(s,a),1),h=Math.max(s,a);Math.max(n,o)%l==0&&h%c==0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return .01>Math.abs(Math.round(e)-e)}};ip.INSTANCE=new ip;var ig=class extends t7{constructor(e,i,r){super(),this._onScroll=this._register(new eY),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new eY),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let i={lazyRender:"u">typeof e.lazyRender&&e.lazyRender,className:"u">typeof e.className?e.className:"",useShadows:!("u">typeof e.useShadows)||e.useShadows,handleMouseWheel:!("u">typeof e.handleMouseWheel)||e.handleMouseWheel,flipAxes:"u">typeof e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:"u">typeof e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:"u">typeof e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:"u">typeof e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:"u">typeof e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:"u">typeof e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:!("u">typeof e.scrollPredominantAxis)||e.scrollPredominantAxis,mouseWheelSmoothScroll:!("u">typeof e.mouseWheelSmoothScroll)||e.mouseWheelSmoothScroll,arrowSize:"u">typeof e.arrowSize?e.arrowSize:11,listenOnDomNode:"u">typeof e.listenOnDomNode?e.listenOnDomNode:null,horizontal:"u">typeof e.horizontal?e.horizontal:1,horizontalScrollbarSize:"u">typeof e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:"u">typeof e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:"u">typeof e.horizontalHasArrows&&e.horizontalHasArrows,vertical:"u">typeof e.vertical?e.vertical:1,verticalScrollbarSize:"u">typeof e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:"u">typeof e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:"u">typeof e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:"u">typeof e.scrollByPage&&e.scrollByPage};return i.horizontalSliderSize="u">typeof e.horizontalSliderSize?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize="u">typeof e.verticalSliderSize?e.verticalSliderSize:i.verticalScrollbarSize,ts&&(i.className+=" mac"),i}(i),this._scrollable=r,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let n={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new iu(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new ih(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=t6(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=t6(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=t6(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new tB),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ek(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ts&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){"u">typeof e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),"u">typeof e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),"u">typeof e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),"u">typeof e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),"u">typeof e.horizontal&&(this._options.horizontal=e.horizontal),"u">typeof e.vertical&&(this._options.vertical=e.vertical),"u">typeof e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),"u">typeof e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),"u">typeof e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new tM(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ek(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new tM(e))};this._mouseWheelToDispose.push(tZ(this._listenOnDomNode,t5.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=ip.INSTANCE;i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+n===0?s=n=0:Math.abs(n)>=Math.abs(s)?s=0:n=0),this._options.flipAxes&&([n,s]=[s,n]);let o=!ts&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!s&&(s=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,n*=this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(n){let e=50*n,i=a.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(l,i)}if(s){let e=50*s,i=a.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(l,i)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",s=i?" top":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${r||i?" top-left-corner":""}${s}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet(()=>this._hide(),500)}},im=class extends ig{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},i_=class extends eD{constructor(e,i,r,n,s,o,a,l){super(),this._bufferService=r,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new eY),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new ii({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>iT(n.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new im(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ej.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(eE(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(eE(()=>this._styleElement.remove())),this._register(ej.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
25
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;0!==r&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};i_=M([P(2,G),P(3,el),P(4,J),P(5,ef),P(6,ei),P(7,eh)],i_);var iv=class extends eD{constructor(e,i,r,n,s){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=n,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(eE(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;"right"===(e.options.anchor||"left")?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};iv=M([P(1,G),P(2,el),P(3,es),P(4,eh)],iv);var iy=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(i,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},ib={full:0,left:0,center:0,right:0},iS={full:0,left:0,center:0,right:0},iw={full:0,left:0,center:0,right:0},ix=class extends eD{constructor(e,i,r,n,s,o,a,l){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=n,this._renderService=s,this._optionsService=o,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new iy,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(eE(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);iS.full=this._canvas.width,iS.left=e,iS.center=i,iS.right=e,this._refreshDrawHeightConstants(),iw.full=1,iw.left=1,iw.center=1+iS.left,iw.right=1+iS.left+iS.center}_refreshDrawHeightConstants(){ib.full=Math.round(2*this._coreBrowserService.dpr);let e=Math.round(Math.max(Math.min(this._canvas.height/this._bufferService.buffer.lines.length,12),6)*this._coreBrowserService.dpr);ib.left=e,ib.center=e,ib.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ib.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ib.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ib.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ib.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(){for(let e of(this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear(),this._decorationService.decorations))this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)"full"!==i.position&&this._renderColorZone(i);for(let i of e)"full"===i.position&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(iw[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ib[e.position||"full"]/2),iS[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ib[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ix=M([P(2,G),P(3,es),P(4,eh),P(5,ei),P(6,ef),P(7,el)],ix),(d=iL||={}).NUL="\0",d.SOH="\x01",d.STX="\x02",d.ETX="\x03",d.EOT="\x04",d.ENQ="\x05",d.ACK="\x06",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
|
|
26
|
+
`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="\x0e",d.SI="\x0f",d.DLE="\x10",d.DC1="\x11",d.DC2="\x12",d.DC3="\x13",d.DC4="\x14",d.NAK="\x15",d.SYN="\x16",d.ETB="\x17",d.CAN="\x18",d.EM="\x19",d.SUB="\x1a",d.ESC="\x1b",d.FS="\x1c",d.GS="\x1d",d.RS="\x1e",d.US="\x1f",d.SP=" ",d.DEL="",(f=iA||={}).PAD="",f.HOP="",f.BPH="",f.NBH="",f.IND="",f.NEL="
",f.SSA="",f.ESA="",f.HTS="",f.HTJ="",f.VTS="",f.PLD="",f.PLU="",f.RI="",f.SS2="",f.SS3="",f.DCS="",f.PU1="",f.PU2="",f.STS="",f.CCH="",f.MW="",f.SPA="",f.EPA="",f.SOS="",f.SGCI="",f.SCI="",f.CSI="",f.ST="",f.OSC="",f.PM="",f.APC="",(iM||={}).ST=`${iL.ESC}\\`;var iC=class{constructor(e,i,r,n,s,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=n,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,(i=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start)).length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${iL.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};iC=M([P(2,G),P(3,ei),P(4,Z),P(5,eh)],iC);var ik,iE,iR,iT,iD,iL,iA,iM,iP,iO=0,iB=0,iN=0,iI=0,iF={css:"#00000000",rgba:0};(nf=iP||={}).toCss=function(e,i,r,n){return void 0!==n?`#${iV(e)}${iV(i)}${iV(r)}${iV(n)}`:`#${iV(e)}${iV(i)}${iV(r)}`},nf.toRgba=function(e,i,r,n=255){return(e<<24|i<<16|r<<8|n)>>>0},nf.toColor=function(e,i,r,n){return{css:nf.toCss(e,i,r,n),rgba:nf.toRgba(e,i,r,n)}};var iz=np||={};function iH(e,i){return iI=Math.round(255*i),[iO,iB,iN]=n_.toChannels(e.rgba),{css:iP.toCss(iO,iB,iN,iI),rgba:iP.toRgba(iO,iB,iN,iI)}}iz.blend=function(e,i){if(1==(iI=(255&i.rgba)/255))return{css:i.css,rgba:i.rgba};let r=i.rgba>>24&255,n=i.rgba>>16&255,s=i.rgba>>8&255,o=e.rgba>>24&255,a=e.rgba>>16&255,l=e.rgba>>8&255;return iO=o+Math.round((r-o)*iI),iB=a+Math.round((n-a)*iI),iN=l+Math.round((s-l)*iI),{css:iP.toCss(iO,iB,iN),rgba:iP.toRgba(iO,iB,iN)}},iz.isOpaque=function(e){return(255&e.rgba)==255},iz.ensureContrastRatio=function(e,i,r){let n=n_.ensureContrastRatio(e.rgba,i.rgba,r);if(n)return iP.toColor(n>>24&255,n>>16&255,n>>8&255)},iz.opaque=function(e){let i=(255|e.rgba)>>>0;return[iO,iB,iN]=n_.toChannels(i),{css:iP.toCss(iO,iB,iN),rgba:i}},iz.opacity=iH,iz.multiplyOpacity=function(e,i){return iI=255&e.rgba,iH(e,iI*i/255)},iz.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let i,r;try{let e=document.createElement("canvas");e.width=1,e.height=1;let n=e.getContext("2d",{willReadFrequently:!0});n&&((i=n).globalCompositeOperation="copy",r=i.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return iO=parseInt(e.slice(1,2).repeat(2),16),iB=parseInt(e.slice(2,3).repeat(2),16),iN=parseInt(e.slice(3,4).repeat(2),16),iP.toColor(iO,iB,iN);case 5:return iO=parseInt(e.slice(1,2).repeat(2),16),iB=parseInt(e.slice(2,3).repeat(2),16),iN=parseInt(e.slice(3,4).repeat(2),16),iI=parseInt(e.slice(4,5).repeat(2),16),iP.toColor(iO,iB,iN,iI);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let n=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return iO=parseInt(n[1]),iB=parseInt(n[2]),iN=parseInt(n[3]),iI=Math.round((void 0===n[5]?1:parseFloat(n[5]))*255),iP.toColor(iO,iB,iN,iI);if(!i||!r||(i.fillStyle=r,i.fillStyle=e,"string"!=typeof i.fillStyle)||(i.fillRect(0,0,1,1),[iO,iB,iN,iI]=i.getImageData(0,0,1,1).data,255!==iI))throw Error("css.toColor: Unsupported css format");return{rgba:iP.toRgba(iO,iB,iN,iI),css:e}}})(ng||={});var ij=nm||={};function iW(e,i,r){let n=e/255,s=i/255,o=r/255;return .2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}ij.relativeLuminance=function(e){return iW(e>>16&255,e>>8&255,255&e)},ij.relativeLuminance2=iW;var i$=n_||={};function iU(e,i,r){let n=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,h=iK(nm.relativeLuminance2(a,l,c),nm.relativeLuminance2(n,s,o));for(;h<r&&(a>0||l>0||c>0);)a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c-=Math.max(0,Math.ceil(.1*c)),h=iK(nm.relativeLuminance2(a,l,c),nm.relativeLuminance2(n,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function iq(e,i,r){let n=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,h=iK(nm.relativeLuminance2(a,l,c),nm.relativeLuminance2(n,s,o));for(;h<r&&(a<255||l<255||c<255);)a=Math.min(255,a+Math.ceil((255-a)*.1)),l=Math.min(255,l+Math.ceil((255-l)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),h=iK(nm.relativeLuminance2(a,l,c),nm.relativeLuminance2(n,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function iV(e){let i=e.toString(16);return i.length<2?"0"+i:i}function iK(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}i$.blend=function(e,i){if(1==(iI=(255&i)/255))return i;let r=e>>24&255,n=e>>16&255,s=e>>8&255;return iO=r+Math.round(((i>>24&255)-r)*iI),iB=n+Math.round(((i>>16&255)-n)*iI),iN=s+Math.round(((i>>8&255)-s)*iI),iP.toRgba(iO,iB,iN)},i$.ensureContrastRatio=function(e,i,r){let n=nm.relativeLuminance(e>>8),s=nm.relativeLuminance(i>>8);if(iK(n,s)<r){if(s<n){let s=iU(e,i,r),o=iK(n,nm.relativeLuminance(s>>8));if(o<r){let a=iq(e,i,r);return o>iK(n,nm.relativeLuminance(a>>8))?s:a}return s}let o=iq(e,i,r),a=iK(n,nm.relativeLuminance(o>>8));if(a<r){let s=iU(e,i,r);return a>iK(n,nm.relativeLuminance(s>>8))?o:s}return o}},i$.reduceLuminance=iU,i$.increaseLuminance=iq,i$.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var iY=class extends ${constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},iX=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new q}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||0===i.length)return[];let r=[],n=i.translateToString(!0),s=0,o=0,a=0,l=i.getFg(0),c=i.getBg(0);for(let e=0;e<i.getTrimmedLength();e++)if(i.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(e-s>1){let e=this._getJoinedRanges(n,a,o,i,s);for(let i=0;i<e.length;i++)r.push(e[i])}s=e,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(this._bufferService.cols-s>1){let e=this._getJoinedRanges(n,a,o,i,s);for(let i=0;i<e.length;i++)r.push(e[i])}return r}_getJoinedRanges(e,i,r,n,s){let o=e.substring(i,r),a=[];try{a=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let i=this._characterJoiners[e].handler(o);for(let e=0;e<i.length;e++)iX._mergeRanges(a,i[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,n,s),a}_stringRangesToCellRanges(e,i,r){let n=0,s=!1,o=0,a=e[0];if(a){for(let l=r;l<this._bufferService.cols;l++){let r=i.getWidth(l),c=i.getString(l).length||1;if(0!==r){if(!s&&a[0]<=o&&(a[0]=l,s=!0),a[1]<=o){if(a[1]=l,!(a=e[++n]))break;a[0]<=o?(a[0]=l,s=!0):s=!1}o+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let r=!1;for(let n=0;n<e.length;n++){let s=e[n];if(r){if(i[1]<=s[0])return e[n-1][1]=i[1],e;if(i[1]<=s[1])return e[n-1][1]=Math.max(i[1],s[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(i[1]<=s[0])return e.splice(n,0,i),e;if(i[1]<=s[1])return s[0]=Math.min(i[0],s[0]),e;i[0]<s[1]&&(s[0]=Math.min(i[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=i[1]:e.push(i),e}};function iG(){return{width:0,height:0}}iX=M([P(0,G)],iX);var iJ=class{constructor(e,i,r,n,s,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=n,this._coreService=s,this._decorationService=o,this._themeService=a,this._workCell=new q,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,n,s,o,a,l,c,h,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,g=e.getNoBgTrimmedLength();r&&g<o+1&&(g=o+1);let m,_=0,v="",y=0,b=0,S=0,w=0,x=!1,C=0,k=!1,E=0,R=0,T=[],D=-1!==h&&-1!==u;for(let L=0;L<g;L++){let g;e.loadCell(L,this._workCell);let A=this._workCell.getWidth();if(0===A)continue;let M=!1,P=L>=R,O=L,B=this._workCell;if(f.length>0&&L===f[0][0]&&P){let n=f.shift(),s=this._isCellInSelection(n[0],i);for(y=n[0]+1;y<n[1];y++)P&&=s===this._isCellInSelection(y,i);(P&&=!r||o<n[0]||o>=n[1])?(M=!0,B=new iY(this._workCell,e.translateToString(!0,n[0],n[1]),n[1]-n[0]),O=n[1]-1,A=B.getWidth()):R=n[1]}let N=this._isCellInSelection(L,i),I=r&&L===o,F=D&&L>=h&&L<=u,z=!1;this._decorationService.forEachDecorationAtCell(L,i,void 0,e=>{z=!0});let H=B.getChars()||" ";if(" "===H&&(B.isUnderline()||B.isOverline())&&(H=" "),E=A*l-c.get(H,B.isBold(),B.isItalic()),m)if(_&&(N&&k||!N&&!k&&B.bg===b)&&(N&&k&&p.selectionForeground||B.fg===S)&&B.extended.ext===w&&F===x&&E===C&&!I&&!M&&!z&&P){B.isInvisible()?v+=" ":v+=H,_++;continue}else _&&(m.textContent=v),m=this._document.createElement("span"),_=0,v="";else m=this._document.createElement("span");if(b=B.bg,S=B.fg,w=B.extended.ext,x=F,C=E,k=N,M&&o>=L&&o<=O&&(o=L),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized){if(T.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&T.push("xterm-cursor-blink"),T.push("bar"===n?"xterm-cursor-bar":"underline"===n?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":T.push("xterm-cursor-outline");break;case"block":T.push("xterm-cursor-block");break;case"bar":T.push("xterm-cursor-bar");break;case"underline":T.push("xterm-cursor-underline")}}if(B.isBold()&&T.push("xterm-bold"),B.isItalic()&&T.push("xterm-italic"),B.isDim()&&T.push("xterm-dim"),v=B.isInvisible()?" ":B.getChars()||" ",B.isUnderline()&&(T.push(`xterm-underline-${B.extended.underlineStyle}`)," "===v&&(v=" "),!B.isUnderlineColorDefault()))if(B.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${$.toColorRGB(B.getUnderlineColor()).join(",")})`;else{let e=B.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&B.isBold()&&e<8&&(e+=8),m.style.textDecorationColor=p.ansi[e].css}B.isOverline()&&(T.push("xterm-overline")," "===v&&(v=" ")),B.isStrikethrough()&&T.push("xterm-strikethrough"),F&&(m.style.textDecoration="underline");let j=B.getFgColor(),W=B.getFgColorMode(),U=B.getBgColor(),q=B.getBgColorMode(),V=!!B.isInverse();if(V){let e=j;j=U,U=e;let i=W;W=q,q=i}let K,Y,X=!1;switch(this._decorationService.forEachDecorationAtCell(L,i,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(q=0x3000000,U=e.backgroundColorRGB.rgba>>8&0xffffff,K=e.backgroundColorRGB),e.foregroundColorRGB&&(W=0x3000000,j=e.foregroundColorRGB.rgba>>8&0xffffff,Y=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&N&&(U=(K=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff,q=0x3000000,X=!0,p.selectionForeground&&(W=0x3000000,j=p.selectionForeground.rgba>>8&0xffffff,Y=p.selectionForeground)),X&&T.push("xterm-decoration-top"),q){case 0x1000000:case 0x2000000:g=p.ansi[U],T.push(`xterm-bg-${U}`);break;case 0x3000000:g=iP.toColor(U>>16,U>>8&255,255&U),this._addStyle(m,`background-color:#${iZ((U>>>0).toString(16),"0",6)}`);break;default:V?(g=p.foreground,T.push("xterm-bg-257")):g=p.background}switch(K||B.isDim()&&(K=np.multiplyOpacity(g,.5)),W){case 0x1000000:case 0x2000000:B.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(m,g,p.ansi[j],B,K,void 0)||T.push(`xterm-fg-${j}`);break;case 0x3000000:let G=iP.toColor(j>>16&255,j>>8&255,255&j);this._applyMinimumContrast(m,g,G,B,K,Y)||this._addStyle(m,`color:#${iZ(j.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(m,g,p.foreground,B,K,Y)||V&&T.push("xterm-fg-257")}T.length&&(m.className=T.join(" "),T.length=0),I||M||z||!P?m.textContent=v:_++,E!==this.defaultSpacing&&(m.style.letterSpacing=`${E}px`),d.push(m),L=O}return m&&_&&(m.textContent=v),d}_applyMinimumContrast(e,i,r,n,s,o){var a,l,c;if(1===this._optionsService.rawOptions.minimumContrastRatio||57508<=(l=a=n.getCode())&&l<=57558||9472<=(c=a)&&c<=9631)return!1;let h=this._getContrastCache(n),u;if(s||o||(u=h.getColor(i.rgba,r.rgba)),void 0===u){let e=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);u=np.ensureContrastRatio(s||i,o||r,e),h.setColor((s||i).rgba,(o||r).rgba,u??null)}return!!u&&(this._addStyle(e,`color:${u.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,n=this._selectionEnd;return!!r&&!!n&&(this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&i>=r[1]&&e<n[0]&&i<=n[1]:e<r[0]&&i>=r[1]&&e>=n[0]&&i<=n[1]:i>r[1]&&i<n[1]||r[1]===n[1]&&i===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&i===n[1]&&e<n[0]||r[1]<n[1]&&i===r[1]&&e>=r[0])}};function iZ(e,i,r){for(;e.length<r;)e=i+e;return e}iJ=M([P(1,ed),P(2,ei),P(3,el),P(4,Z),P(5,es),P(6,ef)],iJ);var iQ=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,n,s,o],this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,r,n){e===this._font&&i===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,i,r){let n=0;if(!i&&!r&&1===e.length&&(n=e.charCodeAt(0))<256){if(-9999!==this._flat[n])return this._flat[n];let i=this._measure(e,0);return i>0&&(this._flat[n]=i),i}let s=e;i&&(s+="B"),r&&(s+="I");let o=this._holey.get(s);if(void 0===o){let n=0;i&&(n|=1),r&&(n|=2),(o=this._measure(e,n))>0&&this._holey.set(s,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},i0=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,r,n=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1])return void this.clear();let s=e.buffers.active.ydisp,o=i[1]-s,a=r[1]-s,l=Math.max(o,0),c=Math.min(a,e.rows-1);l>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=i[0],this.endCol=r[0])}isCellSelected(e,i,r){return!!this.hasSelection&&(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol)}},i1="xterm-dom-renderer-owner-",i2="xterm-rows",i5="xterm-fg-",i3="xterm-bg-",i4="xterm-focus",i6="xterm-selection",i9=1,i8=class extends eD{constructor(e,i,r,n,s,o,a,l,c,h,u,d,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=n,this._viewportElement=s,this._helperContainer=o,this._linkifier2=a,this._charSizeService=c,this._optionsService=h,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=i9++,this._rowElements=[],this._selectionRenderModel=new i0,this.onRequestRedraw=this._register(new eY).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(i2),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(i6),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:iG(),cell:iG()},device:{canvas:iG(),cell:iG(),char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(iJ,document),this._element.classList.add(i1+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(eE(()=>{this._element.classList.remove(i1+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new iQ(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;for(let i of(this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this._rowElements))i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${i2} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${i2} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${i2} .xterm-dim { color: ${np.multiplyOpacity(e.foreground,.5).css};}${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;for(let[o,a]of(i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}@keyframes ${n} { 50% { box-shadow: none; }}@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}${this._terminalSelector} .${i2}.${i4} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${i2}.${i4} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${i2}.${i4} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${i2} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${i2} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${i2} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${i2} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${i2} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}${this._terminalSelector} .${i6} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${i6} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${i6} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`,e.ansi.entries()))i+=`${this._terminalSelector} .${i5}${o} { color: ${a.css}; }${this._terminalSelector} .${i5}${o}.xterm-dim { color: ${np.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${i3}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${i5}257 { color: ${np.opaque(e.background).css}; }${this._terminalSelector} .${i5}257.xterm-dim { color: ${np.multiplyOpacity(np.opaque(e.background),.5).css}; }${this._terminalSelector} .${i3}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let e=this._rowElements.length;e<=i;e++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(i4),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(i4),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let r=e[0]>i[0];l.appendChild(this._createSelectionElement(o,r?i[0]:e[0],r?e[0]:i[0],a-o+1))}else{let r=n===o?e[0]:0,c=o===s?i[0]:this._bufferService.cols;if(l.appendChild(this._createSelectionElement(o,r,c)),l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,a-o-1)),o!==a){let e=s===a?i[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,i,r,n=1){let s=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),s.style.height=`${n*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${a}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let r=this._bufferService.buffer,n=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=i;c++){let e=c+r.ydisp,i=this._rowElements[c],h=r.lines.get(e);if(!i||!h)break;i.replaceChildren(...this._rowFactory.createRow(h,e,e===n,a,l,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${i1}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,s,o){r<0&&(e=0),n<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,h=Math.min(l.x,s-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=r;a<=n;++a){let p=a+l.ydisp,g=this._rowElements[a],m=l.lines.get(p);if(!g||!m)break;g.replaceChildren(...this._rowFactory.createRow(m,p,p===c,d,f,h,u,this.dimensions.css.cell.width,this._widthCache,o?a===r?e:0:-1,o?(a===n?i:s)-1:-1))}}};i8=M([P(7,ee),P(8,ea),P(9,ei),P(10,G),P(11,Z),P(12,el),P(13,ef)],i8);var i7=class extends eD{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new eY),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ri(this._optionsService))}catch{this._measureStrategy=this._register(new rt(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};i7=M([P(2,ei)],i7);var re=class extends eD{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){void 0!==e&&e>0&&void 0!==i&&i>0&&(this._result.width=e,this._result.height=i)}},rt=class extends re{constructor(e,i,r){super(),this._document=e,this._parentElement=i,this._optionsService=r,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}},ri=class extends re{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},rr=class extends eD{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new rn(this._window)),this._onDprChange=this._register(new eY),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new eY),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(ej.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(tZ(this._textarea,"focus",()=>this._isFocused=!0)),this._register(tZ(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},rn=class extends eD{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new eL),this._onDprChange=this._register(new eY),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(eE(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=tZ(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},rs=class extends eD{constructor(){super(),this.linkProviders=[],this._register(eE(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);-1!==i&&this.linkProviders.splice(i,1)}}}};function ro(e,i,r){let n=r.getBoundingClientRect(),s=e.getComputedStyle(r),o=parseInt(s.getPropertyValue("padding-left")),a=parseInt(s.getPropertyValue("padding-top"));return[i.clientX-n.left-o,i.clientY-n.top-a]}var ra=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,n,s){return function(e,i,r,n,s,o,a,l,c){if(!o)return;let h=ro(e,i,r);return h[0]=Math.ceil((h[0]+(c?a/2:0))/a),h[1]=Math.ceil(h[1]/l),h[0]=Math.min(Math.max(h[0],1),n+ +!!c),h[1]=Math.min(Math.max(h[1],1),s),h}(window,e,i,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,i){let r=ro(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};ra=M([P(0,eh),P(1,ea)],ra);var rl=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},rc={},rh={getSafariVersion:()=>rv,isChromeOS:()=>rC,isFirefox:()=>rg,isIpad:()=>rb,isIphone:()=>rS,isLegacyEdge:()=>rm,isLinux:()=>rx,isMac:()=>ry,isNode:()=>rd,isSafari:()=>r_,isWindows:()=>rw};for(var ru in rh)L(rc,ru,{get:rh[ru],enumerable:!0});var rd="u">typeof D.default&&"title"in D.default,rf=rd?"node":navigator.userAgent,rp=rd?"node":navigator.platform,rg=rf.includes("Firefox"),rm=rf.includes("Edge"),r_=/^((?!chrome|android).)*safari/i.test(rf);function rv(){if(!r_)return 0;let e=rf.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var ry=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(rp),rb="iPad"===rp,rS="iPhone"===rp,rw=["Windows","Win16","Win32","WinCE"].includes(rp),rx=rp.indexOf("Linux")>=0,rC=/\bCrOS\b/.test(rf),rk=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,r=0,n=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,1.5*(r=Math.max(i=Math.max(1,performance.now()-i),r))>(s=e.timeRemaining())){n-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-i))}ms`),this._start();return}n=s}this.clear()}},rE=class extends rk{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},rR=class extends rk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},rT=!rd&&"requestIdleCallback"in window?rR:rE,rD=class{constructor(){this._queue=new rT}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rL=class extends eD{constructor(e,i,r,n,s,o,a,l,c){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new eL),this._pausedResizeTask=new rD,this._observerDisposable=this._register(new eL),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 eY),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new eY),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new eY),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new eY),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new rl((e,i)=>this._renderRows(e,i),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rA(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(eE(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=eE(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),i=Math.max(i,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rL=M([P(2,ei),P(3,ea),P(4,Z),P(5,es),P(6,G),P(7,el),P(8,ef)],rL);var rA=class{constructor(e,i,r){this._coreBrowserService=e,this._coreService=i,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function rM(e,i,r,n){return rN(Math.abs(e-rP(e,r)-(i-rP(i,r)))-function(e,i,r){let n=0,s=e-rP(e,r),o=i-rP(i,r);for(let a=0;a<Math.abs(s-o);a++){let o="A"===function(e,i){return e>i?"A":"B"}(e,i)?-1:1;r.buffer.lines.get(s+o*a)?.isWrapped&&n++}return n}(e,i,r),rB(e>i?"A":"B",n))}function rP(e,i){let r=0,n=i.buffer.lines.get(e),s=n?.isWrapped;for(;s&&e>=0&&e<i.rows;)r++,n=i.buffer.lines.get(--e),s=n?.isWrapped;return r}function rO(e,i,r,n,s,o){let a=e,l=i,c="";for(;(a!==r||l!==n)&&l>=0&&l<o.buffer.lines.length;)a+=s?1:-1,s&&a>o.cols-1?(c+=o.buffer.translateBufferLineToString(l,!1,e,a),a=0,e=0,l++):!s&&a<0&&(c+=o.buffer.translateBufferLineToString(l,!1,0,e+1),e=a=o.cols-1,l--);return c+o.buffer.translateBufferLineToString(l,!1,e,a)}function rB(e,i){return iL.ESC+(i?"O":"[")+e}function rN(e,i){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=i;return r}var rI=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!!e&&!!i&&(e[1]>i[1]||e[1]===i[1]&&e[0]>i[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function rF(e,i){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var rz=RegExp(" ","g"),rH=class extends eD{constructor(e,i,r,n,s,o,a,l,c){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=n,this._coreService=s,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new q,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new eY),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new eY),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new eY),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new eY),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new rI(this._bufferService),this._activeSelectionMode=0,this._register(eE(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1])}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(3===this._activeSelectionMode){if(e[0]===i[0])return"";let s=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let e=r.translateBufferLineToString(a,!0,s,o);n.push(e)}}else{let s=e[1]===i[1]?i[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let s=e[1]+1;s<=i[1]-1;s++){let e=r.lines.get(s),i=r.translateBufferLineToString(s,!0);e?.isWrapped?n[n.length-1]+=i:n.push(i)}if(e[1]!==i[1]){let e=r.lines.get(i[1]),s=r.translateBufferLineToString(i[1],!0,0,i[0]);e&&e.isWrapped?n[n.length-1]+=s:n.push(s)}}return n.map(e=>e.replace(rz," ")).join(rw?`\r
|
|
27
27
|
`:`
|
|
28
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),rT&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!r&&!!n&&!!i&&this._areCoordsInSelection(i,r,n)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!r&&!!n&&this._areCoordsInSelection([e,i],r,n)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=r$(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=ru(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return rC?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(rC&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,r,n){var s,o,a,l,c,h,u,d,f,p,g,m,_,v,y,b;let S,w=r.buffer.x,x=r.buffer.y;if(!r.buffer.hasScrollback){let b,S,C;return s=w,(0===rI(o=x,i,a=r,l=n).length?"":rj(rz(s,o,s,o-rF(o,a),!1,a).length,rH("D",l)))+rI(x,i,r,n)+(c=w,h=x,u=e,b=rI(h,d=i,f=r,p=n).length>0?d-rF(d,f):h,C=(g=c,m=h,S=rI(_=u,v=d,y=f,p).length>0?v-rF(v,y):m,g<_&&S<=v||g>=_&&S<v?"C":"D"),rj(rz(c,b,u,d,"C"===C,f).length,rH(C,p)))}if(x===i)return S=w>e?"D":"C",rj(Math.abs(w-e),rH(S,n));S=x>i?"D":"C";let C=Math.abs(x-i);return rj((b=x>i?e:w,r.cols-b+(C-1)*r.cols+1+((x>i?w:e)-1)),rH(S,n))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let n=0;i>=n;n++){let s=e.loadCell(n,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:s>1&&i!==n&&(r+=s-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let a=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(o,e[0]),c=l,h=e[0]-l,u=0,d=0,f=0,p=0;if(" "===a.charAt(l)){for(;l>0&&" "===a.charAt(l-1);)l--;for(;c<a.length&&" "===a.charAt(c+1);)c++}else{let i=e[0],r=e[0];0===o.getWidth(i)&&(u++,i--),2===o.getWidth(r)&&(d++,r++);let n=o.getString(r).length;for(n>1&&(p+=n-1,c+=n-1);i>0&&l>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,i--):e>1&&(f+=e-1,l-=e-1),l--,i--}for(;r<o.length&&c+1<a.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,r++):e>1&&(p+=e-1,c+=e-1),c++,r++}}c++;let g=l+h-u+f,m=Math.min(this._bufferService.cols,c-l+u+d-f-p);if(!(!i&&""===a.slice(l,c).trim())){if(r&&0===g&&32!==o.getCodePoint(0)){let i=s.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;g-=e,m+=e}}}if(n&&g+m===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=s.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(m+=i.length)}}return{start:g,length:m}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=r$(r,this._bufferService.cols)}};rq=I([F(3,et),F(4,er),F(5,ep),F(6,ea),F(7,eg),F(8,ef)],rq);var rV=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},rK=class{constructor(){this._color=new rV,this._css=new rV}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},rY=Object.freeze((()=>{let e=[nb.toColor("#2e3436"),nb.toColor("#cc0000"),nb.toColor("#4e9a06"),nb.toColor("#c4a000"),nb.toColor("#3465a4"),nb.toColor("#75507b"),nb.toColor("#06989a"),nb.toColor("#d3d7cf"),nb.toColor("#555753"),nb.toColor("#ef2929"),nb.toColor("#8ae234"),nb.toColor("#fce94f"),nb.toColor("#729fcf"),nb.toColor("#ad7fa8"),nb.toColor("#34e2e2"),nb.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=i[r/36%6|0],s=i[r/6%6|0],o=i[r%6];e.push({css:iF.toCss(n,s,o),rgba:iF.toRgba(n,s,o)})}for(let i=0;i<24;i++){let r=8+10*i;e.push({css:iF.toCss(r,r,r),rgba:iF.toRgba(r,r,r)})}return e})()),rX=nb.toColor("#ffffff"),rG=nb.toColor("#000000"),rJ=nb.toColor("#ffffff"),rZ={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},rQ=class extends eO{constructor(e){super(),this._optionsService=e,this._contrastCache=new rK,this._halfContrastCache=new rK,this._onChangeColors=this._register(new eQ),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:rX,background:rG,cursor:rJ,cursorAccent:rG,selectionForeground:void 0,selectionBackgroundTransparent:rZ,selectionBackgroundOpaque:ny.blend(rG,rZ),selectionInactiveBackgroundTransparent:rZ,selectionInactiveBackgroundOpaque:ny.blend(rG,rZ),scrollbarSliderBackground:ny.opacity(rX,.2),scrollbarSliderHoverBackground:ny.opacity(rX,.4),scrollbarSliderActiveBackground:ny.opacity(rX,.5),overviewRulerBorder:rX,ansi:rY.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=r0(e.foreground,rX),i.background=r0(e.background,rG),i.cursor=ny.blend(i.background,r0(e.cursor,rJ)),i.cursorAccent=ny.blend(i.background,r0(e.cursorAccent,rG)),i.selectionBackgroundTransparent=r0(e.selectionBackground,rZ),i.selectionBackgroundOpaque=ny.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=r0(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=ny.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?r0(e.selectionForeground,i$):void 0,i.selectionForeground===i$&&(i.selectionForeground=void 0),ny.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=ny.opacity(i.selectionBackgroundTransparent,.3)),ny.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=ny.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=r0(e.scrollbarSliderBackground,ny.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=r0(e.scrollbarSliderHoverBackground,ny.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=r0(e.scrollbarSliderActiveBackground,ny.opacity(i.foreground,.5)),i.overviewRulerBorder=r0(e.overviewRulerBorder,rX),i.ansi=rY.slice(),i.ansi[0]=r0(e.black,rY[0]),i.ansi[1]=r0(e.red,rY[1]),i.ansi[2]=r0(e.green,rY[2]),i.ansi[3]=r0(e.yellow,rY[3]),i.ansi[4]=r0(e.blue,rY[4]),i.ansi[5]=r0(e.magenta,rY[5]),i.ansi[6]=r0(e.cyan,rY[6]),i.ansi[7]=r0(e.white,rY[7]),i.ansi[8]=r0(e.brightBlack,rY[8]),i.ansi[9]=r0(e.brightRed,rY[9]),i.ansi[10]=r0(e.brightGreen,rY[10]),i.ansi[11]=r0(e.brightYellow,rY[11]),i.ansi[12]=r0(e.brightBlue,rY[12]),i.ansi[13]=r0(e.brightMagenta,rY[13]),i.ansi[14]=r0(e.brightCyan,rY[14]),i.ansi[15]=r0(e.brightWhite,rY[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)i.ansi[n+16]=r0(e.extendedAnsi[n],rY[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function r0(e,i){if(void 0!==e)try{return nb.toColor(e)}catch{}return i}rQ=I([F(0,ea)],rQ);var r1=class{constructor(...e){for(let[i,r]of(this._entries=new Map,e))this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},r2=class{constructor(){this._services=new r1,this._services.set(es,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let r=(e[Z]||[]).sort((e,i)=>e.index-i.index),n=[];for(let i of r){let r=this._services.get(i.id);if(!r)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);n.push(r)}let s=r.length>0?r[0].index:i.length;if(i.length!==s)throw Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${i.length} static arguments`);return new e(...i,...n)}},r5={trace:0,debug:1,info:2,warn:3,error:4,off:5},r3=class extends eO{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=r5[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...r)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};r3=I([F(0,ea)],r3);var r4=class extends eO{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new eQ),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new eQ),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new eQ),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...r){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+r<0)throw Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=i-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let n=e+i+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<i;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},r6=Object.freeze(new Y),r9=0,r8=class e{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let n=i||G.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,n);this.length=e}get(e){let i=this._data[3*e+0],r=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:r?U(r):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?U(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return r9=3*e,i.content=this._data[r9+0],i.fg=this._data[r9+1],i.bg=this._data[r9+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,r,n){0x10000000&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=i|r<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,i,r){let n=this._data[3*e+0];2097152&n?this._combined[e]+=U(i):2097151&n?(this._combined[e]=U(2097151&n)+U(i),n&=-2097152,n|=2097152):n=4194304|i,r&&(n&=-0xc00001,n|=r<<22),this._data[3*e+0]=n}insertCells(e,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let n=new G;for(let r=this.length-e-i-1;r>=0;--r)this.setCell(e+i+r,this.loadCell(e+r,n));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let n=new G;for(let r=0;r<this.length-e-i;++r)this.setCell(e+r,this.loadCell(e+i+r,n));for(let e=this.length-i;e<this.length;++e)this.setCell(e,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,n=!1){if(n){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let r=0;r<i.length;r++){let n=parseInt(i[r],10);n>=e&&delete this._combined[n]}let n=Object.keys(this._extendedAttrs);for(let i=0;i<n.length;i++){let r=parseInt(n[i],10);r>=e&&delete this._extendedAttrs[r]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,r,n,s){let o=e._data;if(s)for(let s=n-1;s>=0;s--){for(let e=0;e<3;e++)this._data[(r+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[i+s])}else for(let s=0;s<n;s++){for(let e=0;e<3;e++)this._data[(r+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[i+s])}let a=Object.keys(e._combined);for(let n=0;n<a.length;n++){let s=parseInt(a[n],10);s>=i&&(this._combined[s-i+r]=e._combined[s])}}translateToString(e,i,r,n){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),n&&(n.length=0);let s="";for(;i<r;){let e=this._data[3*i+0],r=2097151&e,o=2097152&e?this._combined[i]:r?U(r):" ";if(s+=o,n)for(let e=0;e<o.length;++e)n.push(i);i+=e>>22||1}return n&&n.push(i),s}};function r7(e,i,r){if(i===e.length-1)return e[i].getTrimmedLength();let n=!e[i].hasContent(r-1)&&1===e[i].getWidth(r-1),s=2===e[i+1].getWidth(0);return n&&s?r-1:r}var ne=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new eQ),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),eL(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};ne._nextId=1;var nt={},ni=nt.B;nt[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:"≥","{":"π","|":"≠","}":"£","~":"·"},nt.A={"#":"£"},nt.B=void 0,nt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},nt.C=nt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},nt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},nt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},nt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},nt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},nt.E=nt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},nt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},nt.H=nt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},nt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var nr=class{constructor(e,i,r){this._hasScrollback=e,this._optionsService=i,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=r6.clone(),this.savedCharset=ni,this.markers=[],this._nullCell=G.fromCharData([0,"",1,0]),this._whitespaceCell=G.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new rP,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r4(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new X),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new X),this._whitespaceCell}getBlankLine(e,i){return new r8(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=r6);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r4(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let r=this.getNullCell(r6),n=0,s=this._getCorrectBufferLength(i);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)n+=+this.lines.get(i).resize(e,r);let o=0;if(this._rows<i)for(let n=this._rows;n<i;n++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new r8(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new r8(e,r)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let e=this.lines.length-s;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)n+=+this.lines.get(i).resize(e,r);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,n=function(e,i,r,n,s,o){let a=[];for(let l=0;l<e.length-1;l++){let c=l,h=e.get(++c);if(!h.isWrapped)continue;let u=[e.get(l)];for(;c<e.length&&h.isWrapped;)u.push(h),h=e.get(++c);if(!o&&n>=l&&n<c){l+=u.length-1;continue}let d=0,f=r7(u,0,i),p=1,g=0;for(;p<u.length;){let e=r7(u,p,i),n=Math.min(e-g,r-f);u[d].copyCellsFrom(u[p],g,f,n,!1),(f+=n)===r&&(d++,f=0),(g+=n)===e&&(p++,g=0),0===f&&0!==d&&2===u[d-1].getWidth(r-1)&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,s))}u[d].replaceCells(f,r,s);let m=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)m++;m>0&&(a.push(l+u.length-m),a.push(m)),l+=u.length-1}return a}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(r6),r);if(n.length>0){let r=function(e,i){let r=[],n=0,s=i[0],o=0;for(let a=0;a<e.length;a++)if(s===a){let r=i[++n];e.onDeleteEmitter.fire({index:a-o,amount:r}),a+=r-1,o+=r,s=i[++n]}else r.push(a);return{layout:r,countRemoved:o}}(this.lines,n);(function(e,i){let r=[];for(let n=0;n<i.length;n++)r.push(e.get(i[n]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=i.length})(this.lines,r.layout),this._reflowLargerAdjustViewport(e,i,r.countRemoved)}}_reflowLargerAdjustViewport(e,i,r){let n=this.getNullCell(r6),s=r;for(;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new r8(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(r6),s=[],o=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let c=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),c.unshift(l);if(!r){let e=this.ybase+this.y;if(e>=a&&e<a+c.length)continue}let h=c[c.length-1].getTrimmedLength(),u=function(e,i,r){let n=[],s=e.map((r,n)=>r7(e,n,i)).reduce((e,i)=>e+i),o=0,a=0,l=0;for(;l<s;){if(s-l<r){n.push(s-l);break}o+=r;let c=r7(e,a,i);o>c&&(o-=c,a++);let h=2===e[a].getWidth(o-1);h&&o--;let u=h?r-1:r;n.push(u),l+=u}return n}(c,this._cols,e),d=u.length-c.length,f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(r6,!0);p.push(e)}p.length>0&&(s.push({start:a+c.length+o,newLines:p}),o+=p.length),c.push(...p);let g=u.length-1,m=u[g];0===m&&(m=u[--g]);let _=c.length-d-1,v=h;for(;_>=0;){let e=Math.min(v,m);if(void 0===c[g])break;c[g].copyCellsFrom(c[_],v-e,m-e,e,!0),0==(m-=e)&&(m=u[--g]),0==(v-=e)&&(v=r7(c,Math.max(--_,0),this._cols))}for(let i=0;i<c.length;i++)u[i]<e&&c[i].setCell(u[i],n);let y=d-f;for(;y-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+i-1)}if(s.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let r=this.lines.length,n=r-1,a=0,l=s[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let c=0;for(let h=Math.min(this.lines.maxLength-1,r+o-1);h>=0;h--)if(l&&l.start>n+c){for(let e=l.newLines.length-1;e>=0;e--)this.lines.set(h--,l.newLines[e]);h++,e.push({index:n+1,amount:l.newLines.length}),c+=l.newLines.length,l=s[++a]}else this.lines.set(h,i[n--]);let h=0;for(let i=e.length-1;i>=0;i--)e[i].index+=h,this.lines.onInsertEmitter.fire(e[i]),h+=e[i].amount;let u=Math.max(0,r+o-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,i,r=0,n){let s=this.lines.get(e);return s?s.translateToString(i,r,n):""}getWrappedRangeForLine(e){let i=e,r=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:i,last:r}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new ne(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},nn=class extends eO{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new eQ),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 nr(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new nr(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ns=class extends eO{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new eQ),this.onResize=this._onResize.event,this._onScroll=this._register(new eQ),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new nn(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,n=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,n;(n=this._cachedBlankLine)&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=r.getBlankLine(e,i),this._cachedBlankLine=n),n.isWrapped=i;let s=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(o+1,0,n.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=o-s+1;r.lines.shiftElements(s+1,e-1,-1),r.lines.set(o,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(0===r.ydisp)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};ns=I([F(0,ea)],ns);var no={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:rC,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},na=["normal","bold","100","200","300","400","500","600","700","800","900"],nl=class extends eO{constructor(e){super(),this._onOptionChange=this._register(new eQ),this.onOptionChange=this._onOptionChange.event;let i={...no};for(let r in e)if(r in i)try{let n=e[r];i[r]=this._sanitizeAndValidateOption(r,n)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(eA(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&i()})}_setupOptions(){let e=e=>{if(!(e in no))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in no))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var r;if(i||(i=no[e]),"block"!==(r=i)&&"underline"!==r&&"bar"!==r)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=no[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=na.includes(i)?i:no[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function nc(e,i=5){if("object"!=typeof e)return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=i<=1?e[n]:e[n]&&nc(e[n],i-1);return r}var nh=Object.freeze({insertMode:!1}),nu=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),nd=class extends eO{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new eQ),this.onData=this._onData.event,this._onUserInput=this._register(new eQ),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new eQ),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new eQ),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=nc(nh),this.decPrivateModes=nc(nu)}reset(){this.modes=nc(nh),this.decPrivateModes=nc(nu)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};nd=I([F(0,et),F(1,eo),F(2,ea)],nd);var nf={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function np(e,i){let r=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||i||(r|=3)),r}var ng=String.fromCharCode,nm={DEFAULT:e=>{let i=[np(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${ng(i[0])}${ng(i[1])}${ng(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${np(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${np(e,!0)};${e.x};${e.y}${i}`}},n_=class extends eO{constructor(e,i,r){for(let n of(super(),this._bufferService=e,this._coreService=i,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new eQ),this.onProtocolChange=this._onProtocolChange.event,Object.keys(nf)))this.addProtocol(n,nf[n]);for(let e of Object.keys(nm))this.addEncoding(e,nm[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,r){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===r)return 0;let n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i/r+0,50>Math.abs(e.deltaY)&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};n_=I([F(0,et),F(1,er),F(2,ea)],n_);var nv,ny,nb,nS,nw,nx,nC=[[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]],nk=[[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]],nE=class{constructor(){if(this.version="6",!nx){(nx=new Uint8Array(65536)).fill(1),nx[0]=0,nx.fill(0,1,32),nx.fill(0,127,160),nx.fill(2,4352,4448),nx[9001]=2,nx[9002]=2,nx.fill(2,11904,42192),nx[12351]=1,nx.fill(2,44032,55204),nx.fill(2,63744,64256),nx.fill(2,65040,65050),nx.fill(2,65072,65136),nx.fill(2,65280,65377),nx.fill(2,65504,65511);for(let e=0;e<nC.length;++e)nx.fill(0,nC[e][0],nC[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?nx[e]:!function(e,i){let r=0,n=i.length-1,s;if(e<i[0][0]||e>i[n][1])return!1;for(;n>=r;)if(e>i[s=r+n>>1][1])r=s+1;else{if(!(e<i[s][0]))return!0;n=s-1}return!1}(e,nk)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let r=this.wcwidth(e),n=0===r&&0!==i;if(n){let e=nR.extractWidth(i);0===e?n=!1:e>r&&(r=e)}return nR.createPropertyValue(0,r,n)}},nR=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new eQ,this.onChange=this._onChange.event;let e=new nE;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(0xffffff&e)<<3|(3&i)<<1|!!r}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(i){let r=0,n=0,s=i.length;for(let o=0;o<s;++o){let a=i.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return r+this.wcwidth(a);let e=i.charCodeAt(o);56320<=e&&e<=57343?a=(a-55296)*1024+e-56320+65536:r+=this.wcwidth(e)}let l=this.charProperties(a,n),c=e.extractWidth(l);e.extractShouldJoin(l)&&(c-=e.extractWidth(n)),r+=c,n=l}return r}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},nT=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function nD(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var nL=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let r=new e;if(!i.length)return r;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let n=i[e];if(Array.isArray(n))for(let e=0;e<n.length;++e)r.addSubParam(n[e]);else r.addParam(n)}return r}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,n=255&this._subParamsIdx[i];n-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,n))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,n=255&this._subParamsIdx[i];n-r>0&&(e[i]=this._subParams.slice(r,n))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,n=r[i-1];r[i-1]=~n?Math.min(10*n+e,0x7fffffff):e}},nA=[],nM=class{constructor(){this._state=0,this._active=nA,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=nA}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=nA,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||nA,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,i,r);else this._handlerFb(this._id,"PUT",q(e,i,r))}start(){this.reset(),this._state=1}put(e,i,r){if(3!==this._state){if(1===this._state)for(;i<r;){let r=e[i++];if(59===r){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-i>0&&this._put(e,i,r)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,n=this._active.length-1,s=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===r){for(;n>=0&&!0!==(r=this._active[n].end(e));n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if((r=this._active[n].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=nA,this._id=-1,this._state=0}}},nP=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=q(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},nO=[],nB=class{constructor(){this._handlers=Object.create(null),this._active=nO,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=nO}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=nO,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||nO,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,i,r);else this._handlerFb(this._ident,"PUT",q(e,i,r))}unhook(e,i=!0){if(this._active.length){let r=!1,n=this._active.length-1,s=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===r){for(;n>=0&&!0!==(r=this._active[n].unhook(e));n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if((r=this._active[n].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=nO,this._ident=0}},nN=new nL;nN.addParam(0);var nI=class{constructor(e){this._handler=e,this._data="",this._params=nN,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():nN,this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=q(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=nN,this._data="",this._hitLimit=!1,e));return this._params=nN,this._data="",this._hitLimit=!1,i}},nF=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,n){this.table[i<<8|e]=r<<4|n}addMany(e,i,r,n){for(let s=0;s<e.length;s++)this.table[i<<8|e[s]]=r<<4|n}},nz=function(){let e=new nF(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),r=(e,r)=>i.slice(e,r),n=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),a;for(a in e.setDefault(1,0),e.addMany(n,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),nH=class extends eO{constructor(e=nz){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new nL,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(eA(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new nM),this._dcsParser=this._register(new nB),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&60>r||r>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let n=e.intermediates.charCodeAt(i);if(32>n||n>47)throw Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw Error("final must be a single byte");let n=e.final.charCodeAt(0);if(i[0]>n||n>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=n}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,n,s){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=s}parse(e,i,r){let n=0,s=0,o=0,a;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,s=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&s>-1){for(;s>=0&&!0!==(a=i[s](this._params));s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 4:if(!1===r&&s>-1){for(;s>=0&&!0!==(a=i[s]());s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(24!==n&&26!==n,r))return a;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(24!==n&&26!==n,r))return a;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let r=o;r<i;++r){switch(n=e[r],(s=this._transitions.table[this.currentState<<8|(n<160?n:160)])>>4){case 2:for(let s=r+1;;++s)if(s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160){this._printHandler(e,r,s),r=s-1;break}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:r,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|n],l=o?o.length-1:-1;for(;l>=0&&!0!==(a=o[l](this._params));l--)if(a instanceof Promise)return this._preserveStack(3,o,l,s,r),a;l<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++r<i&&(n=e[r])>47&&n<60)r--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let c=this._escHandlers[this._collect<<8|n],h=c?c.length-1:-1;for(;h>=0&&!0!==(a=c[h]());h--)if(a instanceof Promise)return this._preserveStack(4,c,h,s,r),a;h<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let s=r+1;;++s)if(s>=i||24===(n=e[s])||26===n||27===n||n>127&&n<160){this._dcsParser.put(e,r,s),r=s-1;break}break;case 14:if(a=this._dcsParser.unhook(24!==n&&26!==n))return this._preserveStack(6,[],0,s,r),a;27===n&&(s|=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 s=r+1;;s++)if(s>=i||(n=e[s])<32||n>127&&n<160){this._oscParser.put(e,r,s),r=s-1;break}break;case 6:if(a=this._oscParser.end(24!==n&&26!==n))return this._preserveStack(5,[],0,s,r),a;27===n&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&s}}},nj=/^([\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})$/,nW=/^[\da-f]+$/;function n$(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=nj.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),nW.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,r=[0,0,0];for(let n=0;n<3;++n){let s=parseInt(i.slice(e*n,e*n+e),16);r[n]=1===e?s<<4:2===e?s:3===e?s>>4:s>>8}return r}}function nU(e,i){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(i){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}var nq={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function nV(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var nK=0,nY=class extends eO{constructor(e,i,r,n,s,o,a,l,c=new nH){for(let h in super(),this._bufferService=e,this._charsetService=i,this._coreService=r,this._logService=n,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=a,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new V,this._utf8Decoder=new K,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=r6.clone(),this._eraseAttrDataInternal=r6.clone(),this._onRequestBell=this._register(new eQ),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new eQ),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new eQ),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new eQ),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new eQ),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new eQ),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new eQ),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new eQ),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new eQ),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new eQ),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new eQ),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new eQ),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new eQ),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 nX(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,i,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:r})}),this._parser.setDcsHandlerFallback((e,i,r)=>{"HOOK"===i&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:r})}),this._parser.setPrintHandler((e,i,r)=>this.print(e,i,r)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(iB.BEL,()=>this.bell()),this._parser.setExecuteHandler(iB.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(iB.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(iB.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(iB.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(iB.BS,()=>this.backspace()),this._parser.setExecuteHandler(iB.HT,()=>this.tab()),this._parser.setExecuteHandler(iB.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(iB.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(iN.IND,()=>this.index()),this._parser.setExecuteHandler(iN.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(iN.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new nP(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new nP(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new nP(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new nP(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new nP(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new nP(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new nP(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new nP(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new nP(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new nP(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new nP(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new nP(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset()),nt)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nI((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,n=this._activeBuffer.x,s=this._activeBuffer.y,o=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),a||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,a="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,a))return this._preserveStack(n,s,a,i),this._logSlowResolvingAsync(r),r}else if(!a){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,i))return this._preserveStack(n,s,i,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,i,r){let n,s,o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-i>0&&2===d.getWidth(this._activeBuffer.x-1)&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=i;p<r;++p){if((n=e[p])<127&&o){let e=o[String.fromCharCode(n)];e&&(n=e.charCodeAt(0))}let i=this._unicodeService.charProperties(n,f);s=nR.extractWidth(i);let r=nR.extractShouldJoin(i),g=r?nR.extractWidth(f):0;if(f=i,a&&this._onA11yChar.fire(U(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-g>l){if(c){let e=d,i=this._activeBuffer.x-g;for(this._activeBuffer.x=g,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),g>0&&d instanceof r8&&d.copyCellsFrom(e,i,0,g,!1);i<l;)e.setCellFromCodepoint(i++,0,1,u)}else if(this._activeBuffer.x=l-1,2===s)continue}if(r&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,n,s);for(let e=s-g;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(h&&(d.insertCells(this._activeBuffer.x,s-g,this._activeBuffer.getNullCell(u)),2===d.getWidth(l-1)&&d.setCellFromCodepoint(l-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,n,s,u),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-i>0&&0===d.getWidth(this._activeBuffer.x)&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!nV(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new nI(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new nP(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,r,n=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),n&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);r<this._bufferService.rows;r++)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;i--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;i--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)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(r6));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let r=e.params[0]||1,n=nR.extractWidth(i),s=this._activeBuffer.x-n,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),a=new Uint32Array(o.length*r),l=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;a[l++]=i,e+=i>65535?2:1}let c=l;for(let e=1;e<r;++e)a.copyWithin(c,0,l),c+=l;return this.print(a,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(iB.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(iB.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(iB.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(iB.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(iB.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ni),this._charsetService.setgCharset(1,ni),this._charsetService.setgCharset(2,ni),this._charsetService.setgCharset(3,ni);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){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(),1049===e.params[i]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,i){let r,n,s,o;(n=r||={})[n.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",n[n.SET=1]="SET",n[n.RESET=2]="RESET",n[n.PERMANENTLY_SET=3]="PERMANENTLY_SET",n[n.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let a=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:u,cols:d}=this._bufferService,{active:f,alt:p}=u,g=this._optionsService.rawOptions,m=e=>e?1:2,_=e.params[0];return s=_,o=i?2===_?4:4===_?m(h.modes.insertMode):12===_?3:20===_?m(g.convertEol):0:1===_?m(a.applicationCursorKeys):3===_?g.windowOptions.setWinLines?80===d?2:+(132===d):0:6===_?m(a.origin):7===_?m(a.wraparound):8===_?3:9===_?m("X10"===l):12===_?m(g.cursorBlink):25===_?m(!h.isCursorHidden):45===_?m(a.reverseWraparound):66===_?m(a.applicationKeypad):67===_?4:1e3===_?m("VT200"===l):1002===_?m("DRAG"===l):1003===_?m("ANY"===l):1004===_?m(a.sendFocus):1005===_?4:1006===_?m("SGR"===c):1015===_?4:1016===_?m("SGR_PIXELS"===c):1048===_?1:47===_||1047===_||1049===_?m(f===p):2004===_?m(a.bracketedPasteMode):2026===_?m(a.synchronizedOutput):0,h.triggerDataEvent(`${iB.ESC}[${i?"":"?"}${s};${o}$y`),!0}_updateAttrColor(e,i,r,n,s){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=Y.fromColorRGB([r,n,s])):5===i&&(e&=-0x3000100,e|=0x2000000|255&r),e}_extractColor(e,i,r){let n=[0,0,-1,0,0,0],s=0,o=0;do{if(n[o+s]=e.params[i+o],e.hasSubParams(i+o)){let r=e.getSubParams(i+o),a=0;do 5===n[1]&&(s=1),n[o+a+1+s]=r[a];while(++a<r.length&&a+o+1+s<n.length)break}if(5===n[1]&&o+s>=2||2===n[1]&&o+s>=5)break;n[1]&&(s=1)}while(++o+i<e.length&&o+s<n.length)for(let e=2;e<n.length;++e)-1===n[e]&&(n[e]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=r6.fg,e.bg=r6.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,r,n=this._curAttrData;for(let s=0;s<i;s++)(r=e.params[s])>=30&&r<=37?(n.fg&=-0x3000100,n.fg|=0x1000000|r-30):r>=40&&r<=47?(n.bg&=-0x3000100,n.bg|=0x1000000|r-40):r>=90&&r<=97?(n.fg&=-0x3000100,n.fg|=0x1000000|r-90|8):r>=100&&r<=107?(n.bg&=-0x3000100,n.bg|=0x1000000|r-100|8):0===r?this._processSGR0(n):1===r?n.fg|=0x8000000:3===r?n.bg|=0x4000000:4===r?(n.fg|=0x10000000,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,n)):5===r?n.fg|=0x20000000:7===r?n.fg|=0x4000000:8===r?n.fg|=0x40000000:9===r?n.fg|=0x80000000:2===r?n.bg|=0x8000000:21===r?this._processUnderline(2,n):22===r?(n.fg&=-0x8000001,n.bg&=-0x8000001):23===r?n.bg&=-0x4000001:24===r?(n.fg&=-0x10000001,this._processUnderline(0,n)):25===r?n.fg&=-0x20000001:27===r?n.fg&=-0x4000001:28===r?n.fg&=-0x40000001:29===r?n.fg&=0x7fffffff:39===r?(n.fg&=-0x4000000,n.fg|=0xffffff&r6.fg):49===r?(n.bg&=-0x4000000,n.bg|=0xffffff&r6.bg):38===r||48===r||58===r?s+=this._extractColor(e,s,n):53===r?n.bg|=0x40000000:55===r?n.bg&=-0x40000001:59===r?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):100===r?(n.fg&=-0x4000000,n.fg|=0xffffff&r6.fg,n.bg&=-0x4000000,n.bg|=0xffffff&r6.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${iB.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iB.ESC}[${i};${r}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iB.ESC}[?${e};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=r6.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!nV(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${iB.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],r=e.split(";");for(;r.length>1;){let e=r.shift(),n=r.shift();if(/^\d+$/.exec(e)){let r=parseInt(e);if(nG(r))if("?"===n)i.push({type:0,index:r});else{let e=n$(n);e&&i.push({type:1,index:r,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let r=e.slice(0,i).trim(),n=e.slice(i+1);return n?this._createHyperlink(r,n):!r.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,s=r.findIndex(e=>e.startsWith("id="));return -1!==s&&(n=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let e=0;e<r.length&&!(i>=this._specialColors.length);++e,++i)if("?"===r[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let n=n$(r[e]);n&&this._onColor.fire([{type:1,index:this._specialColors[i],color:n}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],r=e.split(";");for(let e=0;e<r.length;++e)if(/^\d+$/.exec(r[e])){let n=parseInt(r[e]);nG(n)&&i.push({type:2,index:n})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,ni),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(nq[e[0]],nt[e[1]]||ni),!0}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=r6.clone(),this._eraseAttrDataInternal=r6.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new G;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let r=this._activeBuffer.ybase+this._activeBuffer.y+i,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let r=e=>(this._coreService.triggerDataEvent(`${iB.ESC}${e}${iB.ESC}\\`),!0),n=this._bufferService.buffer,s=this._optionsService.rawOptions;return r('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[s.cursorStyle]-!!s.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},nX=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(nK=e,e=i,i=nK),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function nG(e){return 0<=e&&e<256}nX=I([F(0,et)],nX);var nJ=class extends eO{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new eQ),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let r;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],n=this._action(e,i);if(n){let e=e=>performance.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);n.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-r>=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()}},nZ=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let r=i.addMarker(i.ybase+i.y),n={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(n,r)),this._dataByLinkId.set(n.id,n),n.id}let r=this._getEntryIdKey(e),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let s=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==i)){let e=this._bufferService.buffer.addMarker(i);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};nZ=I([F(0,et)],nZ);var nQ=!1,n0=class extends eO{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new eB),this._onBinary=this._register(new eQ),this.onBinary=this._onBinary.event,this._onData=this._register(new eQ),this.onData=this._onData.event,this._onLineFeed=this._register(new eQ),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new eQ),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new eQ),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new eQ),this._instantiationService=new r2,this.optionsService=this._register(new nl(e)),this._instantiationService.setService(ea,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ns)),this._instantiationService.setService(et,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(r3)),this._instantiationService.setService(eo,this._logService),this.coreService=this._register(this._instantiationService.createInstance(nd)),this._instantiationService.setService(er,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(n_)),this._instantiationService.setService(ei,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nR)),this._instantiationService.setService(ec,this.unicodeService),this._charsetService=this._instantiationService.createInstance(nT),this._instantiationService.setService(en,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(nZ),this._instantiationService.setService(el,this._oscLinkService),this._inputHandler=this._register(new nY(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(eV.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(eV.forward(this._bufferService.onResize,this._onResize)),this._register(eV.forward(this.coreService.onData,this._onData)),this._register(eV.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new nJ((e,i)=>this._inputHandler.parse(e,i))),this._register(eV.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new eQ),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!nQ&&(this._logService.warn("writeSync is unreliable and will be removed soon."),nQ=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(nD.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(nD(this._bufferService),!1))),this._windowsWrappingHeuristics.value=eA(()=>{for(let i of e)i.dispose()})}}},n1={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:["'",'"']},n2=0,n5=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new rP,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new rP,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,r=0,n=Array(this._array.length+this._insertedValues.length);for(let s=0;s<n.length;s++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(n[s]=e[i],i++):n[s]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(n2=this._search(i))||this._getKey(this._array[n2])!==i)return!1;do if(this._array[n2]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(n2),!0;while(++n2<this._array.length&&this._getKey(this._array[n2])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,r=Array(this._array.length-e.length),n=0;for(let s=0;s<this._array.length;s++)e[i]===s?i++:r[n++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((n2=this._search(e))<0||n2>=this._array.length)&&this._getKey(this._array[n2])===e)do yield this._array[n2];while(++n2<this._array.length&&this._getKey(this._array[n2])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((n2=this._search(e))<0||n2>=this._array.length)&&this._getKey(this._array[n2])===e)do i(this._array[n2]);while(++n2<this._array.length&&this._getKey(this._array[n2])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let n=i+r>>1,s=this._getKey(this._array[n]);if(s>e)r=n-1;else if(s<e)i=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return i}},n3=0,n4=0,n6=class extends eO{constructor(){super(),this._decorations=new n5(e=>e?.marker.line),this._onDecorationRegistered=this._register(new eQ),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new eQ),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(eA(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new n9(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),r=i.onDispose(()=>{r.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let n=0,s=0;for(let o of this._decorations.getKeyIterator(i))s=(n=o.options.x??0)+(o.options.width??1),e>=n&&e<s&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,i,r,n){this._decorations.forEachByKey(i,i=>{n4=(n3=i.options.x??0)+(i.options.width??1),e>=n3&&e<n4&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},n9=class extends eP{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new eQ),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new eQ),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=nb.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=nb.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},n8=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=n-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},n7=class extends eO{constructor(e,i,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n8(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
29
|
-
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(
|
|
30
|
-
`&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=H)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,n=r.lines.length.toString();for(let s=e;s<=i;s++){let e=r.lines.get(r.ydisp+s),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",a=(r.ydisp+s+1).toString(),l=this._rowElements[s];l&&(0===o.length?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=o,this._rowColumns.set(l,i)),l.setAttribute("aria-posinset",a),l.setAttribute("aria-setsize",n),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r,n,s=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(s.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(r=s,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=s,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let s=({node:e,offset:i})=>{let r=e instanceof Text?e.parentNode:e,n=parseInt(r?.getAttribute("aria-posinset"),10)-1;if(isNaN(n))return console.warn("row is invalid. Race condition?"),null;let s=this._rowColumns.get(r);if(!s)return console.warn("columns is null. Race condition?"),null;let o=i<s.length?s[i]:s.slice(-1)[0]+1;return o>=this._terminal.cols&&(++n,o=0),{row:n,column:o}},o=s(i),a=s(r);if(!(!o||!a)){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/i})`}};n7=I([F(1,es),F(2,ef),F(3,eg)],n7);var se=class extends eO{constructor(e,i,r,n,s){super(),this._element=e,this._mouseService=i,this._renderService=r,this._bufferService=n,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new eQ),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new eQ),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(eA(()=>{eL(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(t5(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(t5(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(t5(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(t5(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let e=0;e<r.length;e++){let i=r[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,s]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):s.provideLinks(e.y,i=>{if(this._isMouseOut)return;let s=i?.map(e=>({link:e}));this._activeProviderReplies?.set(n,s),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let n=0;n<i.size;n++){let s=i.get(n);if(s)for(let i=0;i<s.length;i++){let n=s[i],o=n.link.range.start.y<e?0:n.link.range.start.x,a=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){s.splice(i--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),s=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(s=!0);if(!s&&n){let e=n.find(e=>this._linkAtPosition(e.link,i));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let e=0;e<this._activeProviderReplies.size;e++){let n=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(n){r=!0,this._handleNewLink(n);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,r;if(!this._currentLink)return;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);n&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,eL(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,n=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,s=i.y*this._bufferService.cols+i.x;return r<=s&&s<=n}_positionFromMouseEvent(e,i,r){let n=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,n,s){return{x1:e,y1:i,x2:r,y2:n,cols:this._bufferService.cols,fg:s}}};se=I([F(1,ep),F(2,eg),F(3,et),F(4,ey)],se);var st=class extends n0{constructor(e={}){super(e),this._linkifier=this._register(new eB),this.browser=rp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new eB),this._onCursorMove=this._register(new eQ),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new eQ),this.onKey=this._onKey.event,this._onRender=this._register(new eQ),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new eQ),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new eQ),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new eQ),this.onBell=this._onBell.event,this._onFocus=this._register(new eQ),this._onBlur=this._register(new eQ),this._onA11yCharEmitter=this._register(new eQ),this._onA11yTabEmitter=this._register(new eQ),this._onWillOpen=this._register(new eQ),this._setup(),this._decorationService=this._instantiationService.createInstance(n6),this._instantiationService.setService(eh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rh),this._instantiationService.setService(ey,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(eu)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(eV.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(eV.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(eV.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(eV.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(eA(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let e,r="";switch(i.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+i.index}switch(i.type){case 0:let n=ny.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iB.ESC}]${r};${function(e,i=16){let[r,n,s]=e;return`rgb:${nU(r,i)}/${nU(n,i)}/${nU(s,i)}`}(n)}${iI.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=iF.toColor(...i.color));else{let r=e;this._themeService.modifyColors(e=>e[r]=iF.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(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(n7,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iB.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iB.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,s=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(t5(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,r,n;return i=this.textarea,r=this.coreService,n=this.optionsService,void(e.stopPropagation(),e.clipboardData&&j(e.clipboardData.getData("text/plain"),i,r,n))};this._register(t5(this.textarea,"paste",e)),this._register(t5(this.element,"paste",e)),rb?this._register(t5(this.element,"mousedown",e=>{2===e.button&&$(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(t5(this.element,"contextmenu",e=>{$(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rT&&this._register(t5(this.element,"auxclick",e=>{1===e.button&&W(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(t5(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(t5(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(t5(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(t5(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(t5(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(t5(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(t5(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(t5(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",z),rD||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(rl,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(ef,this._coreBrowserService),this._register(t5(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(t5(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rn,this._document,this._helperContainer),this._instantiationService.setService(ed,this._charSizeService),this._themeService=this._instantiationService.createInstance(rQ),this._instantiationService.setService(ev,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(i0),this._instantiationService.setService(e_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rB,this.rows,this.screenElement)),this._instantiationService.setService(eg,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(iD,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rd),this._instantiationService.setService(ep,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(se,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(iw,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(rq,this.element,this.screenElement,n)),this._instantiationService.setService(em,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(eV.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(ix,this.screenElement)),this._register(t5(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(n7,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iT,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iT,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(rr,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(i){let r,n,s=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!s)return!1;switch(i.overrideType||i.type){case"mousemove":n=32,void 0===i.buttons?(r=3,void 0!==i.button&&(r=i.button<3?i.button:3)):r=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":n=0,r=i.button<3?i.button:3;break;case"mousedown":n=1,r=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;n=o<0?0:1,r=4;break;default:return!1}return void 0!==n&&void 0!==r&&!(r>4)&&e.coreMouseService.triggerMouseEvent({col:s.col,row:s.row,x:s.x,y:s.y,button:r,action:n,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(e)),o=e=>(r(e),this.cancel(e,!0)),a=e=>{e.buttons&&r(e)},l=e=>{e.buttons||r(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?n.mousemove||(i.addEventListener("mousemove",l),n.mousemove=l):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&e?n.wheel||(i.addEventListener("wheel",o,{passive:!1}),n.wheel=o):(i.removeEventListener("wheel",n.wheel),n.wheel=null),2&e?n.mouseup||(n.mouseup=s):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&e?n.mousedrag||(n.mousedrag=a):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(t5(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return r(e),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(e)})),this._register(t5(i,"wheel",i=>{if(!n.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let r=iB.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){j(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let r=function(e,i,r,n){let s={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?s.key=iB.ESC+"OA":s.key=iB.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?s.key=iB.ESC+"OD":s.key=iB.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?s.key=iB.ESC+"OC":s.key=iB.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?s.key=iB.ESC+"OB":s.key=iB.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":iB.DEL,e.altKey&&(s.key=iB.ESC+s.key);break;case 9:if(e.shiftKey){s.key=iB.ESC+"[Z";break}s.key=iB.HT,s.cancel=!0;break;case 13:s.key=e.altKey?iB.ESC+iB.CR:iB.CR,s.cancel=!0;break;case 27:s.key=iB.ESC,e.altKey&&(s.key=iB.ESC+iB.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=iB.ESC+"[1;"+(o+1)+"D":i?s.key=iB.ESC+"OD":s.key=iB.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=iB.ESC+"[1;"+(o+1)+"C":i?s.key=iB.ESC+"OC":s.key=iB.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=iB.ESC+"[1;"+(o+1)+"A":i?s.key=iB.ESC+"OA":s.key=iB.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=iB.ESC+"[1;"+(o+1)+"B":i?s.key=iB.ESC+"OB":s.key=iB.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=iB.ESC+"[2~");break;case 46:o?s.key=iB.ESC+"[3;"+(o+1)+"~":s.key=iB.ESC+"[3~";break;case 36:o?s.key=iB.ESC+"[1;"+(o+1)+"H":i?s.key=iB.ESC+"OH":s.key=iB.ESC+"[H";break;case 35:o?s.key=iB.ESC+"[1;"+(o+1)+"F":i?s.key=iB.ESC+"OF":s.key=iB.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=iB.ESC+"[5;"+(o+1)+"~":s.key=iB.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=iB.ESC+"[6;"+(o+1)+"~":s.key=iB.ESC+"[6~";break;case 112:o?s.key=iB.ESC+"[1;"+(o+1)+"P":s.key=iB.ESC+"OP";break;case 113:o?s.key=iB.ESC+"[1;"+(o+1)+"Q":s.key=iB.ESC+"OQ";break;case 114:o?s.key=iB.ESC+"[1;"+(o+1)+"R":s.key=iB.ESC+"OR";break;case 115:o?s.key=iB.ESC+"[1;"+(o+1)+"S":s.key=iB.ESC+"OS";break;case 116:o?s.key=iB.ESC+"[15;"+(o+1)+"~":s.key=iB.ESC+"[15~";break;case 117:o?s.key=iB.ESC+"[17;"+(o+1)+"~":s.key=iB.ESC+"[17~";break;case 118:o?s.key=iB.ESC+"[18;"+(o+1)+"~":s.key=iB.ESC+"[18~";break;case 119:o?s.key=iB.ESC+"[19;"+(o+1)+"~":s.key=iB.ESC+"[19~";break;case 120:o?s.key=iB.ESC+"[20;"+(o+1)+"~":s.key=iB.ESC+"[20~";break;case 121:o?s.key=iB.ESC+"[21;"+(o+1)+"~":s.key=iB.ESC+"[21~";break;case 122:o?s.key=iB.ESC+"[23;"+(o+1)+"~":s.key=iB.ESC+"[23~";break;case 123:o?s.key=iB.ESC+"[24;"+(o+1)+"~":s.key=iB.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!r||n)&&e.altKey&&!e.metaKey){let i=n1[e.keyCode]?.[+!!e.shiftKey];if(i)s.key=iB.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),s.key=iB.ESC+i}else if(32===e.keyCode)s.key=iB.ESC+(e.ctrlKey?iB.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),s.key=iB.ESC+i,s.cancel=!0}}else!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(s.key=iB.US),"@"===e.key&&(s.key=iB.NUL)):s.key=e.key:65===e.keyCode&&(s.type=1);else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=iB.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=iB.DEL:219===e.keyCode?s.key=iB.ESC:220===e.keyCode?s.key=iB.FS:221===e.keyCode&&(s.key=iB.GS)}return s}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){let i=this.rows-1;return this.scrollLines(2===r.type?-i:i),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((r.key===iB.ETX||r.key===iB.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(r6));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(iB.ESC+"[I"):this.coreService.triggerDataEvent(iB.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iB.ESC}[4;${r};${i}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iB.ESC}[6;${s};${n}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},si=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},sr=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new G)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},sn=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let i=this._buffer.lines.get(e);if(i)return new sr(i)}getNullCell(){return new G}},ss=class extends eO{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new eQ),this.onBufferChange=this._onBufferChange.event,this._normal=new sn(this._core.buffers.normal,"normal"),this._alternate=new sn(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},so=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,r)=>i(e,r.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},sa=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},sl=["cols","rows"],sc=0,sh=class extends eO{constructor(e){super(),this._core=this._register(new st(e)),this._addonManager=this._register(new si),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],r=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let n={get:i.bind(this,e),set:r.bind(this,e)};Object.defineProperty(this._publicOptions,e,n)}}_checkReadonlyOptions(e){if(sl.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new so(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new sa(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 ss(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,r){this._verifyIntegers(e,i,r),this._core.select(e,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
31
|
-
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return z},set promptLabel(t){z=t},get tooMuchOutput(){return H},set tooMuchOutput(t){H=t}}}_verifyIntegers(...e){for(sc of e)if(sc===1/0||isNaN(sc)||sc%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sc of e)if(sc&&(sc===1/0||isNaN(sc)||sc%1!=0||sc<0))throw Error("This API only accepts positive integers")}};e.s(["Terminal",0,sh],99894);var su=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((s-(a.right+a.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((n-l)/e.css.cell.height))}}};e.s(["FitAddon",0,su],93309);let sd=Object.create(null);sd.open="0",sd.close="1",sd.ping="2",sd.pong="3",sd.message="4",sd.upgrade="5",sd.noop="6";let sf=Object.create(null);Object.keys(sd).forEach(e=>{sf[sd[e]]=e});let sp={type:"error",data:"parser error"},sg="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),sm="function"==typeof ArrayBuffer,s_=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,sv=({type:e,data:i},r,n)=>{if(sg&&i instanceof Blob)if(r)return n(i);else return sy(i,n);if(sm&&(i instanceof ArrayBuffer||s_(i)))if(r)return n(i);else return sy(new Blob([i]),n);return n(sd[e]+(i||""))},sy=(e,i)=>{let r=new FileReader;return r.onload=function(){i("b"+(r.result.split(",")[1]||""))},r.readAsDataURL(e)};function sb(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let sS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sw="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<sS.length;e++)sw[sS.charCodeAt(e)]=e;let sx="function"==typeof ArrayBuffer,sC=(e,i)=>{if("string"!=typeof e)return{type:"message",data:sE(e,i)};let r=e.charAt(0);return"b"===r?{type:"message",data:sk(e.substring(1),i)}:sf[r]?e.length>1?{type:sf[r],data:e.substring(1)}:{type:sf[r]}:sp},sk=(e,i)=>sx?sE((e=>{let i=.75*e.length,r=e.length,n,s=0,o,a,l,c;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);let h=new ArrayBuffer(i),u=new Uint8Array(h);for(n=0;n<r;n+=4)o=sw[e.charCodeAt(n)],a=sw[e.charCodeAt(n+1)],l=sw[e.charCodeAt(n+2)],c=sw[e.charCodeAt(n+3)],u[s++]=o<<2|a>>4,u[s++]=(15&a)<<4|l>>2,u[s++]=(3&l)<<6|63&c;return h})(e),i):{base64:!0,data:e},sE=(e,i)=>"blob"===i?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function sR(e){return e.reduce((e,i)=>e+i.length,0)}function sT(e,i){if(e[0].length===i)return e.shift();let r=new Uint8Array(i),n=0;for(let s=0;s<i;s++)r[s]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),r}function sD(e){if(e){var i=e;for(var r in sD.prototype)i[r]=sD.prototype[r];return i}}sD.prototype.on=sD.prototype.addEventListener=function(e,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(i),this},sD.prototype.once=function(e,i){function r(){this.off(e,r),i.apply(this,arguments)}return r.fn=i,this.on(e,r),this},sD.prototype.off=sD.prototype.removeListener=sD.prototype.removeAllListeners=sD.prototype.removeEventListener=function(e,i){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===i||r.fn===i){n.splice(s,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},sD.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var i=Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)i[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,i)}return this},sD.prototype.emitReserved=sD.prototype.emit,sD.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},sD.prototype.hasListeners=function(e){return!!this.listeners(e).length};let sL="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,i)=>i(e,0),sA="u">typeof self?self:"u">typeof window?window:Function("return this")();function sM(e,...i){return i.reduce((i,r)=>(e.hasOwnProperty(r)&&(i[r]=e[r]),i),{})}let sP=sA.setTimeout,sO=sA.clearTimeout;function sB(e,i){i.useNativeTimers?(e.setTimeoutFn=sP.bind(sA),e.clearTimeoutFn=sO.bind(sA)):(e.setTimeoutFn=sA.setTimeout.bind(sA),e.clearTimeoutFn=sA.clearTimeout.bind(sA))}function sN(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class sI extends Error{constructor(e,i,r){super(e),this.description=i,this.context=r,this.type="TransportError"}}class sF extends sD{constructor(e){super(),this.writable=!1,sB(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,i,r){return super.emitReserved("error",new sI(e,i,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let i=sC(e,this.socket.binaryType);this.onPacket(i)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,i={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let i=function(e){let i="";for(let r in e)e.hasOwnProperty(r)&&(i.length&&(i+="&"),i+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return i}(e);return i.length?"?"+i:""}}class sz extends sF{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let i=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||i()})),this.writable||(e++,this.once("drain",function(){--e||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let i=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};((e,i)=>{let r=e.split("\x1e"),n=[];for(let e=0;e<r.length;e++){let s=sC(r[e],i);if(n.push(s),"error"===s.type)break}return n})(e,this.socket.binaryType).forEach(i),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){var i;let r,n,s;this.writable=!1,i=e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})},n=Array(r=e.length),s=0,e.forEach((e,o)=>{sv(e,!1,e=>{n[o]=e,++s===r&&i(n.join("\x1e"))})})}uri(){let e=this.opts.secure?"https":"http",i=this.query||{};return!1!==this.opts.timestampRequests&&(i[this.opts.timestampParam]=sN()),this.supportsBinary||i.sid||(i.b64=1),this.createUri(e,i)}}let sH=!1;try{sH="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let sj=sH;function sW(){}class s$ extends sz{constructor(e){if(super(e),"u">typeof location){const i="https:"===location.protocol;let r=location.port;r||(r=i?"443":"80"),this.xd="u">typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,i){let r=this.request({method:"POST",data:e});r.on("success",i),r.on("error",(e,i)=>{this.onError("xhr post error",e,i)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=e}}class sU extends sD{constructor(e,i,r){super(),this.createRequest=e,sB(this,r),this._opts=r,this._method=r.method||"GET",this._uri=i,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;let i=sM(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(i);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"u">typeof document&&(this._index=sU.requestsCount++,sU.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=sW,e)try{this._xhr.abort()}catch(e){}"u">typeof document&&delete sU.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function sq(){for(let e in sU.requests)sU.requests.hasOwnProperty(e)&&sU.requests[e].abort()}sU.requestsCount=0,sU.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",sq):"function"==typeof addEventListener&&addEventListener("onpagehide"in sA?"pagehide":"unload",sq,!1));let sV=(m=sK({xdomain:!1}))&&null!==m.responseType;function sK(e){let i=e.xdomain;try{if("u">typeof XMLHttpRequest&&(!i||sj))return new XMLHttpRequest}catch(e){}if(!i)try{return new sA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let sY="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class sX extends sF{get name(){return"websocket"}doOpen(){let e=this.uri(),i=this.opts.protocols,r=sY?{}:sM(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,i,r)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let i=0;i<e.length;i++){let r=e[i],n=i===e.length-1;sv(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}n&&sL(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=sN()),this.supportsBinary||(i.b64=1),this.createUri(e,i)}}let sG=sA.WebSocket||sA.MozWebSocket,sJ={websocket:class extends sX{createSocket(e,i,r){return sY?new sG(e,i,r):i?new sG(e,i):new sG(e)}doWrite(e,i){this.ws.send(i)}},webtransport:class extends sF{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{var n,s;let o,a,l,c,h=(n=Number.MAX_SAFE_INTEGER,s=this.socket.binaryType,r||(r=new TextDecoder),o=[],a=0,l=-1,c=!1,new TransformStream({transform(e,i){for(o.push(e);;){if(0===a){if(1>sR(o))break;let e=sT(o,1);c=(128&e[0])==128,a=(l=127&e[0])<126?3:126===l?1:2}else if(1===a){if(2>sR(o))break;let e=sT(o,2);l=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),a=3}else if(2===a){if(8>sR(o))break;let e=sT(o,8),r=new DataView(e.buffer,e.byteOffset,e.length),n=r.getUint32(0);if(n>2097151){i.enqueue(sp);break}l=0x100000000*n+r.getUint32(4),a=3}else{if(sR(o)<l)break;let e=sT(o,l);i.enqueue(sC(c?e:r.decode(e),s)),a=0}if(0===l||l>n){i.enqueue(sp);break}}}})),u=e.readable.pipeThrough(h).getReader(),d=new TransformStream({transform(e,r){var n;n=i=>{let n,s=i.length;if(s<126)new DataView((n=new Uint8Array(1)).buffer).setUint8(0,s);else if(s<65536){let e=new DataView((n=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,s)}else{let e=new DataView((n=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(n[0]|=128),r.enqueue(n),r.enqueue(i)},sg&&e.data instanceof Blob?e.data.arrayBuffer().then(sb).then(n):sm&&(e.data instanceof ArrayBuffer||s_(e.data))?n(sb(e.data)):sv(e,!1,e=>{i||(i=new TextEncoder),n(i.encode(e))})}});d.readable.pipeTo(e.writable),this._writer=d.writable.getWriter();let f=()=>{u.read().then(({done:e,value:i})=>{e||(this.onPacket(i),f())}).catch(e=>{})};f();let p={type:"open"};this.query.sid&&(p.data=`{"sid":"${this.query.sid}"}`),this._writer.write(p).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let i=0;i<e.length;i++){let r=e[i],n=i===e.length-1;this._writer.write(r).then(()=>{n&&sL(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}},polling:class extends s${constructor(e){super(e);const i=e&&e.forceBase64;this.supportsBinary=sV&&!i}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new sU(sK,this.uri(),e)}}},sZ=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,sQ=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function s0(e){var i,r;let n,s;if(e.length>8e3)throw"URI too long";let o=e,a=e.indexOf("["),l=e.indexOf("]");-1!=a&&-1!=l&&(e=e.substring(0,a)+e.substring(a,l).replace(/:/g,";")+e.substring(l,e.length));let c=sZ.exec(e||""),h={},u=14;for(;u--;)h[sQ[u]]=c[u]||"";return -1!=a&&-1!=l&&(h.source=o,h.host=h.host.substring(1,h.host.length-1).replace(/;/g,":"),h.authority=h.authority.replace("[","").replace("]","").replace(/;/g,":"),h.ipv6uri=!0),n=(i=h.path).replace(/\/{2,9}/g,"/").split("/"),("/"==i.slice(0,1)||0===i.length)&&n.splice(0,1),"/"==i.slice(-1)&&n.splice(n.length-1,1),h.pathNames=n,r=h.query,s={},r.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,i,r){i&&(s[i]=r)}),h.queryKey=s,h}let s1="function"==typeof addEventListener&&"function"==typeof removeEventListener,s2=[];s1&&addEventListener("offline",()=>{s2.forEach(e=>e())},!1);class s5 extends sD{constructor(e,i){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(i=e,e=null),e){const r=s0(e);i.hostname=r.host,i.secure="https"===r.protocol||"wss"===r.protocol,i.port=r.port,r.query&&(i.query=r.query)}else i.host&&(i.hostname=s0(i.host).host);sB(this,i),this.secure=null!=i.secure?i.secure:"u">typeof location&&"https:"===location.protocol,i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||("u">typeof location?location.hostname:"localhost"),this.port=i.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(e=>{let i=e.prototype.name;this.transports.push(i),this._transportsByName[i]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let i={},r=e.split("&");for(let e=0,n=r.length;e<n;e++){let n=r[e].split("=");i[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return i}(this.opts.query)),s1&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},s2.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=4,i.transport=e,this.id&&(i.sid=this.id);let r=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&s5.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",s5.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let i=0;i<this.writeBuffer.length;i++){let r=this.writeBuffer[i].data;if(r&&(e+="string"==typeof r?function(e){let i=0,r=0;for(let n=0,s=e.length;n<s;n++)(i=e.charCodeAt(n))<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4);return r}(r):Math.ceil(1.33*(r.byteLength||r.size))),i>0&&e>this._maxPayload)return this.writeBuffer.slice(0,i);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,sL(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,r){return this._sendPacket("message",e,i,r),this}send(e,i,r){return this._sendPacket("message",e,i,r),this}_sendPacket(e,i,r,n){if("function"==typeof i&&(n=i,i=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;let s={type:e,data:i,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},r=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(s5.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),s1&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=s2.indexOf(this._offlineEventListener);-1!==e&&s2.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}s5.protocol=4;class s3 extends s5{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let i=this.createTransport(e),r=!1;s5.priorWebsocketSuccess=!1;let n=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;s5.priorWebsocketSuccess="websocket"===i.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(h(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{let e=Error("probe error");e.transport=i.name,this.emitReserved("upgradeError",e)}}))};function s(){r||(r=!0,h(),i.close(),i=null)}let o=e=>{let r=Error("probe error: "+e);r.transport=i.name,s(),this.emitReserved("upgradeError",r)};function a(){o("transport closed")}function l(){o("socket closed")}function c(e){i&&e.name!==i.name&&s()}let h=()=>{i.removeListener("open",n),i.removeListener("error",o),i.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};i.once("open",n),i.once("error",o),i.once("close",a),this.once("close",l),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||i.open()},200):i.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let i=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&i.push(e[r]);return i}}class s4 extends s3{constructor(e,i={}){const r="object"==typeof e?e:i;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>sJ[e]).filter(e=>!!e)),super(e,r)}}s4.protocol;let s6="function"==typeof ArrayBuffer,s9=Object.prototype.toString,s8="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===s9.call(Blob),s7="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===s9.call(File);function oe(e){return s6&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||s8&&e instanceof Blob||s7&&e instanceof File}let ot=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(_=v||(v={}))[_.CONNECT=0]="CONNECT",_[_.DISCONNECT=1]="DISCONNECT",_[_.EVENT=2]="EVENT",_[_.ACK=3]="ACK",_[_.CONNECT_ERROR=4]="CONNECT_ERROR",_[_.BINARY_EVENT=5]="BINARY_EVENT",_[_.BINARY_ACK=6]="BINARY_ACK";class oi extends sD{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let i;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let r=(i=this.decodeString(e)).type===v.BINARY_EVENT;r||i.type===v.BINARY_ACK?(i.type=r?v.EVENT:v.ACK,this.reconstructor=new or(i),0===i.attachments&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(oe(e)||e.base64)if(this.reconstructor)(i=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+e)}decodeString(e){let i=0,r={type:Number(e.charAt(0))};if(void 0===v[r.type])throw Error("unknown packet type "+r.type);if(r.type===v.BINARY_EVENT||r.type===v.BINARY_ACK){let n=i+1;for(;"-"!==e.charAt(++i)&&i!=e.length;);let s=e.substring(n,i);if(s!=Number(s)||"-"!==e.charAt(i))throw Error("Illegal attachments");let o=Number(s);if(!on(o)||o<0)throw Error("Illegal attachments");if(o>this.opts.maxAttachments)throw Error("too many attachments");r.attachments=o}if("/"===e.charAt(i+1)){let n=i+1;for(;++i&&","!==e.charAt(i)&&i!==e.length;);r.nsp=e.substring(n,i)}else r.nsp="/";let n=e.charAt(i+1);if(""!==n&&Number(n)==n){let n=i+1;for(;++i;){let r=e.charAt(i);if(null==r||Number(r)!=r){--i;break}if(i===e.length)break}r.id=Number(e.substring(n,i+1))}if(e.charAt(++i)){let n=this.tryParse(e.substr(i));if(oi.isPayloadValid(r.type,n))r.data=n;else throw Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,i){switch(e){case v.CONNECT:return os(i);case v.DISCONNECT:return void 0===i;case v.CONNECT_ERROR:return"string"==typeof i||os(i);case v.EVENT:case v.BINARY_EVENT:return Array.isArray(i)&&("number"==typeof i[0]||"string"==typeof i[0]&&-1===ot.indexOf(i[0]));case v.ACK:case v.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class or{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var i,r;let e=(i=this.reconPack,r=this.buffers,i.data=function e(i,r){if(!i)return i;if(i&&!0===i._placeholder){if("number"==typeof i.num&&i.num>=0&&i.num<r.length)return r[i.num];throw Error("illegal attachments")}if(Array.isArray(i))for(let n=0;n<i.length;n++)i[n]=e(i[n],r);else if("object"==typeof i)for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&(i[n]=e(i[n],r));return i}(i.data,r),delete i.attachments,i);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let on=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function os(e){return"[object Object]"===Object.prototype.toString.call(e)}function oo(e,i,r){return e.on(i,r),function(){e.off(i,r)}}e.s(["Decoder",0,oi,"Encoder",0,class{constructor(e){this.replacer=e}encode(e){return(e.type===v.EVENT||e.type===v.ACK)&&function e(i,r){if(!i||"object"!=typeof i)return!1;if(Array.isArray(i)){for(let r=0,n=i.length;r<n;r++)if(e(i[r]))return!0;return!1}if(oe(i))return!0;if(i.toJSON&&"function"==typeof i.toJSON&&1==arguments.length)return e(i.toJSON(),!0);for(let r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&e(i[r]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===v.EVENT?v.BINARY_EVENT:v.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let i=""+e.type;return(e.type===v.BINARY_EVENT||e.type===v.BINARY_ACK)&&(i+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(i+=e.nsp+","),null!=e.id&&(i+=e.id),null!=e.data&&(i+=JSON.stringify(e.data,this.replacer)),i}encodeAsBinary(e){let i,r,n=(i=[],r=e.data,e.data=function e(i,r){if(!i)return i;if(oe(i)){let e={_placeholder:!0,num:r.length};return r.push(i),e}if(Array.isArray(i)){let n=Array(i.length);for(let s=0;s<i.length;s++)n[s]=e(i[s],r);return n}if("object"==typeof i&&!(i instanceof Date)){let n={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=e(i[s],r));return n}return i}(r,i),e.attachments=i.length,{packet:e,buffers:i}),s=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(s),o}},"PacketType",0,v,"isPacketValid",0,function(e){var i;return"string"==typeof e.nsp&&(void 0===(i=e.id)||on(i))&&function(e,i){switch(e){case v.CONNECT:return void 0===i||os(i);case v.DISCONNECT:return void 0===i;case v.EVENT:return Array.isArray(i)&&("number"==typeof i[0]||"string"==typeof i[0]&&-1===ot.indexOf(i[0]));case v.ACK:return Array.isArray(i);case v.CONNECT_ERROR:return"string"==typeof i||os(i);default:return!1}}(e.type,e.data)},"protocol",0,5],51890);let oa=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ol extends sD{constructor(e,i,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=i,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[oo(e,"open",this.onopen.bind(this)),oo(e,"packet",this.onpacket.bind(this)),oo(e,"error",this.onerror.bind(this)),oo(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...i){var r,n,s;if(oa.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(i.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;let o={type:v.EVENT,data:i};if(o.options={},o.options.compress=!1!==this.flags.compress,"function"==typeof i[i.length-1]){let e=this.ids++,r=i.pop();this._registerAckCallback(e,r),o.id=e}let a=null==(n=null==(r=this.io.engine)?void 0:r.transport)?void 0:n.writable,l=this.connected&&!(null==(s=this.io.engine)?void 0:s._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,i){var r;let n=null!=(r=this.flags.timeout)?r:this._opts.ackTimeout;if(void 0===n){this.acks[e]=i;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);i.call(this,Error("operation has timed out"))},n),o=(...e)=>{this.io.clearTimeoutFn(s),i.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...i){return new Promise((r,n)=>{let s=(e,i)=>e?n(e):r(i);s.withError=!0,i.push(s),this.emit(e,...i)})}_addToQueue(e){let i;"function"==typeof e[e.length-1]&&(i=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...n)=>(this._queue[0],null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(e)):(this._queue.shift(),i&&i(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let i=this._queue[0];(!i.pending||e)&&(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:v.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case v.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case v.EVENT:case v.BINARY_EVENT:this.onevent(e);break;case v.ACK:case v.BINARY_ACK:this.onack(e);break;case v.DISCONNECT:this.ondisconnect();break;case v.CONNECT_ERROR:this.destroy();let i=Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i)}}onevent(e){let i=e.data||[];null!=e.id&&i.push(this.ack(e.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let i of this._anyListeners.slice())i.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let i=this,r=!1;return function(...n){r||(r=!0,i.packet({type:v.ACK,id:e,data:n}))}}onack(e){let i=this.acks[e.id];"function"==typeof i&&(delete this.acks[e.id],i.withError&&e.data.unshift(null),i.apply(this,e.data))}onconnect(e,i){this.id=e,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:v.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let i=this._anyListeners;for(let r=0;r<i.length;r++)if(e===i[r]){i.splice(r,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let i=this._anyOutgoingListeners;for(let r=0;r<i.length;r++)if(e===i[r]){i.splice(r,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let i of this._anyOutgoingListeners.slice())i.apply(this,e.data)}}var oc=e.i(51890);function oh(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}oh.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),r=Math.floor(i*this.jitter*e);e=(1&Math.floor(10*i))==0?e-r:e+r}return 0|Math.min(e,this.max)},oh.prototype.reset=function(){this.attempts=0},oh.prototype.setMin=function(e){this.ms=e},oh.prototype.setMax=function(e){this.max=e},oh.prototype.setJitter=function(e){this.jitter=e};class ou extends sD{constructor(e,i){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(i=e,e=void 0),(i=i||{}).path=i.path||"/socket.io",this.opts=i,sB(this,i),this.reconnection(!1!==i.reconnection),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(r=i.randomizationFactor)?r:.5),this.backoff=new oh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==i.timeout?2e4:i.timeout),this._readyState="closed",this.uri=e;const n=i.parser||oc;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==i.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var i;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null==(i=this.backoff)||i.setMin(e),this)}randomizationFactor(e){var i;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null==(i=this.backoff)||i.setJitter(e),this)}reconnectionDelayMax(e){var i;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null==(i=this.backoff)||i.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new s4(this.uri,this.opts);let i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let n=oo(i,"open",function(){r.onopen(),e&&e()}),s=i=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",i),e?e(i):this.maybeReconnectOnOpen()},o=oo(i,"error",s);if(!1!==this._timeout){let e=this._timeout,r=this.setTimeoutFn(()=>{n(),s(Error("timeout")),i.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(n),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(oo(e,"ping",this.onping.bind(this)),oo(e,"data",this.ondata.bind(this)),oo(e,"error",this.onerror.bind(this)),oo(e,"close",this.onclose.bind(this)),oo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){sL(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,i){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ol(this,e,i),this.nsps[e]=r),r}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let i=this.encoder.encode(e);for(let r=0;r<i.length;r++)this.engine.write(i[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,i){var r;this.cleanup(),null==(r=this.engine)||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let i=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},i);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let od={};function of(e,i){let r;"object"==typeof e&&(i=e,e=void 0);let n=function(e,i="",r){let n=e;r=r||"u">typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),n=s0(e)),!n.port&&(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";let s=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port+i,n.href=n.protocol+"://"+s+(r&&r.port===n.port?"":":"+n.port),n}(e,(i=i||{}).path||"/socket.io"),s=n.source,o=n.id,a=n.path,l=od[o]&&a in od[o].nsps;return i.forceNew||i["force new connection"]||!1===i.multiplex||l?r=new ou(s,i):(od[o]||(od[o]=new ou(s,i)),r=od[o]),n.query&&!i.query&&(i.query=n.queryKey),r.socket(n.path,i)}Object.assign(of,{Manager:ou,Socket:ol,io:of,connect:of}),e.s(["io",0,of],96085);var op=e.i(75254);let og=(0,op.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,og],31343);let om=(0,op.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);e.s(["SquarePen",0,om],10031)},77814,e=>{"use strict";var i,r=e.i(18050);e.s([],33847),e.i(33847),e.i(47167);var n=e.i(71645),s=e.i(231),o=e.i(62372);let a=new Map;function l(e,i,r){return null==e?"":(function(e,i){let r=JSON.stringify({locale:e,options:i}),n=a.get(r);if(n)return n;let s=new Intl.NumberFormat(e,i);return a.set(r,s),s})(i,r).format(e)}var c=e.i(27601),h=e.i(67805);let u=n.createContext(void 0);function d(){let e=n.useContext(u);if(void 0===e)throw Error((0,h.default)(51));return e}let f=((i={}).complete="data-complete",i.indeterminate="data-indeterminate",i.progressing="data-progressing",i),p={status:e=>"progressing"===e?{[f.progressing]:""}:"complete"===e?{[f.complete]:""}:"indeterminate"===e?{[f.indeterminate]:""}:null};function g(e,i){return null==i?"indeterminate progress":e||`${i}%`}let m=n.forwardRef(function(e,i){var a;let{format:h,getAriaValueText:d=g,locale:f,max:m=100,min:_=0,value:v,render:y,className:b,children:S,...w}=e,[x,C]=n.useState(),k=(0,s.useValueAsRef)(h),E="indeterminate";Number.isFinite(v)&&(E=v===m?"complete":"progressing");let R=(a=k.current,null==v?"":a?l(v,f,a):l(v/100,f,{style:"percent"})),T=n.useMemo(()=>({status:E}),[E]),D={"aria-labelledby":x,"aria-valuemax":m,"aria-valuemin":_,"aria-valuenow":v??void 0,"aria-valuetext":d(R,v),role:"progressbar",children:(0,r.jsxs)(n.Fragment,{children:[S,(0,r.jsx)("span",{role:"presentation",style:o.visuallyHidden,children:"x"})]})},L=n.useMemo(()=>({formattedValue:R,max:m,min:_,setLabelId:C,state:T,status:E,value:v}),[R,m,_,C,T,E,v]),A=(0,c.useRenderElement)("div",e,{state:T,ref:i,props:[D,w],stateAttributesMapping:p});return(0,r.jsx)(u.Provider,{value:L,children:A})}),_=n.forwardRef(function(e,i){let{render:r,className:n,...s}=e,{state:o}=d();return(0,c.useRenderElement)("div",e,{state:o,ref:i,props:s,stateAttributesMapping:p})}),v=n.forwardRef(function(e,i){let{render:r,className:s,...o}=e,{max:a,min:l,value:h,state:u}=d(),f=Number.isFinite(h)&&null!==h?(h-l)*100/(a-l):null,g=n.useCallback(()=>null==f?{}:{insetInlineStart:0,height:"inherit",width:`${f}%`},[f]);return(0,c.useRenderElement)("div",e,{state:u,ref:i,props:[{style:g()},o],stateAttributesMapping:p})}),y=n.forwardRef(function(e,i){let{className:r,render:n,children:s,...o}=e,{value:a,formattedValue:l,state:h}=d(),u=null==a?"indeterminate":l,f=null==a?null:l;return(0,c.useRenderElement)("span",e,{state:h,ref:i,props:[{"aria-hidden":!0,children:"function"==typeof s?s(u,a):f},o],stateAttributesMapping:p})});var b=e.i(24564);let S=n.forwardRef(function(e,i){let{render:r,className:n,id:s,...o}=e,{setLabelId:a,state:l}=d(),h=(0,b.useRegisteredLabelId)(s,a);return(0,c.useRenderElement)("span",e,{state:l,ref:i,props:[{id:h,role:"presentation"},o],stateAttributesMapping:p})});e.s(["Indicator",0,v,"Label",0,S,"Root",0,m,"Track",0,_,"Value",0,y],45929);var w=e.i(45929),w=w,x=e.i(52088);function C({className:e,...i}){return(0,r.jsx)(w.Track,{className:(0,x.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-md bg-muted",e),"data-slot":"progress-track",...i})}function k({className:e,...i}){return(0,r.jsx)(w.Indicator,{"data-slot":"progress-indicator",className:(0,x.cn)("h-full bg-primary transition-all",e),...i})}e.s(["Progress",0,function({className:e,children:i,value:n,...s}){return(0,r.jsxs)(w.Root,{value:n,"data-slot":"progress",className:(0,x.cn)("flex flex-wrap gap-3",e),...s,children:[i,(0,r.jsx)(C,{children:(0,r.jsx)(k,{})})]})}],77814)},67211,e=>{"use strict";var i=e.i(18050),r=e.i(71645),n=e.i(99894),s=e.i(93309),o=e.i(96085),a=e.i(627),l=e.i(31278),c=e.i(74886),h=e.i(31343),u=e.i(43531),d=e.i(10031),f=e.i(12382),p=e.i(85902),g=e.i(77814),m=e.i(70935);let _=(0,r.forwardRef)(function({tabId:e,cwd:_,env:v,worktreePath:y,command:b,className:S="",initialTodos:w,isActive:x,onTodosUpdated:C,onStatusChange:k},E){let R=(0,r.useRef)(null),T=(0,r.useRef)(null),D=(0,r.useRef)(null),L=(0,r.useRef)(null),A=(0,r.useRef)(e),[M,P]=(0,r.useState)(!1),O=(0,r.useRef)(!1),B=(0,r.useRef)(x),N=(0,r.useRef)(!1),I=(0,r.useRef)(!1),[F,z]=(0,r.useState)("idle"),[H,j]=(0,r.useState)("idle"),[W,$]=(0,r.useState)(w??[]),[U,q]=(0,r.useState)(!1),{effectiveTheme:V}=(0,a.useTheme)(),K=(0,r.useRef)(k);K.current=k;let Y="dark"===V,X=Y?{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",selectionBackground:"#add6ff"};function G(){let e=L.current,i=T.current,r=A.current;e&&e.connected&&i&&r&&e.emit("resize",{sessionId:r,cols:i.cols,rows:i.rows})}function J(e){e.write("\x1b[2J\x1b[3J\x1b[H")}async function Z(i,r,n){z("connecting");try{var s,a,l,c;let h,u,d=await fetch((0,m.apiUrl)("/api/terminal/sessions"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:_,env:v,worktreePath:y,sessionId:i,command:b}),signal:n});if(!d.ok){let e=await d.text().catch(()=>"");throw Error(`Failed to create session: ${d.status} ${e}`)}let f=await d.json();if(n.aborted)return;A.current=f.sessionId,f.reused||J(r),s=f.sessionId,a=f.reused,l=r,c=n,L.current=h=(0,o.io)((0,m.getServerUrl)(),{transports:["websocket"]}),u=!1,h.on("connect",()=>{let e=N.current;N.current=!0,e?l.writeln("\x1b[90mReconnected.\x1b[0m"):a?(I.current=!0,J(l)):l.writeln("\x1b[90mConnected.\x1b[0m"),z("connected"),h.emit("join",{room:`tab:${s}`}),e&&B.current&&l.focus()}),h.on("output",({data:e})=>{a&&!u?(u=!0,l.write(e,()=>{I.current=!1,D.current?.fit(),G()})):l.write(e)}),h.on("exit",({exitCode:e})=>{console.log("[TerminalView] PTY exited with code:",e),z("exited"),A.current=null,L.current=null}),h.on("error",({message:e})=>{console.error("[TerminalView] Socket error message:",e),z("error")}),h.on("disconnect",()=>{c.aborted||z(e=>"exited"===e||"paused"===e||"idle"===e?e:"exited")}),h.on("status-changed",({status:e})=>{j(e)}),h.on("todos-updated",({todos:i})=>{$(i),C?.(e,i)}),h.on("editor:open",({sessionId:e,content:i})=>{window.dispatchEvent(new CustomEvent("editor-session-open-request",{detail:{sessionId:e,content:i}}))}),l.onData(e=>{h.connected&&A.current&&h.emit("input",{sessionId:A.current,data:e})})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;console.error("[TerminalView] connectSession error:",e instanceof Error?e.message:String(e)),z("error")}}async function Q(){let i=T.current;if(!i)return;let r=new AbortController;await Z(e,i,r.signal)}(0,r.useEffect)(()=>{K.current?.(e,F,H)},[e,F,H]),(0,r.useLayoutEffect)(()=>{B.current=x}),(0,r.useEffect)(()=>{x&&T.current?.focus()},[x]),(0,r.useEffect)(()=>{if(M)T.current?.blur();else if(x){let e=R.current?.querySelector("textarea.xterm-helper-textarea");e?.focus()}},[M,x]),(0,r.useEffect)(()=>{"connected"===F&&D.current&&(D.current.fit(),I.current||G())},[F]),(0,r.useEffect)(()=>{if(!R.current)return;let i=new n.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Cascadia Code", "Fira Code", "Menlo", monospace',theme:X,allowProposedApi:!0}),r=new s.FitAddon;i.loadAddon(r),i.open(R.current),r.fit(),T.current=i,D.current=r,B.current&&i.focus(),i.attachCustomKeyEventHandler(()=>!O.current),i.buffer.onBufferChange(e=>{"normal"===e.type&&i.refresh(0,i.rows-1)});let o=new ResizeObserver(()=>{r.fit(),I.current||G()});o.observe(R.current);let a=new AbortController;return Z(e,i,a.signal),()=>{a.abort(),o.disconnect(),i.dispose(),T.current=null,D.current=null,L.current?.disconnect(),L.current=null}},[]),(0,r.useEffect)(()=>{T.current&&(T.current.options.theme=X)},[Y]),(0,r.useEffect)(()=>{function e(){O.current=!0,T.current?.blur()}function i(){if(O.current=!1,!B.current)return;let e=R.current?.querySelector("textarea.xterm-helper-textarea");e?.focus()}return window.addEventListener("editor-session-open",e),window.addEventListener("editor-session-done",i),()=>{window.removeEventListener("editor-session-open",e),window.removeEventListener("editor-session-done",i)}},[]),(0,r.useEffect)(()=>{function e(){if("visible"!==document.visibilityState)return;let e=L.current;if(!e||!e.connected)return;let i=setTimeout(()=>{e.off("health-check-ack",r),e.disconnect()},3e3);function r(){clearTimeout(i),B.current&&T.current?.focus()}e.once("health-check-ack",r),e.emit("health-check")}return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,r.useImperativeHandle)(E,()=>({sendInput:e=>{let i=L.current,r=A.current;i?.connected&&r&&i.emit("input",{sessionId:r,data:e})},focus:()=>{T.current?.focus()}}));let ee=(0,r.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{q(!0),setTimeout(()=>q(!1),2e3)})},[e]),et="connecting"===F,ei="paused"===F||"exited"===F||"error"===F,er="connected"===F,en=W.filter(e=>"deleted"!==e.status),es=en.filter(e=>"completed"===e.status).length,eo=en.length,ea=e.length>8?`${e.slice(0,8)}…`:e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:`flex flex-col h-full min-h-0 ${S}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 border-b border-border flex-shrink-0 bg-card",children:[(0,i.jsx)("span",{className:"font-mono text-xs text-muted-foreground",title:e,children:ea}),(0,i.jsx)(p.Button,{variant:"ghost",size:"icon-xs",onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Copy tab ID",children:U?(0,i.jsx)(u.Check,{className:"w-3 h-3 text-success"}):(0,i.jsx)(c.Copy,{className:"w-3 h-3"})}),(0,i.jsxs)(p.Button,{size:"xs",onClick:function(){let e=L.current,i=A.current;if(!e||!e.connected||!i)return;let r=`claude --dangerously-skip-permissions --resume ${i} 2>/dev/null || claude --dangerously-skip-permissions --session-id ${i}
|
|
28
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),rx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!r&&!!n&&!!i&&this._areCoordsInSelection(i,r,n)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!r&&!!n&&this._areCoordsInSelection([e,i],r,n)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=rF(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return!!n&&(this._selectWordAt(n,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=ro(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return ry?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(ry&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,r,n){var s,o,a,l,c,h,u,d,f,p,g,m,_,v,y,b;let S,w=r.buffer.x,x=r.buffer.y;if(!r.buffer.hasScrollback){let b,S,C;return s=w,(0===rM(o=x,i,a=r,l=n).length?"":rN(rO(s,o,s,o-rP(o,a),!1,a).length,rB("D",l)))+rM(x,i,r,n)+(c=w,h=x,u=e,b=rM(h,d=i,f=r,p=n).length>0?d-rP(d,f):h,C=(g=c,m=h,S=rM(_=u,v=d,y=f,p).length>0?v-rP(v,y):m,g<_&&S<=v||g>=_&&S<v?"C":"D"),rN(rO(c,b,u,d,"C"===C,f).length,rB(C,p)))}if(x===i)return S=w>e?"D":"C",rN(Math.abs(w-e),rB(S,n));S=x>i?"D":"C";let C=Math.abs(x-i);return rN((b=x>i?e:w,r.cols-b+(C-1)*r.cols+1+((x>i?w:e)-1)),rB(S,n))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let n=0;i>=n;n++){let s=e.loadCell(n,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:s>1&&i!==n&&(r+=s-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let a=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(o,e[0]),c=l,h=e[0]-l,u=0,d=0,f=0,p=0;if(" "===a.charAt(l)){for(;l>0&&" "===a.charAt(l-1);)l--;for(;c<a.length&&" "===a.charAt(c+1);)c++}else{let i=e[0],r=e[0];0===o.getWidth(i)&&(u++,i--),2===o.getWidth(r)&&(d++,r++);let n=o.getString(r).length;for(n>1&&(p+=n-1,c+=n-1);i>0&&l>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,i--):e>1&&(f+=e-1,l-=e-1),l--,i--}for(;r<o.length&&c+1<a.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,r++):e>1&&(p+=e-1,c+=e-1),c++,r++}}c++;let g=l+h-u+f,m=Math.min(this._bufferService.cols,c-l+u+d-f-p);if(!(!i&&""===a.slice(l,c).trim())){if(r&&0===g&&32!==o.getCodePoint(0)){let i=s.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;g-=e,m+=e}}}if(n&&g+m===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=s.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(m+=i.length)}}return{start:g,length:m}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=rF(r,this._bufferService.cols)}};rH=M([P(3,G),P(4,Z),P(5,ec),P(6,ei),P(7,eh),P(8,el)],rH);var rj=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},rW=class{constructor(){this._color=new rj,this._css=new rj}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},r$=Object.freeze((()=>{let e=[ng.toColor("#2e3436"),ng.toColor("#cc0000"),ng.toColor("#4e9a06"),ng.toColor("#c4a000"),ng.toColor("#3465a4"),ng.toColor("#75507b"),ng.toColor("#06989a"),ng.toColor("#d3d7cf"),ng.toColor("#555753"),ng.toColor("#ef2929"),ng.toColor("#8ae234"),ng.toColor("#fce94f"),ng.toColor("#729fcf"),ng.toColor("#ad7fa8"),ng.toColor("#34e2e2"),ng.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=i[r/36%6|0],s=i[r/6%6|0],o=i[r%6];e.push({css:iP.toCss(n,s,o),rgba:iP.toRgba(n,s,o)})}for(let i=0;i<24;i++){let r=8+10*i;e.push({css:iP.toCss(r,r,r),rgba:iP.toRgba(r,r,r)})}return e})()),rU=ng.toColor("#ffffff"),rq=ng.toColor("#000000"),rV=ng.toColor("#ffffff"),rK={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},rY=class extends eD{constructor(e){super(),this._optionsService=e,this._contrastCache=new rW,this._halfContrastCache=new rW,this._onChangeColors=this._register(new eY),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:rU,background:rq,cursor:rV,cursorAccent:rq,selectionForeground:void 0,selectionBackgroundTransparent:rK,selectionBackgroundOpaque:np.blend(rq,rK),selectionInactiveBackgroundTransparent:rK,selectionInactiveBackgroundOpaque:np.blend(rq,rK),scrollbarSliderBackground:np.opacity(rU,.2),scrollbarSliderHoverBackground:np.opacity(rU,.4),scrollbarSliderActiveBackground:np.opacity(rU,.5),overviewRulerBorder:rU,ansi:r$.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=rX(e.foreground,rU),i.background=rX(e.background,rq),i.cursor=np.blend(i.background,rX(e.cursor,rV)),i.cursorAccent=np.blend(i.background,rX(e.cursorAccent,rq)),i.selectionBackgroundTransparent=rX(e.selectionBackground,rK),i.selectionBackgroundOpaque=np.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=rX(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=np.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?rX(e.selectionForeground,iF):void 0,i.selectionForeground===iF&&(i.selectionForeground=void 0),np.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=np.opacity(i.selectionBackgroundTransparent,.3)),np.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=np.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=rX(e.scrollbarSliderBackground,np.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=rX(e.scrollbarSliderHoverBackground,np.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=rX(e.scrollbarSliderActiveBackground,np.opacity(i.foreground,.5)),i.overviewRulerBorder=rX(e.overviewRulerBorder,rU),i.ansi=r$.slice(),i.ansi[0]=rX(e.black,r$[0]),i.ansi[1]=rX(e.red,r$[1]),i.ansi[2]=rX(e.green,r$[2]),i.ansi[3]=rX(e.yellow,r$[3]),i.ansi[4]=rX(e.blue,r$[4]),i.ansi[5]=rX(e.magenta,r$[5]),i.ansi[6]=rX(e.cyan,r$[6]),i.ansi[7]=rX(e.white,r$[7]),i.ansi[8]=rX(e.brightBlack,r$[8]),i.ansi[9]=rX(e.brightRed,r$[9]),i.ansi[10]=rX(e.brightGreen,r$[10]),i.ansi[11]=rX(e.brightYellow,r$[11]),i.ansi[12]=rX(e.brightBlue,r$[12]),i.ansi[13]=rX(e.brightMagenta,r$[13]),i.ansi[14]=rX(e.brightCyan,r$[14]),i.ansi[15]=rX(e.brightWhite,r$[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<r;n++)i.ansi[n+16]=rX(e.extendedAnsi[n],r$[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function rX(e,i){if(void 0!==e)try{return ng.toColor(e)}catch{}return i}rY=M([P(0,ei)],rY);var rG=class{constructor(...e){for(let[i,r]of(this._entries=new Map,e))this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},rJ=class{constructor(){this._services=new rG,this._services.set(ee,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let r=(e[K]||[]).sort((e,i)=>e.index-i.index),n=[];for(let i of r){let r=this._services.get(i.id);if(!r)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);n.push(r)}let s=r.length>0?r[0].index:i.length;if(i.length!==s)throw Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${i.length} static arguments`);return new e(...i,...n)}},rZ={trace:0,debug:1,info:2,warn:3,error:4,off:5},rQ=class extends eD{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=rZ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...r)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};rQ=M([P(0,ei)],rQ);var r0=class extends eD{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new eY),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new eY),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new eY),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...r){if(i){for(let r=e;r<this._length-i;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+r<0)throw Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=i-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let n=e+i+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<i;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},r1=Object.freeze(new $),r2=0,r5=class e{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let n=i||q.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,n);this.length=e}get(e){let i=this._data[3*e+0],r=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:r?z(r):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?z(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return r2=3*e,i.content=this._data[r2+0],i.fg=this._data[r2+1],i.bg=this._data[r2+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,r,n){0x10000000&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=i|r<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,i,r){let n=this._data[3*e+0];2097152&n?this._combined[e]+=z(i):2097151&n?(this._combined[e]=z(2097151&n)+z(i),n&=-2097152,n|=2097152):n=4194304|i,r&&(n&=-0xc00001,n|=r<<22),this._data[3*e+0]=n}insertCells(e,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let n=new q;for(let r=this.length-e-i-1;r>=0;--r)this.setCell(e+i+r,this.loadCell(e+r,n));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let n=new q;for(let r=0;r<this.length-e-i;++r)this.setCell(e+r,this.loadCell(e+i+r,n));for(let e=this.length-i;e<this.length;++e)this.setCell(e,r)}else for(let i=e;i<this.length;++i)this.setCell(i,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,n=!1){if(n){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let r=0;r<i.length;r++){let n=parseInt(i[r],10);n>=e&&delete this._combined[n]}let n=Object.keys(this._extendedAttrs);for(let i=0;i<n.length;i++){let r=parseInt(n[i],10);r>=e&&delete this._extendedAttrs[r]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,r,n,s){let o=e._data;if(s)for(let s=n-1;s>=0;s--){for(let e=0;e<3;e++)this._data[(r+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[i+s])}else for(let s=0;s<n;s++){for(let e=0;e<3;e++)this._data[(r+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[i+s])}let a=Object.keys(e._combined);for(let n=0;n<a.length;n++){let s=parseInt(a[n],10);s>=i&&(this._combined[s-i+r]=e._combined[s])}}translateToString(e,i,r,n){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),n&&(n.length=0);let s="";for(;i<r;){let e=this._data[3*i+0],r=2097151&e,o=2097152&e?this._combined[i]:r?z(r):" ";if(s+=o,n)for(let e=0;e<o.length;++e)n.push(i);i+=e>>22||1}return n&&n.push(i),s}};function r3(e,i,r){if(i===e.length-1)return e[i].getTrimmedLength();let n=!e[i].hasContent(r-1)&&1===e[i].getWidth(r-1),s=2===e[i+1].getWidth(0);return n&&s?r-1:r}var r4=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new eY),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ek(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};r4._nextId=1;var r6={},r9=r6.B;r6[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:"≥","{":"π","|":"≠","}":"£","~":"·"},r6.A={"#":"£"},r6.B=void 0,r6[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r6.C=r6[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r6.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r6.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r6.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r6.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r6.E=r6[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r6.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r6.H=r6[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r6["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var r8=class{constructor(e,i,r){this._hasScrollback=e,this._optionsService=i,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=r1.clone(),this.savedCharset=r9,this.markers=[],this._nullCell=q.fromCharData([0,"",1,0]),this._whitespaceCell=q.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new rT,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r0(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new U),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new U),this._whitespaceCell}getBlankLine(e,i){return new r5(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=r1);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r0(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let r=this.getNullCell(r1),n=0,s=this._getCorrectBufferLength(i);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)n+=+this.lines.get(i).resize(e,r);let o=0;if(this._rows<i)for(let n=this._rows;n<i;n++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new r5(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new r5(e,r)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let e=this.lines.length-s;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)n+=+this.lines.get(i).resize(e,r);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,n=function(e,i,r,n,s,o){let a=[];for(let l=0;l<e.length-1;l++){let c=l,h=e.get(++c);if(!h.isWrapped)continue;let u=[e.get(l)];for(;c<e.length&&h.isWrapped;)u.push(h),h=e.get(++c);if(!o&&n>=l&&n<c){l+=u.length-1;continue}let d=0,f=r3(u,0,i),p=1,g=0;for(;p<u.length;){let e=r3(u,p,i),n=Math.min(e-g,r-f);u[d].copyCellsFrom(u[p],g,f,n,!1),(f+=n)===r&&(d++,f=0),(g+=n)===e&&(p++,g=0),0===f&&0!==d&&2===u[d-1].getWidth(r-1)&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,s))}u[d].replaceCells(f,r,s);let m=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)m++;m>0&&(a.push(l+u.length-m),a.push(m)),l+=u.length-1}return a}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(r1),r);if(n.length>0){let r=function(e,i){let r=[],n=0,s=i[0],o=0;for(let a=0;a<e.length;a++)if(s===a){let r=i[++n];e.onDeleteEmitter.fire({index:a-o,amount:r}),a+=r-1,o+=r,s=i[++n]}else r.push(a);return{layout:r,countRemoved:o}}(this.lines,n);(function(e,i){let r=[];for(let n=0;n<i.length;n++)r.push(e.get(i[n]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=i.length})(this.lines,r.layout),this._reflowLargerAdjustViewport(e,i,r.countRemoved)}}_reflowLargerAdjustViewport(e,i,r){let n=this.getNullCell(r1),s=r;for(;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new r5(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,i){let r=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(r1),s=[],o=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let c=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),c.unshift(l);if(!r){let e=this.ybase+this.y;if(e>=a&&e<a+c.length)continue}let h=c[c.length-1].getTrimmedLength(),u=function(e,i,r){let n=[],s=e.map((r,n)=>r3(e,n,i)).reduce((e,i)=>e+i),o=0,a=0,l=0;for(;l<s;){if(s-l<r){n.push(s-l);break}o+=r;let c=r3(e,a,i);o>c&&(o-=c,a++);let h=2===e[a].getWidth(o-1);h&&o--;let u=h?r-1:r;n.push(u),l+=u}return n}(c,this._cols,e),d=u.length-c.length,f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(r1,!0);p.push(e)}p.length>0&&(s.push({start:a+c.length+o,newLines:p}),o+=p.length),c.push(...p);let g=u.length-1,m=u[g];0===m&&(m=u[--g]);let _=c.length-d-1,v=h;for(;_>=0;){let e=Math.min(v,m);if(void 0===c[g])break;c[g].copyCellsFrom(c[_],v-e,m-e,e,!0),0==(m-=e)&&(m=u[--g]),0==(v-=e)&&(v=r3(c,Math.max(--_,0),this._cols))}for(let i=0;i<c.length;i++)u[i]<e&&c[i].setCell(u[i],n);let y=d-f;for(;y-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+i-1)}if(s.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let r=this.lines.length,n=r-1,a=0,l=s[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let c=0;for(let h=Math.min(this.lines.maxLength-1,r+o-1);h>=0;h--)if(l&&l.start>n+c){for(let e=l.newLines.length-1;e>=0;e--)this.lines.set(h--,l.newLines[e]);h++,e.push({index:n+1,amount:l.newLines.length}),c+=l.newLines.length,l=s[++a]}else this.lines.set(h,i[n--]);let h=0;for(let i=e.length-1;i>=0;i--)e[i].index+=h,this.lines.onInsertEmitter.fire(e[i]),h+=e[i].amount;let u=Math.max(0,r+o-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,i,r=0,n){let s=this.lines.get(e);return s?s.translateToString(i,r,n):""}getWrappedRangeForLine(e){let i=e,r=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:i,last:r}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new r4(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},r7=class extends eD{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new eY),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 r8(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r8(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ne=class extends eD{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new eY),this.onResize=this._onResize.event,this._onScroll=this._register(new eY),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new r7(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,n=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,n;(n=this._cachedBlankLine)&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=r.getBlankLine(e,i),this._cachedBlankLine=n),n.isWrapped=i;let s=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){let e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(o+1,0,n.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let e=o-s+1;r.lines.shiftElements(s+1,e-1,-1),r.lines.set(o,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(0===r.ydisp)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};ne=M([P(0,ei)],ne);var nt={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ry,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ni=["normal","bold","100","200","300","400","500","600","700","800","900"],nr=class extends eD{constructor(e){super(),this._onOptionChange=this._register(new eY),this.onOptionChange=this._onOptionChange.event;let i={...nt};for(let r in e)if(r in i)try{let n=e[r];i[r]=this._sanitizeAndValidateOption(r,n)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(eE(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&i()})}_setupOptions(){let e=e=>{if(!(e in nt))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in nt))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var r;if(i||(i=nt[e]),"block"!==(r=i)&&"underline"!==r&&"bar"!==r)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=nt[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=ni.includes(i)?i:nt[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function nn(e,i=5){if("object"!=typeof e)return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=i<=1?e[n]:e[n]&&nn(e[n],i-1);return r}var ns=Object.freeze({insertMode:!1}),no=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),na=class extends eD{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new eY),this.onData=this._onData.event,this._onUserInput=this._register(new eY),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new eY),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new eY),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=nn(ns),this.decPrivateModes=nn(no)}reset(){this.modes=nn(ns),this.decPrivateModes=nn(no)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};na=M([P(0,G),P(1,et),P(2,ei)],na);var nl={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function nc(e,i){let r=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||i||(r|=3)),r}var nh=String.fromCharCode,nu={DEFAULT:e=>{let i=[nc(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${nh(i[0])}${nh(i[1])}${nh(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${nc(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${nc(e,!0)};${e.x};${e.y}${i}`}},nd=class extends eD{constructor(e,i,r){for(let n of(super(),this._bufferService=e,this._coreService=i,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new eY),this.onProtocolChange=this._onProtocolChange.event,Object.keys(nl)))this.addProtocol(n,nl[n]);for(let e of Object.keys(nu))this.addEncoding(e,nu[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,r){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===r)return 0;let n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i/r+0,50>Math.abs(e.deltaY)&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};nd=M([P(0,G),P(1,Z),P(2,ei)],nd);var nf,np,ng,nm,n_,nv,ny=[[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]],nb=[[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]],nS=class{constructor(){if(this.version="6",!nv){(nv=new Uint8Array(65536)).fill(1),nv[0]=0,nv.fill(0,1,32),nv.fill(0,127,160),nv.fill(2,4352,4448),nv[9001]=2,nv[9002]=2,nv.fill(2,11904,42192),nv[12351]=1,nv.fill(2,44032,55204),nv.fill(2,63744,64256),nv.fill(2,65040,65050),nv.fill(2,65072,65136),nv.fill(2,65280,65377),nv.fill(2,65504,65511);for(let e=0;e<ny.length;++e)nv.fill(0,ny[e][0],ny[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?nv[e]:!function(e,i){let r=0,n=i.length-1,s;if(e<i[0][0]||e>i[n][1])return!1;for(;n>=r;)if(e>i[s=r+n>>1][1])r=s+1;else{if(!(e<i[s][0]))return!0;n=s-1}return!1}(e,nb)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let r=this.wcwidth(e),n=0===r&&0!==i;if(n){let e=nw.extractWidth(i);0===e?n=!1:e>r&&(r=e)}return nw.createPropertyValue(0,r,n)}},nw=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new eY,this.onChange=this._onChange.event;let e=new nS;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(0xffffff&e)<<3|(3&i)<<1|!!r}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(i){let r=0,n=0,s=i.length;for(let o=0;o<s;++o){let a=i.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return r+this.wcwidth(a);let e=i.charCodeAt(o);56320<=e&&e<=57343?a=(a-55296)*1024+e-56320+65536:r+=this.wcwidth(e)}let l=this.charProperties(a,n),c=e.extractWidth(l);e.extractShouldJoin(l)&&(c-=e.extractWidth(n)),r+=c,n=l}return r}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},nx=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function nC(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=0!==i[3]&&32!==i[3])}var nk=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let r=new e;if(!i.length)return r;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let n=i[e];if(Array.isArray(n))for(let e=0;e<n.length;++e)r.addSubParam(n[e]);else r.addParam(n)}return r}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,n=255&this._subParamsIdx[i];n-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,n))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,n=255&this._subParamsIdx[i];n-r>0&&(e[i]=this._subParams.slice(r,n))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,n=r[i-1];r[i-1]=~n?Math.min(10*n+e,0x7fffffff):e}},nE=[],nR=class{constructor(){this._state=0,this._active=nE,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=nE}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=nE,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||nE,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,i,r);else this._handlerFb(this._id,"PUT",H(e,i,r))}start(){this.reset(),this._state=1}put(e,i,r){if(3!==this._state){if(1===this._state)for(;i<r;){let r=e[i++];if(59===r){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-i>0&&this._put(e,i,r)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,n=this._active.length-1,s=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===r){for(;n>=0&&!0!==(r=this._active[n].end(e));n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if((r=this._active[n].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=nE,this._id=-1,this._state=0}}},nT=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=H(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},nD=[],nL=class{constructor(){this._handlers=Object.create(null),this._active=nD,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=nD}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=nD,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||nD,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,i,r);else this._handlerFb(this._ident,"PUT",H(e,i,r))}unhook(e,i=!0){if(this._active.length){let r=!1,n=this._active.length-1,s=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===r){for(;n>=0&&!0!==(r=this._active[n].unhook(e));n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if((r=this._active[n].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=nD,this._ident=0}},nA=new nk;nA.addParam(0);var nM=class{constructor(e){this._handler=e,this._data="",this._params=nA,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():nA,this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=H(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=nA,this._data="",this._hitLimit=!1,e));return this._params=nA,this._data="",this._hitLimit=!1,i}},nP=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,n){this.table[i<<8|e]=r<<4|n}addMany(e,i,r,n){for(let s=0;s<e.length;s++)this.table[i<<8|e[s]]=r<<4|n}},nO=function(){let e=new nP(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),r=(e,r)=>i.slice(e,r),n=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),a;for(a in e.setDefault(1,0),e.addMany(n,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),nB=class extends eD{constructor(e=nO){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new nk,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(eE(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new nR),this._dcsParser=this._register(new nL),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((r=e.prefix.charCodeAt(0))&&60>r||r>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let n=e.intermediates.charCodeAt(i);if(32>n||n>47)throw Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw Error("final must be a single byte");let n=e.final.charCodeAt(0);if(i[0]>n||n>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=n}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,n,s){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=s}parse(e,i,r){let n=0,s=0,o=0,a;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,s=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&s>-1){for(;s>=0&&!0!==(a=i[s](this._params));s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 4:if(!1===r&&s>-1){for(;s>=0&&!0!==(a=i[s]());s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(24!==n&&26!==n,r))return a;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],a=this._oscParser.end(24!==n&&26!==n,r))return a;27===n&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let r=o;r<i;++r){switch(n=e[r],(s=this._transitions.table[this.currentState<<8|(n<160?n:160)])>>4){case 2:for(let s=r+1;;++s)if(s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160||++s>=i||(n=e[s])<32||n>126&&n<160){this._printHandler(e,r,s),r=s-1;break}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:r,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|n],l=o?o.length-1:-1;for(;l>=0&&!0!==(a=o[l](this._params));l--)if(a instanceof Promise)return this._preserveStack(3,o,l,s,r),a;l<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++r<i&&(n=e[r])>47&&n<60)r--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let c=this._escHandlers[this._collect<<8|n],h=c?c.length-1:-1;for(;h>=0&&!0!==(a=c[h]());h--)if(a instanceof Promise)return this._preserveStack(4,c,h,s,r),a;h<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let s=r+1;;++s)if(s>=i||24===(n=e[s])||26===n||27===n||n>127&&n<160){this._dcsParser.put(e,r,s),r=s-1;break}break;case 14:if(a=this._dcsParser.unhook(24!==n&&26!==n))return this._preserveStack(6,[],0,s,r),a;27===n&&(s|=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 s=r+1;;s++)if(s>=i||(n=e[s])<32||n>127&&n<160){this._oscParser.put(e,r,s),r=s-1;break}break;case 6:if(a=this._oscParser.end(24!==n&&26!==n))return this._preserveStack(5,[],0,s,r),a;27===n&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&s}}},nN=/^([\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})$/,nI=/^[\da-f]+$/;function nF(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=nN.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),nI.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,r=[0,0,0];for(let n=0;n<3;++n){let s=parseInt(i.slice(e*n,e*n+e),16);r[n]=1===e?s<<4:2===e?s:3===e?s>>4:s>>8}return r}}function nz(e,i){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(i){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}var nH={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function nj(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var nW=0,n$=class extends eD{constructor(e,i,r,n,s,o,a,l,c=new nB){for(let h in super(),this._bufferService=e,this._charsetService=i,this._coreService=r,this._logService=n,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=a,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new j,this._utf8Decoder=new W,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=r1.clone(),this._eraseAttrDataInternal=r1.clone(),this._onRequestBell=this._register(new eY),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new eY),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new eY),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new eY),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new eY),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new eY),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new eY),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new eY),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new eY),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new eY),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new eY),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new eY),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new eY),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 nU(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,i,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:r})}),this._parser.setDcsHandlerFallback((e,i,r)=>{"HOOK"===i&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:r})}),this._parser.setPrintHandler((e,i,r)=>this.print(e,i,r)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(iL.BEL,()=>this.bell()),this._parser.setExecuteHandler(iL.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(iL.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(iL.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(iL.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(iL.BS,()=>this.backspace()),this._parser.setExecuteHandler(iL.HT,()=>this.tab()),this._parser.setExecuteHandler(iL.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(iL.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(iA.IND,()=>this.index()),this._parser.setExecuteHandler(iA.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(iA.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new nT(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new nT(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new nT(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new nT(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new nT(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new nT(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new nT(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new nT(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new nT(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new nT(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new nT(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new nT(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset()),r6)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nM((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,n=this._activeBuffer.x,s=this._activeBuffer.y,o=0,a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),a||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,a="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,a))return this._preserveStack(n,s,a,i),this._logSlowResolvingAsync(r),r}else if(!a){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,i))return this._preserveStack(n,s,i,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==n||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,i,r){let n,s,o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-i>0&&2===d.getWidth(this._activeBuffer.x-1)&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=i;p<r;++p){if((n=e[p])<127&&o){let e=o[String.fromCharCode(n)];e&&(n=e.charCodeAt(0))}let i=this._unicodeService.charProperties(n,f);s=nw.extractWidth(i);let r=nw.extractShouldJoin(i),g=r?nw.extractWidth(f):0;if(f=i,a&&this._onA11yChar.fire(z(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-g>l){if(c){let e=d,i=this._activeBuffer.x-g;for(this._activeBuffer.x=g,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),g>0&&d instanceof r5&&d.copyCellsFrom(e,i,0,g,!1);i<l;)e.setCellFromCodepoint(i++,0,1,u)}else if(this._activeBuffer.x=l-1,2===s)continue}if(r&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,n,s);for(let e=s-g;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(h&&(d.insertCells(this._activeBuffer.x,s-g,this._activeBuffer.getNullCell(u)),2===d.getWidth(l-1)&&d.setCellFromCodepoint(l-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,n,s,u),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&r-i>0&&0===d.getWidth(this._activeBuffer.x)&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!nj(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new nM(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new nT(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,r,n=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),n&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);r<this._bufferService.rows;r++)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;i--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;i--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)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(r1));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let r=e.params[0]||1,n=nw.extractWidth(i),s=this._activeBuffer.x-n,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),a=new Uint32Array(o.length*r),l=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;a[l++]=i,e+=i>65535?2:1}let c=l;for(let e=1;e<r;++e)a.copyWithin(c,0,l),c+=l;return this.print(a,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(iL.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(iL.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(iL.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(iL.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(iL.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,r9),this._charsetService.setgCharset(1,r9),this._charsetService.setgCharset(2,r9),this._charsetService.setgCharset(3,r9);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){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(),1049===e.params[i]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,i){let r,n,s,o;(n=r||={})[n.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",n[n.SET=1]="SET",n[n.RESET=2]="RESET",n[n.PERMANENTLY_SET=3]="PERMANENTLY_SET",n[n.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let a=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:u,cols:d}=this._bufferService,{active:f,alt:p}=u,g=this._optionsService.rawOptions,m=e=>e?1:2,_=e.params[0];return s=_,o=i?2===_?4:4===_?m(h.modes.insertMode):12===_?3:20===_?m(g.convertEol):0:1===_?m(a.applicationCursorKeys):3===_?g.windowOptions.setWinLines?80===d?2:+(132===d):0:6===_?m(a.origin):7===_?m(a.wraparound):8===_?3:9===_?m("X10"===l):12===_?m(g.cursorBlink):25===_?m(!h.isCursorHidden):45===_?m(a.reverseWraparound):66===_?m(a.applicationKeypad):67===_?4:1e3===_?m("VT200"===l):1002===_?m("DRAG"===l):1003===_?m("ANY"===l):1004===_?m(a.sendFocus):1005===_?4:1006===_?m("SGR"===c):1015===_?4:1016===_?m("SGR_PIXELS"===c):1048===_?1:47===_||1047===_||1049===_?m(f===p):2004===_?m(a.bracketedPasteMode):2026===_?m(a.synchronizedOutput):0,h.triggerDataEvent(`${iL.ESC}[${i?"":"?"}${s};${o}$y`),!0}_updateAttrColor(e,i,r,n,s){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=$.fromColorRGB([r,n,s])):5===i&&(e&=-0x3000100,e|=0x2000000|255&r),e}_extractColor(e,i,r){let n=[0,0,-1,0,0,0],s=0,o=0;do{if(n[o+s]=e.params[i+o],e.hasSubParams(i+o)){let r=e.getSubParams(i+o),a=0;do 5===n[1]&&(s=1),n[o+a+1+s]=r[a];while(++a<r.length&&a+o+1+s<n.length)break}if(5===n[1]&&o+s>=2||2===n[1]&&o+s>=5)break;n[1]&&(s=1)}while(++o+i<e.length&&o+s<n.length)for(let e=2;e<n.length;++e)-1===n[e]&&(n[e]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=r1.fg,e.bg=r1.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,r,n=this._curAttrData;for(let s=0;s<i;s++)(r=e.params[s])>=30&&r<=37?(n.fg&=-0x3000100,n.fg|=0x1000000|r-30):r>=40&&r<=47?(n.bg&=-0x3000100,n.bg|=0x1000000|r-40):r>=90&&r<=97?(n.fg&=-0x3000100,n.fg|=0x1000000|r-90|8):r>=100&&r<=107?(n.bg&=-0x3000100,n.bg|=0x1000000|r-100|8):0===r?this._processSGR0(n):1===r?n.fg|=0x8000000:3===r?n.bg|=0x4000000:4===r?(n.fg|=0x10000000,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,n)):5===r?n.fg|=0x20000000:7===r?n.fg|=0x4000000:8===r?n.fg|=0x40000000:9===r?n.fg|=0x80000000:2===r?n.bg|=0x8000000:21===r?this._processUnderline(2,n):22===r?(n.fg&=-0x8000001,n.bg&=-0x8000001):23===r?n.bg&=-0x4000001:24===r?(n.fg&=-0x10000001,this._processUnderline(0,n)):25===r?n.fg&=-0x20000001:27===r?n.fg&=-0x4000001:28===r?n.fg&=-0x40000001:29===r?n.fg&=0x7fffffff:39===r?(n.fg&=-0x4000000,n.fg|=0xffffff&r1.fg):49===r?(n.bg&=-0x4000000,n.bg|=0xffffff&r1.bg):38===r||48===r||58===r?s+=this._extractColor(e,s,n):53===r?n.bg|=0x40000000:55===r?n.bg&=-0x40000001:59===r?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):100===r?(n.fg&=-0x4000000,n.fg|=0xffffff&r1.fg,n.bg&=-0x4000000,n.bg|=0xffffff&r1.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${iL.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iL.ESC}[${i};${r}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iL.ESC}[?${e};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=r1.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!nj(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${iL.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],r=e.split(";");for(;r.length>1;){let e=r.shift(),n=r.shift();if(/^\d+$/.exec(e)){let r=parseInt(e);if(nq(r))if("?"===n)i.push({type:0,index:r});else{let e=nF(n);e&&i.push({type:1,index:r,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let r=e.slice(0,i).trim(),n=e.slice(i+1);return n?this._createHyperlink(r,n):!r.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,s=r.findIndex(e=>e.startsWith("id="));return -1!==s&&(n=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let e=0;e<r.length&&!(i>=this._specialColors.length);++e,++i)if("?"===r[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let n=nF(r[e]);n&&this._onColor.fire([{type:1,index:this._specialColors[i],color:n}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],r=e.split(";");for(let e=0;e<r.length;++e)if(/^\d+$/.exec(r[e])){let n=parseInt(r[e]);nq(n)&&i.push({type:2,index:n})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,r9),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(nH[e[0]],r6[e[1]]||r9),!0}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=r1.clone(),this._eraseAttrDataInternal=r1.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new q;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let r=this._activeBuffer.ybase+this._activeBuffer.y+i,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let r=e=>(this._coreService.triggerDataEvent(`${iL.ESC}${e}${iL.ESC}\\`),!0),n=this._bufferService.buffer,s=this._optionsService.rawOptions;return r('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[s.cursorStyle]-!!s.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},nU=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(nW=e,e=i,i=nW),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function nq(e){return 0<=e&&e<256}nU=M([P(0,G)],nU);var nV=class extends eD{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new eY),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let r;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],n=this._action(e,i);if(n){let e=e=>performance.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);n.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-r>=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()}},nK=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let r=i.addMarker(i.ybase+i.y),n={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(n,r)),this._dataByLinkId.set(n.id,n),n.id}let r=this._getEntryIdKey(e),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let s=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==i)){let e=this._bufferService.buffer.addMarker(i);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};nK=M([P(0,G)],nK);var nY=!1,nX=class extends eD{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new eL),this._onBinary=this._register(new eY),this.onBinary=this._onBinary.event,this._onData=this._register(new eY),this.onData=this._onData.event,this._onLineFeed=this._register(new eY),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new eY),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new eY),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new eY),this._instantiationService=new rJ,this.optionsService=this._register(new nr(e)),this._instantiationService.setService(ei,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ne)),this._instantiationService.setService(G,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(rQ)),this._instantiationService.setService(et,this._logService),this.coreService=this._register(this._instantiationService.createInstance(na)),this._instantiationService.setService(Z,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(nd)),this._instantiationService.setService(J,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nw)),this._instantiationService.setService(en,this.unicodeService),this._charsetService=this._instantiationService.createInstance(nx),this._instantiationService.setService(Q,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(nK),this._instantiationService.setService(er,this._oscLinkService),this._inputHandler=this._register(new n$(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ej.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ej.forward(this._bufferService.onResize,this._onResize)),this._register(ej.forward(this.coreService.onData,this._onData)),this._register(ej.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new nV((e,i)=>this._inputHandler.parse(e,i))),this._register(ej.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new eY),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!nY&&(this._logService.warn("writeSync is unreliable and will be removed soon."),nY=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(nC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(nC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=eE(()=>{for(let i of e)i.dispose()})}}},nG={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:["'",'"']},nJ=0,nZ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new rT,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new rT,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,r=0,n=Array(this._array.length+this._insertedValues.length);for(let s=0;s<n.length;s++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(n[s]=e[i],i++):n[s]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(nJ=this._search(i))||this._getKey(this._array[nJ])!==i)return!1;do if(this._array[nJ]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(nJ),!0;while(++nJ<this._array.length&&this._getKey(this._array[nJ])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,r=Array(this._array.length-e.length),n=0;for(let s=0;s<this._array.length;s++)e[i]===s?i++:r[n++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((nJ=this._search(e))<0||nJ>=this._array.length)&&this._getKey(this._array[nJ])===e)do yield this._array[nJ];while(++nJ<this._array.length&&this._getKey(this._array[nJ])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((nJ=this._search(e))<0||nJ>=this._array.length)&&this._getKey(this._array[nJ])===e)do i(this._array[nJ]);while(++nJ<this._array.length&&this._getKey(this._array[nJ])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let n=i+r>>1,s=this._getKey(this._array[n]);if(s>e)r=n-1;else if(s<e)i=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return i}},nQ=0,n0=0,n1=class extends eD{constructor(){super(),this._decorations=new nZ(e=>e?.marker.line),this._onDecorationRegistered=this._register(new eY),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new eY),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(eE(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new n2(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),r=i.onDispose(()=>{r.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let n=0,s=0;for(let o of this._decorations.getKeyIterator(i))s=(n=o.options.x??0)+(o.options.width??1),e>=n&&e<s&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,i,r,n){this._decorations.forEachByKey(i,i=>{n0=(nQ=i.options.x??0)+(i.options.width??1),e>=nQ&&e<n0&&(!r||(i.options.layer??"bottom")===r)&&n(i)})}},n2=class extends eT{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new eY),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new eY),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=ng.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=ng.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},n5=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=n-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},n3=class extends eD{constructor(e,i,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n5(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
29
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(tZ(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(eE(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
30
|
+
`&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=B)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let r=this._terminal.buffer,n=r.lines.length.toString();for(let s=e;s<=i;s++){let e=r.lines.get(r.ydisp+s),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",a=(r.ydisp+s+1).toString(),l=this._rowElements[s];l&&(0===o.length?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=o,this._rowColumns.set(l,i)),l.setAttribute("aria-posinset",a),l.setAttribute("aria-setsize",n),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r,n,s=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(s.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(r=s,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=s,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let s=({node:e,offset:i})=>{let r=e instanceof Text?e.parentNode:e,n=parseInt(r?.getAttribute("aria-posinset"),10)-1;if(isNaN(n))return console.warn("row is invalid. Race condition?"),null;let s=this._rowColumns.get(r);if(!s)return console.warn("columns is null. Race condition?"),null;let o=i<s.length?s[i]:s.slice(-1)[0]+1;return o>=this._terminal.cols&&(++n,o=0),{row:n,column:o}},o=s(i),a=s(r);if(!(!o||!a)){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let n=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/i})`}};n3=M([P(1,ee),P(2,el),P(3,eh)],n3);var n4=class extends eD{constructor(e,i,r,n,s){super(),this._element=e,this._mouseService=i,this._renderService=r,this._bufferService=n,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new eY),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new eY),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(eE(()=>{ek(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(tZ(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(tZ(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(tZ(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(tZ(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let r=e.composedPath();for(let e=0;e<r.length;e++){let i=r[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,s]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):s.provideLinks(e.y,i=>{if(this._isMouseOut)return;let s=i?.map(e=>({link:e}));this._activeProviderReplies?.set(n,s),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let n=0;n<i.size;n++){let s=i.get(n);if(s)for(let i=0;i<s.length;i++){let n=s[i],o=n.link.range.start.y<e?0:n.link.range.start.x,a=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){s.splice(i--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),s=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(s=!0);if(!s&&n){let e=n.find(e=>this._linkAtPosition(e.link,i));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let e=0;e<this._activeProviderReplies.size;e++){let n=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(n){r=!0,this._handleNewLink(n);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,r;if(!this._currentLink)return;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);n&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ek(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,n=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,i,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,s=i.y*this._bufferService.cols+i.x;return r<=s&&s<=n}_positionFromMouseEvent(e,i,r){let n=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,n,s){return{x1:e,y1:i,x2:r,y2:n,cols:this._bufferService.cols,fg:s}}};n4=M([P(1,ec),P(2,eh),P(3,G),P(4,ep)],n4);var n6=class extends nX{constructor(e={}){super(e),this._linkifier=this._register(new eL),this.browser=rc,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new eL),this._onCursorMove=this._register(new eY),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new eY),this.onKey=this._onKey.event,this._onRender=this._register(new eY),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new eY),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new eY),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new eY),this.onBell=this._onBell.event,this._onFocus=this._register(new eY),this._onBlur=this._register(new eY),this._onA11yCharEmitter=this._register(new eY),this._onA11yTabEmitter=this._register(new eY),this._onWillOpen=this._register(new eY),this._setup(),this._decorationService=this._instantiationService.createInstance(n1),this._instantiationService.setService(es,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rs),this._instantiationService.setService(ep,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(eo)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(ej.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ej.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ej.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ej.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(eE(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let e,r="";switch(i.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+i.index}switch(i.type){case 0:let n=np.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iL.ESC}]${r};${function(e,i=16){let[r,n,s]=e;return`rgb:${nz(r,i)}/${nz(n,i)}/${nz(s,i)}`}(n)}${iM.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=iP.toColor(...i.color));else{let r=e;this._themeService.modifyColors(e=>e[r]=iP.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(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(n3,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iL.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iL.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,s=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(tZ(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,r,n;return i=this.textarea,r=this.coreService,n=this.optionsService,void(e.stopPropagation(),e.clipboardData&&N(e.clipboardData.getData("text/plain"),i,r,n))};this._register(tZ(this.textarea,"paste",e)),this._register(tZ(this.element,"paste",e)),rg?this._register(tZ(this.element,"mousedown",e=>{2===e.button&&F(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(tZ(this.element,"contextmenu",e=>{F(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rx&&this._register(tZ(this.element,"auxclick",e=>{1===e.button&&I(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(tZ(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(tZ(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(tZ(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(tZ(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(tZ(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(tZ(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(tZ(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(tZ(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",O),rC||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(rr,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(el,this._coreBrowserService),this._register(tZ(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(tZ(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i7,this._document,this._helperContainer),this._instantiationService.setService(ea,this._charSizeService),this._themeService=this._instantiationService.createInstance(rY),this._instantiationService.setService(ef,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(iX),this._instantiationService.setService(ed,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rL,this.rows,this.screenElement)),this._instantiationService.setService(eh,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(iC,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ra),this._instantiationService.setService(ec,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(n4,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(i_,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(rH,this.element,this.screenElement,n)),this._instantiationService.setService(eu,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(ej.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(iv,this.screenElement)),this._register(tZ(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(n3,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ix,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ix,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i8,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(i){let r,n,s=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!s)return!1;switch(i.overrideType||i.type){case"mousemove":n=32,void 0===i.buttons?(r=3,void 0!==i.button&&(r=i.button<3?i.button:3)):r=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":n=0,r=i.button<3?i.button:3;break;case"mousedown":n=1,r=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;n=o<0?0:1,r=4;break;default:return!1}return void 0!==n&&void 0!==r&&!(r>4)&&e.coreMouseService.triggerMouseEvent({col:s.col,row:s.row,x:s.x,y:s.y,button:r,action:n,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(e)),o=e=>(r(e),this.cancel(e,!0)),a=e=>{e.buttons&&r(e)},l=e=>{e.buttons||r(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?n.mousemove||(i.addEventListener("mousemove",l),n.mousemove=l):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&e?n.wheel||(i.addEventListener("wheel",o,{passive:!1}),n.wheel=o):(i.removeEventListener("wheel",n.wheel),n.wheel=null),2&e?n.mouseup||(n.mouseup=s):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&e?n.mousedrag||(n.mousedrag=a):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(tZ(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return r(e),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(e)})),this._register(tZ(i,"wheel",i=>{if(!n.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let r=iL.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){N(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let r=function(e,i,r,n){let s={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?s.key=iL.ESC+"OA":s.key=iL.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?s.key=iL.ESC+"OD":s.key=iL.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?s.key=iL.ESC+"OC":s.key=iL.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?s.key=iL.ESC+"OB":s.key=iL.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":iL.DEL,e.altKey&&(s.key=iL.ESC+s.key);break;case 9:if(e.shiftKey){s.key=iL.ESC+"[Z";break}s.key=iL.HT,s.cancel=!0;break;case 13:s.key=e.altKey?iL.ESC+iL.CR:iL.CR,s.cancel=!0;break;case 27:s.key=iL.ESC,e.altKey&&(s.key=iL.ESC+iL.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=iL.ESC+"[1;"+(o+1)+"D":i?s.key=iL.ESC+"OD":s.key=iL.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=iL.ESC+"[1;"+(o+1)+"C":i?s.key=iL.ESC+"OC":s.key=iL.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=iL.ESC+"[1;"+(o+1)+"A":i?s.key=iL.ESC+"OA":s.key=iL.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=iL.ESC+"[1;"+(o+1)+"B":i?s.key=iL.ESC+"OB":s.key=iL.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=iL.ESC+"[2~");break;case 46:o?s.key=iL.ESC+"[3;"+(o+1)+"~":s.key=iL.ESC+"[3~";break;case 36:o?s.key=iL.ESC+"[1;"+(o+1)+"H":i?s.key=iL.ESC+"OH":s.key=iL.ESC+"[H";break;case 35:o?s.key=iL.ESC+"[1;"+(o+1)+"F":i?s.key=iL.ESC+"OF":s.key=iL.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=iL.ESC+"[5;"+(o+1)+"~":s.key=iL.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=iL.ESC+"[6;"+(o+1)+"~":s.key=iL.ESC+"[6~";break;case 112:o?s.key=iL.ESC+"[1;"+(o+1)+"P":s.key=iL.ESC+"OP";break;case 113:o?s.key=iL.ESC+"[1;"+(o+1)+"Q":s.key=iL.ESC+"OQ";break;case 114:o?s.key=iL.ESC+"[1;"+(o+1)+"R":s.key=iL.ESC+"OR";break;case 115:o?s.key=iL.ESC+"[1;"+(o+1)+"S":s.key=iL.ESC+"OS";break;case 116:o?s.key=iL.ESC+"[15;"+(o+1)+"~":s.key=iL.ESC+"[15~";break;case 117:o?s.key=iL.ESC+"[17;"+(o+1)+"~":s.key=iL.ESC+"[17~";break;case 118:o?s.key=iL.ESC+"[18;"+(o+1)+"~":s.key=iL.ESC+"[18~";break;case 119:o?s.key=iL.ESC+"[19;"+(o+1)+"~":s.key=iL.ESC+"[19~";break;case 120:o?s.key=iL.ESC+"[20;"+(o+1)+"~":s.key=iL.ESC+"[20~";break;case 121:o?s.key=iL.ESC+"[21;"+(o+1)+"~":s.key=iL.ESC+"[21~";break;case 122:o?s.key=iL.ESC+"[23;"+(o+1)+"~":s.key=iL.ESC+"[23~";break;case 123:o?s.key=iL.ESC+"[24;"+(o+1)+"~":s.key=iL.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!r||n)&&e.altKey&&!e.metaKey){let i=nG[e.keyCode]?.[+!!e.shiftKey];if(i)s.key=iL.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),s.key=iL.ESC+i}else if(32===e.keyCode)s.key=iL.ESC+(e.ctrlKey?iL.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),s.key=iL.ESC+i,s.cancel=!0}}else!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(s.key=iL.US),"@"===e.key&&(s.key=iL.NUL)):s.key=e.key:65===e.keyCode&&(s.type=1);else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=iL.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=iL.DEL:219===e.keyCode?s.key=iL.ESC:220===e.keyCode?s.key=iL.FS:221===e.keyCode&&(s.key=iL.GS)}return s}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){let i=this.rows-1;return this.scrollLines(2===r.type?-i:i),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((r.key===iL.ETX||r.key===iL.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(r1));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(iL.ESC+"[I"):this.coreService.triggerDataEvent(iL.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iL.ESC}[4;${r};${i}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iL.ESC}[6;${s};${n}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},n9=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},n8=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new q)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},n7=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let i=this._buffer.lines.get(e);if(i)return new n8(i)}getNullCell(){return new q}},se=class extends eD{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new eY),this.onBufferChange=this._onBufferChange.event,this._normal=new n7(this._core.buffers.normal,"normal"),this._alternate=new n7(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},st=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,r)=>i(e,r.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},si=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},sr=["cols","rows"],sn=0,ss=class extends eD{constructor(e){super(),this._core=this._register(new n6(e)),this._addonManager=this._register(new n9),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],r=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let n={get:i.bind(this,e),set:r.bind(this,e)};Object.defineProperty(this._publicOptions,e,n)}}_checkReadonlyOptions(e){if(sr.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new st(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new si(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 se(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,r){this._verifyIntegers(e,i,r),this._core.select(e,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
31
|
+
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return O},set promptLabel(t){O=t},get tooMuchOutput(){return B},set tooMuchOutput(t){B=t}}}_verifyIntegers(...e){for(sn of e)if(sn===1/0||isNaN(sn)||sn%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sn of e)if(sn&&(sn===1/0||isNaN(sn)||sn%1!=0||sn<0))throw Error("This API only accepts positive integers")}};e.s(["Terminal",0,ss],99894);var so=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((s-(a.right+a.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((n-l)/e.css.cell.height))}}};e.s(["FitAddon",0,so],93309)},31343,10031,e=>{"use strict";var i=e.i(75254);let r=(0,i.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,r],31343);let n=(0,i.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);e.s(["SquarePen",0,n],10031)},77814,e=>{"use strict";var i,r=e.i(18050);e.s([],33847),e.i(33847),e.i(47167);var n=e.i(71645),s=e.i(231),o=e.i(62372);let a=new Map;function l(e,i,r){return null==e?"":(function(e,i){let r=JSON.stringify({locale:e,options:i}),n=a.get(r);if(n)return n;let s=new Intl.NumberFormat(e,i);return a.set(r,s),s})(i,r).format(e)}var c=e.i(27601),h=e.i(67805);let u=n.createContext(void 0);function d(){let e=n.useContext(u);if(void 0===e)throw Error((0,h.default)(51));return e}let f=((i={}).complete="data-complete",i.indeterminate="data-indeterminate",i.progressing="data-progressing",i),p={status:e=>"progressing"===e?{[f.progressing]:""}:"complete"===e?{[f.complete]:""}:"indeterminate"===e?{[f.indeterminate]:""}:null};function g(e,i){return null==i?"indeterminate progress":e||`${i}%`}let m=n.forwardRef(function(e,i){var a;let{format:h,getAriaValueText:d=g,locale:f,max:m=100,min:_=0,value:v,render:y,className:b,children:S,...w}=e,[x,C]=n.useState(),k=(0,s.useValueAsRef)(h),E="indeterminate";Number.isFinite(v)&&(E=v===m?"complete":"progressing");let R=(a=k.current,null==v?"":a?l(v,f,a):l(v/100,f,{style:"percent"})),T=n.useMemo(()=>({status:E}),[E]),D={"aria-labelledby":x,"aria-valuemax":m,"aria-valuemin":_,"aria-valuenow":v??void 0,"aria-valuetext":d(R,v),role:"progressbar",children:(0,r.jsxs)(n.Fragment,{children:[S,(0,r.jsx)("span",{role:"presentation",style:o.visuallyHidden,children:"x"})]})},L=n.useMemo(()=>({formattedValue:R,max:m,min:_,setLabelId:C,state:T,status:E,value:v}),[R,m,_,C,T,E,v]),A=(0,c.useRenderElement)("div",e,{state:T,ref:i,props:[D,w],stateAttributesMapping:p});return(0,r.jsx)(u.Provider,{value:L,children:A})}),_=n.forwardRef(function(e,i){let{render:r,className:n,...s}=e,{state:o}=d();return(0,c.useRenderElement)("div",e,{state:o,ref:i,props:s,stateAttributesMapping:p})}),v=n.forwardRef(function(e,i){let{render:r,className:s,...o}=e,{max:a,min:l,value:h,state:u}=d(),f=Number.isFinite(h)&&null!==h?(h-l)*100/(a-l):null,g=n.useCallback(()=>null==f?{}:{insetInlineStart:0,height:"inherit",width:`${f}%`},[f]);return(0,c.useRenderElement)("div",e,{state:u,ref:i,props:[{style:g()},o],stateAttributesMapping:p})}),y=n.forwardRef(function(e,i){let{className:r,render:n,children:s,...o}=e,{value:a,formattedValue:l,state:h}=d(),u=null==a?"indeterminate":l,f=null==a?null:l;return(0,c.useRenderElement)("span",e,{state:h,ref:i,props:[{"aria-hidden":!0,children:"function"==typeof s?s(u,a):f},o],stateAttributesMapping:p})});var b=e.i(24564);let S=n.forwardRef(function(e,i){let{render:r,className:n,id:s,...o}=e,{setLabelId:a,state:l}=d(),h=(0,b.useRegisteredLabelId)(s,a);return(0,c.useRenderElement)("span",e,{state:l,ref:i,props:[{id:h,role:"presentation"},o],stateAttributesMapping:p})});e.s(["Indicator",0,v,"Label",0,S,"Root",0,m,"Track",0,_,"Value",0,y],45929);var w=e.i(45929),w=w,x=e.i(52088);function C({className:e,...i}){return(0,r.jsx)(w.Track,{className:(0,x.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-md bg-muted",e),"data-slot":"progress-track",...i})}function k({className:e,...i}){return(0,r.jsx)(w.Indicator,{"data-slot":"progress-indicator",className:(0,x.cn)("h-full bg-primary",e),style:{transition:"width 500ms ease-in-out"},...i})}e.s(["Progress",0,function({className:e,children:i,value:n,...s}){return(0,r.jsxs)(w.Root,{value:n,"data-slot":"progress",className:(0,x.cn)("flex flex-wrap gap-3",e),...s,children:[i,(0,r.jsx)(C,{children:(0,r.jsx)(k,{})})]})}],77814)},67211,e=>{"use strict";var i=e.i(18050),r=e.i(71645),n=e.i(99894),s=e.i(93309),o=e.i(96085),a=e.i(627),l=e.i(31278),c=e.i(74886),h=e.i(31343),u=e.i(43531),d=e.i(10031),f=e.i(12382),p=e.i(85902),g=e.i(77814),m=e.i(70935);let _=(0,r.forwardRef)(function({tabId:e,cwd:_,env:v,worktreePath:y,command:b,className:S="",initialTodos:w,isActive:x,onTodosUpdated:C,onStatusChange:k},E){let R=(0,r.useRef)(null),T=(0,r.useRef)(null),D=(0,r.useRef)(null),L=(0,r.useRef)(null),A=(0,r.useRef)(e),[M,P]=(0,r.useState)(!1),O=(0,r.useRef)(!1),B=(0,r.useRef)(x),N=(0,r.useRef)(!1),I=(0,r.useRef)(!1),[F,z]=(0,r.useState)("idle"),[H,j]=(0,r.useState)("idle"),[W,$]=(0,r.useState)(w??[]),[U,q]=(0,r.useState)(!1),{effectiveTheme:V}=(0,a.useTheme)(),K=(0,r.useRef)(k);K.current=k;let Y="dark"===V,X=Y?{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",selectionBackground:"#add6ff"};function G(){let e=L.current,i=T.current,r=A.current;e&&e.connected&&i&&r&&e.emit("resize",{sessionId:r,cols:i.cols,rows:i.rows})}function J(e){e.write("\x1b[2J\x1b[3J\x1b[H")}async function Z(i,r,n){z("connecting");try{var s,a,l,c;let h,u,d=await fetch((0,m.apiUrl)("/api/terminal/sessions"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:_,env:v,worktreePath:y,sessionId:i,command:b}),signal:n});if(!d.ok){let e=await d.text().catch(()=>"");throw Error(`Failed to create session: ${d.status} ${e}`)}let f=await d.json();if(n.aborted)return;A.current=f.sessionId,f.reused||J(r),s=f.sessionId,a=f.reused,l=r,c=n,L.current=h=(0,o.io)((0,m.getServerUrl)(),{transports:["websocket"]}),u=!1,h.on("connect",()=>{let e=N.current;N.current=!0,e?l.writeln("\x1b[90mReconnected.\x1b[0m"):a?(I.current=!0,J(l)):l.writeln("\x1b[90mConnected.\x1b[0m"),z("connected"),h.emit("join",{room:`tab:${s}`}),e&&B.current&&l.focus()}),h.on("output",({data:e})=>{a&&!u?(u=!0,l.write(e,()=>{I.current=!1,D.current?.fit(),G()})):l.write(e)}),h.on("exit",({exitCode:e})=>{console.log("[TerminalView] PTY exited with code:",e),z("exited"),A.current=null,L.current=null}),h.on("error",({message:e})=>{console.error("[TerminalView] Socket error message:",e),z("error")}),h.on("disconnect",()=>{c.aborted||z(e=>"exited"===e||"paused"===e||"idle"===e?e:"exited")}),h.on("status-changed",({status:e})=>{j(e)}),h.on("todos-updated",({todos:i})=>{$(i),C?.(e,i)}),h.on("editor:open",({sessionId:e,content:i})=>{window.dispatchEvent(new CustomEvent("editor-session-open-request",{detail:{sessionId:e,content:i}}))}),l.onData(e=>{h.connected&&A.current&&h.emit("input",{sessionId:A.current,data:e})})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;console.error("[TerminalView] connectSession error:",e instanceof Error?e.message:String(e)),z("error")}}async function Q(){let i=T.current;if(!i)return;let r=new AbortController;await Z(e,i,r.signal)}(0,r.useEffect)(()=>{K.current?.(e,F,H)},[e,F,H]),(0,r.useLayoutEffect)(()=>{B.current=x}),(0,r.useEffect)(()=>{x&&T.current?.focus()},[x]),(0,r.useEffect)(()=>{if(M)T.current?.blur();else if(x){let e=R.current?.querySelector("textarea.xterm-helper-textarea");e?.focus()}},[M,x]),(0,r.useEffect)(()=>{"connected"===F&&D.current&&(D.current.fit(),I.current||G())},[F]),(0,r.useEffect)(()=>{if(!R.current)return;let i=new n.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Cascadia Code", "Fira Code", "Menlo", monospace',theme:X,allowProposedApi:!0}),r=new s.FitAddon;i.loadAddon(r),i.open(R.current),r.fit(),T.current=i,D.current=r,B.current&&i.focus(),i.attachCustomKeyEventHandler(()=>!O.current),i.buffer.onBufferChange(e=>{"normal"===e.type&&i.refresh(0,i.rows-1)});let o=new ResizeObserver(()=>{r.fit(),I.current||G()});o.observe(R.current);let a=new AbortController;return Z(e,i,a.signal),()=>{a.abort(),o.disconnect(),i.dispose(),T.current=null,D.current=null,L.current?.disconnect(),L.current=null}},[]),(0,r.useEffect)(()=>{T.current&&(T.current.options.theme=X)},[Y]),(0,r.useEffect)(()=>{function e(){O.current=!0,T.current?.blur()}function i(){if(O.current=!1,!B.current)return;let e=R.current?.querySelector("textarea.xterm-helper-textarea");e?.focus()}return window.addEventListener("editor-session-open",e),window.addEventListener("editor-session-done",i),()=>{window.removeEventListener("editor-session-open",e),window.removeEventListener("editor-session-done",i)}},[]),(0,r.useEffect)(()=>{function e(){if("visible"!==document.visibilityState)return;let e=L.current;if(!e||!e.connected)return;let i=setTimeout(()=>{e.off("health-check-ack",r),e.disconnect()},3e3);function r(){clearTimeout(i),B.current&&T.current?.focus()}e.once("health-check-ack",r),e.emit("health-check")}return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,r.useImperativeHandle)(E,()=>({sendInput:e=>{let i=L.current,r=A.current;i?.connected&&r&&i.emit("input",{sessionId:r,data:e})},focus:()=>{T.current?.focus()}}));let ee=(0,r.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{q(!0),setTimeout(()=>q(!1),2e3)})},[e]),et="connecting"===F,ei="paused"===F||"exited"===F||"error"===F,er="connected"===F,en=W.filter(e=>"deleted"!==e.status),es=en.filter(e=>"completed"===e.status).length,eo=en.length,ea=e.length>8?`${e.slice(0,8)}…`:e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:`flex flex-col h-full min-h-0 ${S}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 border-b border-border flex-shrink-0 bg-card",children:[(0,i.jsx)("span",{className:"font-mono text-xs text-muted-foreground",title:e,children:ea}),(0,i.jsx)(p.Button,{variant:"ghost",size:"icon-xs",onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Copy tab ID",children:U?(0,i.jsx)(u.Check,{className:"w-3 h-3 text-success"}):(0,i.jsx)(c.Copy,{className:"w-3 h-3"})}),(0,i.jsxs)(p.Button,{size:"xs",onClick:function(){let e=L.current,i=A.current;if(!e||!e.connected||!i)return;let r=`claude --dangerously-skip-permissions --resume ${i} 2>/dev/null || claude --dangerously-skip-permissions --session-id ${i}
|
|
32
32
|
`;e.emit("input",{sessionId:i,data:r})},disabled:!er,title:"Run Claude",children:[(0,i.jsx)(h.Play,{className:"w-3 h-3"}),"Run Claude"]}),(0,i.jsxs)(p.Button,{variant:"ghost",size:"xs",onClick:()=>P(!0),disabled:!er,className:"text-muted-foreground hover:text-foreground",title:"Open editor input",children:[(0,i.jsx)(d.SquarePen,{className:"w-3 h-3"}),"Open Editor"]}),eo>0&&(0,i.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",title:W.find(e=>"in_progress"===e.status)?.content??"",children:[(0,i.jsx)(g.Progress,{value:es,max:eo,className:"w-16 gap-0 [&_[data-slot=progress-track]]:h-[3px]"}),(0,i.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[es,"/",eo]})]})]}),(0,i.jsxs)("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[(0,i.jsx)("div",{ref:R,className:"w-full h-full",style:{padding:"4px"}}),et&&(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background",children:(0,i.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-xs",children:[(0,i.jsx)(l.Loader2,{className:"w-4 h-4 animate-spin"}),(0,i.jsx)("span",{children:"Connecting..."})]})}),ei&&(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/90",children:(0,i.jsxs)("div",{className:"text-center space-y-2",children:["error"===F&&(0,i.jsx)("p",{className:"text-xs text-destructive",children:"Connection failed"}),"exited"===F&&(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:"Session ended"}),"paused"===F&&(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:"Paused"}),(0,i.jsx)(p.Button,{size:"xs",onClick:Q,children:"Reconnect"})]})})]})]}),(0,i.jsx)(f.MonacoEditorModal,{open:M,onOpenChange:e=>{e.open||P(!1)},onSubmit:e=>{T.current&&e&&T.current.paste(e),P(!1)},title:"Terminal Input",submitLabel:"Paste"})]})});e.s(["TerminalView",0,_])}]);
|