/*!--------------------------------------------------------
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *--------------------------------------------------------*/
(function(){var e=["exports","require","vs/base/common/event","vs/base/common/errors","vs/base/common/lifecycle","vs/base/common/functional","vs/base/common/cancellation","vs/base/common/async","vs/base/parts/ipc/node/ipc","vs/base/common/linkedList","vs/base/common/platform","vs/base/common/path","vs/base/common/uuid","vs/base/common/iterator","vs/base/parts/ipc/node/ipc.net","vs/platform/instantiation/common/instantiation","os","net","vs/platform/driver/node/driver"],t=function(t){for(var n=[],s=0,i=t.length;s<i;s++)n[s]=e[t[s]];return n};define(e[3],t([1,0]),function(e,t){"use strict";function n(e){return e instanceof Error&&e.name===i&&e.message===i}Object.defineProperty(t,"__esModule",{value:!0});class s{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{if(e.stack)throw new Error(e.message+"\n\n"+e.stack);throw 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)}}t.ErrorHandler=s,t.errorHandler=new s,t.setUnexpectedErrorHandler=function(e){t.errorHandler.setUnexpectedErrorHandler(e)},t.onUnexpectedError=function(e){n(e)||t.errorHandler.onUnexpectedError(e)},t.onUnexpectedExternalError=function(e){n(e)||t.errorHandler.onUnexpectedExternalError(e)},t.transformErrorForSerialization=function(e){if(e instanceof Error){let{name:t,message:n}=e;return{$isError:!0,name:t,message:n,stack:e.stacktrace||e.stack}}return e};const i="Canceled";t.isPromiseCanceledError=n,t.canceled=function(){let e=new Error(i);return e.name=e.message,e},t.illegalArgument=function(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")},t.illegalState=function(e){
return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")},t.readonly=function(e){return e?new Error(`readonly property '${e} cannot be changed'`):new Error("readonly property cannot be changed")},t.disposed=function(e){const t=new Error(`${e} has been disposed`);return t.name="DISPOSED",t},t.getErrorMessage=function(e){return e?e.message?e.message:e.stack?e.stack.split("\n")[0]:String(e):"Error"}}),define(e[5],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.once=function(e){const t=this;let n,s=!1;return function(){return s?n:(s=!0,n=e.apply(t,arguments))}}}),define(e[13],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FIN={done:!0,value:void 0};var n;!function(e){function n(e,t){for(let n=e.next();!n.done;n=e.next())t(n.value)}const s={next:()=>t.FIN};e.empty=function(){return s},e.fromArray=function(e,n=0,s=e.length){return{next:()=>n>=s?t.FIN:{done:!1,value:e[n++]}}},e.from=function(t){
return t?Array.isArray(t)?e.fromArray(t):t:e.empty()},e.map=function(e,n){return{next(){const s=e.next();return s.done?t.FIN:{done:!1,value:n(s.value)}}}},e.filter=function(e,n){return{next(){for(;;){const s=e.next();if(s.done)return t.FIN;if(n(s.value))return{done:!1,value:s.value}}}}},e.forEach=n,e.collect=function(e){const t=[];return n(e,e=>t.push(e)),t}}(n=t.Iterator||(t.Iterator={})),t.getSequenceIterator=function(e){return Array.isArray(e)?n.fromArray(e):e};class s{constructor(e,t=0,n=e.length,s=t-1){this.items=e,this.start=t,this.end=n,this.index=s}first(){return this.index=this.start,this.current()}next(){return this.index=Math.min(this.index+1,this.end),this.current()}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}}t.ArrayIterator=s;class i extends s{constructor(e,t=0,n=e.length,s=t-1){super(e,t,n,s)}current(){return super.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,
this.current()}last(){return this.index=this.end-1,this.current()}parent(){return null}}t.ArrayNavigator=i;class r{constructor(e,t){this.iterator=e,this.fn=t}next(){return this.fn(this.iterator.next())}}t.MappedIterator=r;class o extends r{constructor(e,t){super(e,t),this.navigator=e}current(){return this.fn(this.navigator.current())}previous(){return this.fn(this.navigator.previous())}parent(){return this.fn(this.navigator.parent())}first(){return this.fn(this.navigator.first())}last(){return this.fn(this.navigator.last())}next(){return this.fn(this.navigator.next())}}t.MappedNavigator=o}),define(e[4],t([1,0,5]),function(e,t,n){"use strict";function s(e,...t){if(Array.isArray(e))return e.forEach(e=>e&&e.dispose()),[];if(0!==t.length)return s(e),s(t),[];if(e)return e.dispose(),e}Object.defineProperty(t,"__esModule",{value:!0}),t.isDisposable=function(e){return"function"==typeof e.dispose&&0===e.dispose.length},t.dispose=s,t.combinedDisposable=function(e){return{dispose:()=>s(e)}},t.toDisposable=function(e){
return{dispose(){e()}}};class i{constructor(){this._toDispose=[],this._lifecycle_disposable_isDisposed=!1}get toDispose(){return this._toDispose}dispose(){this._lifecycle_disposable_isDisposed=!0,this._toDispose=s(this._toDispose)}_register(e){return this._lifecycle_disposable_isDisposed?(console.warn("Registering disposable on object that has already been disposed."),e.dispose()):this._toDispose.push(e),e}}i.None=Object.freeze({dispose(){}}),t.Disposable=i;class r{constructor(){this.references=Object.create(null)}acquire(e){let t=this.references[e];t||(t=this.references[e]={counter:0,object:this.createReferencedObject(e)});const{object:s}=t,i=n.once(()=>{0==--t.counter&&(this.destroyReferencedObject(e,t.object),delete this.references[e])});return t.counter++,{object:s,dispose:i}}}t.ReferenceCollection=r;class o{constructor(e){this.object=e}dispose(){}}t.ImmortalReference=o}),define(e[9],t([1,0,13]),function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class s{constructor(e){
this.element=e}}class i{constructor(){this._size=0}get size(){return this._size}isEmpty(){return!this._first}clear(){this._first=void 0,this._last=void 0,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const n=new s(e);if(this._first)if(t){const e=this._last;this._last=n,n.prev=e,e.next=n}else{const e=this._first;this._first=n,n.next=e,e.prev=n}else this._first=n,this._last=n;return this._size+=1,this._remove.bind(this,n)}shift(){if(this._first){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last){const e=this._last.element;return this._remove(this._last),e}}_remove(e){let t=this._first;for(;t instanceof s;){if(t===e){if(t.prev&&t.next){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev||t.next?t.next?t.prev||(this._first=this._first.next,this._first.prev=void 0):(this._last=this._last.prev,this._last.next=void 0):(this._first=void 0,this._last=void 0);this._size-=1;break}t=t.next}}iterator(){let e,t=this._first;return{
next:()=>t?(e?e.value=t.element:e={done:!1,value:t.element},t=t.next,e):n.FIN}}toArray(){let e=[];for(let t=this._first;t instanceof s;t=t.next)e.push(t.element);return e}}t.LinkedList=i});var n=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,r){function o(e){try{l(s.next(e))}catch(e){r(e)}}function c(e){try{l(s.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(o,c)}l((s=s.apply(e,t||[])).next())})};define(e[2],t([1,0,3,5,4,9]),function(e,t,s,i,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c;!function(e){function t(e){return(t,n=null,s)=>{let i,r=!1;return i=e(e=>{if(!r)return i?i.dispose():r=!0,t.call(n,e)},null,s),r&&i.dispose(),i}}function n(e,t){return c((n,s=null,i)=>e(e=>n.call(s,t(e)),null,i))}function s(e,t){return c((n,s=null,i)=>e(e=>{t(e),n.call(s,e)},null,i))}function i(e,t){return c((n,s=null,i)=>e(e=>t(e)&&n.call(s,e),null,i))}function o(e,t,s){let i=s;return n(e,e=>i=t(i,e))}function c(e){let t
;const n=new h({onFirstListenerAdd(){t=e(n.fire,n)},onLastListenerRemove(){t.dispose()}});return n.event}function l(e){let t,n=!0;return i(e,e=>{let s=n||e!==t;return n=!1,t=e,s})}const a={dispose(){}};e.None=function(){return a},e.once=t,e.map=n,e.forEach=s,e.filter=i,e.signal=function(e){return e},e.any=function(...e){return(t,n=null,s)=>r.combinedDisposable(e.map(e=>e(e=>t.call(n,e),null,s)))},e.reduce=o,e.snapshot=c,e.debounce=function(e,t,n=100,s=!1,i){let r,o=void 0,c=void 0,l=0;const a=new h({leakWarningThreshold:i,onFirstListenerAdd(){r=e(e=>{l++,o=t(o,e),s&&!c&&a.fire(o),clearTimeout(c),c=setTimeout(()=>{let e=o;o=void 0,c=void 0,(!s||l>1)&&a.fire(e),l=0},n)})},onLastListenerRemove(){r.dispose()}});return a.event},e.stopwatch=function(e){const s=(new Date).getTime();return n(t(e),e=>(new Date).getTime()-s)},e.latch=l,e.buffer=function(e,t=!1,n=[]){let s=n.slice(),i=e(e=>{s?s.push(e):o.fire(e)});const r=()=>{s&&s.forEach(e=>o.fire(e)),s=null},o=new h({onFirstListenerAdd(){i||(i=e(e=>o.fire(e)))},
onFirstListenerDidAdd(){s&&(t?setTimeout(r):r())},onLastListenerRemove(){i&&i.dispose(),i=null}});return o.event},e.echo=function(e,t=!1,n=[]){n=n.slice(),e(e=>{n.push(e),i.fire(e)});const s=(e,t)=>n.forEach(n=>e.call(t,n)),i=new h({onListenerDidAdd(e,n,i){t?setTimeout(()=>s(n,i)):s(n,i)}});return i.event};class u{constructor(e){this.event=e}map(e){return new u(n(this.event,e))}forEach(e){return new u(s(this.event,e))}filter(e){return new u(i(this.event,e))}reduce(e,t){return new u(o(this.event,e,t))}latch(){return new u(l(this.event))}on(e,t,n){return this.event(e,t,n)}once(e,n,s){return t(this.event)(e,n,s)}}e.chain=function(e){return new u(e)},e.fromNodeEventEmitter=function(e,t,n=(e=>e)){const s=(...e)=>i.fire(n(...e)),i=new h({onFirstListenerAdd:()=>e.on(t,s),onLastListenerRemove:()=>e.removeListener(t,s)});return i.event},e.fromPromise=function(e){const t=new h;let n=!1;return e.then(void 0,()=>null).then(()=>{n?t.fire(void 0):setTimeout(()=>t.fire(void 0),0)}),n=!0,t.event},e.toPromise=function(e){
return new Promise(n=>t(e)(n))}}(c=t.Event||(t.Event={}));let l=-1;t.setGlobalLeakWarningThreshold=function(e){let t=l;return l=e,{dispose(){l=t}}};class a{constructor(e,t=Math.random().toString(18).slice(2,5)){this.customThreshold=e,this.name=t,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(e){let t=l;if("number"==typeof this.customThreshold&&(t=this.customThreshold),t<=0||e<t)return;this._stacks||(this._stacks=new Map);let n=(new Error).stack.split("\n").slice(3).join("\n"),s=this._stacks.get(n)||0;if(this._stacks.set(n,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*t;let n,s=0;this._stacks.forEach((e,t)=>{(!n||s<e)&&(n=t,s=e)}),console.warn(`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${s}):`),console.warn(n)}return()=>{let e=this._stacks.get(n)||0;this._stacks.set(n,e-1)}}}class h{constructor(e){this._disposed=!1,this._options=e,
this._leakageMon=l>0?new a(this._options&&this._options.leakWarningThreshold):void 0}get event(){return this._event||(this._event=((e,t,n)=>{this._listeners||(this._listeners=new o.LinkedList);const s=this._listeners.isEmpty();s&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const i=this._listeners.push(t?[e,t]:e);s&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,e,t);let r;this._leakageMon&&(r=this._leakageMon.check(this._listeners.size));let c;return c={dispose:()=>{if(r&&r(),c.dispose=h._noop,!this._disposed&&(i(),this._options&&this._options.onLastListenerRemove)){this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)}}},Array.isArray(n)&&n.push(c),c})),this._event}fire(e){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=[])
;for(let t=this._listeners.iterator(),n=t.next();!n.done;n=t.next())this._deliveryQueue.push([n.value,e]);for(;this._deliveryQueue.length>0;){const[e,t]=this._deliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){s.onUnexpectedError(e)}}}}dispose(){this._listeners&&(this._listeners=void 0),this._deliveryQueue&&(this._deliveryQueue.length=0),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0}}h._noop=function(){},t.Emitter=h;class u extends h{fireAsync(e){return n(this,void 0,void 0,function*(){if(this._listeners){this._asyncDeliveryQueue||(this._asyncDeliveryQueue=[]);for(let t=this._listeners.iterator(),n=t.next();!n.done;n=t.next()){let t=[];this._asyncDeliveryQueue.push([n.value,e(t,"function"==typeof n.value?n.value:n.value[0]),t])}for(;this._asyncDeliveryQueue.length>0;){const[e,t,n]=this._asyncDeliveryQueue.shift();try{"function"==typeof e?e.call(void 0,t):e[0].call(e[1],t)}catch(e){s.onUnexpectedError(e);continue}Object.freeze(n),yield Promise.all(n)}}})
}}t.AsyncEmitter=u;class d{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new h({onFirstListenerAdd:()=>this.onFirstListenerAdd(),onLastListenerRemove:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};this.events.push(t),this.hasListeners&&this.hook(t);return r.toDisposable(i.once(()=>{this.hasListeners&&this.unhook(t);const e=this.events.indexOf(t);this.events.splice(e,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(e=>this.emitter.fire(e))}unhook(e){e.listener&&e.listener.dispose(),e.listener=null}dispose(){this.emitter.dispose()}}t.EventMultiplexer=d;class f{constructor(){this.buffers=[]}wrapEvent(e){return(t,n,s)=>e(e=>{const s=this.buffers[this.buffers.length-1];s?s.push(()=>t.call(n,e)):t.call(n,e)},void 0,s)}bufferEvents(e){const t=[];this.buffers.push(t);const n=e()
;return this.buffers.pop(),t.forEach(e=>e()),n}}t.EventBufferer=f;class p{constructor(){this.listening=!1,this.inputEvent=c.None,this.inputEventListener=r.Disposable.None,this.emitter=new h({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}t.Relay=p}),define(e[6],t([1,0,2]),function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}});var i;!function(e){e.isCancellationToken=function(t){
return t===e.None||t===e.Cancelled||t instanceof r||!(!t||"object"!=typeof t)&&"boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:s})}(i=t.CancellationToken||(t.CancellationToken={}));class r{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?s:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class o{get token(){return this._token||(this._token=new r),this._token}cancel(){this._token?this._token instanceof r&&this._token.cancel():this._token=i.Cancelled}dispose(){
this._token?this._token instanceof r&&this._token.dispose():this._token=i.None}}t.CancellationTokenSource=o}),define(e[7],t([1,0,6,3,2,4]),function(e,t,n,s,i,r){"use strict";function o(e){return e&&"function"==typeof e.then}function c(e){const t=new n.CancellationTokenSource,i=e(t.token),r=new Promise((e,n)=>{t.token.onCancellationRequested(()=>{n(s.canceled())}),Promise.resolve(i).then(n=>{t.dispose(),e(n)},e=>{t.dispose(),n(e)})});return new class{cancel(){t.cancel()}then(e,t){return r.then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return r.finally(e)}}}function l(e,t){return t?new Promise((n,i)=>{const r=setTimeout(n,e);t.onCancellationRequested(()=>{clearTimeout(r),i(s.canceled())})}):c(t=>l(e,t))}function a(e){function t(r){void 0!==r&&null!==r&&n.push(r);const o=s<i?e[s++]():null;return o?o.then(t):Promise.resolve(n)}const n=[];let s=0;const i=e.length;return Promise.resolve(null).then(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isThenable=o,t.createCancelablePromise=c,
t.asPromise=function(e){return new Promise((t,n)=>{let s=e();o(s)?s.then(t,n):t(s)})};class h{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const e=()=>{this.queuedPromise=null;const e=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,e};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=e(),new Promise((e,t)=>{this.activePromise.then(t=>{this.activePromise=null,e(t)},e=>{this.activePromise=null,t(e)})})}}t.Throttler=h;class u{constructor(){this.current=Promise.resolve(null)}queue(e){return this.current=this.current.then(()=>e())}}t.Sequencer=u;class d{constructor(e){this.defaultDelay=e,this.timeout=null,this.completionPromise=null,this.doResolve=null,this.task=null}trigger(e,t=this.defaultDelay){return this.task=e,this.cancelTimeout(),
this.completionPromise||(this.completionPromise=new Promise((e,t)=>{this.doResolve=e,this.doReject=t}).then(()=>{this.completionPromise=null,this.doResolve=null;const e=this.task;return this.task=null,e()})),this.timeout=setTimeout(()=>{this.timeout=null,this.doResolve(null)},t),this.completionPromise}isTriggered(){return null!==this.timeout}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject(s.canceled()),this.completionPromise=null)}cancelTimeout(){null!==this.timeout&&(clearTimeout(this.timeout),this.timeout=null)}dispose(){this.cancelTimeout()}}t.Delayer=d;class f{constructor(e){this.delayer=new d(e),this.throttler=new h}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose()}}t.ThrottledDelayer=f;class p{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,
this._completePromise(!0)}wait(){return this._promise}}t.Barrier=p,t.timeout=l,t.disposableTimeout=function(e,t=0){const n=setTimeout(e,t);return r.toDisposable(()=>clearTimeout(n))},t.ignoreErrors=function(e){return e.then(void 0,e=>void 0)},t.sequence=a,t.first=function(e,t=(e=>!!e),n=null){let s=0;const i=e.length,r=()=>{if(s>=i)return Promise.resolve(n);const o=e[s++];return Promise.resolve(o()).then(e=>t(e)?Promise.resolve(e):r())};return r()};class m{constructor(e){this._size=0,this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onFinished=new i.Emitter}get onFinished(){return this._onFinished.event}get size(){return this._size}queue(e){return this._size++,new Promise((t,n)=>{this.outstandingPromises.push({factory:e,c:t,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){const e=this.outstandingPromises.shift();this.runningPromises++;const t=e.factory();t.then(e.c,e.e),
t.then(()=>this.consumed(),()=>this.consumed())}}consumed(){this._size--,this.runningPromises--,this.outstandingPromises.length>0?this.consume():this._onFinished.fire()}dispose(){this._onFinished.dispose()}}t.Limiter=m;class v extends m{constructor(){super(1)}}t.Queue=v;class g{constructor(){this.queues=Object.create(null)}queueFor(e){const t=e.toString();if(!this.queues[t]){const e=new v;e.onFinished(()=>{e.dispose(),delete this.queues[t]}),this.queues[t]=e}return this.queues[t]}}t.ResourceQueue=g;class _ extends r.Disposable{constructor(e,t){super(),this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),super.dispose()}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}}t.TimeoutTimer=_;class w extends r.Disposable{constructor(){super(),this._token=-1}dispose(){
this.cancel(),super.dispose()}cancel(){-1!==this._token&&(clearInterval(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setInterval(()=>{e()},t)}}t.IntervalTimer=w;class C{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}isScheduled(){return-1!==this.timeoutToken}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner&&this.runner()}}t.RunOnceScheduler=C;class y extends C{constructor(e,t){super(e,t),this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){const e=this.units;this.units=[],this.runner&&this.runner(e)}dispose(){this.units=[],super.dispose()}}t.RunOnceWorker=y,t.nfcall=function(e,...t){return new Promise((n,s)=>e(...t,(e,t)=>e?s(e):n(t)))},
t.ninvoke=function(e,t,...n){return new Promise((s,i)=>t.call(e,...n,(e,t)=>e?i(e):s(t)))},function(){if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){let e=Object.freeze({didTimeout:!0,timeRemaining:()=>15});t.runWhenIdle=(t=>{let n=setTimeout(()=>t(e)),s=!1;return{dispose(){s||(s=!0,clearTimeout(n))}}})}else t.runWhenIdle=((e,t)=>{let n=requestIdleCallback(e,"number"==typeof t?{timeout:t}:void 0),s=!1;return{dispose(){s||(s=!0,cancelIdleCallback(n))}}})}();class b{constructor(e){this._executor=(()=>{try{this._value=e()}catch(e){this._error=e}finally{this._didRun=!0}}),this._handle=t.runWhenIdle(()=>this._executor())}dispose(){this._handle.dispose()}getValue(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}}t.IdleValue=b}),define(e[10],t([1,0]),function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LANGUAGE_DEFAULT="en";let n=!1,s=!1,i=!1,r=!1,o=!1,c=void 0,l=t.LANGUAGE_DEFAULT,a=void 0
;const h="undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.electron&&"renderer"===process.type;if("object"!=typeof navigator||h){if("object"==typeof process){n="win32"===process.platform,s="darwin"===process.platform,i="linux"===process.platform,c=t.LANGUAGE_DEFAULT,l=t.LANGUAGE_DEFAULT;const e=process.env.VSCODE_NLS_CONFIG;if(e)try{const n=JSON.parse(e),s=n.availableLanguages["*"];c=n.locale,l=s||t.LANGUAGE_DEFAULT,a=n._translationsConfigFile}catch(e){}r=!0}}else{const e=navigator.userAgent;n=e.indexOf("Windows")>=0,s=e.indexOf("Macintosh")>=0,i=e.indexOf("Linux")>=0,o=!0,l=c=navigator.language}!function(e){e[e.Web=0]="Web",e[e.Mac=1]="Mac",e[e.Linux=2]="Linux",e[e.Windows=3]="Windows"}(t.Platform||(t.Platform={})),t.PlatformToString=function(e){switch(e){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}};let u=0;r&&(s?u=1:n?u=3:i&&(u=2)),t.isWindows=n,t.isMacintosh=s,t.isLinux=i,t.isNative=r,t.isWeb=o,t.platform=u,t.isRootUser=function(){
return r&&!n&&0===process.getuid()},t.language=l,t.locale=c,t.translationsConfigFile=a;const d="object"==typeof self?self:"object"==typeof global?global:{};t.globals=d;let f=null;t.setImmediate=function(e){return null===f&&(f=t.globals.setImmediate?t.globals.setImmediate.bind(t.globals):"undefined"!=typeof process&&"function"==typeof process.nextTick?process.nextTick.bind(process):t.globals.setTimeout.bind(t.globals)),f(e)};!function(e){e[e.Windows=1]="Windows",e[e.Macintosh=2]="Macintosh",e[e.Linux=3]="Linux"}(t.OperatingSystem||(t.OperatingSystem={})),t.OS=s?2:n?1:3}),define(e[11],t([1,0,10]),function(e,t,n){"use strict";function s(e,t){if("string"!=typeof e)throw new g(t,"string",e)}function i(e){return e===p||e===m}function r(e){return e===p}function o(e){return e>=a&&e<=u||e>=h&&e<=d}function c(e,t,n,s){let i,r="",o=0,c=-1,l=0;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(s(i))break;i=p}if(s(i)){if(c===a-1||1===l);else if(c!==a-1&&2===l){
if(r.length<2||2!==o||r.charCodeAt(r.length-1)!==f||r.charCodeAt(r.length-2)!==f){if(r.length>2){const e=r.lastIndexOf(n);-1===e?(r="",o=0):o=(r=r.slice(0,e)).length-1-r.lastIndexOf(n),c=a,l=0;continue}if(2===r.length||1===r.length){r="",o=0,c=a,l=0;continue}}t&&(r.length>0?r+=`${n}..`:r="..",o=2)}else r.length>0?r+=n+e.slice(c+1,a):r=e.slice(c+1,a),o=a-c-1;c=a,l=0}else i===f&&-1!==l?++l:l=-1}return r}function l(e,t){const n=t.dir||t.root,s=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+s:n+e+s:s}const a=65,h=97,u=90,d=122,f=46,p=47,m=92,v="undefined"==typeof process?{cwd:()=>"/",env:{},get platform(){return n.isWindows?"win32":"posix"}}:process;class g extends Error{constructor(e,t,n){let s;"string"==typeof t&&0===t.indexOf("not ")?(s="must not be",t=t.replace(/^not /,"")):s="must be";let i;i=`The "${e}" ${-1!==e.indexOf(".")?"property":"argument"} ${s} of type ${t}`,super(i+=`. Received type ${typeof n}`)}}const _={resolve(...e){let t="",n="",r=!1;for(let c=e.length-1;c>=-1;c--){let l
;if(c>=0?l=e[c]:t?void 0!==(l=v.env["="+t]||v.cwd())&&l.slice(0,3).toLowerCase()===t.toLowerCase()+"\\"||(l=t+"\\"):l=v.cwd(),s(l,"path"),0===l.length)continue;let a=l.length,h=0,u="",d=!1;const f=l.charCodeAt(0);if(a>1)if(i(f))if(d=!0,i(l.charCodeAt(1))){let e=2,t=e;for(;e<a&&!i(l.charCodeAt(e));++e);if(e<a&&e!==t){const n=l.slice(t,e);for(t=e;e<a&&i(l.charCodeAt(e));++e);if(e<a&&e!==t){for(t=e;e<a&&!i(l.charCodeAt(e));++e);e===a?(u="\\\\"+n+"\\"+l.slice(t),h=e):e!==t&&(u="\\\\"+n+"\\"+l.slice(t,e),h=e)}}}else h=1;else o(f)&&58===l.charCodeAt(1)&&(u=l.slice(0,2),h=2,a>2&&i(l.charCodeAt(2))&&(d=!0,h=3));else i(f)&&(h=1,d=!0);if(!(u.length>0&&t.length>0&&u.toLowerCase()!==t.toLowerCase())&&(0===t.length&&u.length>0&&(t=u),r||(n=l.slice(h)+"\\"+n,r=d),t.length>0&&r))break}return n=c(n,!r,"\\",i),t+(r?"\\":"")+n||"."},normalize(e){s(e,"path");const t=e.length;if(0===t)return".";let n,r=0,l=!1;const a=e.charCodeAt(0);if(t>1)if(i(a))if(l=!0,i(e.charCodeAt(1))){let s=2,o=s;for(;s<t&&!i(e.charCodeAt(s));++s);
if(s<t&&s!==o){const c=e.slice(o,s);for(o=s;s<t&&i(e.charCodeAt(s));++s);if(s<t&&s!==o){for(o=s;s<t&&!i(e.charCodeAt(s));++s);if(s===t)return"\\\\"+c+"\\"+e.slice(o)+"\\";s!==o&&(n="\\\\"+c+"\\"+e.slice(o,s),r=s)}}}else r=1;else o(a)&&58===e.charCodeAt(1)&&(n=e.slice(0,2),r=2,t>2&&i(e.charCodeAt(2))&&(l=!0,r=3));else if(i(a))return"\\";let h;return 0!==(h=r<t?c(e.slice(r),!l,"\\",i):"").length||l||(h="."),h.length>0&&i(e.charCodeAt(t-1))&&(h+="\\"),void 0===n?l?h.length>0?"\\"+h:"\\":h.length>0?h:"":l?h.length>0?n+"\\"+h:n+"\\":h.length>0?n+h:n},isAbsolute(e){s(e,"path");const t=e.length;if(0===t)return!1;const n=e.charCodeAt(0);return!!i(n)||!!(o(n)&&t>2&&58===e.charCodeAt(1)&&i(e.charCodeAt(2)))},join(...e){if(0===e.length)return".";let t,n;for(let i=0;i<e.length;++i){let r=e[i];s(r,"path"),r.length>0&&(void 0===t?t=n=r:t+="\\"+r)}if(void 0===t)return".";let r=!0,o=0;if(i(n.charCodeAt(0))){++o;const e=n.length;e>1&&i(n.charCodeAt(1))&&(++o,e>2&&(i(n.charCodeAt(2))?++o:r=!1))}if(r){
for(;o<t.length&&i(t.charCodeAt(o));++o);o>=2&&(t="\\"+t.slice(o))}return _.normalize(t)},relative(e,t){if(s(e,"from"),s(t,"to"),e===t)return"";let n=_.resolve(e),i=_.resolve(t);if(n===i)return"";if(e=n.toLowerCase(),t=i.toLowerCase(),e===t)return"";let r=0;for(;r<e.length&&e.charCodeAt(r)===m;++r);let o=e.length;for(;o-1>r&&e.charCodeAt(o-1)===m;--o);let c=o-r,l=0;for(;l<t.length&&t.charCodeAt(l)===m;++l);let a=t.length;for(;a-1>l&&t.charCodeAt(a-1)===m;--a);let h=a-l,u=c<h?c:h,d=-1,f=0;for(;f<=u;++f){if(f===u){if(h>u){if(t.charCodeAt(l+f)===m)return i.slice(l+f+1);if(2===f)return i.slice(l+f)}c>u&&(e.charCodeAt(r+f)===m?d=f:2===f&&(d=3));break}let n=e.charCodeAt(r+f);if(n!==t.charCodeAt(l+f))break;n===m&&(d=f)}if(f!==u&&-1===d)return i;let p="";for(-1===d&&(d=0),f=r+d+1;f<=o;++f)f!==o&&e.charCodeAt(f)!==m||(0===p.length?p+="..":p+="\\..");return p.length>0?p+i.slice(l+d,a):(l+=d,i.charCodeAt(l)===m&&++l,i.slice(l,a))},toNamespacedPath(e){if("string"!=typeof e)return e;if(0===e.length)return""
;const t=_.resolve(e);if(t.length>=3)if(t.charCodeAt(0)===m){if(t.charCodeAt(1)===m){const e=t.charCodeAt(2);if(63!==e&&e!==f)return"\\\\?\\UNC\\"+t.slice(2)}}else if(o(t.charCodeAt(0))&&58===t.charCodeAt(1)&&t.charCodeAt(2)===m)return"\\\\?\\"+t;return e},dirname(e){s(e,"path");const t=e.length;if(0===t)return".";let n=-1,r=-1,c=!0,l=0;const a=e.charCodeAt(0);if(t>1)if(i(a)){if(n=l=1,i(e.charCodeAt(1))){let s=2,r=s;for(;s<t&&!i(e.charCodeAt(s));++s);if(s<t&&s!==r){for(r=s;s<t&&i(e.charCodeAt(s));++s);if(s<t&&s!==r){for(r=s;s<t&&!i(e.charCodeAt(s));++s);if(s===t)return e;s!==r&&(n=l=s+1)}}}}else o(a)&&58===e.charCodeAt(1)&&(n=l=2,t>2&&i(e.charCodeAt(2))&&(n=l=3));else if(i(a))return e;for(let n=t-1;n>=l;--n)if(i(e.charCodeAt(n))){if(!c){r=n;break}}else c=!1;if(-1===r){if(-1===n)return".";r=n}return e.slice(0,r)},basename(e,t){void 0!==t&&s(t,"ext"),s(e,"path");let n,r=0,c=-1,l=!0;if(e.length>=2){o(e.charCodeAt(0))&&58===e.charCodeAt(1)&&(r=2)}if(void 0!==t&&t.length>0&&t.length<=e.length){
if(t.length===e.length&&t===e)return"";let s=t.length-1,o=-1;for(n=e.length-1;n>=r;--n){const a=e.charCodeAt(n);if(i(a)){if(!l){r=n+1;break}}else-1===o&&(l=!1,o=n+1),s>=0&&(a===t.charCodeAt(s)?-1==--s&&(c=n):(s=-1,c=o))}return r===c?c=o:-1===c&&(c=e.length),e.slice(r,c)}for(n=e.length-1;n>=r;--n)if(i(e.charCodeAt(n))){if(!l){r=n+1;break}}else-1===c&&(l=!1,c=n+1);return-1===c?"":e.slice(r,c)},extname(e){s(e,"path");let t=0,n=-1,r=0,c=-1,l=!0,a=0;e.length>=2&&58===e.charCodeAt(1)&&o(e.charCodeAt(0))&&(t=r=2);for(let s=e.length-1;s>=t;--s){const t=e.charCodeAt(s);if(i(t)){if(!l){r=s+1;break}}else-1===c&&(l=!1,c=s+1),t===f?-1===n?n=s:1!==a&&(a=1):-1!==n&&(a=-1)}return-1===n||-1===c||0===a||1===a&&n===c-1&&n===r+1?"":e.slice(n,c)},format(e){if(null===e||"object"!=typeof e)throw new g("pathObject","Object",e);return l("\\",e)},parse(e){s(e,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;let n=e.length,r=0,c=e.charCodeAt(0);if(n>1){if(i(c)){if(r=1,i(e.charCodeAt(1))){let t=2,s=t
;for(;t<n&&!i(e.charCodeAt(t));++t);if(t<n&&t!==s){for(s=t;t<n&&i(e.charCodeAt(t));++t);if(t<n&&t!==s){for(s=t;t<n&&!i(e.charCodeAt(t));++t);t===n?r=t:t!==s&&(r=t+1)}}}}else if(o(c)&&58===e.charCodeAt(1)){if(r=2,!(n>2))return t.root=t.dir=e,t;if(i(e.charCodeAt(2))){if(3===n)return t.root=t.dir=e,t;r=3}}}else if(i(c))return t.root=t.dir=e,t;r>0&&(t.root=e.slice(0,r));let l=-1,a=r,h=-1,u=!0,d=e.length-1,p=0;for(;d>=r;--d)if(c=e.charCodeAt(d),i(c)){if(!u){a=d+1;break}}else-1===h&&(u=!1,h=d+1),c===f?-1===l?l=d:1!==p&&(p=1):-1!==l&&(p=-1);return-1===l||-1===h||0===p||1===p&&l===h-1&&l===a+1?-1!==h&&(t.base=t.name=e.slice(a,h)):(t.name=e.slice(a,l),t.base=e.slice(a,h),t.ext=e.slice(l,h)),t.dir=a>0&&a!==r?e.slice(0,a-1):t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},w={resolve(...e){let t="",n=!1;for(let i=e.length-1;i>=-1&&!n;i--){let r;s(r=i>=0?e[i]:v.cwd(),"path"),0!==r.length&&(t=r+"/"+t,n=r.charCodeAt(0)===p)}return t=c(t,!n,"/",r),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize(e){if(s(e,"path"),
0===e.length)return".";const t=e.charCodeAt(0)===p,n=e.charCodeAt(e.length-1)===p;return 0!==(e=c(e,!t,"/",r)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:e=>(s(e,"path"),e.length>0&&e.charCodeAt(0)===p),join(...e){if(0===e.length)return".";let t;for(let n=0;n<e.length;++n){let e=arguments[n];s(e,"path"),e.length>0&&(void 0===t?t=e:t+="/"+e)}return void 0===t?".":w.normalize(t)},relative(e,t){if(s(e,"from"),s(t,"to"),e===t)return"";if(e=w.resolve(e),t=w.resolve(t),e===t)return"";let n=1;for(;n<e.length&&e.charCodeAt(n)===p;++n);let i=e.length,r=i-n,o=1;for(;o<t.length&&t.charCodeAt(o)===p;++o);let c=t.length-o,l=r<c?r:c,a=-1,h=0;for(;h<=l;++h){if(h===l){if(c>l){if(t.charCodeAt(o+h)===p)return t.slice(o+h+1);if(0===h)return t.slice(o+h)}else r>l&&(e.charCodeAt(n+h)===p?a=h:0===h&&(a=0));break}let s=e.charCodeAt(n+h);if(s!==t.charCodeAt(o+h))break;s===p&&(a=h)}let u="";for(h=n+a+1;h<=i;++h)h!==i&&e.charCodeAt(h)!==p||(0===u.length?u+="..":u+="/..");return u.length>0?u+t.slice(o+a):(o+=a,
t.charCodeAt(o)===p&&++o,t.slice(o))},toNamespacedPath:e=>e,dirname(e){if(s(e,"path"),0===e.length)return".";const t=e.charCodeAt(0)===p;let n=-1,i=!0;for(let t=e.length-1;t>=1;--t)if(e.charCodeAt(t)===p){if(!i){n=t;break}}else i=!1;return-1===n?t?"/":".":t&&1===n?"//":e.slice(0,n)},basename(e,t){void 0!==t&&s(t,"ext"),s(e,"path");let n,i=0,r=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let s=t.length-1,c=-1;for(n=e.length-1;n>=0;--n){const l=e.charCodeAt(n);if(l===p){if(!o){i=n+1;break}}else-1===c&&(o=!1,c=n+1),s>=0&&(l===t.charCodeAt(s)?-1==--s&&(r=n):(s=-1,r=c))}return i===r?r=c:-1===r&&(r=e.length),e.slice(i,r)}for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===p){if(!o){i=n+1;break}}else-1===r&&(o=!1,r=n+1);return-1===r?"":e.slice(i,r)},extname(e){s(e,"path");let t=-1,n=0,i=-1,r=!0,o=0;for(let s=e.length-1;s>=0;--s){const c=e.charCodeAt(s);if(c!==p)-1===i&&(r=!1,i=s+1),c===f?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!r){n=s+1;break}}
return-1===t||-1===i||0===o||1===o&&t===i-1&&t===n+1?"":e.slice(t,i)},format(e){if(null===e||"object"!=typeof e)throw new g("pathObject","Object",e);return l("/",e)},parse(e){s(e,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;let n,i=e.charCodeAt(0)===p;i?(t.root="/",n=1):n=0;let r=-1,o=0,c=-1,l=!0,a=e.length-1,h=0;for(;a>=n;--a){const t=e.charCodeAt(a);if(t!==p)-1===c&&(l=!1,c=a+1),t===f?-1===r?r=a:1!==h&&(h=1):-1!==r&&(h=-1);else if(!l){o=a+1;break}}return-1===r||-1===c||0===h||1===h&&r===c-1&&r===o+1?-1!==c&&(t.base=t.name=0===o&&i?e.slice(1,c):e.slice(o,c)):(0===o&&i?(t.name=e.slice(1,r),t.base=e.slice(1,c)):(t.name=e.slice(o,r),t.base=e.slice(o,c)),t.ext=e.slice(r,c)),o>0?t.dir=e.slice(0,o-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};w.win32=_.win32=_,w.posix=_.posix=w;return"win32"===v.platform?_:w}),define(e[12],t([1,0]),function(e,t){"use strict";function n(){return new r}function s(e){return o.test(e)}Object.defineProperty(t,"__esModule",{value:!0
});class i{constructor(e){this._value=e}asHex(){return this._value}}class r extends i{constructor(){super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}}r._chars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],r._timeHighBits=["8","9","a","b"],t.v4=n;const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;t.isUUID=s,t.parse=function(e){if(!s(e))throw new Error("invalid uuid");return new i(e)},
t.generateUuid=function(){return n().asHex()}}),define(e[8],t([1,0,4,2,7,6,3]),function(e,t,s,i,r,o,c){"use strict";function l(e){const t=Buffer.allocUnsafe(4);return t.writeUInt32BE(e,0),t}function a(e){return e.read(4).readUInt32BE(0)}function h(e,t){if(void 0===t)e.write(g.Undefined);else if("string"==typeof t){const n=Buffer.from(t);e.write(g.String),e.write(l(n.length)),e.write(n)}else if(Buffer.isBuffer(t))e.write(g.Buffer),e.write(l(t.length)),e.write(t);else if(Array.isArray(t)){e.write(g.Array),e.write(l(t.length));for(const n of t)h(e,n)}else{const n=Buffer.from(JSON.stringify(t));e.write(g.Object),e.write(l(n.length)),e.write(n)}}function u(e){switch(e.read(1).readUInt8(0)){case v.Undefined:return;case v.String:return e.read(a(e)).toString();case v.Buffer:return e.read(a(e));case v.Array:{const t=a(e),n=[];for(let s=0;s<t;s++)n.push(u(e));return n}case v.Object:return JSON.parse(e.read(a(e)).toString())}}function d(e){return{call:(t,n,s)=>e.then(e=>e.call(t,n,s)),listen(t,n){const s=new i.Relay
;return e.then(e=>s.input=e.listen(t,n)),s.event}}}Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.Promise=100]="Promise",e[e.PromiseCancel=101]="PromiseCancel",e[e.EventListen=102]="EventListen",e[e.EventDispose=103]="EventDispose"}(t.RequestType||(t.RequestType={}));!function(e){e[e.Initialize=200]="Initialize",e[e.PromiseSuccess=201]="PromiseSuccess",e[e.PromiseError=202]="PromiseError",e[e.PromiseErrorObj=203]="PromiseErrorObj",e[e.EventFire=204]="EventFire"}(t.ResponseType||(t.ResponseType={}));var f;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Idle=1]="Idle"}(f||(f={}));class p{constructor(e){this.buffer=e,this.pos=0}read(e){const t=this.buffer.slice(this.pos,this.pos+e);return this.pos+=t.length,t}}class m{constructor(){this.buffers=[]}get buffer(){return Buffer.concat(this.buffers)}write(e){this.buffers.push(e)}}var v;!function(e){e[e.Undefined=0]="Undefined",e[e.String=1]="String",e[e.Buffer=2]="Buffer",e[e.Array=3]="Array",e[e.Object=4]="Object"}(v||(v={}));const g={
Undefined:Buffer.alloc(1,v.Undefined),String:Buffer.alloc(1,v.String),Buffer:Buffer.alloc(1,v.Buffer),Array:Buffer.alloc(1,v.Array),Object:Buffer.alloc(1,v.Object)};class _{constructor(e,t){this.protocol=e,this.ctx=t,this.channels=new Map,this.activeRequests=new Map,this.protocolListener=this.protocol.onMessage(e=>this.onRawMessage(e)),this.sendResponse({type:200})}registerChannel(e,t){this.channels.set(e,t)}sendResponse(e){switch(e.type){case 200:return this.send([e.type]);case 201:case 202:case 204:case 203:return this.send([e.type,e.id],e.data)}}send(e,t){const n=new m;h(n,e),h(n,t),this.sendBuffer(n.buffer)}sendBuffer(e){try{this.protocol.send(e)}catch(e){}}onRawMessage(e){const t=new p(e),n=u(t),s=u(t),i=n[0];switch(i){case 100:return this.onPromise({type:i,id:n[1],channelName:n[2],name:n[3],arg:s});case 102:return this.onEventListen({type:i,id:n[1],channelName:n[2],name:n[3],arg:s});case 101:case 103:return this.disposeActiveRequest({type:i,id:n[1]})}}onPromise(e){
const t=this.channels.get(e.channelName);if(!t)throw new Error("Unknown channel");const n=new o.CancellationTokenSource;let i;try{i=t.call(this.ctx,e.name,e.arg,n.token)}catch(e){i=Promise.reject(e)}const r=e.id;i.then(t=>{this.sendResponse({id:r,data:t,type:201}),this.activeRequests.delete(e.id)},t=>{t instanceof Error?this.sendResponse({id:r,data:{message:t.message,name:t.name,stack:t.stack?t.stack.split?t.stack.split("\n"):t.stack:void 0},type:202}):this.sendResponse({id:r,data:t,type:203}),this.activeRequests.delete(e.id)});const c=s.toDisposable(()=>n.cancel());this.activeRequests.set(e.id,c)}onEventListen(e){const t=this.channels.get(e.channelName);if(!t)throw new Error("Unknown channel");const n=e.id,s=t.listen(this.ctx,e.name,e.arg)(e=>this.sendResponse({id:n,data:e,type:204}));this.activeRequests.set(e.id,s)}disposeActiveRequest(e){const t=this.activeRequests.get(e.id);t&&(t.dispose(),this.activeRequests.delete(e.id))}dispose(){this.protocolListener&&(this.protocolListener.dispose(),
this.protocolListener=null),this.activeRequests.forEach(e=>e.dispose()),this.activeRequests.clear()}}t.ChannelServer=_;class w{constructor(e){this.protocol=e,this.state=f.Uninitialized,this.activeRequests=new Set,this.handlers=new Map,this.lastRequestId=0,this._onDidInitialize=new i.Emitter,this.onDidInitialize=this._onDidInitialize.event,this.protocolListener=this.protocol.onMessage(e=>this.onBuffer(e))}getChannel(e){const t=this;return{call:(n,s,i)=>t.requestPromise(e,n,s,i),listen:(n,s)=>t.requestEvent(e,n,s)}}requestPromise(e,t,n,i=o.CancellationToken.None){const l=this.lastRequestId++,a={id:l,type:100,channelName:e,name:t,arg:n};if(i.isCancellationRequested)return Promise.reject(c.canceled());let h;return new Promise((e,t)=>{if(i.isCancellationRequested)return t(c.canceled());let n=r.createCancelablePromise(e=>this.whenInitialized());n.then(()=>{n=null;this.handlers.set(l,n=>{switch(n.type){case 201:this.handlers.delete(l),e(n.data);break;case 202:this.handlers.delete(l);const s=new Error(n.data.message)
;s.stack=n.data.stack,s.name=n.data.name,t(s);break;case 203:this.handlers.delete(l),t(n.data)}}),this.sendRequest(a)});const o=()=>{n?(n.cancel(),n=null):this.sendRequest({id:l,type:101}),t(c.canceled())},u=i.onCancellationRequested(o);h=s.combinedDisposable([s.toDisposable(o),u]),this.activeRequests.add(h)}).finally(()=>this.activeRequests.delete(h))}requestEvent(e,t,n){const s=this.lastRequestId++,o={id:s,type:102,channelName:e,name:t,arg:n};let c=null;const l=new i.Emitter({onFirstListenerAdd:()=>{(c=r.createCancelablePromise(e=>this.whenInitialized())).then(()=>{c=null,this.activeRequests.add(l),this.sendRequest(o)})},onLastListenerRemove:()=>{c?(c.cancel(),c=null):(this.activeRequests.delete(l),this.sendRequest({id:s,type:103}))}});return this.handlers.set(s,e=>l.fire(e.data)),l.event}sendRequest(e){switch(e.type){case 100:case 102:return this.send([e.type,e.id,e.channelName,e.name],e.arg);case 101:case 103:return this.send([e.type,e.id])}}send(e,t){const n=new m;h(n,e),h(n,t),this.sendBuffer(n.buffer)}
sendBuffer(e){try{this.protocol.send(e)}catch(e){}}onBuffer(e){const t=new p(e),n=u(t),s=u(t);switch(n[0]){case 200:return this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.onResponse({type:n[0],id:n[1],data:s})}}onResponse(e){if(200===e.type)return this.state=f.Idle,void this._onDidInitialize.fire();const t=this.handlers.get(e.id);t&&t(e)}whenInitialized(){return this.state===f.Idle?Promise.resolve():i.Event.toPromise(this.onDidInitialize)}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),this.activeRequests.forEach(e=>e.dispose()),this.activeRequests.clear()}}t.ChannelClient=w;class C{constructor(e){this.channels=new Map,this._connections=new Set,this._onDidChangeConnections=new i.Emitter,this.onDidChangeConnections=this._onDidChangeConnections.event,e(({protocol:e,onDidClientDisconnect:t})=>{i.Event.once(e.onMessage)(n=>{const s=u(new p(n)),i=new _(e,s),r=new w(e);this.channels.forEach((e,t)=>i.registerChannel(t,e));const o={
channelClient:r,ctx:s};this._connections.add(o),this._onDidChangeConnections.fire(o),t(()=>{i.dispose(),r.dispose(),this._connections.delete(o)})})})}get connections(){const e=[];return this._connections.forEach(t=>e.push(t)),e}getChannel(e,t){const n=this;return{call:(s,i,r)=>d(t.routeCall(n,s,i).then(t=>t.channelClient.getChannel(e))).call(s,i,r),listen:(s,i)=>d(t.routeEvent(n,s,i).then(t=>t.channelClient.getChannel(e))).listen(s,i)}}registerChannel(e,t){this.channels.set(e,t)}dispose(){this.channels.clear(),this._connections.clear(),this._onDidChangeConnections.dispose()}}t.IPCServer=C;class y{constructor(e,t){const n=new m;h(n,t),e.send(n.buffer),this.channelClient=new w(e),this.channelServer=new _(e,t)}getChannel(e){return this.channelClient.getChannel(e)}registerChannel(e,t){this.channelServer.registerChannel(e,t)}dispose(){this.channelClient.dispose(),this.channelServer.dispose()}}t.IPCClient=y,t.getDelayedChannel=d,t.getNextTickChannel=function(e){let t=!1;return{
call:(n,s,i)=>t?e.call(n,s,i):r.timeout(0).then(()=>t=!0).then(()=>e.call(n,s,i)),listen(n,s){if(t)return e.listen(n,s);const o=new i.Relay;return r.timeout(0).then(()=>t=!0).then(()=>o.input=e.listen(n,s)),o.event}}};class b{constructor(e){this.fn=e}routeCall(e){return this.route(e)}routeEvent(e){return this.route(e)}route(e){return n(this,void 0,void 0,function*(){for(const t of e.connections)if(yield Promise.resolve(this.fn(t.ctx)))return Promise.resolve(t);return yield i.Event.toPromise(e.onDidChangeConnections),yield this.route(e)})}}t.StaticRouter=b}),define(e[14],t([1,0,17,2,8,11,16,12,7]),function(e,t,n,s,i,r,o,c,l){"use strict";function a(e){let t,n=!1,i=!1,r=[];const o=()=>{if(!i){for(i=!0;n&&r.length>0;)t.fire(r.shift());i=!1}};return e(e=>{r.push(e),o()}),(t=new s.Emitter({onFirstListenerAdd:()=>{n=!0,process.nextTick(o)},onLastListenerRemove:()=>{n=!1}})).event}Object.defineProperty(t,"__esModule",{value:!0}),t.generateRandomPipeName=function(){const e=c.generateUuid()
;return"win32"===process.platform?`\\\\.\\pipe\\vscode-ipc-${e}-sock`:r.join(o.tmpdir(),`vscode-ipc-${e}.sock`)};class h{constructor(e,t){this._socket=e,this._onMessage=new s.Emitter,this.onMessage=this._onMessage.event,this._onClose=new s.Emitter,this.onClose=this._onClose.event,this._writeBuffer=new class{constructor(){this._data=[],this._totalLength=0}add(e,t){const n=0===this._totalLength;return this._data.push(e,t),this._totalLength+=e.length+t.length,n}take(){const e=Buffer.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,e}},this._isDisposed=!1,this._chunks=[];let n=0;const i={readHead:!0,bodyLen:-1},r=e=>{for(this._chunks.push(e),n+=e.length;n>0;){if(i.readHead){if(!(n>=h._headerLen))break;{const e=Buffer.concat(this._chunks);i.bodyLen=e.readUInt32BE(0),i.readHead=!1;const t=e.slice(h._headerLen);n=t.length,this._chunks=[t]}}if(!i.readHead){if(!(n>=i.bodyLen))break;{const e=Buffer.concat(this._chunks),t=e.slice(0,i.bodyLen),s=e.slice(i.bodyLen);if(n=s.length,
this._chunks=[s],i.bodyLen=-1,i.readHead=!0,this._onMessage.fire(t),this._isDisposed)break}}}},o=()=>{if(t&&t.length>0){let e=t;t=void 0,r(e)}};this._firstChunkTimer=new l.TimeoutTimer,this._firstChunkTimer.setIfNotSet(()=>{o()},0),this._socketDataListener=(e=>{o(),r(e)}),e.on("data",this._socketDataListener),this._socketEndListener=(()=>{o()}),e.on("end",this._socketEndListener),this._socketCloseListener=(()=>{this._onClose.fire()}),e.once("close",this._socketCloseListener)}dispose(){this._isDisposed=!0,this._firstChunkTimer.dispose(),this._socket.removeListener("data",this._socketDataListener),this._socket.removeListener("end",this._socketEndListener),this._socket.removeListener("close",this._socketCloseListener)}end(){this._socket.end()}getBuffer(){return Buffer.concat(this._chunks)}send(e){const t=Buffer.allocUnsafe(h._headerLen);t.writeUInt32BE(e.length,0,!0),this._writeSoon(t,e)}_writeSoon(e,t){this._writeBuffer.add(e,t)&&setImmediate(()=>{
this._socket.destroyed||this._socket.write(this._writeBuffer.take())})}}h._headerLen=4,t.Protocol=h;class u extends i.IPCServer{static toClientConnectionEvent(e){const t=s.Event.fromNodeEventEmitter(e,"connection");return s.Event.map(t,e=>({protocol:new h(e),onDidClientDisconnect:s.Event.once(s.Event.fromNodeEventEmitter(e,"close"))}))}constructor(e){super(u.toClientConnectionEvent(e)),this.server=e}dispose(){super.dispose(),this.server&&(this.server.close(),this.server=null)}}t.Server=u;class d extends i.IPCClient{constructor(e,t){super(e,t),this.protocol=e}static fromSocket(e,t){return new d(new h(e),t)}get onClose(){return this.protocol.onClose}dispose(){super.dispose(),this.protocol.end()}}t.Client=d,t.serve=function(e){return new Promise((t,s)=>{const i=n.createServer();i.on("error",s),i.listen(e,()=>{i.removeListener("error",s),t(new u(i))})})},t.connect=function(e,t){return new Promise((s,i)=>{const r=n.createConnection(e,()=>{r.removeListener("error",i),s(d.fromSocket(r,t))});r.once("error",i)})}
;class f{constructor(e){this._actual=e,this.onMessage=a(this._actual.onMessage),this.onClose=a(this._actual.onClose)}send(e){this._actual.send(e)}end(){this._actual.end()}}t.BufferedProtocol=f}),define(e[15],t([1,0]),function(e,t){"use strict";function n(e,t,n,s){t[i.DI_TARGET]===t?t[i.DI_DEPENDENCIES].push({id:e,index:n,optional:s}):(t[i.DI_DEPENDENCIES]=[{id:e,index:n,optional:s}],t[i.DI_TARGET]=t)}function s(e){if(i.serviceIds.has(e))return i.serviceIds.get(e);const t=function(e,s,i){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");n(t,e,i,!1)};return t.toString=(()=>e),i.serviceIds.set(e,t),t}Object.defineProperty(t,"__esModule",{value:!0});var i;!function(e){e.serviceIds=new Map,e.DI_TARGET="$di$target",e.DI_DEPENDENCIES="$di$dependencies",e.getServiceDependencies=function(t){return t[e.DI_DEPENDENCIES]||[]}}(i=t._util||(t._util={})),t.IInstantiationService=s("instantiationService"),t.createDecorator=s,t.optional=function(e){
return function(t,s,i){if(3!==arguments.length)throw new Error("@optional-decorator can only be used to decorate a parameter");n(e,t,i,!0)}}}),define(e[18],t([1,0,14,15]),function(e,t,s,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ID="driverService",t.IDriver=i.createDecorator(t.ID);class r{constructor(e){this.driver=e}listen(e,t){throw new Error("No event found")}call(e,t,n){switch(t){case"getWindowIds":return this.driver.getWindowIds();case"capturePage":return this.driver.capturePage(n);case"reloadWindow":return this.driver.reloadWindow(n);case"exitApplication":return this.driver.exitApplication();case"dispatchKeybinding":return this.driver.dispatchKeybinding(n[0],n[1]);case"click":return this.driver.click(n[0],n[1],n[2],n[3]);case"doubleClick":return this.driver.doubleClick(n[0],n[1]);case"setValue":return this.driver.setValue(n[0],n[1],n[2]);case"getTitle":return this.driver.getTitle(n[0]);case"isActiveElement":return this.driver.isActiveElement(n[0],n[1]);case"getElements":
return this.driver.getElements(n[0],n[1],n[2]);case"typeInEditor":return this.driver.typeInEditor(n[0],n[1],n[2]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(n[0],n[1]);case"writeInTerminal":return this.driver.writeInTerminal(n[0],n[1],n[2])}throw new Error(`Call not found: ${t}`)}}t.DriverChannel=r;class o{constructor(e){this.channel=e}getWindowIds(){return this.channel.call("getWindowIds")}capturePage(e){return this.channel.call("capturePage",e)}reloadWindow(e){return this.channel.call("reloadWindow",e)}exitApplication(){return this.channel.call("exitApplication")}dispatchKeybinding(e,t){return this.channel.call("dispatchKeybinding",[e,t])}click(e,t,n,s){return this.channel.call("click",[e,t,n,s])}doubleClick(e,t){return this.channel.call("doubleClick",[e,t])}setValue(e,t,n){return this.channel.call("setValue",[e,t,n])}getTitle(e){return this.channel.call("getTitle",[e])}isActiveElement(e,t){return this.channel.call("isActiveElement",[e,t])}getElements(e,t,n){
return this.channel.call("getElements",[e,t,n])}typeInEditor(e,t,n){return this.channel.call("typeInEditor",[e,t,n])}getTerminalBuffer(e,t){return this.channel.call("getTerminalBuffer",[e,t])}writeInTerminal(e,t,n){return this.channel.call("writeInTerminal",[e,t,n])}}t.DriverChannelClient=o;class c{constructor(e){this.registry=e}listen(e,t){throw new Error(`Event not found: ${t}`)}call(e,t,n){switch(t){case"registerWindowDriver":return this.registry.registerWindowDriver(n);case"reloadWindowDriver":return this.registry.reloadWindowDriver(n)}throw new Error(`Call not found: ${t}`)}}t.WindowDriverRegistryChannel=c;class l{constructor(e){this.channel=e}registerWindowDriver(e){return this.channel.call("registerWindowDriver",e)}reloadWindowDriver(e){return this.channel.call("reloadWindowDriver",e)}}t.WindowDriverRegistryChannelClient=l;class a{constructor(e){this.driver=e}listen(e,t){throw new Error(`No event found: ${t}`)}call(e,t,n){switch(t){case"click":return this.driver.click(n[0],n[1],n[2]);case"doubleClick":
return this.driver.doubleClick(n);case"setValue":return this.driver.setValue(n[0],n[1]);case"getTitle":return this.driver.getTitle();case"isActiveElement":return this.driver.isActiveElement(n);case"getElements":return this.driver.getElements(n[0],n[1]);case"typeInEditor":return this.driver.typeInEditor(n[0],n[1]);case"getTerminalBuffer":return this.driver.getTerminalBuffer(n);case"writeInTerminal":return this.driver.writeInTerminal(n[0],n[1])}throw new Error(`Call not found: ${t}`)}}t.WindowDriverChannel=a;class h{constructor(e){this.channel=e}click(e,t,n){return this.channel.call("click",[e,t,n])}doubleClick(e){return this.channel.call("doubleClick",e)}setValue(e,t){return this.channel.call("setValue",[e,t])}getTitle(){return this.channel.call("getTitle")}isActiveElement(e){return this.channel.call("isActiveElement",e)}getElements(e,t){return this.channel.call("getElements",[e,t])}typeInEditor(e,t){return this.channel.call("typeInEditor",[e,t])}getTerminalBuffer(e){
return this.channel.call("getTerminalBuffer",e)}writeInTerminal(e,t){return this.channel.call("writeInTerminal",[e,t])}}t.WindowDriverChannelClient=h,t.connect=function(e){return n(this,void 0,void 0,function*(){const t=yield s.connect(e,"driverClient"),n=t.getChannel("driver");return{client:t,driver:new o(n)}})}})}).call(this);
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/05f146c7a8f7f78e80261aa3b2a2e642586f9eb3/core/vs/platform/driver/node/driver.js.map
