@xterm/addon-search 0.16.0-beta.124 → 0.16.0-beta.125

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.
@@ -14,15 +14,15 @@
14
14
  * Copyright (c) Microsoft Corporation. All rights reserved.
15
15
  * Licensed under the MIT License. See License.txt in the project root for license information.
16
16
  *--------------------------------------------------------------------------------------------*/
17
- var he=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Z.isErrorNoTelemetry(e)?new Z(e.message+`
17
+ var fe=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Z.isErrorNoTelemetry(e)?new Z(e.message+`
18
18
 
19
19
  `+e.stack):new Error(e.message+`
20
20
 
21
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Ue=new he;function ee(r){ze(r)||Ue.onUnexpectedError(r)}var fe="Canceled";function ze(r){return r instanceof X?!0:r instanceof Error&&r.name===fe&&r.message===fe}var X=class extends Error{constructor(){super(fe),this.name=this.message}};var Z=class r extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof r)return e;let t=new r;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function pe(r,e){let t=this,n=!1,i;return function(){if(n)return i;if(n=!0,e)try{i=r.apply(t,arguments)}finally{e()}else i=r.apply(t,arguments);return i}}function Ve(r,e,t=0,n=r.length){let i=t,s=n;for(;i<s;){let a=Math.floor((i+s)/2);e(r[a])?i=a+1:s=a}return i-1}var te=class te{constructor(e){this._array=e;this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(te.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!e(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}let t=Ve(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};te.assertInvariants=!1;var ye=te;var Ee;(d=>{function r(l){return l<0}d.isLessThan=r;function e(l){return l<=0}d.isLessThanOrEqual=e;function t(l){return l>0}d.isGreaterThan=t;function n(l){return l===0}d.isNeitherLessOrGreaterThan=n,d.greaterThan=1,d.lessThan=-1,d.neitherLessOrGreaterThan=0})(Ee||={});function De(r,e){return(t,n)=>e(r(t),r(n))}var we=(r,e)=>r-e;var F=class F{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new F(t=>this.iterate(n=>e(n)?t(n):!0))}map(e){return new F(t=>this.iterate(n=>t(e(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(i=>((n||Ee.isGreaterThan(e(i,t)))&&(n=!1,t=i),!0)),t}};F.empty=new F(e=>{});var Ie=F;function Re(r,e){let t=Object.create(null);for(let n of r){let i=e(n),s=t[i];s||(s=t[i]=[]),s.push(n)}return t}var Le,Ce,Se=class{constructor(e,t){this.toKey=t;this._map=new Map;this[Le]="SetWithKey";for(let n of e)this.add(n)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(n=>e.call(t,n,n,this))}[(Ce=Symbol.iterator,Le=Symbol.toStringTag,Ce)](){return this.values()}};var ne=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){let t=this.map.get(e);return t||new Set}};var Te;(j=>{function r(v){return v&&typeof v=="object"&&typeof v[Symbol.iterator]=="function"}j.is=r;let e=Object.freeze([]);function t(){return e}j.empty=t;function*n(v){yield v}j.single=n;function i(v){return r(v)?v:n(v)}j.wrap=i;function s(v){return v||e}j.from=s;function*a(v){for(let g=v.length-1;g>=0;g--)yield v[g]}j.reverse=a;function d(v){return!v||v[Symbol.iterator]().next().done===!0}j.isEmpty=d;function l(v){return v[Symbol.iterator]().next().value}j.first=l;function f(v,g){let x=0;for(let R of v)if(g(R,x++))return!0;return!1}j.some=f;function p(v,g){for(let x of v)if(g(x))return x}j.find=p;function*m(v,g){for(let x of v)g(x)&&(yield x)}j.filter=m;function*I(v,g){let x=0;for(let R of v)yield g(R,x++)}j.map=I;function*E(v,g){let x=0;for(let R of v)yield*g(R,x++)}j.flatMap=E;function*C(...v){for(let g of v)yield*g}j.concat=C;function k(v,g,x){let R=x;for(let K of v)R=g(R,K);return R}j.reduce=k;function*D(v,g,x=v.length){for(g<0&&(g+=v.length),x<0?x+=v.length:x>v.length&&(x=v.length);g<x;g++)yield v[g]}j.slice=D;function w(v,g=Number.POSITIVE_INFINITY){let x=[];if(g===0)return[x,v];let R=v[Symbol.iterator]();for(let K=0;K<g;K++){let ce=R.next();if(ce.done)return[x,j.empty()];x.push(ce.value)}return[x,{[Symbol.iterator](){return R}}]}j.consume=w;async function y(v){let g=[];for await(let x of v)g.push(x);return Promise.resolve(g)}j.asyncToArray=y})(Te||={});var je=!1,N=null,ie=class ie{constructor(){this.livingDisposables=new Map}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:ie.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){let t=this.getDisposableData(e);t.source||(t.source=new Error().stack)}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let i=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,i),i}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,n])=>n.source!==null&&!this.getRootParent(n,e).isSingleton).flatMap(([n])=>n)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let l=new Map,f=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,l).isSingleton);if(f.length===0)return;let p=new Set(f.map(m=>m.value));if(n=f.filter(m=>!(m.parent&&p.has(m.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function i(l){function f(m,I){for(;m.length>0&&I.some(E=>typeof E=="string"?E===m[0]:m[0].match(E));)m.shift()}let p=l.source.split(`
21
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},ze=new fe;function ee(r){Ve(r)||ze.onUnexpectedError(r)}var pe="Canceled";function Ve(r){return r instanceof X?!0:r instanceof Error&&r.name===pe&&r.message===pe}var X=class extends Error{constructor(){super(pe),this.name=this.message}};var Z=class r extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof r)return e;let t=new r;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};function Te(r,e){let t=this,n=!1,i;return function(){if(n)return i;if(n=!0,e)try{i=r.apply(t,arguments)}finally{e()}else i=r.apply(t,arguments);return i}}function je(r,e,t=0,n=r.length){let i=t,s=n;for(;i<s;){let a=Math.floor((i+s)/2);e(r[a])?i=a+1:s=a}return i-1}var te=class te{constructor(e){this._array=e;this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(te.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!e(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}let t=je(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};te.assertInvariants=!1;var Ie=te;var De;(d=>{function r(l){return l<0}d.isLessThan=r;function e(l){return l<=0}d.isLessThanOrEqual=e;function t(l){return l>0}d.isGreaterThan=t;function n(l){return l===0}d.isNeitherLessOrGreaterThan=n,d.greaterThan=1,d.lessThan=-1,d.neitherLessOrGreaterThan=0})(De||={});function we(r,e){return(t,n)=>e(r(t),r(n))}var Se=(r,e)=>r-e;var P=class P{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new P(t=>this.iterate(n=>e(n)?t(n):!0))}map(e){return new P(t=>this.iterate(n=>t(e(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(i=>((n||De.isGreaterThan(e(i,t)))&&(n=!1,t=i),!0)),t}};P.empty=new P(e=>{});var Ee=P;function ke(r,e){let t=Object.create(null);for(let n of r){let i=e(n),s=t[i];s||(s=t[i]=[]),s.push(n)}return t}var Ce,Re,Le=class{constructor(e,t){this.toKey=t;this._map=new Map;this[Ce]="SetWithKey";for(let n of e)this.add(n)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(n=>e.call(t,n,n,this))}[(Re=Symbol.iterator,Ce=Symbol.toStringTag,Re)](){return this.values()}};var ne=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){let t=this.map.get(e);return t||new Set}};var me;(H=>{function r(v){return v&&typeof v=="object"&&typeof v[Symbol.iterator]=="function"}H.is=r;let e=Object.freeze([]);function t(){return e}H.empty=t;function*n(v){yield v}H.single=n;function i(v){return r(v)?v:n(v)}H.wrap=i;function s(v){return v||e}H.from=s;function*a(v){for(let g=v.length-1;g>=0;g--)yield v[g]}H.reverse=a;function d(v){return!v||v[Symbol.iterator]().next().done===!0}H.isEmpty=d;function l(v){return v[Symbol.iterator]().next().value}H.first=l;function f(v,g){let x=0;for(let R of v)if(g(R,x++))return!0;return!1}H.some=f;function p(v,g){for(let x of v)if(g(x))return x}H.find=p;function*m(v,g){for(let x of v)g(x)&&(yield x)}H.filter=m;function*I(v,g){let x=0;for(let R of v)yield g(R,x++)}H.map=I;function*E(v,g){let x=0;for(let R of v)yield*g(R,x++)}H.flatMap=E;function*C(...v){for(let g of v)yield*g}H.concat=C;function k(v,g,x){let R=x;for(let Q of v)R=g(R,Q);return R}H.reduce=k;function*D(v,g,x=v.length){for(g<0&&(g+=v.length),x<0?x+=v.length:x>v.length&&(x=v.length);g<x;g++)yield v[g]}H.slice=D;function w(v,g=Number.POSITIVE_INFINITY){let x=[];if(g===0)return[x,v];let R=v[Symbol.iterator]();for(let Q=0;Q<g;Q++){let he=R.next();if(he.done)return[x,H.empty()];x.push(he.value)}return[x,{[Symbol.iterator](){return R}}]}H.consume=w;async function y(v){let g=[];for await(let x of v)g.push(x);return Promise.resolve(g)}H.asyncToArray=y})(me||={});var Ke=!1,W=null,ie=class ie{constructor(){this.livingDisposables=new Map}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:ie.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){let t=this.getDisposableData(e);t.source||(t.source=new Error().stack)}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let i=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,i),i}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,n])=>n.source!==null&&!this.getRootParent(n,e).isSingleton).flatMap(([n])=>n)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let l=new Map,f=[...this.livingDisposables.values()].filter(m=>m.source!==null&&!this.getRootParent(m,l).isSingleton);if(f.length===0)return;let p=new Set(f.map(m=>m.value));if(n=f.filter(m=>!(m.parent&&p.has(m.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function i(l){function f(m,I){for(;m.length>0&&I.some(E=>typeof E=="string"?E===m[0]:m[0].match(E));)m.shift()}let p=l.source.split(`
22
22
  `).map(m=>m.trim().replace("at ","")).filter(m=>m!=="");return f(p,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),p.reverse()}let s=new ne;for(let l of n){let f=i(l);for(let p=0;p<=f.length;p++)s.add(f.slice(0,p).join(`
23
- `),l)}n.sort(De(l=>l.idx,we));let a="",d=0;for(let l of n.slice(0,e)){d++;let f=i(l),p=[];for(let m=0;m<f.length;m++){let I=f[m];I=`(shared with ${s.get(f.slice(0,m+1).join(`
23
+ `),l)}n.sort(we(l=>l.idx,Se));let a="",d=0;for(let l of n.slice(0,e)){d++;let f=i(l),p=[];for(let m=0;m<f.length;m++){let I=f[m];I=`(shared with ${s.get(f.slice(0,m+1).join(`
24
24
  `)).size}/${n.length} leaks) at ${I}`;let C=s.get(f.slice(0,m).join(`
25
- `)),k=Re([...C].map(D=>i(D)[m]),D=>D);delete k[f[m]];for(let[D,w]of Object.entries(k))p.unshift(` - stacktraces of ${w.length} other leaks continue with ${D}`);p.unshift(I)}a+=`
25
+ `)),k=ke([...C].map(D=>i(D)[m]),D=>D);delete k[f[m]];for(let[D,w]of Object.entries(k))p.unshift(` - stacktraces of ${w.length} other leaks continue with ${D}`);p.unshift(I)}a+=`
26
26
 
27
27
 
28
28
  ==================== Leaking disposable ${d}/${n.length}: ${l.value.constructor.name} ====================
@@ -35,10 +35,10 @@ ${p.join(`
35
35
 
36
36
  ... and ${n.length-e} more leaking disposables
37
37
 
38
- `),{leaks:n,details:a}}};ie.idx=0;var ke=ie;function Ke(r){N=r}if(je){let r="__is_disposable_tracked__";Ke(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[r]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==O.None)try{e[r]=!0}catch{}}markAsDisposed(e){if(e&&e!==O.None)try{e[r]=!0}catch{}}markAsSingleton(e){}})}function re(r){return N?.trackDisposable(r),r}function oe(r){N?.markAsDisposed(r)}function Q(r,e){N?.setParent(r,e)}function He(r,e){if(N)for(let t of r)N.setParent(t,e)}function W(r){if(Te.is(r)){let e=[];for(let t of r)if(t)try{t.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function ae(...r){let e=q(()=>W(r));return He(r,e),e}function q(r){let e=re({dispose:pe(()=>{oe(e),r()})});return e}var se=class se{constructor(){this._toDispose=new Set;this._isDisposed=!1;re(this)}dispose(){this._isDisposed||(oe(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{W(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return Q(e,this),this._isDisposed?se.DISABLE_DISPOSED_WARNING||console.warn(new 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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Q(e,null))}};se.DISABLE_DISPOSED_WARNING=!1;var P=se,O=class{constructor(){this._store=new P;re(this),Q(this._store,this)}dispose(){oe(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};O.None=Object.freeze({dispose(){}});var $=class{constructor(){this._isDisposed=!1;re(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Q(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,oe(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Q(e,null),e}};var U=class U{constructor(e){this.element=e,this.next=U.Undefined,this.prev=U.Undefined}};U.Undefined=new U(void 0);var Oe=U;var Qe=globalThis.performance&&typeof globalThis.performance.now=="function",le=class r{static create(e){return new r(e)}constructor(e){this._now=Qe&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var $e=!1,Ae=!1,qe=!1,Be;(G=>{G.None=()=>O.None;function e(h){if(qe){let{onDidAddListener:o}=h,c=B.create(),u=0;h.onDidAddListener=()=>{++u===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),c.print()),o?.()}}}function t(h,o){return I(h,()=>{},0,void 0,!0,void 0,o)}G.defer=t;function n(h){return(o,c=null,u)=>{let T=!1,b;return b=h(_=>{if(!T)return b?b.dispose():T=!0,o.call(c,_)},null,u),T&&b.dispose(),b}}G.once=n;function i(h,o,c){return p((u,T=null,b)=>h(_=>u.call(T,o(_)),null,b),c)}G.map=i;function s(h,o,c){return p((u,T=null,b)=>h(_=>{o(_),u.call(T,_)},null,b),c)}G.forEach=s;function a(h,o,c){return p((u,T=null,b)=>h(_=>o(_)&&u.call(T,_),null,b),c)}G.filter=a;function d(h){return h}G.signal=d;function l(...h){return(o,c=null,u)=>{let T=ae(...h.map(b=>b(_=>o.call(c,_))));return m(T,u)}}G.any=l;function f(h,o,c,u){let T=c;return i(h,b=>(T=o(T,b),T),u)}G.reduce=f;function p(h,o){let c,u={onWillAddFirstListener(){c=h(T.fire,T)},onDidRemoveLastListener(){c?.dispose()}};o||e(u);let T=new A(u);return o?.add(T),T.event}function m(h,o){return o instanceof Array?o.push(h):o&&o.add(h),h}function I(h,o,c=100,u=!1,T=!1,b,_){let S,L,M,Y=0,H,xe={leakWarningThreshold:b,onWillAddFirstListener(){S=h(Pe=>{Y++,L=o(L,Pe),u&&!M&&(J.fire(L),L=void 0),H=()=>{let We=L;L=void 0,M=void 0,(!u||Y>1)&&J.fire(We),Y=0},typeof c=="number"?(clearTimeout(M),M=setTimeout(H,c)):M===void 0&&(M=0,queueMicrotask(H))})},onWillRemoveListener(){T&&Y>0&&H?.()},onDidRemoveLastListener(){H=void 0,S.dispose()}};_||e(xe);let J=new A(xe);return _?.add(J),J.event}G.debounce=I;function E(h,o=0,c){return G.debounce(h,(u,T)=>u?(u.push(T),u):[T],o,void 0,!0,void 0,c)}G.accumulate=E;function C(h,o=(u,T)=>u===T,c){let u=!0,T;return a(h,b=>{let _=u||!o(b,T);return u=!1,T=b,_},c)}G.latch=C;function k(h,o,c){return[G.filter(h,o,c),G.filter(h,u=>!o(u),c)]}G.split=k;function D(h,o=!1,c=[],u){let T=c.slice(),b=h(L=>{T?T.push(L):S.fire(L)});u&&u.add(b);let _=()=>{T?.forEach(L=>S.fire(L)),T=null},S=new A({onWillAddFirstListener(){b||(b=h(L=>S.fire(L)),u&&u.add(b))},onDidAddFirstListener(){T&&(o?setTimeout(_):_())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return u&&u.add(S),S.event}G.buffer=D;function w(h,o){return(u,T,b)=>{let _=o(new j);return h(function(S){let L=_.evaluate(S);L!==y&&u.call(T,L)},void 0,b)}}G.chain=w;let y=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(o){return this.steps.push(o),this}forEach(o){return this.steps.push(c=>(o(c),c)),this}filter(o){return this.steps.push(c=>o(c)?c:y),this}reduce(o,c){let u=c;return this.steps.push(T=>(u=o(u,T),u)),this}latch(o=(c,u)=>c===u){let c=!0,u;return this.steps.push(T=>{let b=c||!o(T,u);return c=!1,u=T,b?T:y}),this}evaluate(o){for(let c of this.steps)if(o=c(o),o===y)break;return o}}function v(h,o,c=u=>u){let u=(...S)=>_.fire(c(...S)),T=()=>h.on(o,u),b=()=>h.removeListener(o,u),_=new A({onWillAddFirstListener:T,onDidRemoveLastListener:b});return _.event}G.fromNodeEventEmitter=v;function g(h,o,c=u=>u){let u=(...S)=>_.fire(c(...S)),T=()=>h.addEventListener(o,u),b=()=>h.removeEventListener(o,u),_=new A({onWillAddFirstListener:T,onDidRemoveLastListener:b});return _.event}G.fromDOMEventEmitter=g;function x(h){return new Promise(o=>n(h)(o))}G.toPromise=x;function R(h){let o=new A;return h.then(c=>{o.fire(c)},()=>{o.fire(void 0)}).finally(()=>{o.dispose()}),o.event}G.fromPromise=R;function K(h,o){return h(c=>o.fire(c))}G.forward=K;function ce(h,o,c){return o(c),h(u=>o(u))}G.runAndSubscribe=ce;class Ne{constructor(o,c){this._observable=o;this._counter=0;this._hasChanged=!1;let u={onWillAddFirstListener:()=>{o.addObserver(this)},onDidRemoveLastListener:()=>{o.removeObserver(this)}};c||e(u),this.emitter=new A(u),c&&c.add(this.emitter)}beginUpdate(o){this._counter++}handlePossibleChange(o){}handleChange(o,c){this._hasChanged=!0}endUpdate(o){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Xe(h,o){return new Ne(h,o).emitter.event}G.fromObservable=Xe;function Ze(h){return(o,c,u)=>{let T=0,b=!1,_={beginUpdate(){T++},endUpdate(){T--,T===0&&(h.reportChanges(),b&&(b=!1,o.call(c)))},handlePossibleChange(){},handleChange(){b=!0}};h.addObserver(_),h.reportChanges();let S={dispose(){h.removeObserver(_)}};return u instanceof P?u.add(S):Array.isArray(u)&&u.push(S),S}}G.fromObservableLight=Ze})(Be||={});var z=class z{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${e}_${z._idPool++}`,z.all.add(this)}start(e){this._stopWatch=new le,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}}};z.all=new Set,z._idPool=0;var me=z,Me=-1;var de=class de{constructor(e,t,n=(de._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=n;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,a]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${a}):`;console.warn(d),console.warn(s);let l=new be(d,s);this._errorHandler(l)}return()=>{let s=this._stacks.get(e.value)||0;this._stacks.set(e.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,i]of this._stacks)(!e||t<i)&&(e=[n,i],t=i);return e}};de._idPool=1;var ve=de,B=class r{constructor(e){this.value=e}static create(){let e=new Error;return new r(e.stack??"")}print(){console.warn(this.value.split(`
38
+ `),{leaks:n,details:a}}};ie.idx=0;var Oe=ie;function He(r){W=r}if(Ke){let r="__is_disposable_tracked__";He(new class{trackDisposable(e){let t=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[r]||console.log(t)},3e3)}setParent(e,t){if(e&&e!==O.None)try{e[r]=!0}catch{}}markAsDisposed(e){if(e&&e!==O.None)try{e[r]=!0}catch{}}markAsSingleton(e){}})}function re(r){return W?.trackDisposable(r),r}function oe(r){W?.markAsDisposed(r)}function q(r,e){W?.setParent(r,e)}function Qe(r,e){if(W)for(let t of r)W.setParent(t,e)}function z(r){if(me.is(r)){let e=[];for(let t of r)if(t)try{t.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}function ae(...r){let e=F(()=>z(r));return Qe(r,e),e}function F(r){let e=re({dispose:Te(()=>{oe(e),r()})});return e}var se=class se{constructor(){this._toDispose=new Set;this._isDisposed=!1;re(this)}dispose(){this._isDisposed||(oe(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{z(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return q(e,this),this._isDisposed?se.DISABLE_DISPOSED_WARNING||console.warn(new 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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),q(e,null))}};se.DISABLE_DISPOSED_WARNING=!1;var U=se,O=class{constructor(){this._store=new U;re(this),q(this._store,this)}dispose(){oe(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};O.None=Object.freeze({dispose(){}});var M=class{constructor(){this._isDisposed=!1;re(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&q(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,oe(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&q(e,null),e}};var V=class V{constructor(e){this.element=e,this.next=V.Undefined,this.prev=V.Undefined}};V.Undefined=new V(void 0);var Ae=V;var $e=globalThis.performance&&typeof globalThis.performance.now=="function",le=class r{static create(e){return new r(e)}constructor(e){this._now=$e&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var qe=!1,Me=!1,Be=!1,Ge;(G=>{G.None=()=>O.None;function e(h){if(Be){let{onDidAddListener:o}=h,c=B.create(),u=0;h.onDidAddListener=()=>{++u===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),c.print()),o?.()}}}function t(h,o){return I(h,()=>{},0,void 0,!0,void 0,o)}G.defer=t;function n(h){return(o,c=null,u)=>{let T=!1,b;return b=h(_=>{if(!T)return b?b.dispose():T=!0,o.call(c,_)},null,u),T&&b.dispose(),b}}G.once=n;function i(h,o,c){return p((u,T=null,b)=>h(_=>u.call(T,o(_)),null,b),c)}G.map=i;function s(h,o,c){return p((u,T=null,b)=>h(_=>{o(_),u.call(T,_)},null,b),c)}G.forEach=s;function a(h,o,c){return p((u,T=null,b)=>h(_=>o(_)&&u.call(T,_),null,b),c)}G.filter=a;function d(h){return h}G.signal=d;function l(...h){return(o,c=null,u)=>{let T=ae(...h.map(b=>b(_=>o.call(c,_))));return m(T,u)}}G.any=l;function f(h,o,c,u){let T=c;return i(h,b=>(T=o(T,b),T),u)}G.reduce=f;function p(h,o){let c,u={onWillAddFirstListener(){c=h(T.fire,T)},onDidRemoveLastListener(){c?.dispose()}};o||e(u);let T=new A(u);return o?.add(T),T.event}function m(h,o){return o instanceof Array?o.push(h):o&&o.add(h),h}function I(h,o,c=100,u=!1,T=!1,b,_){let S,L,N,Y=0,$,ye={leakWarningThreshold:b,onWillAddFirstListener(){S=h(We=>{Y++,L=o(L,We),u&&!N&&(J.fire(L),L=void 0),$=()=>{let Ue=L;L=void 0,N=void 0,(!u||Y>1)&&J.fire(Ue),Y=0},typeof c=="number"?(clearTimeout(N),N=setTimeout($,c)):N===void 0&&(N=0,queueMicrotask($))})},onWillRemoveListener(){T&&Y>0&&$?.()},onDidRemoveLastListener(){$=void 0,S.dispose()}};_||e(ye);let J=new A(ye);return _?.add(J),J.event}G.debounce=I;function E(h,o=0,c){return G.debounce(h,(u,T)=>u?(u.push(T),u):[T],o,void 0,!0,void 0,c)}G.accumulate=E;function C(h,o=(u,T)=>u===T,c){let u=!0,T;return a(h,b=>{let _=u||!o(b,T);return u=!1,T=b,_},c)}G.latch=C;function k(h,o,c){return[G.filter(h,o,c),G.filter(h,u=>!o(u),c)]}G.split=k;function D(h,o=!1,c=[],u){let T=c.slice(),b=h(L=>{T?T.push(L):S.fire(L)});u&&u.add(b);let _=()=>{T?.forEach(L=>S.fire(L)),T=null},S=new A({onWillAddFirstListener(){b||(b=h(L=>S.fire(L)),u&&u.add(b))},onDidAddFirstListener(){T&&(o?setTimeout(_):_())},onDidRemoveLastListener(){b&&b.dispose(),b=null}});return u&&u.add(S),S.event}G.buffer=D;function w(h,o){return(u,T,b)=>{let _=o(new H);return h(function(S){let L=_.evaluate(S);L!==y&&u.call(T,L)},void 0,b)}}G.chain=w;let y=Symbol("HaltChainable");class H{constructor(){this.steps=[]}map(o){return this.steps.push(o),this}forEach(o){return this.steps.push(c=>(o(c),c)),this}filter(o){return this.steps.push(c=>o(c)?c:y),this}reduce(o,c){let u=c;return this.steps.push(T=>(u=o(u,T),u)),this}latch(o=(c,u)=>c===u){let c=!0,u;return this.steps.push(T=>{let b=c||!o(T,u);return c=!1,u=T,b?T:y}),this}evaluate(o){for(let c of this.steps)if(o=c(o),o===y)break;return o}}function v(h,o,c=u=>u){let u=(...S)=>_.fire(c(...S)),T=()=>h.on(o,u),b=()=>h.removeListener(o,u),_=new A({onWillAddFirstListener:T,onDidRemoveLastListener:b});return _.event}G.fromNodeEventEmitter=v;function g(h,o,c=u=>u){let u=(...S)=>_.fire(c(...S)),T=()=>h.addEventListener(o,u),b=()=>h.removeEventListener(o,u),_=new A({onWillAddFirstListener:T,onDidRemoveLastListener:b});return _.event}G.fromDOMEventEmitter=g;function x(h){return new Promise(o=>n(h)(o))}G.toPromise=x;function R(h){let o=new A;return h.then(c=>{o.fire(c)},()=>{o.fire(void 0)}).finally(()=>{o.dispose()}),o.event}G.fromPromise=R;function Q(h,o){return h(c=>o.fire(c))}G.forward=Q;function he(h,o,c){return o(c),h(u=>o(u))}G.runAndSubscribe=he;class Pe{constructor(o,c){this._observable=o;this._counter=0;this._hasChanged=!1;let u={onWillAddFirstListener:()=>{o.addObserver(this)},onDidRemoveLastListener:()=>{o.removeObserver(this)}};c||e(u),this.emitter=new A(u),c&&c.add(this.emitter)}beginUpdate(o){this._counter++}handlePossibleChange(o){}handleChange(o,c){this._hasChanged=!0}endUpdate(o){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Ze(h,o){return new Pe(h,o).emitter.event}G.fromObservable=Ze;function et(h){return(o,c,u)=>{let T=0,b=!1,_={beginUpdate(){T++},endUpdate(){T--,T===0&&(h.reportChanges(),b&&(b=!1,o.call(c)))},handlePossibleChange(){},handleChange(){b=!0}};h.addObserver(_),h.reportChanges();let S={dispose(){h.removeObserver(_)}};return u instanceof U?u.add(S):Array.isArray(u)&&u.push(S),S}}G.fromObservableLight=et})(Ge||={});var j=class j{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${e}_${j._idPool++}`,j.all.add(this)}start(e){this._stopWatch=new le,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}}};j.all=new Set,j._idPool=0;var ve=j,Fe=-1;var de=class de{constructor(e,t,n=(de._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=n;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,a]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${a}):`;console.warn(d),console.warn(s);let l=new ge(d,s);this._errorHandler(l)}return()=>{let s=this._stacks.get(e.value)||0;this._stacks.set(e.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,i]of this._stacks)(!e||t<i)&&(e=[n,i],t=i);return e}};de._idPool=1;var be=de,B=class r{constructor(e){this.value=e}static create(){let e=new Error;return new r(e.stack??"")}print(){console.warn(this.value.split(`
39
39
  `).slice(2).join(`
40
- `))}},be=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ge=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Ge=0,V=class{constructor(e){this.value=e;this.id=Ge++}},Ye=2,Je=(r,e)=>{if(r instanceof V)e(r);else for(let t=0;t<r.length;t++){let n=r[t];n&&e(n)}},ue;if($e){let r=[];setInterval(()=>{r.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(r.join(`
41
- `)),r.length=0)},3e3),ue=new FinalizationRegistry(e=>{typeof e=="string"&&r.push(e)})}var A=class{constructor(e){this._size=0;this._options=e,this._leakageMon=Me>0||this._options?.leakWarningThreshold?new ve(e?.onListenerError??ee,this._options?.leakWarningThreshold??Me):void 0,this._perfMon=this._options?._profName?new me(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ae){let e=this._listeners;queueMicrotask(()=>{Je(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new ge(`${l}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||ee)(p),O.None}if(this._disposed)return O.None;t&&(e=e.bind(t));let i=new V(e),s,a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=B.create(),s=this._leakageMon.check(i.stack,this._size+1)),Ae&&(i.stack=a??B.create()),this._listeners?this._listeners instanceof V?(this._deliveryQueue??=new _e,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let d=q(()=>{ue?.unregister(d),s?.(),this._removeListener(i)});if(n instanceof P?n.add(d):Array.isArray(n)&&n.push(d),ue){let l=new Error().stack.split(`
40
+ `))}},ge=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},_e=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Ye=0,K=class{constructor(e){this.value=e;this.id=Ye++}},Je=2,Xe=(r,e)=>{if(r instanceof K)e(r);else for(let t=0;t<r.length;t++){let n=r[t];n&&e(n)}},ue;if(qe){let r=[];setInterval(()=>{r.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(r.join(`
41
+ `)),r.length=0)},3e3),ue=new FinalizationRegistry(e=>{typeof e=="string"&&r.push(e)})}var A=class{constructor(e){this._size=0;this._options=e,this._leakageMon=Fe>0||this._options?.leakWarningThreshold?new be(e?.onListenerError??ee,this._options?.leakWarningThreshold??Fe):void 0,this._perfMon=this._options?._profName?new ve(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Me){let e=this._listeners;queueMicrotask(()=>{Xe(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new _e(`${l}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||ee)(p),O.None}if(this._disposed)return O.None;t&&(e=e.bind(t));let i=new K(e),s,a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=B.create(),s=this._leakageMon.check(i.stack,this._size+1)),Me&&(i.stack=a??B.create()),this._listeners?this._listeners instanceof K?(this._deliveryQueue??=new xe,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let d=F(()=>{ue?.unregister(d),s?.(),this._removeListener(i)});if(n instanceof U?n.add(d):Array.isArray(n)&&n.push(d),ue){let l=new Error().stack.split(`
42
42
  `).slice(2,3).join(`
43
- `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);ue.register(d,f?.[2]??l,d)}return d},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Ye<=t.length){let s=0;for(let a=0;a<t.length;a++)t[a]?t[s++]=t[a]:i&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=s}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ee;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof V)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var _e=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Fe=class extends O{constructor(t){super();this._highlightedLines=new Set;this._highlightDecorations=[];this._searchResultsWithHighlight=[];this._selectedDecoration=this._register(new $);this._linesCacheTimeoutId=0;this._linesCacheDisposables=new $;this._onDidChangeResults=this._register(new A);this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._onDidChangeResults.event}activate(t){this._terminal=t,this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(q(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout(()=>{let t=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(t,{...this._lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._selectedDecoration.clear(),W(this._highlightDecorations),this._highlightDecorations=[],this._searchResultsWithHighlight=[],this._highlightedLines.clear(),t||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let s=this._lastSearchOptions?this._didOptionsChange(this._lastSearchOptions,n):!0;this._lastSearchOptions=n,n?.decorations&&(this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||s)&&this._highlightAllMatches(t,n);let a=this._findNextAndSelect(t,n,i);return this._fireResults(n),this._cachedSearchTerm=t,a}_highlightAllMatches(t,n){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!t||t.length===0){this.clearDecorations();return}n=n||{},this.clearDecorations(!0);let i,s=this._find(t,0,0,n);for(;s&&(i?.row!==s.row||i?.col!==s.col)&&!(this._searchResultsWithHighlight.length>=this._highlightLimit);)i=s,this._searchResultsWithHighlight.push(i),s=this._find(t,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,n);for(let a of this._searchResultsWithHighlight){let d=this._createResultDecorations(a,n.decorations,!1);if(d)for(let l of d)this._storeDecoration(l,a)}}_storeDecoration(t,n){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:n,dispose(){t.dispose()}})}_find(t,n,i,s){if(!this._terminal||!t||t.length===0){this._terminal?.clearSelection(),this.clearDecorations();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);let a;this._initLinesCache();let d={startRow:n,startCol:i};if(a=this._findInLine(t,d,s),!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(d.startRow=l,d.startCol=0,a=this._findInLine(t,d,s),!a);l++);return a}_findNextAndSelect(t,n,i){if(!this._terminal||!t||t.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let a=0,d=0;s&&(this._cachedSearchTerm===t?(a=s.end.x,d=s.end.y):(a=s.start.x,d=s.start.y)),this._initLinesCache();let l={startRow:d,startCol:a},f=this._findInLine(t,l,n);if(!f)for(let p=d+1;p<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=p,l.startCol=0,f=this._findInLine(t,l,n),!f);p++);if(!f&&d!==0)for(let p=0;p<d&&(l.startRow=p,l.startCol=0,f=this._findInLine(t,l,n),!f);p++);return!f&&s&&(l.startRow=s.start.y,l.startCol=0,f=this._findInLine(t,l,n)),this._selectResult(f,n?.decorations,i?.noScroll)}findPrevious(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let s=this._lastSearchOptions?this._didOptionsChange(this._lastSearchOptions,n):!0;this._lastSearchOptions=n,n?.decorations&&(this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||s)&&this._highlightAllMatches(t,n);let a=this._findPreviousAndSelect(t,n,i);return this._fireResults(n),this._cachedSearchTerm=t,a}_didOptionsChange(t,n){return n?t.caseSensitive!==n.caseSensitive||t.regex!==n.regex||t.wholeWord!==n.wholeWord:!1}_fireResults(t){if(t?.decorations){let n=-1;if(this._selectedDecoration.value){let i=this._selectedDecoration.value.match;for(let s=0;s<this._searchResultsWithHighlight.length;s++){let a=this._searchResultsWithHighlight[s];if(a.row===i.row&&a.col===i.col&&a.size===i.size){n=s;break}}}this._onDidChangeResults.fire({resultIndex:n,resultCount:this._searchResultsWithHighlight.length})}}_findPreviousAndSelect(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!t||t.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let a=this._terminal.buffer.active.baseY+this._terminal.rows-1,d=this._terminal.cols,l=!0;this._initLinesCache();let f={startRow:a,startCol:d},p;if(s&&(f.startRow=a=s.start.y,f.startCol=d=s.start.x,this._cachedSearchTerm!==t&&(p=this._findInLine(t,f,n,!1),p||(f.startRow=a=s.end.y,f.startCol=d=s.end.x))),p||(p=this._findInLine(t,f,n,l)),!p){f.startCol=Math.max(f.startCol,this._terminal.cols);for(let m=a-1;m>=0&&(f.startRow=m,p=this._findInLine(t,f,n,l),!p);m--);}if(!p&&a!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let m=this._terminal.buffer.active.baseY+this._terminal.rows-1;m>=a&&(f.startRow=m,p=this._findInLine(t,f,n,l),!p);m--);return this._selectResult(p,n?.decorations,i?.noScroll)}_initLinesCache(){let t=this._terminal;this._linesCache||(this._linesCache=new Array(t.buffer.active.length),this._linesCacheDisposables.value=ae(t.onLineFeed(()=>this._destroyLinesCache()),t.onCursorMove(()=>this._destroyLinesCache()),t.onResize(()=>this._destroyLinesCache()))),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}_isWholeWord(t,n,i){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t-1]))&&(t+i.length===n.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t+i.length]))}_findInLine(t,n,i={},s=!1){let a=this._terminal,d=n.startRow,l=n.startCol;if(a.buffer.active.getLine(d)?.isWrapped){if(s){n.startCol+=a.cols;return}return n.startRow--,n.startCol+=a.cols,this._findInLine(t,n,i)}let p=this._linesCache?.[d];p||(p=this._translateBufferLineToStringWithWrap(d,!0),this._linesCache&&(this._linesCache[d]=p));let[m,I]=p,E=this._bufferColsToStringOffset(d,l),C=t,k=m;i.regex||(C=i.caseSensitive?t:t.toLowerCase(),k=i.caseSensitive?m:m.toLowerCase());let D=-1;if(i.regex){let w=RegExp(C,i.caseSensitive?"g":"gi"),y;if(s)for(;y=w.exec(k.slice(0,E));)D=w.lastIndex-y[0].length,t=y[0],w.lastIndex-=t.length-1;else y=w.exec(k.slice(E)),y&&y[0].length>0&&(D=E+(w.lastIndex-y[0].length),t=y[0])}else s?E-C.length>=0&&(D=k.lastIndexOf(C,E-C.length)):D=k.indexOf(C,E);if(D>=0){if(i.wholeWord&&!this._isWholeWord(D,k,t))return;let w=0;for(;w<I.length-1&&D>=I[w+1];)w++;let y=w;for(;y<I.length-1&&D+t.length>=I[y+1];)y++;let j=D-I[w],v=D+t.length-I[y],g=this._stringLengthToBufferSize(d+w,j),R=this._stringLengthToBufferSize(d+y,v)-g+a.cols*(y-w);return{term:t,col:g,row:d+w,size:R}}}_stringLengthToBufferSize(t,n){let i=this._terminal.buffer.active.getLine(t);if(!i)return 0;for(let s=0;s<n;s++){let a=i.getCell(s);if(!a)break;let d=a.getChars();d.length>1&&(n-=d.length-1);let l=i.getCell(s+1);l&&l.getWidth()===0&&n++}return n}_bufferColsToStringOffset(t,n){let i=this._terminal,s=t,a=0,d=i.buffer.active.getLine(s);for(;n>0&&d;){for(let l=0;l<n&&l<i.cols;l++){let f=d.getCell(l);if(!f)break;f.getWidth()&&(a+=f.getCode()===0?1:f.getChars().length)}if(s++,d=i.buffer.active.getLine(s),d&&!d.isWrapped)break;n-=i.cols}return a}_translateBufferLineToStringWithWrap(t,n){let i=this._terminal,s=[],a=[0],d=i.buffer.active.getLine(t);for(;d;){let l=i.buffer.active.getLine(t+1),f=l?l.isWrapped:!1,p=d.translateToString(!f&&n);if(f&&l){let m=d.getCell(d.length-1);m&&m.getCode()===0&&m.getWidth()===1&&l.getCell(0)?.getWidth()===2&&(p=p.slice(0,-1))}if(s.push(p),f)a.push(a[a.length-1]+p.length);else break;t++,d=l}return[s.join(""),a]}_selectResult(t,n,i){let s=this._terminal;if(this._selectedDecoration.clear(),!t)return s.clearSelection(),!1;if(s.select(t.col,t.row,t.size),n){let a=this._createResultDecorations(t,n,!0);a&&(this._selectedDecoration.value={decorations:a,match:t,dispose(){W(a)}})}if(!i&&(t.row>=s.buffer.active.viewportY+s.rows||t.row<s.buffer.active.viewportY)){let a=t.row-s.buffer.active.viewportY;a-=Math.floor(s.rows/2),s.scrollLines(a)}return!0}_applyStyles(t,n,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),n&&(t.style.outline=`1px solid ${n}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,n,i){let s=this._terminal,a=[],d=t.col,l=t.size,f=-s.buffer.active.baseY-s.buffer.active.cursorY+t.row;for(;l>0;){let m=Math.min(s.cols-d,l);a.push([f,d,m]),d=0,l-=m,f++}let p=[];for(let m of a){let I=s.registerMarker(m[0]),E=s.registerDecoration({marker:I,x:m[1],width:m[2],backgroundColor:i?n.activeMatchBackground:n.matchBackground,overviewRulerOptions:this._highlightedLines.has(I.line)?void 0:{color:i?n.activeMatchColorOverviewRuler:n.matchOverviewRuler,position:"center"}});if(E){let C=[];C.push(I),C.push(E.onRender(k=>this._applyStyles(k,i?n.activeMatchBorder:n.matchBorder,!1))),C.push(E.onDispose(()=>W(C))),p.push(E)}}return p.length===0?void 0:p}};export{Fe as SearchAddon};
43
+ `).trim(),f=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);ue.register(d,f?.[2]??l,d)}return d},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Je<=t.length){let s=0;for(let a=0;a<t.length;a++)t[a]?t[s++]=t[a]:i&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=s}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ee;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof K)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var xe=class{constructor(){this.i=-1;this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var ce=class extends O{constructor(t){super();this._terminal=t;this._linesCacheTimeoutId=0;this._linesCacheDisposables=this._register(new M);this._register(F(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=ae(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&(window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=0)}getLineFromCache(t){return this._linesCache?.[t]}setLineInCache(t,n){this._linesCache&&(this._linesCache[t]=n)}translateBufferLineToStringWithWrap(t,n){let i=[],s=[0],a=this._terminal.buffer.active.getLine(t);for(;a;){let d=this._terminal.buffer.active.getLine(t+1),l=d?d.isWrapped:!1,f=a.translateToString(!l&&n);if(l&&d){let p=a.getCell(a.length-1);p&&p.getCode()===0&&p.getWidth()===1&&d.getCell(0)?.getWidth()===2&&(f=f.slice(0,-1))}if(i.push(f),l)s.push(s[s.length-1]+f.length);else break;t++,a=d}return[i.join(""),s]}};var Ne=class extends O{constructor(t){super();this._highlightedLines=new Set;this._highlightDecorations=[];this._searchResultsWithHighlight=[];this._selectedDecoration=this._register(new M);this._lineCache=this._register(new M);this._onDidChangeResults=this._register(new A);this._highlightLimit=t?.highlightLimit??1e3}get onDidChangeResults(){return this._onDidChangeResults.event}activate(t){this._terminal=t,this._lineCache.value=new ce(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(F(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout(()=>{let t=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(t,{...this._lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){this._selectedDecoration.clear(),z(this._highlightDecorations),this._highlightDecorations=[],this._searchResultsWithHighlight=[],this._highlightedLines.clear(),t||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let s=this._lastSearchOptions?this._didOptionsChange(this._lastSearchOptions,n):!0;this._lastSearchOptions=n,n?.decorations&&(this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||s)&&this._highlightAllMatches(t,n);let a=this._findNextAndSelect(t,n,i);return this._fireResults(n),this._cachedSearchTerm=t,a}_highlightAllMatches(t,n){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!t||t.length===0){this.clearDecorations();return}n=n||{},this.clearDecorations(!0);let i,s=this._find(t,0,0,n);for(;s&&(i?.row!==s.row||i?.col!==s.col)&&!(this._searchResultsWithHighlight.length>=this._highlightLimit);)i=s,this._searchResultsWithHighlight.push(i),s=this._find(t,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,n);for(let a of this._searchResultsWithHighlight){let d=this._createResultDecorations(a,n.decorations,!1);if(d)for(let l of d)this._storeDecoration(l,a)}}_storeDecoration(t,n){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:n,dispose(){t.dispose()}})}_find(t,n,i,s){if(!this._terminal||!t||t.length===0){this._terminal?.clearSelection(),this.clearDecorations();return}if(i>this._terminal.cols)throw new Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);let a;this._lineCache.value.initLinesCache();let d={startRow:n,startCol:i};if(a=this._findInLine(t,d,s),!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(d.startRow=l,d.startCol=0,a=this._findInLine(t,d,s),!a);l++);return a}_findNextAndSelect(t,n,i){if(!this._terminal||!t||t.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let a=0,d=0;s&&(this._cachedSearchTerm===t?(a=s.end.x,d=s.end.y):(a=s.start.x,d=s.start.y)),this._lineCache.value.initLinesCache();let l={startRow:d,startCol:a},f=this._findInLine(t,l,n);if(!f)for(let p=d+1;p<this._terminal.buffer.active.baseY+this._terminal.rows&&(l.startRow=p,l.startCol=0,f=this._findInLine(t,l,n),!f);p++);if(!f&&d!==0)for(let p=0;p<d&&(l.startRow=p,l.startCol=0,f=this._findInLine(t,l,n),!f);p++);return!f&&s&&(l.startRow=s.start.y,l.startCol=0,f=this._findInLine(t,l,n)),this._selectResult(f,n?.decorations,i?.noScroll)}findPrevious(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let s=this._lastSearchOptions?this._didOptionsChange(this._lastSearchOptions,n):!0;this._lastSearchOptions=n,n?.decorations&&(this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||s)&&this._highlightAllMatches(t,n);let a=this._findPreviousAndSelect(t,n,i);return this._fireResults(n),this._cachedSearchTerm=t,a}_didOptionsChange(t,n){return n?t.caseSensitive!==n.caseSensitive||t.regex!==n.regex||t.wholeWord!==n.wholeWord:!1}_fireResults(t){if(t?.decorations){let n=-1;if(this._selectedDecoration.value){let i=this._selectedDecoration.value.match;for(let s=0;s<this._searchResultsWithHighlight.length;s++){let a=this._searchResultsWithHighlight[s];if(a.row===i.row&&a.col===i.col&&a.size===i.size){n=s;break}}}this._onDidChangeResults.fire({resultIndex:n,resultCount:this._searchResultsWithHighlight.length})}}_findPreviousAndSelect(t,n,i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");if(!this._terminal||!t||t.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let a=this._terminal.buffer.active.baseY+this._terminal.rows-1,d=this._terminal.cols,l=!0;this._lineCache.value.initLinesCache();let f={startRow:a,startCol:d},p;if(s&&(f.startRow=a=s.start.y,f.startCol=d=s.start.x,this._cachedSearchTerm!==t&&(p=this._findInLine(t,f,n,!1),p||(f.startRow=a=s.end.y,f.startCol=d=s.end.x))),p||(p=this._findInLine(t,f,n,l)),!p){f.startCol=Math.max(f.startCol,this._terminal.cols);for(let m=a-1;m>=0&&(f.startRow=m,p=this._findInLine(t,f,n,l),!p);m--);}if(!p&&a!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let m=this._terminal.buffer.active.baseY+this._terminal.rows-1;m>=a&&(f.startRow=m,p=this._findInLine(t,f,n,l),!p);m--);return this._selectResult(p,n?.decorations,i?.noScroll)}_isWholeWord(t,n,i){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t-1]))&&(t+i.length===n.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(n[t+i.length]))}_findInLine(t,n,i={},s=!1){let a=this._terminal,d=n.startRow,l=n.startCol;if(a.buffer.active.getLine(d)?.isWrapped){if(s){n.startCol+=a.cols;return}return n.startRow--,n.startCol+=a.cols,this._findInLine(t,n,i)}let p=this._lineCache.value.getLineFromCache(d);p||(p=this._lineCache.value.translateBufferLineToStringWithWrap(d,!0),this._lineCache.value.setLineInCache(d,p));let[m,I]=p,E=this._bufferColsToStringOffset(d,l),C=t,k=m;i.regex||(C=i.caseSensitive?t:t.toLowerCase(),k=i.caseSensitive?m:m.toLowerCase());let D=-1;if(i.regex){let w=RegExp(C,i.caseSensitive?"g":"gi"),y;if(s)for(;y=w.exec(k.slice(0,E));)D=w.lastIndex-y[0].length,t=y[0],w.lastIndex-=t.length-1;else y=w.exec(k.slice(E)),y&&y[0].length>0&&(D=E+(w.lastIndex-y[0].length),t=y[0])}else s?E-C.length>=0&&(D=k.lastIndexOf(C,E-C.length)):D=k.indexOf(C,E);if(D>=0){if(i.wholeWord&&!this._isWholeWord(D,k,t))return;let w=0;for(;w<I.length-1&&D>=I[w+1];)w++;let y=w;for(;y<I.length-1&&D+t.length>=I[y+1];)y++;let H=D-I[w],v=D+t.length-I[y],g=this._stringLengthToBufferSize(d+w,H),R=this._stringLengthToBufferSize(d+y,v)-g+a.cols*(y-w);return{term:t,col:g,row:d+w,size:R}}}_stringLengthToBufferSize(t,n){let i=this._terminal.buffer.active.getLine(t);if(!i)return 0;for(let s=0;s<n;s++){let a=i.getCell(s);if(!a)break;let d=a.getChars();d.length>1&&(n-=d.length-1);let l=i.getCell(s+1);l&&l.getWidth()===0&&n++}return n}_bufferColsToStringOffset(t,n){let i=this._terminal,s=t,a=0,d=i.buffer.active.getLine(s);for(;n>0&&d;){for(let l=0;l<n&&l<i.cols;l++){let f=d.getCell(l);if(!f)break;f.getWidth()&&(a+=f.getCode()===0?1:f.getChars().length)}if(s++,d=i.buffer.active.getLine(s),d&&!d.isWrapped)break;n-=i.cols}return a}_selectResult(t,n,i){let s=this._terminal;if(this._selectedDecoration.clear(),!t)return s.clearSelection(),!1;if(s.select(t.col,t.row,t.size),n){let a=this._createResultDecorations(t,n,!0);a&&(this._selectedDecoration.value={decorations:a,match:t,dispose(){z(a)}})}if(!i&&(t.row>=s.buffer.active.viewportY+s.rows||t.row<s.buffer.active.viewportY)){let a=t.row-s.buffer.active.viewportY;a-=Math.floor(s.rows/2),s.scrollLines(a)}return!0}_applyStyles(t,n,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),n&&(t.style.outline=`1px solid ${n}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,n,i){let s=this._terminal,a=[],d=t.col,l=t.size,f=-s.buffer.active.baseY-s.buffer.active.cursorY+t.row;for(;l>0;){let m=Math.min(s.cols-d,l);a.push([f,d,m]),d=0,l-=m,f++}let p=[];for(let m of a){let I=s.registerMarker(m[0]),E=s.registerDecoration({marker:I,x:m[1],width:m[2],backgroundColor:i?n.activeMatchBackground:n.matchBackground,overviewRulerOptions:this._highlightedLines.has(I.line)?void 0:{color:i?n.activeMatchColorOverviewRuler:n.matchOverviewRuler,position:"center"}});if(E){let C=[];C.push(I),C.push(E.onRender(k=>this._applyStyles(k,i?n.activeMatchBorder:n.matchBorder,!1))),C.push(E.onDispose(()=>z(C))),p.push(E)}}return p.length===0?void 0:p}};export{Ne as SearchAddon};
44
44
  //# sourceMappingURL=addon-search.mjs.map