/*!-------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="432ab60b-03fd-5b94-a706-559aecaf9176")}catch(e){}}(); var co=function(t,e){return co=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},co(t,e)};export function __extends(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");co(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}export var __assign=function(){return __assign=Object.assign||function(e){for(var i,r=1,s=arguments.length;r=0;a--)(o=t[a])&&(n=(s<3?o(n):s>3?o(e,i,n):o(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n}export function __param(t,e){return function(i,r){e(i,r,t)}}export function __esDecorate(t,e,i,r,s,n){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=r.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?r.static?t:t.prototype:null,h=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),f,d=!1,p=i.length-1;p>=0;p--){var v={};for(var m in r)v[m]=m==="access"?{}:r[m];for(var m in r.access)v.access[m]=r.access[m];v.addInitializer=function(S){if(d)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(S||null))};var w=(0,i[p])(a==="accessor"?{get:h.get,set:h.set}:h[l],v);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(f=o(w.get))&&(h.get=f),(f=o(w.set))&&(h.set=f),(f=o(w.init))&&s.unshift(f)}else(f=o(w))&&(a==="field"?s.unshift(f):h[l]=f)}c&&Object.defineProperty(c,r.name,h),d=!0}export function __runInitializers(t,e,i){for(var r=arguments.length>2,s=0;s0&&n[n.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}export function __read(t,e){var i=typeof Symbol=="function"&&t[Symbol.iterator];if(!i)return t;var r=i.call(t),s,n=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)n.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return n}export function __spread(){for(var t=[],e=0;e1||l(p,m)})},v&&(s[p]=v(s[p])))}function l(p,v){try{c(r[p](v))}catch(m){d(n[0][3],m)}}function c(p){p.value instanceof __await?Promise.resolve(p.value.v).then(h,f):d(n[0][2],p)}function h(p){l("next",p)}function f(p){l("throw",p)}function d(p,v){p(v),n.shift(),n.length&&l(n[0][0],n[0][1])}}export function __asyncDelegator(t){var e,i;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,n){e[s]=t[s]?function(o){return(i=!i)?{value:__await(t[s](o)),done:!1}:n?n(o):o}:n}}export function __asyncValues(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),i={},r("next"),r("throw"),r("return"),i[Symbol.asyncIterator]=function(){return this},i);function r(n){i[n]=t[n]&&function(o){return new Promise(function(a,l){o=t[n](o),s(a,l,o.done,o.value)})}}function s(n,o,a,l){Promise.resolve(l).then(function(c){n({value:c,done:a})},o)}}export function __makeTemplateObject(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var n1=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e};export function __importStar(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i in t)i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)&&__createBinding(e,t,i);return n1(e,t),e}export function __importDefault(t){return t&&t.__esModule?t:{default:t}}export function __classPrivateFieldGet(t,e,i,r){if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?r:i==="a"?r.call(t):r?r.value:e.get(t)}export function __classPrivateFieldSet(t,e,i,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,i):s?s.value=i:e.set(t,i),i}export function __classPrivateFieldIn(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}export function __addDisposableResource(t,e,i){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,s;if(i){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],i&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:r,async:i})}else i&&t.stack.push({async:!0});return e}var o1=typeof SuppressedError=="function"?SuppressedError:function(t,e,i){var r=new Error(i);return r.name="SuppressedError",r.error=t,r.suppressed=e,r};export function __disposeResources(t){function e(r){t.error=t.hasError?new o1(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}function i(){for(;t.stack.length;){var r=t.stack.pop();try{var s=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(s).then(i,function(n){return e(n),i()})}catch(n){e(n)}}if(t.hasError)throw t.error}return i()}export default{__extends,__assign,__rest,__decorate,__param,__metadata,__awaiter,__generator,__createBinding,__exportStar,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault,__classPrivateFieldGet,__classPrivateFieldSet,__classPrivateFieldIn,__addDisposableResource,__disposeResources};var a1=Object.create,Xl=Object.defineProperty,l1=Object.getOwnPropertyDescriptor,Yl=Object.getOwnPropertyNames,c1=Object.getPrototypeOf,u1=Object.prototype.hasOwnProperty,h1=(t,e)=>function(){return e||(0,t[Yl(t)[0]])((e={exports:{}}).exports,e),e.exports},f1=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Yl(e))!u1.call(t,s)&&s!==i&&Xl(t,s,{get:()=>e[s],enumerable:!(r=l1(e,s))||r.enumerable});return t},d1=(t,e,i)=>(i=t!=null?a1(c1(t)):{},f1(e||!t||!t.__esModule?Xl(i,"default",{value:t,enumerable:!0}):i,t)),p1=h1({"node_modules/minimist/index.js"(t,e){e.exports=function(n,o){o||(o={});var a={bools:{},strings:{},unknownFn:null};typeof o.unknown=="function"&&(a.unknownFn=o.unknown),typeof o.boolean=="boolean"&&o.boolean?a.allBools=!0:[].concat(o.boolean).filter(Boolean).forEach(function(C){a.bools[C]=!0});var l={};Object.keys(o.alias||{}).forEach(function(C){l[C]=[].concat(o.alias[C]),l[C].forEach(function(ee){l[ee]=[C].concat(l[C].filter(function(Fe){return ee!==Fe}))})}),[].concat(o.string).filter(Boolean).forEach(function(C){a.strings[C]=!0,l[C]&&(a.strings[l[C]]=!0)});var c=o.default||{},h={_:[]};Object.keys(a.bools).forEach(function(C){p(C,c[C]===void 0?!1:c[C])});var f=[];n.indexOf("--")!==-1&&(f=n.slice(n.indexOf("--")+1),n=n.slice(0,n.indexOf("--")));function d(C,ee){return a.allBools&&/^--[^=]+$/.test(ee)||a.strings[C]||a.bools[C]||l[C]}function p(C,ee,Fe){if(!(Fe&&a.unknownFn&&!d(C,Fe)&&a.unknownFn(Fe)===!1)){var B=!a.strings[C]&&r(ee)?Number(ee):ee;v(h,C.split("."),B),(l[C]||[]).forEach(function(nt){v(h,nt.split("."),B)})}}function v(C,ee,Fe){for(var B=C,nt=0;ntt.call(e,i,i,this))}[Symbol.iterator](){return this.values()}},w1=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?er.isErrorNoTelemetry(t)?new er(t.message+` `+t.stack):new Error(t.message+` `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},ec=new w1;function S1(t){ec.setUnexpectedErrorHandler(t)}function b1(t){if(!t||typeof t!="object")return!1;const e=t;return e.code==="EPIPE"&&e.syscall?.toUpperCase()==="WRITE"}function Nt(t){Ci(t)||ec.onUnexpectedError(t)}var Ns="Canceled";function Ci(t){return t instanceof Te?!0:t instanceof Error&&t.name===Ns&&t.message===Ns}var Te=class extends Error{constructor(){super(Ns),this.name=this.message}};function tc(){const t=new Error(Ns);return t.name=t.message,t}function E1(t){return t?new Error(`Illegal argument: ${t}`):new Error("Illegal argument")}function ic(t){return t?new Error(`Illegal state: ${t}`):new Error("Illegal state")}function H(t){return t?t.message?t.message:t.stack?t.stack.split(` `)[0]:String(t):"Error"}var er=class Wl extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Wl)return e;const i=new Wl;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},_1=class Rd extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Rd.prototype)}};function rc(t,e){const i=this;let r=!1,s;return function(){if(r)return s;if(r=!0,e)try{s=t.apply(i,arguments)}finally{e()}else s=t.apply(i,arguments);return s}}function x1(t,e,i=0,r=t.length){let s=i,n=r;for(;sr===s){if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let r=0,s=t.length;r!!e)}function sc(t){return Array.isArray(t)&&t.length>0}function Xt(t,e=i=>i){const i=new Set;return t.filter(r=>{const s=e(r);return i.has(s)?!1:(i.add(s),!0)})}function nc(t,e){return t.push(e),()=>P1(t,e)}function P1(t,e){const i=t.indexOf(e);if(i>-1)return t.splice(i,1),e}function oc(t,e){let i;if(typeof e=="number"){let r=e;i=()=>{const s=Math.sin(r++)*179426549;return s-Math.floor(s)}}else i=Math.random;for(let r=t.length-1;r>0;r-=1){const s=Math.floor(i()*(r+1)),n=t[r];t[r]=t[s],t[s]=n}}var uo;(function(t){function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(uo||(uo={}));function I1(t,e){return(i,r)=>e(t(i),t(r))}var k1=(t,e)=>t-e,e2=class Jn{static{this.empty=new Jn(e=>{})}constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){const e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(e){return new Jn(i=>this.iterate(r=>e(r)?i(r):!0))}map(e){return new Jn(i=>this.iterate(r=>i(e(r))))}some(e){let i=!1;return this.iterate(r=>(i=e(r),!i)),i}findFirst(e){let i;return this.iterate(r=>e(r)?(i=r,!1):!0),i}findLast(e){let i;return this.iterate(r=>(e(r)&&(i=r),!0)),i}findLastMaxBy(e){let i,r=!0;return this.iterate(s=>((r||uo.isGreaterThan(e(s,i)))&&(r=!1,i=s),!0)),i}},ac,lc,cc,D1=class{constructor(t,e){this.uri=t,this.value=e}};function C1(t){return Array.isArray(t)}var Ge=class _s{static{this.defaultToKey=e=>e.toString()}constructor(e,i){if(this[ac]="ResourceMap",e instanceof _s)this.map=new Map(e.map),this.toKey=i??_s.defaultToKey;else if(C1(e)){this.map=new Map,this.toKey=i??_s.defaultToKey;for(const[r,s]of e)this.set(r,s)}else this.map=new Map,this.toKey=e??_s.defaultToKey}set(e,i){return this.map.set(this.toKey(e),new D1(e,i)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,i){typeof i<"u"&&(e=e.bind(i));for(const[r,s]of this.map)e(s.value,s.uri,this)}*values(){for(const e of this.map.values())yield e.value}*keys(){for(const e of this.map.values())yield e.uri}*entries(){for(const e of this.map.values())yield[e.uri,e.value]}*[(ac=Symbol.toStringTag,Symbol.iterator)](){for(const[,e]of this.map)yield[e.uri,e.value]}},ho=class{constructor(t,e){this[lc]="ResourceSet",!t||typeof t=="function"?this._map=new Ge(t):(this._map=new Ge(e),t.forEach(this.add,this))}get size(){return this._map.size}add(t){return this._map.set(t,t),this}clear(){this._map.clear()}delete(t){return this._map.delete(t)}forEach(t,e){this._map.forEach((i,r)=>t.call(e,r,r,this))}has(t){return this._map.has(t)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(lc=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}},uc;(function(t){t[t.None=0]="None",t[t.AsOld=1]="AsOld",t[t.AsNew=2]="AsNew"})(uc||(uc={}));var R1=class{constructor(){this[cc]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(t){return this._map.has(t)}get(t,e=0){const i=this._map.get(t);if(i)return e!==0&&this.touch(i,e),i.value}set(t,e,i=0){let r=this._map.get(t);if(r)r.value=e,i!==0&&this.touch(r,i);else{switch(r={key:t,value:e,next:void 0,previous:void 0},i){case 0:this.addItemLast(r);break;case 1:this.addItemFirst(r);break;case 2:this.addItemLast(r);break;default:this.addItemLast(r);break}this._map.set(t,r),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){const e=this._map.get(t);if(e)return this._map.delete(t),this.removeItem(e),this._size--,e.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,e){const i=this._state;let r=this._head;for(;r;){if(e?t.bind(e)(r.value,r.key,this):t(r.value,r.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const t=this,e=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.key,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}values(){const t=this,e=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.value,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}entries(){const t=this,e=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:[i.key,i.value],done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}[(cc=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._head,i=this.size;for(;e&&i>t;)this._map.delete(e.key),e=e.next,i--;this._head=e,this._size=i,e&&(e.previous=void 0),this._state++}trimNew(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._tail,i=this.size;for(;e&&i>t;)this._map.delete(e.key),e=e.previous,i--;this._tail=e,this._size=i,e&&(e.next=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{const e=t.next,i=t.previous;if(!e||!i)throw new Error("Invalid list");e.previous=i,i.next=e}t.next=void 0,t.previous=void 0,this._state++}touch(t,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(t===this._head)return;const i=t.next,r=t.previous;t===this._tail?(r.next=void 0,this._tail=r):(i.previous=r,r.next=i),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(e===2){if(t===this._tail)return;const i=t.next,r=t.previous;t===this._head?(i.previous=void 0,this._head=i):(i.previous=r,r.next=i),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){const t=[];return this.forEach((e,i)=>{t.push([i,e])}),t}fromJSON(t){this.clear();for(const[e,i]of t)this.set(e,i)}},L1=class extends R1{constructor(t,e=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,e=2){return super.get(t,e)}peek(t){return super.get(t,0)}set(t,e){return super.set(t,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},Ms=class extends L1{constructor(t,e=1){super(t,e)}trim(t){this.trimOld(t)}set(t,e){return super.set(t,e),this.checkTrim(),this}},A1=class{constructor(){this.map=new Map}add(t,e){let i=this.map.get(t);i||(i=new Set,this.map.set(t,i)),i.add(e)}delete(t,e){const i=this.map.get(t);i&&(i.delete(e),i.size===0&&this.map.delete(t))}forEach(t,e){const i=this.map.get(t);i&&i.forEach(e)}get(t){const e=this.map.get(t);return e||new Set}};function fo(t,e){if(!t)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function O1(t,e="unexpected state"){if(!t)throw typeof e=="string"?new _1(`Assertion Failed: ${e}`):e}function Re(t){return typeof t=="string"}function Ne(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}function F1(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t=="object"&&t instanceof e}function hc(t){return typeof t=="number"&&!isNaN(t)}function T1(t){return!!t&&typeof t[Symbol.iterator]=="function"}function Dt(t){return t===!0||t===!1}function Et(t){return typeof t>"u"}function fc(t){return!Qe(t)}function Qe(t){return Et(t)||t===null}function dc(t){return O1(t!=null,"Argument is `undefined` or `null`."),t}var N1=Object.prototype.hasOwnProperty;function pc(t){if(!Ne(t))return!1;for(const e in t)if(N1.call(t,e))return!1;return!0}function M1(t){return typeof t=="function"}var Ri;(function(t){function e(x){return x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}t.is=e;const i=Object.freeze([]);function r(){return i}t.empty=r;function*s(x){yield x}t.single=s;function n(x){return e(x)?x:s(x)}t.wrap=n;function o(x){return x||i}t.from=o;function*a(x){for(let A=x.length-1;A>=0;A--)yield x[A]}t.reverse=a;function l(x){return!x||x[Symbol.iterator]().next().done===!0}t.isEmpty=l;function c(x){return x[Symbol.iterator]().next().value}t.first=c;function h(x,A){let M=0;for(const Z of x)if(A(Z,M++))return!0;return!1}t.some=h;function f(x,A){for(const M of x)if(A(M))return M}t.find=f;function*d(x,A){for(const M of x)A(M)&&(yield M)}t.filter=d;function*p(x,A){let M=0;for(const Z of x)yield A(Z,M++)}t.map=p;function*v(x,A){let M=0;for(const Z of x)yield*A(Z,M++)}t.flatMap=v;function*m(...x){for(const A of x)T1(A)?yield*A:yield A}t.concat=m;function w(x,A,M){let Z=M;for(const C of x)Z=A(Z,C);return Z}t.reduce=w;function S(x){let A=0;for(const M of x)A++;return A}t.length=S;function*_(x,A,M=x.length){for(A<-x.length&&(A=0),A<0&&(A+=x.length),M<0?M+=x.length:M>x.length&&(M=x.length);Ar.source!==null&&!this.getRootParent(r,e).isSingleton).flatMap(([r])=>r)}computeLeakingDisposables(e=10,i){let r;if(i)r=i;else{const l=new Map,c=[...this.livingDisposables.values()].filter(f=>f.source!==null&&!this.getRootParent(f,l).isSingleton);if(c.length===0)return;const h=new Set(c.map(f=>f.value));if(r=c.filter(f=>!(f.parent&&h.has(f.parent))),r.length===0)throw new Error("There are cyclic diposable chains!")}if(!r)return;function s(l){function c(f,d){for(;f.length>0&&d.some(p=>typeof p=="string"?p===f[0]:f[0].match(p));)f.shift()}const h=l.source.split(` `).map(f=>f.trim().replace("at ","")).filter(f=>f!=="");return c(h,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),h.reverse()}const n=new A1;for(const l of r){const c=s(l);for(let h=0;h<=c.length;h++)n.add(c.slice(0,h).join(` `),l)}r.sort(I1(l=>l.idx,k1));let o="",a=0;for(const l of r.slice(0,e)){a++;const c=s(l),h=[];for(let f=0;fs(w)[f]),w=>w);delete m[c[f]];for(const[w,S]of Object.entries(m))h.unshift(` - stacktraces of ${S.length} other leaks continue with ${w}`);h.unshift(d)}o+=` ==================== Leaking disposable ${a}/${r.length}: ${l.value.constructor.name} ==================== ${h.join(` `)} ============================================================ `}return r.length>e&&(o+=` ... and ${r.length-e} more leaking disposables `),{leaks:r,details:o}}};function V1(t){rr=t}if(U1){const t="__is_disposable_tracked__";V1(new class{trackDisposable(e){const i=new Error("Potentially leaked disposable").stack;setTimeout(()=>{e[t]||console.log(i)},3e3)}setParent(e,i){if(e&&e!==K.None)try{e[t]=!0}catch{}}markAsDisposed(e){if(e&&e!==K.None)try{e[t]=!0}catch{}}markAsSingleton(e){}})}function Tr(t){return rr?.trackDisposable(t),t}function Nr(t){rr?.markAsDisposed(t)}function Mr(t,e){rr?.setParent(t,e)}function W1(t,e){if(rr)for(const i of t)rr.setParent(i,e)}function gc(t){return typeof t=="object"&&t!==null&&typeof t.dispose=="function"&&t.dispose.length===0}function _t(t){if(Ri.is(t)){const e=[];for(const i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function mc(...t){const e=ye(()=>_t(t));return W1(t,e),e}function ye(t){const e=Tr({dispose:rc(()=>{Nr(e),t()})});return e}var lt=class Od{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,Tr(this)}dispose(){this._isDisposed||(Nr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{_t(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 Mr(e,this),this._isDisposed?Od.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),Mr(e,null))}},K=class{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new lt,Tr(this),Mr(this._store,this)}dispose(){Nr(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}},Ur=class{constructor(){this._isDisposed=!1,Tr(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),t&&Mr(t,this),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Nr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){const t=this._value;return this._value=void 0,t&&Mr(t,null),t}},po=class{constructor(){this._store=new Map,this._isDisposed=!1,Tr(this)}dispose(){Nr(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{_t(this._store.values())}finally{this._store.clear()}}has(t){return this._store.has(t)}get size(){return this._store.size}get(t){return this._store.get(t)}set(t,e,i=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(t)?.dispose(),this._store.set(t,e)}deleteAndDispose(t){this._store.get(t)?.dispose(),this._store.delete(t)}deleteAndLeak(t){const e=this._store.get(t);return this._store.delete(t),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}},be=class Xn{static{this.Undefined=new Xn(void 0)}constructor(e){this.element=e,this.next=Xn.Undefined,this.prev=Xn.Undefined}},vc=class{constructor(){this._first=be.Undefined,this._last=be.Undefined,this._size=0}get size(){return this._size}get first(){return this._first}isEmpty(){return this._first===be.Undefined}clear(){let t=this._first;for(;t!==be.Undefined;){const e=t.next;t.prev=be.Undefined,t.next=be.Undefined,t=e}this._first=be.Undefined,this._last=be.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){const i=new be(t);if(this._first===be.Undefined)this._first=i,this._last=i;else if(e){const s=this._last;this._last=i,i.prev=s,s.next=i}else{const s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==be.Undefined){const t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==be.Undefined){const t=this._last.element;return this._remove(this._last),t}}remove(t){this._remove(t)}_remove(t){if(t.prev!==be.Undefined&&t.next!==be.Undefined){const e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===be.Undefined&&t.next===be.Undefined?(this._first=be.Undefined,this._last=be.Undefined):t.next===be.Undefined?(this._last=this._last.prev,this._last.next=be.Undefined):t.prev===be.Undefined&&(this._first=this._first.next,this._first.prev=be.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==be.Undefined;)yield t.element,t=t.next}},$1=globalThis.performance&&typeof globalThis.performance.now=="function",Us=class Fd{static create(e){return new Fd(e)}constructor(e){this._now=$1&&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}},yc=!1,q1=!1,ae;(function(t){t.None=()=>K.None;function e(k){if(q1){const{onDidAddListener:D}=k,L=go.create();let R=0;k.onDidAddListener=()=>{++R===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),L.print()),D?.()}}}function i(k,D){return p(k,()=>{},0,void 0,!0,void 0,D)}t.defer=i;function r(k){return(D,L=null,R)=>{let U=!1,z;return z=k(re=>{if(!U)return z?z.dispose():U=!0,D.call(L,re)},null,R),U&&z.dispose(),z}}t.once=r;function s(k,D){return t.once(t.filter(k,D))}t.onceIf=s;function n(k,D,L){return f((R,U=null,z)=>k(re=>R.call(U,D(re)),null,z),L)}t.map=n;function o(k,D,L){return f((R,U=null,z)=>k(re=>{D(re),R.call(U,re)},null,z),L)}t.forEach=o;function a(k,D,L){return f((R,U=null,z)=>k(re=>D(re)&&R.call(U,re),null,z),L)}t.filter=a;function l(k){return k}t.signal=l;function c(...k){return(D,L=null,R)=>{const U=mc(...k.map(z=>z(re=>D.call(L,re))));return d(U,R)}}t.any=c;function h(k,D,L,R){let U=L;return n(k,z=>(U=D(U,z),U),R)}t.reduce=h;function f(k,D){let L;const R={onWillAddFirstListener(){L=k(U.fire,U)},onDidRemoveLastListener(){L?.dispose()}};D||e(R);const U=new O(R);return D?.add(U),U.event}function d(k,D){return D instanceof Array?D.push(k):D&&D.add(k),k}function p(k,D,L=100,R=!1,U=!1,z,re){let Se,ke,Gt,Ii=0,Qt;const Yi={leakWarningThreshold:z,onWillAddFirstListener(){Se=k(Rs=>{Ii++,ke=D(ke,Rs),R&&!Gt&&(Ft.fire(ke),ke=void 0),Qt=()=>{const Ls=ke;ke=void 0,Gt=void 0,(!R||Ii>1)&&Ft.fire(Ls),Ii=0},typeof L=="number"?(clearTimeout(Gt),Gt=setTimeout(Qt,L)):Gt===void 0&&(Gt=0,queueMicrotask(Qt))})},onWillRemoveListener(){U&&Ii>0&&Qt?.()},onDidRemoveLastListener(){Qt=void 0,Se.dispose()}};re||e(Yi);const Ft=new O(Yi);return re?.add(Ft),Ft.event}t.debounce=p;function v(k,D=0,L){return t.debounce(k,(R,U)=>R?(R.push(U),R):[U],D,void 0,!0,void 0,L)}t.accumulate=v;function m(k,D=(R,U)=>R===U,L){let R=!0,U;return a(k,z=>{const re=R||!D(z,U);return R=!1,U=z,re},L)}t.latch=m;function w(k,D,L){return[t.filter(k,D,L),t.filter(k,R=>!D(R),L)]}t.split=w;function S(k,D=!1,L=[],R){let U=L.slice(),z=k(ke=>{U?U.push(ke):Se.fire(ke)});R&&R.add(z);const re=()=>{U?.forEach(ke=>Se.fire(ke)),U=null},Se=new O({onWillAddFirstListener(){z||(z=k(ke=>Se.fire(ke)),R&&R.add(z))},onDidAddFirstListener(){U&&(D?setTimeout(re):re())},onDidRemoveLastListener(){z&&z.dispose(),z=null}});return R&&R.add(Se),Se.event}t.buffer=S;function _(k,D){return(R,U,z)=>{const re=D(new N);return k(function(Se){const ke=re.evaluate(Se);ke!==P&&R.call(U,ke)},void 0,z)}}t.chain=_;const P=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(D){return this.steps.push(D),this}forEach(D){return this.steps.push(L=>(D(L),L)),this}filter(D){return this.steps.push(L=>D(L)?L:P),this}reduce(D,L){let R=L;return this.steps.push(U=>(R=D(R,U),R)),this}latch(D=(L,R)=>L===R){let L=!0,R;return this.steps.push(U=>{const z=L||!D(U,R);return L=!1,R=U,z?U:P}),this}evaluate(D){for(const L of this.steps)if(D=L(D),D===P)break;return D}}function x(k,D,L=R=>R){const R=(...Se)=>re.fire(L(...Se)),U=()=>k.on(D,R),z=()=>k.removeListener(D,R),re=new O({onWillAddFirstListener:U,onDidRemoveLastListener:z});return re.event}t.fromNodeEventEmitter=x;function A(k,D,L=R=>R){const R=(...Se)=>re.fire(L(...Se)),U=()=>k.addEventListener(D,R),z=()=>k.removeEventListener(D,R),re=new O({onWillAddFirstListener:U,onDidRemoveLastListener:z});return re.event}t.fromDOMEventEmitter=A;function M(k,D){return new Promise(L=>r(k)(L,null,D))}t.toPromise=M;function Z(k){const D=new O;return k.then(L=>{D.fire(L)},()=>{D.fire(void 0)}).finally(()=>{D.dispose()}),D.event}t.fromPromise=Z;function C(k,D){return k(L=>D.fire(L))}t.forward=C;function ee(k,D,L){return D(L),k(R=>D(R))}t.runAndSubscribe=ee;class Fe{constructor(D,L){this._observable=D,this._counter=0,this._hasChanged=!1;const R={onWillAddFirstListener:()=>{D.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{D.removeObserver(this)}};L||e(R),this.emitter=new O(R),L&&L.add(this.emitter)}beginUpdate(D){this._counter++}handlePossibleChange(D){}handleChange(D,L){this._hasChanged=!0}endUpdate(D){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function B(k,D){return new Fe(k,D).emitter.event}t.fromObservable=B;function nt(k){return(D,L,R)=>{let U=0,z=!1;const re={beginUpdate(){U++},endUpdate(){U--,U===0&&(k.reportChanges(),z&&(z=!1,D.call(L)))},handlePossibleChange(){},handleChange(){z=!0}};k.addObserver(re),k.reportChanges();const Se={dispose(){k.removeObserver(re)}};return R instanceof lt?R.add(Se):Array.isArray(R)&&R.push(Se),Se}}t.fromObservableLight=nt})(ae||(ae={}));var j1=class $l{static{this.all=new Set}static{this._idPool=0}constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${$l._idPool++}`,$l.all.add(this)}start(e){this._stopWatch=new Us,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}},wc=-1,B1=class Td{static{this._idPool=1}constructor(e,i,r=(Td._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){const r=this.threshold;if(r<=0||i{const n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(const[r,s]of this._stacks)(!e||i{if(t instanceof Vs)e(t);else for(let i=0;i0||this._options?.leakWarningThreshold?new B1(t?.onListenerError??Nt,this._options?.leakWarningThreshold??wc):void 0,this._perfMon=this._options?._profName?new j1(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(yc){const t=this._listeners;queueMicrotask(()=>{Q1(t,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);const l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new H1(`${a}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||Nt)(c),K.None}if(this._disposed)return K.None;e&&(t=t.bind(e));const r=new Vs(t);let s,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=go.create(),s=this._leakageMon.check(r.stack,this._size+1)),yc&&(r.stack=n??go.create()),this._listeners?this._listeners instanceof Vs?(this._deliveryQueue??=new J1,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;const o=ye(()=>{s?.(),this._removeListener(r)});return i instanceof lt?i.add(o):Array.isArray(i)&&i.push(o),o},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}const e=this._listeners,i=e.indexOf(t);if(i===-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--,e[i]=void 0;const r=this._deliveryQueue.current===this;if(this._size*G1<=e.length){let s=0;for(let n=0;n0}},J1=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mo=class extends O{get isPaused(){return this._isPaused!==0}constructor(t){super(t),this._isPaused=0,this._eventQueue=new vc,this._mergeFn=t?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const t=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(t))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(t){this._size&&(this._isPaused!==0?this._eventQueue.push(t):super.fire(t))}},X1=class{constructor(){this.listening=!1,this.inputEvent=ae.None,this.inputEventListener=K.None,this.emitter=new O({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(t){this.inputEvent=t,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=t(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},Sc=Object.freeze(function(t,e){const i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),de;(function(t){function e(i){return i===t.None||i===t.Cancelled||i instanceof Ws?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ae.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Sc})})(de||(de={}));var Ws=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Sc:(this._emitter||(this._emitter=new O),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},sr=class{constructor(t){this._token=void 0,this._parentListener=void 0,this._parentListener=t&&t.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new Ws),this._token}cancel(){this._token?this._token instanceof Ws&&this._token.cancel():this._token=de.Cancelled}dispose(t=!1){t&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Ws&&this._token.dispose():this._token=de.None}};function Y1(){return globalThis._VSCODE_NLS_MESSAGES}function bc(){return globalThis._VSCODE_NLS_LANGUAGE}var Z1=bc()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function $s(t,e){let i;return e.length===0?i=t:i=t.replace(/\{(\d+)\}/g,(r,s)=>{const n=s[0],o=e[n];let a=r;return typeof o=="string"?a=o:(typeof o=="number"||typeof o=="boolean"||o===void 0||o===null)&&(a=String(o)),a}),Z1&&(i="\uFF3B"+i.replace(/[aouei]/g,"$&$&")+"\uFF3D"),i}function g(t,e,...i){return $s(typeof t=="number"?Ec(t,e):e,i)}function Ec(t,e){const i=Y1()?.[t];if(typeof i!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${t} !!!`)}return i}function _c(t,e,...i){let r;typeof t=="number"?r=Ec(t,e):r=e;const s=$s(r,i);return{value:s,original:e===r?s:$s(e,i)}}var nr="en",Vr=!1,Wr=!1,$r=!1,xc=!1,Pc=!1,vo=!1,ep=!1,Ic=!1,tp=!1,ip=!1,qs=void 0,js=nr,kc=nr,Dc=void 0,Yt=void 0,Zt=globalThis,Ze=void 0;typeof Zt.vscode<"u"&&typeof Zt.vscode.process<"u"?Ze=Zt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ze=process);var Cc=typeof Ze?.versions?.electron=="string",rp=Cc&&Ze?.type==="renderer";if(typeof Ze=="object"){Vr=Ze.platform==="win32",Wr=Ze.platform==="darwin",$r=Ze.platform==="linux",xc=$r&&!!Ze.env.SNAP&&!!Ze.env.SNAP_REVISION,ep=Cc,tp=!!Ze.env.CI||!!Ze.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qs=nr,js=nr;const t=Ze.env.VSCODE_NLS_CONFIG;if(t)try{const e=JSON.parse(t);qs=e.userLocale,kc=e.osLocale,js=e.resolvedLanguage||nr,Dc=e.languagePack?.translationsConfigFile}catch{}Pc=!0}else typeof navigator=="object"&&!rp?(Yt=navigator.userAgent,Vr=Yt.indexOf("Windows")>=0,Wr=Yt.indexOf("Macintosh")>=0,Ic=(Yt.indexOf("Macintosh")>=0||Yt.indexOf("iPad")>=0||Yt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,$r=Yt.indexOf("Linux")>=0,ip=Yt?.indexOf("Mobi")>=0,vo=!0,js=bc()||nr,qs=navigator.language.toLowerCase(),kc=qs):console.error("Unable to resolve platform.");var Rc;(function(t){t[t.Web=0]="Web",t[t.Mac=1]="Mac",t[t.Linux=2]="Linux",t[t.Windows=3]="Windows"})(Rc||(Rc={}));function sp(t){switch(t){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var Bs=0;Wr?Bs=1:Vr?Bs=3:$r&&(Bs=2);var _e=Vr,Mt=Wr,et=$r,np=xc,op=Pc,ei=vo,ap=vo&&typeof Zt.importScripts=="function",lp=ap?Zt.origin:void 0,zs=Bs,Ut=Yt,Vt=js,Lc;(function(t){function e(){return Vt}t.value=e;function i(){return Vt.length===2?Vt==="en":Vt.length>=3?Vt[0]==="e"&&Vt[1]==="n"&&Vt[2]==="-":!1}t.isDefaultVariant=i;function r(){return Vt==="en"}t.isDefault=r})(Lc||(Lc={}));var Ac=Dc,cp=typeof Zt.postMessage=="function"&&!Zt.importScripts,up=(()=>{if(cp){const t=[];Zt.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r{const r=++e;t.push({id:r,callback:i}),Zt.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})(),Oc;(function(t){t[t.Windows=1]="Windows",t[t.Macintosh=2]="Macintosh",t[t.Linux=3]="Linux"})(Oc||(Oc={}));var yo=Wr||Ic?2:Vr?1:3,Fc=!!(Ut&&Ut.indexOf("Chrome")>=0),hp=!!(Ut&&Ut.indexOf("Firefox")>=0),fp=!!(!Fc&&Ut&&Ut.indexOf("Safari")>=0),dp=!!(Ut&&Ut.indexOf("Edg/")>=0),i2=!!(Ut&&Ut.indexOf("Android")>=0),r2=Ze?.arch,s2=Ze?.platform,Li,wo=globalThis.vscode;if(typeof wo<"u"&&typeof wo.process<"u"){const t=wo.process;Li={get platform(){return t.platform},get arch(){return t.arch},get env(){return t.env},cwd(){return t.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?Li={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:Li={get platform(){return _e?"win32":Mt?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var qr=Li.cwd,Wt=Li.env,Tc=Li.platform,Nc=Li.arch,pp=65,gp=97,mp=90,vp=122,Ai=46,We=47,ct=92,ti=58,yp=63,Mc=class extends Error{constructor(t,e,i){let r;typeof e=="string"&&e.indexOf("not ")===0?(r="must not be",e=e.replace(/^not /,"")):r="must be";const s=t.indexOf(".")!==-1?"property":"argument";let n=`The "${t}" ${s} ${r} of type ${e}`;n+=`. Received type ${typeof i}`,super(n),this.code="ERR_INVALID_ARG_TYPE"}};function wp(t,e){if(t===null||typeof t!="object")throw new Mc(e,"Object",t)}function xe(t,e){if(typeof t!="string")throw new Mc(e,"string",t)}var ut=Tc==="win32";function Q(t){return t===We||t===ct}function So(t){return t===We}function ii(t){return t>=pp&&t<=mp||t>=gp&&t<=vp}function Hs(t,e,i,r){let s="",n=0,o=-1,a=0,l=0;for(let c=0;c<=t.length;++c){if(c2){const h=s.lastIndexOf(i);h===-1?(s="",n=0):(s=s.slice(0,h),n=s.length-1-s.lastIndexOf(i)),o=c,a=0;continue}else if(s.length!==0){s="",n=0,o=c,a=0;continue}}e&&(s+=s.length>0?`${i}..`:"..",n=2)}else s.length>0?s+=`${i}${t.slice(o+1,c)}`:s=t.slice(o+1,c),n=c-o-1;o=c,a=0}else l===Ai&&a!==-1?++a:a=-1}return s}function Sp(t){return t?`${t[0]==="."?"":"."}${t}`:""}function Uc(t,e){wp(e,"pathObject");const i=e.dir||e.root,r=e.base||`${e.name||""}${Sp(e.ext)}`;return i?i===e.root?`${i}${r}`:`${i}${t}${r}`:r}var Le={resolve(...t){let e="",i="",r=!1;for(let s=t.length-1;s>=-1;s--){let n;if(s>=0){if(n=t[s],xe(n,`paths[${s}]`),n.length===0)continue}else e.length===0?n=qr():(n=Wt[`=${e}`]||qr(),(n===void 0||n.slice(0,2).toLowerCase()!==e.toLowerCase()&&n.charCodeAt(2)===ct)&&(n=`${e}\\`));const o=n.length;let a=0,l="",c=!1;const h=n.charCodeAt(0);if(o===1)Q(h)&&(a=1,c=!0);else if(Q(h))if(c=!0,Q(n.charCodeAt(1))){let f=2,d=f;for(;f2&&Q(n.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(r){if(e.length>0)break}else if(i=`${n.slice(a)}\\${i}`,r=c,c&&e.length>0)break}return i=Hs(i,!r,"\\",Q),r?`${e}\\${i}`:`${e}${i}`||"."},normalize(t){xe(t,"path");const e=t.length;if(e===0)return".";let i=0,r,s=!1;const n=t.charCodeAt(0);if(e===1)return So(n)?"\\":t;if(Q(n))if(s=!0,Q(t.charCodeAt(1))){let a=2,l=a;for(;a2&&Q(t.charCodeAt(2))&&(s=!0,i=3));let o=i0&&Q(t.charCodeAt(e-1))&&(o+="\\"),!s&&r===void 0&&t.includes(":")){if(o.length>=2&&ii(o.charCodeAt(0))&&o.charCodeAt(1)===ti)return`.\\${o}`;let a=t.indexOf(":");do if(a===e-1||Q(t.charCodeAt(a+1)))return`.\\${o}`;while((a=t.indexOf(":",a+1))!==-1)}return r===void 0?s?`\\${o}`:o:s?`${r}\\${o}`:`${r}${o}`},isAbsolute(t){xe(t,"path");const e=t.length;if(e===0)return!1;const i=t.charCodeAt(0);return Q(i)||e>2&&ii(i)&&t.charCodeAt(1)===ti&&Q(t.charCodeAt(2))},join(...t){if(t.length===0)return".";let e,i;for(let n=0;n0&&(e===void 0?e=i=o:e+=`\\${o}`)}if(e===void 0)return".";let r=!0,s=0;if(typeof i=="string"&&Q(i.charCodeAt(0))){++s;const n=i.length;n>1&&Q(i.charCodeAt(1))&&(++s,n>2&&(Q(i.charCodeAt(2))?++s:r=!1))}if(r){for(;s=2&&(e=`\\${e.slice(s)}`)}return Le.normalize(e)},relative(t,e){if(xe(t,"from"),xe(e,"to"),t===e)return"";const i=Le.resolve(t),r=Le.resolve(e);if(i===r||(t=i.toLowerCase(),e=r.toLowerCase(),t===e))return"";if(i.length!==t.length||r.length!==e.length){const v=i.split("\\"),m=r.split("\\");v[v.length-1]===""&&v.pop(),m[m.length-1]===""&&m.pop();const w=v.length,S=m.length,_=w_?m.slice(P).join("\\"):w>_?"..\\".repeat(w-1-P)+"..":"":"..\\".repeat(w-P)+m.slice(P).join("\\")}let s=0;for(;ss&&t.charCodeAt(n-1)===ct;)n--;const o=n-s;let a=0;for(;aa&&e.charCodeAt(l-1)===ct;)l--;const c=l-a,h=oh){if(e.charCodeAt(a+d)===ct)return r.slice(a+d+1);if(d===2)return r.slice(a+d)}o>h&&(t.charCodeAt(s+d)===ct?f=d:d===2&&(f=3)),f===-1&&(f=0)}let p="";for(d=s+f+1;d<=n;++d)(d===n||t.charCodeAt(d)===ct)&&(p+=p.length===0?"..":"\\..");return a+=f,p.length>0?`${p}${r.slice(a,l)}`:(r.charCodeAt(a)===ct&&++a,r.slice(a,l))},toNamespacedPath(t){if(typeof t!="string"||t.length===0)return t;const e=Le.resolve(t);if(e.length<=2)return t;if(e.charCodeAt(0)===ct){if(e.charCodeAt(1)===ct){const i=e.charCodeAt(2);if(i!==yp&&i!==Ai)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(ii(e.charCodeAt(0))&&e.charCodeAt(1)===ti&&e.charCodeAt(2)===ct)return`\\\\?\\${e}`;return e},dirname(t){xe(t,"path");const e=t.length;if(e===0)return".";let i=-1,r=0;const s=t.charCodeAt(0);if(e===1)return Q(s)?t:".";if(Q(s)){if(i=r=1,Q(t.charCodeAt(1))){let a=2,l=a;for(;a2&&Q(t.charCodeAt(2))?3:2,r=i);let n=-1,o=!0;for(let a=e-1;a>=r;--a)if(Q(t.charCodeAt(a))){if(!o){n=a;break}}else o=!1;if(n===-1){if(i===-1)return".";n=i}return t.slice(0,n)},basename(t,e){e!==void 0&&xe(e,"suffix"),xe(t,"path");let i=0,r=-1,s=!0,n;if(t.length>=2&&ii(t.charCodeAt(0))&&t.charCodeAt(1)===ti&&(i=2),e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(n=t.length-1;n>=i;--n){const l=t.charCodeAt(n);if(Q(l)){if(!s){i=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=n):(o=-1,r=a))}return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(n=t.length-1;n>=i;--n)if(Q(t.charCodeAt(n))){if(!s){i=n+1;break}}else r===-1&&(s=!1,r=n+1);return r===-1?"":t.slice(i,r)},extname(t){xe(t,"path");let e=0,i=-1,r=0,s=-1,n=!0,o=0;t.length>=2&&t.charCodeAt(1)===ti&&ii(t.charCodeAt(0))&&(e=r=2);for(let a=t.length-1;a>=e;--a){const l=t.charCodeAt(a);if(Q(l)){if(!n){r=a+1;break}continue}s===-1&&(n=!1,s=a+1),l===Ai?i===-1?i=a:o!==1&&(o=1):i!==-1&&(o=-1)}return i===-1||s===-1||o===0||o===1&&i===s-1&&i===r+1?"":t.slice(i,s)},format:Uc.bind(null,"\\"),parse(t){xe(t,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;const i=t.length;let r=0,s=t.charCodeAt(0);if(i===1)return Q(s)?(e.root=e.dir=t,e):(e.base=e.name=t,e);if(Q(s)){if(r=1,Q(t.charCodeAt(1))){let f=2,d=f;for(;f0&&(e.root=t.slice(0,r));let n=-1,o=r,a=-1,l=!0,c=t.length-1,h=0;for(;c>=r;--c){if(s=t.charCodeAt(c),Q(s)){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),s===Ai?n===-1?n=c:h!==1&&(h=1):n!==-1&&(h=-1)}return a!==-1&&(n===-1||h===0||h===1&&n===a-1&&n===o+1?e.base=e.name=t.slice(o,a):(e.name=t.slice(o,n),e.base=t.slice(o,a),e.ext=t.slice(n,a))),o>0&&o!==r?e.dir=t.slice(0,o-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},bp=(()=>{if(ut){const t=/\\/g;return()=>{const e=qr().replace(t,"/");return e.slice(e.indexOf("/"))}}return()=>qr()})(),se={resolve(...t){let e="",i=!1;for(let r=t.length-1;r>=0&&!i;r--){const s=t[r];xe(s,`paths[${r}]`),s.length!==0&&(e=`${s}/${e}`,i=s.charCodeAt(0)===We)}if(!i){const r=bp();e=`${r}/${e}`,i=r.charCodeAt(0)===We}return e=Hs(e,!i,"/",So),i?`/${e}`:e.length>0?e:"."},normalize(t){if(xe(t,"path"),t.length===0)return".";const e=t.charCodeAt(0)===We,i=t.charCodeAt(t.length-1)===We;return t=Hs(t,!e,"/",So),t.length===0?e?"/":i?"./":".":(i&&(t+="/"),e?`/${t}`:t)},isAbsolute(t){return xe(t,"path"),t.length>0&&t.charCodeAt(0)===We},join(...t){if(t.length===0)return".";const e=[];for(let i=0;i0&&e.push(r)}return e.length===0?".":se.normalize(e.join("/"))},relative(t,e){if(xe(t,"from"),xe(e,"to"),t===e||(t=se.resolve(t),e=se.resolve(e),t===e))return"";const i=1,r=t.length,s=r-i,n=1,o=e.length-n,a=sa){if(e.charCodeAt(n+c)===We)return e.slice(n+c+1);if(c===0)return e.slice(n+c)}else s>a&&(t.charCodeAt(i+c)===We?l=c:c===0&&(l=0));let h="";for(c=i+l+1;c<=r;++c)(c===r||t.charCodeAt(c)===We)&&(h+=h.length===0?"..":"/..");return`${h}${e.slice(n+l)}`},toNamespacedPath(t){return t},dirname(t){if(xe(t,"path"),t.length===0)return".";const e=t.charCodeAt(0)===We;let i=-1,r=!0;for(let s=t.length-1;s>=1;--s)if(t.charCodeAt(s)===We){if(!r){i=s;break}}else r=!1;return i===-1?e?"/":".":e&&i===1?"//":t.slice(0,i)},basename(t,e){e!==void 0&&xe(e,"suffix"),xe(t,"path");let i=0,r=-1,s=!0,n;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e===t)return"";let o=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){const l=t.charCodeAt(n);if(l===We){if(!s){i=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(r=n):(o=-1,r=a))}return i===r?r=a:r===-1&&(r=t.length),t.slice(i,r)}for(n=t.length-1;n>=0;--n)if(t.charCodeAt(n)===We){if(!s){i=n+1;break}}else r===-1&&(s=!1,r=n+1);return r===-1?"":t.slice(i,r)},extname(t){xe(t,"path");let e=-1,i=0,r=-1,s=!0,n=0;for(let o=t.length-1;o>=0;--o){const a=t[o];if(a==="/"){if(!s){i=o+1;break}continue}r===-1&&(s=!1,r=o+1),a==="."?e===-1?e=o:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||r===-1||n===0||n===1&&e===r-1&&e===i+1?"":t.slice(e,r)},format:Uc.bind(null,"/"),parse(t){xe(t,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;const i=t.charCodeAt(0)===We;let r;i?(e.root="/",r=1):r=0;let s=-1,n=0,o=-1,a=!0,l=t.length-1,c=0;for(;l>=r;--l){const h=t.charCodeAt(l);if(h===We){if(!a){n=l+1;break}continue}o===-1&&(a=!1,o=l+1),h===Ai?s===-1?s=l:c!==1&&(c=1):s!==-1&&(c=-1)}if(o!==-1){const h=n===0&&i?1:n;s===-1||c===0||c===1&&s===o-1&&s===n+1?e.base=e.name=t.slice(h,o):(e.name=t.slice(h,s),e.base=t.slice(h,o),e.ext=t.slice(s,o))}return n>0?e.dir=t.slice(0,n-1):i&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};se.win32=Le.win32=Le,se.posix=Le.posix=se;var di=ut?Le.normalize:se.normalize,Vc=ut?Le.isAbsolute:se.isAbsolute,G=ut?Le.join:se.join,Oi=ut?Le.resolve:se.resolve,Wc=ut?Le.relative:se.relative,pi=ut?Le.dirname:se.dirname,Ct=ut?Le.basename:se.basename,Ep=ut?Le.extname:se.extname,n2=ut?Le.format:se.format,o2=ut?Le.parse:se.parse,a2=ut?Le.toNamespacedPath:se.toNamespacedPath,tt=ut?Le.sep:se.sep,l2=ut?Le.delimiter:se.delimiter;function _p(t){return t}var xp=class{constructor(t,e){this.lastCache=void 0,this.lastArgKey=void 0,typeof t=="function"?(this._fn=t,this._computeKey=_p):(this._fn=e,this._computeKey=t.getCacheKey)}get(t){const e=this._computeKey(t);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(t)),this.lastCache}},Fi=class{constructor(t){this.executor=t,this._didRun=!1}get hasValue(){return this._didRun}get value(){if(!this._didRun)try{this._value=this.executor()}catch(t){this._error=t}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}};function Pp(t){return!t||typeof t!="string"?!0:t.trim().length===0}var Ip=/{([^}]+)}/g;function or(t,e){return Object.keys(e).length===0?t:t.replace(Ip,(i,r)=>e[r]??i)}function ar(t){return t.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function kp(t,e){if(!t||!e)return t;const i=e.length;if(i===0||t.length===0)return t;let r=0;for(;t.indexOf(e,r)===r;)r=r+i;return t.substring(r)}function bo(t,e){if(!t||!e)return t;const i=e.length,r=t.length;if(i===0||r===0)return t;let s=r,n=-1;for(;n=t.lastIndexOf(e,s-1),!(n===-1||n+i!==s);){if(n===0)return"";s=n}return t.substring(0,s)}function Eo(t,e){return te?1:0}function _o(t,e,i=0,r=t.length,s=0,n=e.length){for(;ic)return 1}const o=r-i,a=n-s;return oa?1:0}function Ks(t,e){return jr(t,e,0,t.length,0,e.length)}function jr(t,e,i=0,r=t.length,s=0,n=e.length){for(;i=128||c>=128)return _o(t.toLowerCase(),e.toLowerCase(),i,r,s,n);$c(l)&&(l-=32),$c(c)&&(c-=32);const h=l-c;if(h!==0)return h}const o=r-i,a=n-s;return oa?1:0}function $c(t){return t>=97&&t<=122}function qc(t){return t>=65&&t<=90}function Ti(t,e){return t.length===e.length&&jr(t,e)===0}function xo(t,e){const i=e.length;return e.length>t.length?!1:jr(t,e,0,i)===0}function Dp(t){return 55296<=t&&t<=56319}function jc(t){return 56320<=t&&t<=57343}function Cp(t,e){return(t-55296<<10)+(e-56320)+65536}var Rp=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,Lp=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,Ap=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,c2=new RegExp("(?:"+[Rp.source,Lp.source,Ap.source].join("|")+")","g"),u2="\uFEFF",Bc;(function(t){t[t.Other=0]="Other",t[t.Prepend=1]="Prepend",t[t.CR=2]="CR",t[t.LF=3]="LF",t[t.Control=4]="Control",t[t.Extend=5]="Extend",t[t.Regional_Indicator=6]="Regional_Indicator",t[t.SpacingMark=7]="SpacingMark",t[t.L=8]="L",t[t.V=9]="V",t[t.T=10]="T",t[t.LV=11]="LV",t[t.LVT=12]="LVT",t[t.ZWJ=13]="ZWJ",t[t.Extended_Pictographic=14]="Extended_Pictographic"})(Bc||(Bc={}));var h2=class xs{static{this._INSTANCE=null}static getInstance(){return xs._INSTANCE||(xs._INSTANCE=new xs),xs._INSTANCE}constructor(){this._data=Op()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;const i=this._data,r=i.length/3;let s=1;for(;s<=r;)if(ei[3*s+1])s=2*s+1;else return i[3*s+2];return 0}};function Op(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}var zc;(function(t){t[t.zwj=8205]="zwj",t[t.emojiVariantSelector=65039]="emojiVariantSelector",t[t.enclosingKeyCap=8419]="enclosingKeyCap",t[t.space=32]="space"})(zc||(zc={}));var f2=class Ps{static{this.ambiguousCharacterData=new Fi(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}'))}static{this.cache=new xp({getCacheKey:JSON.stringify},e=>{function i(h){const f=new Map;for(let d=0;d!h.startsWith("_")&&h in n);o.length===0&&(o=["_default"]);let a;for(const h of o){const f=i(n[h]);a=s(a,f)}const l=i(n._common),c=r(l,a);return new Ps(c)})}static getInstance(e){return Ps.cache.get(Array.from(e))}static{this._locales=new Fi(()=>Object.keys(Ps.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return Ps._locales.value}constructor(e){this.confusableDictionary=e}isAmbiguous(e){return this.confusableDictionary.has(e)}containsAmbiguousCharacter(e){for(let i=0;it.length)return!1;if(i){if(!xo(t,e))return!1;if(e.length===t.length)return!0;let n=e.length;return e.charAt(e.length-1)===r&&n--,t.charAt(n)===r}return e.charAt(e.length-1)!==r&&(e+=r),t.indexOf(e)===0}function Gc(t){return t>=65&&t<=90||t>=97&&t<=122}function Tp(t){return _e?(t=bo(t,tt),t.endsWith(":")&&(t+=tt)):(t=bo(t,tt),t||(t=tt)),t}function Np(t){const e=di(t);return _e?t.length>3?!1:Mp(e)&&(t.length===2||e.charCodeAt(2)===92):e===se.sep}function Mp(t,e=_e){return e?Gc(t.charCodeAt(0))&&t.charCodeAt(1)===58:!1}var Up="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Vp="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function Wp(t,e,i=8){let r="";for(let n=0;ntypeof i=="function"):!1}function Po(t){const e=t;return e?Qs(e.stream)&&Array.isArray(e.buffer)&&typeof e.ended=="boolean":!1}function Js(t,e){return new $p(t,e)}var $p=class{constructor(t,e){this.reducer=t,this.options=e,this.state={flowing:!1,ended:!1,destroyed:!1},this.buffer={data:[],error:[]},this.listeners={data:[],error:[],end:[]},this.pendingWritePromises=[]}pause(){this.state.destroyed||(this.state.flowing=!1)}resume(){this.state.destroyed||this.state.flowing||(this.state.flowing=!0,this.flowData(),this.flowErrors(),this.flowEnd())}write(t){if(!this.state.destroyed){if(this.state.flowing)this.emitData(t);else if(this.buffer.data.push(t),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(t){this.state.destroyed||(this.state.flowing?this.emitError(t):this.buffer.error.push(t))}end(t){this.state.destroyed||(typeof t<"u"&&this.write(t),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(t){this.listeners.data.slice(0).forEach(e=>e(t))}emitError(t){this.listeners.error.length===0?Nt(t):this.listeners.error.slice(0).forEach(e=>e(t))}emitEnd(){this.listeners.end.slice(0).forEach(t=>t())}on(t,e){if(!this.state.destroyed)switch(t){case"data":this.listeners.data.push(e),this.resume();break;case"end":this.listeners.end.push(e),this.state.flowing&&this.flowEnd()&&this.destroy();break;case"error":this.listeners.error.push(e),this.state.flowing&&this.flowErrors();break}}removeListener(t,e){if(this.state.destroyed)return;let i;switch(t){case"data":i=this.listeners.data;break;case"end":i=this.listeners.end;break;case"error":i=this.listeners.error;break}if(i){const r=i.indexOf(e);r>=0&&i.splice(r,1)}}flowData(){if(this.buffer.data.length===0)return;if(typeof this.reducer=="function"){const e=this.reducer(this.buffer.data);this.emitData(e)}else for(const e of this.buffer.data)this.emitData(e);this.buffer.data.length=0;const t=[...this.pendingWritePromises];this.pendingWritePromises.length=0,t.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(const t of this.buffer.error)this.emitError(t);this.buffer.error.length=0}}flowEnd(){return this.state.ended?(this.emitEnd(),this.listeners.end.length>0):!1}destroy(){this.state.destroyed||(this.state.destroyed=!0,this.state.ended=!0,this.buffer.data.length=0,this.buffer.error.length=0,this.listeners.data.length=0,this.listeners.error.length=0,this.listeners.end.length=0,this.pendingWritePromises.length=0)}};function qp(t,e){const i=[];let r;for(;(r=t.read())!==null;)i.push(r);return e(i)}function jp(t,e,i){const r=[];let s;for(;(s=t.read())!==null&&r.length0?e(r):{read:()=>{if(r.length>0)return r.shift();if(typeof s<"u"){const n=s;return s=void 0,n}return t.read()}}}function Qc(t,e){return new Promise((i,r)=>{const s=[];Io(t,{onData:n=>{e&&s.push(n)},onError:n=>{e?r(n):i(void 0)},onEnd:()=>{i(e?e(s):void 0)}})})}function Io(t,e,i){t.on("error",r=>{i?.isCancellationRequested||e.onError(r)}),t.on("end",()=>{i?.isCancellationRequested||e.onEnd()}),t.on("data",r=>{i?.isCancellationRequested||e.onData(r)})}function Bp(t,e){return new Promise((i,r)=>{const s=new lt,n=[],o=c=>{if(n.push(c),n.length>e)return s.dispose(),t.pause(),i({stream:t,buffer:n,ended:!1})},a=c=>(s.dispose(),r(c)),l=()=>(s.dispose(),i({stream:t,buffer:n,ended:!0}));s.add(ye(()=>t.removeListener("error",a))),t.on("error",a),s.add(ye(()=>t.removeListener("end",l))),t.on("end",l),s.add(ye(()=>t.removeListener("data",o))),t.on("data",o)})}function zp(t){let e=!1;return{read:()=>e?null:(e=!0,t)}}function Jc(t,e,i){const r=Js(i);return Io(t,{onData:s=>r.write(e.data(s)),onError:s=>r.error(e.error?e.error(s):s),onEnd:()=>r.end()}),r}var Xs=typeof Buffer<"u",Hp=new Fi(()=>new Uint8Array(256)),ko,Do,W=class It{static alloc(e){return Xs?new It(Buffer.allocUnsafe(e)):new It(new Uint8Array(e))}static wrap(e){return Xs&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new It(e)}static fromString(e,i){return!(i?.dontUseNodeBuffer||!1)&&Xs?new It(Buffer.from(e)):(ko||(ko=new TextEncoder),new It(ko.encode(e)))}static fromByteArray(e){const i=It.alloc(e.length);for(let r=0,s=e.length;r"u"){i=0;for(let n=0,o=e.length;ni===e.buffer[r])}};function Kp(t,e,i=0){const r=e.byteLength,s=t.byteLength;if(r===0)return 0;if(r===1)return t.indexOf(e[0]);if(r>s-i)return-1;const n=Hp.value;n.fill(e.length);for(let c=0;c>>8,t[i+2]=e,e=e>>>8,t[i+1]=e,e=e>>>8,t[i]=e}function Jp(t,e){return t[e+0]<<0>>>0|t[e+1]<<8>>>0|t[e+2]<<16>>>0|t[e+3]<<24>>>0}function Xp(t,e,i){t[i+0]=e&255,e=e>>>8,t[i+1]=e&255,e=e>>>8,t[i+2]=e&255,e=e>>>8,t[i+3]=e&255}function Yp(t,e){return t[e]}function Zp(t,e,i){t[i]=e}function eg(t){return qp(t,e=>W.concat(e))}function tg(t){return zp(t)}function Ni(t){return Qc(t,e=>W.concat(e))}async function ig(t){return t.ended?W.concat(t.buffer):W.concat([...t.buffer,await Ni(t.stream)])}function rg(t){return Jc(t,{data:e=>typeof e=="string"?W.fromString(e):W.wrap(e)},e=>W.concat(e))}function sg(t){return Js(e=>W.concat(e),t)}var ng=/^\w[\w\d+.-]*$/,og=/^\//,ag=/^\/\//;function lg(t,e){if(!t.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t.authority}", path: "${t.path}", query: "${t.query}", fragment: "${t.fragment}"}`);if(t.scheme&&!ng.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path){if(t.authority){if(!og.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(ag.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function cg(t,e){return!t&&!e?"file":t}function ug(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==Rt&&(e=Rt+e):e=Rt;break}return e}var me="",Rt="/",hg=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,I=class Yn{static isUri(e){return e instanceof Yn?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function":!1}constructor(e,i,r,s,n,o=!1){typeof e=="object"?(this.scheme=e.scheme||me,this.authority=e.authority||me,this.path=e.path||me,this.query=e.query||me,this.fragment=e.fragment||me):(this.scheme=cg(e,o),this.authority=i||me,this.path=ug(this.scheme,r||me),this.query=s||me,this.fragment=n||me,lg(this,o))}get fsPath(){return Ys(this,!1)}with(e){if(!e)return this;let{scheme:i,authority:r,path:s,query:n,fragment:o}=e;return i===void 0?i=this.scheme:i===null&&(i=me),r===void 0?r=this.authority:r===null&&(r=me),s===void 0?s=this.path:s===null&&(s=me),n===void 0?n=this.query:n===null&&(n=me),o===void 0?o=this.fragment:o===null&&(o=me),i===this.scheme&&r===this.authority&&s===this.path&&n===this.query&&o===this.fragment?this:new lr(i,r,s,n,o)}static parse(e,i=!1){const r=hg.exec(e);return r?new lr(r[2]||me,Zs(r[4]||me),Zs(r[5]||me),Zs(r[7]||me),Zs(r[9]||me),i):new lr(me,me,me,me,me)}static file(e){let i=me;if(_e&&(e=e.replace(/\\/g,Rt)),e[0]===Rt&&e[1]===Rt){const r=e.indexOf(Rt,2);r===-1?(i=e.substring(2),e=Rt):(i=e.substring(2,r),e=e.substring(r)||Rt)}return new lr("file",i,e,me,me)}static from(e,i){return new lr(e.scheme,e.authority,e.path,e.query,e.fragment,i)}static joinPath(e,...i){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let r;return _e&&e.scheme==="file"?r=Yn.file(Le.join(Ys(e,!0),...i)).path:r=se.join(e.path,...i),e.with({path:r})}toString(e=!1){return Co(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof Yn)return e;{const i=new lr(e);return i._formatted=e.external??null,i._fsPath=e._sep===Xc?e.fsPath??null:null,i}}else return e}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}},Xc=_e?1:void 0,lr=class extends I{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=Ys(this,!1)),this._fsPath}toString(t=!1){return t?Co(this,!0):(this._formatted||(this._formatted=Co(this,!1)),this._formatted)}toJSON(){const t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=Xc),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t}},Yc={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function Zc(t,e,i){let r,s=-1;for(let n=0;n=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||e&&o===47||i&&o===91||i&&o===93||i&&o===58)s!==-1&&(r+=encodeURIComponent(t.substring(s,n)),s=-1),r!==void 0&&(r+=t.charAt(n));else{r===void 0&&(r=t.substr(0,n));const a=Yc[o];a!==void 0?(s!==-1&&(r+=encodeURIComponent(t.substring(s,n)),s=-1),r+=a):s===-1&&(s=n)}}return s!==-1&&(r+=encodeURIComponent(t.substring(s))),r!==void 0?r:t}function fg(t){let e;for(let i=0;i1&&t.scheme==="file"?i=`//${t.authority}${t.path}`:t.path.charCodeAt(0)===47&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&t.path.charCodeAt(2)===58?e?i=t.path.substr(1):i=t.path[1].toLowerCase()+t.path.substr(2):i=t.path,_e&&(i=i.replace(/\//g,"\\")),i}function Co(t,e){const i=e?fg:Zc;let r="",{scheme:s,authority:n,path:o,query:a,fragment:l}=t;if(s&&(r+=s,r+=":"),(n||s==="file")&&(r+=Rt,r+=Rt),n){let c=n.indexOf("@");if(c!==-1){const h=n.substr(0,c);n=n.substr(c+1),c=h.lastIndexOf(":"),c===-1?r+=i(h,!1,!1):(r+=i(h.substr(0,c),!1,!1),r+=":",r+=i(h.substr(c+1),!1,!0)),r+="@"}n=n.toLowerCase(),c=n.lastIndexOf(":"),c===-1?r+=i(n,!1,!0):(r+=i(n.substr(0,c),!1,!0),r+=n.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){const c=o.charCodeAt(1);c>=65&&c<=90&&(o=`/${String.fromCharCode(c+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){const c=o.charCodeAt(0);c>=65&&c<=90&&(o=`${String.fromCharCode(c+32)}:${o.substr(2)}`)}r+=i(o,!0,!1)}return a&&(r+="?",r+=i(a,!1,!1)),l&&(r+="#",r+=e?l:Zc(l,!1,!1)),r}function eu(t){try{return decodeURIComponent(t)}catch{return t.length>3?t.substr(0,3)+eu(t.substr(3)):t}}var tu=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Zs(t){return t.match(tu)?t.replace(tu,e=>eu(e)):t}var ie;(function(t){t.inMemory="inmemory",t.vscode="vscode",t.internal="private",t.walkThrough="walkThrough",t.walkThroughSnippet="walkThroughSnippet",t.http="http",t.https="https",t.file="file",t.git="git",t.mailto="mailto",t.untitled="untitled",t.data="data",t.command="command",t.vscodeRemote="vscode-remote",t.vscodeRemoteResource="vscode-remote-resource",t.vscodeManagedRemoteResource="vscode-managed-remote-resource",t.vscodeUserData="vscode-userdata",t.vscodeCustomEditor="vscode-custom-editor",t.vscodeNotebook="vscode-notebook",t.vscodeNotebookCell="vscode-notebook-cell",t.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",t.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",t.vscodeNotebookCellOutput="vscode-notebook-cell-output",t.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",t.vscodeNotebookMetadata="vscode-notebook-metadata",t.vscodeInteractiveInput="vscode-interactive-input",t.vscodeSettings="vscode-settings",t.vscodeWorkspaceTrust="vscode-workspace-trust",t.vscodeTerminal="vscode-terminal",t.terminal="terminal",t.vscodeChatCodeBlock="vscode-chat-code-block",t.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",t.vscodeChatSesssion="vscode-chat-editor",t.webviewPanel="webview-panel",t.vscodeWebview="vscode-webview",t.extension="extension",t.aiChat="cursor.aichat",t.notepad="cursor.notepad",t.contextObject="cursor.context-object",t.composer="cursor.composer",t.aiSettings="cursor.aisettings",t.tinderDiffEditor="cursor.tinderdiffeditor",t.vscodeFileResource="vscode-file",t.tmp="tmp",t.vsls="vsls",t.vscodeSourceControl="vscode-scm",t.commentsInput="comment",t.codeSetting="code-setting",t.cursorDev="cursor-dev-utils",t.outputChannel="output",t.accessibleView="accessible-view",t.backgroundComposer="cursor.backgroundcomposer",t.personalEnvironmentJson="cursor.personalenvironmentjson",t.bugbot="cursor.bugbot",t.aiEditorBox="aiEditorBox",t.backgroundComposerPeek="background-composer-peek"})(ie||(ie={}));var dg="tkn",pg=class{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._serverRootPath="/"}setPreferredWebSchema(t){this._preferredWebSchema=t}setDelegate(t){this._delegate=t}setServerRootPath(t,e){this._serverRootPath=se.join(e??"/",mg(t))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return se.join(this._serverRootPath,ie.vscodeRemoteResource)}set(t,e,i){this._hosts[t]=e,this._ports[t]=i}setConnectionToken(t,e){this._connectionTokens[t]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(t){if(this._delegate)try{return this._delegate(t)}catch(o){return Nt(o),t}const e=t.authority;let i=this._hosts[e];i&&i.indexOf(":")!==-1&&i.indexOf("[")===-1&&(i=`[${i}]`);const r=this._ports[e],s=this._connectionTokens[e];let n=`path=${encodeURIComponent(t.path)}`;return typeof s=="string"&&(n+=`&${dg}=${encodeURIComponent(s)}`),I.from({scheme:ei?this._preferredWebSchema:ie.vscodeRemoteResource,authority:`${i}:${r}`,path:this._remoteResourcesPath,query:n})}},gg=new pg;function mg(t){return`${t.quality??"oss"}-${t.commit??"dev"}`}var vg="vscode-app",yg=class Zn{static{this.FALLBACK_AUTHORITY=vg}asBrowserUri(e){const i=this.toUri(e);return this.uriToBrowserUri(i)}uriToBrowserUri(e){return e.scheme===ie.vscodeRemote?gg.rewrite(e):e.scheme===ie.file&&(op||lp===`${ie.vscodeFileResource}://${Zn.FALLBACK_AUTHORITY}`)?e.with({scheme:ie.vscodeFileResource,authority:e.authority||Zn.FALLBACK_AUTHORITY,query:null,fragment:null}):e}asFileUri(e){const i=this.toUri(e);return this.uriToFileUri(i)}uriToFileUri(e){return e.scheme===ie.vscodeFileResource?e.with({scheme:ie.file,authority:e.authority!==Zn.FALLBACK_AUTHORITY?e.authority:null,query:null,fragment:null}):e}toUri(e){if(I.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){const i=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(i))return I.joinPath(I.parse(i,!0),e);const r=G(i,e);return I.file(r)}throw new Error("Cannot determine URI for module id!")}},en=new yg,p2=Object.freeze({"Cache-Control":"no-cache, no-store"}),g2=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports, js-profiling"}),iu;(function(t){const e=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);t.CoopAndCoep=Object.freeze(e.get("3"));const i="vscode-coi";function r(n){let o;typeof n=="string"?o=new URL(n).searchParams:n instanceof URL?o=n.searchParams:I.isUri(n)&&(o=new URL(n.toString(!0)).searchParams);const a=o?.get(i);if(a)return e.get(a)}t.getHeadersFromQuery=r;function s(n,o,a){if(!globalThis.crossOriginIsolated)return;const l=o&&a?"3":a?"2":"1";n instanceof URLSearchParams?n.set(i,l):n[i]=l}t.addSearchParam=s})(iu||(iu={}));function ri(t){return Ys(t,!0)}var tn=class{constructor(t){this._ignorePathCasing=t}compare(t,e,i=!1){return t===e?0:Eo(this.getComparisonKey(t,i),this.getComparisonKey(e,i))}isEqual(t,e,i=!1){return t===e?!0:!t||!e?!1:this.getComparisonKey(t,i)===this.getComparisonKey(e,i)}getComparisonKey(t,e=!1){return t.with({path:this._ignorePathCasing(t)?t.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(t){return this._ignorePathCasing(t)}isEqualOrParent(t,e,i=!1){if(t.scheme===e.scheme){if(t.scheme===ie.file)return Br(ri(t),ri(e),this._ignorePathCasing(t))&&t.query===e.query&&(i||t.fragment===e.fragment);if(nu(t.authority,e.authority))return Br(t.path,e.path,this._ignorePathCasing(t),"/")&&t.query===e.query&&(i||t.fragment===e.fragment)}return!1}joinPath(t,...e){return I.joinPath(t,...e)}basenameOrAuthority(t){return cr(t)||t.authority}basename(t){return se.basename(t.path)}extname(t){return se.extname(t.path)}dirname(t){if(t.path.length===0)return t;let e;return t.scheme===ie.file?e=I.file(pi(ri(t))).path:(e=se.dirname(t.path),t.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${t.toString})) resulted in a relative path`),e="/")),t.with({path:e})}normalizePath(t){if(!t.path.length)return t;let e;return t.scheme===ie.file?e=I.file(di(ri(t))).path:e=se.normalize(t.path),t.with({path:e})}relativePath(t,e){if(t.scheme!==e.scheme||!nu(t.authority,e.authority))return;if(t.scheme===ie.file){const s=Wc(ri(t),ri(e));return _e?Hc(s):s}let i=t.path||"/";const r=e.path||"/";if(this._ignorePathCasing(t)){let s=0;for(const n=Math.min(i.length,r.length);sKc(i).length&&i[i.length-1]===e}else{const i=t.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(t.fsPath)}}removeTrailingPathSeparator(t,e=tt){return ou(t,e)?t.with({path:t.path.substr(0,t.path.length-1)}):t}addTrailingPathSeparator(t,e=tt){let i=!1;if(t.scheme===ie.file){const r=ri(t);i=r!==void 0&&r.length===Kc(r).length&&r[r.length-1]===e}else{e="/";const r=t.path;i=r.length===1&&r.charCodeAt(r.length-1)===47}return!i&&!ou(t,e)?t.with({path:t.path+"/"}):t}},te=new tn(()=>!1),Ro=new tn(t=>t.scheme===ie.file?!et:!0),wg=new tn(t=>!0),ru=te.isEqual.bind(te),su=te.isEqualOrParent.bind(te),m2=te.getComparisonKey.bind(te),v2=te.basenameOrAuthority.bind(te),cr=te.basename.bind(te),y2=te.extname.bind(te),Sg=te.dirname.bind(te),j=te.joinPath.bind(te),bg=te.normalizePath.bind(te),w2=te.relativePath.bind(te),S2=te.resolvePath.bind(te),Eg=te.isAbsolutePath.bind(te),nu=te.isEqualAuthority.bind(te),ou=te.hasTrailingPathSeparator.bind(te),b2=te.removeTrailingPathSeparator.bind(te),E2=te.addTrailingPathSeparator.bind(te),au;(function(t){t.META_DATA_LABEL="label",t.META_DATA_DESCRIPTION="description",t.META_DATA_SIZE="size",t.META_DATA_MIME="mime";function e(i){const r=new Map;i.path.substring(i.path.indexOf(";")+1,i.path.lastIndexOf(";")).split(";").forEach(o=>{const[a,l]=o.split(":");a&&l&&r.set(a,l)});const n=i.path.substring(0,i.path.indexOf(";"));return n&&r.set(t.META_DATA_MIME,n),r}t.parseMetaData=e})(au||(au={}));var _g=Symbol("MicrotaskDelay");function Lo(t){return!!t&&typeof t.then=="function"}function si(t){const e=new sr,i=t(e.token);let r=!1;const s=new Promise((n,o)=>{const a=e.token.onCancellationRequested(()=>{r=!0,a.dispose(),o(new Te)});Promise.resolve(i).then(l=>{a.dispose(),e.dispose(),r?gc(l)&&l.dispose():n(l)},l=>{a.dispose(),e.dispose(),o(l)})});return new class{cancel(){e.cancel(),e.dispose()}then(n,o){return s.then(n,o)}catch(n){return this.then(void 0,n)}finally(n){return s.finally(n)}}}function xg(t,e,i){let r;const s=setTimeout(()=>{r?.(void 0),i?.()},e);return Promise.race([t.finally(()=>clearTimeout(s)),new Promise(n=>r=n)])}var lu=class{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(t){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=t,!this.queuedPromise){const e=()=>{if(this.queuedPromise=null,this.isDisposed)return;const i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(e,e).then(i)})}return new Promise((e,i)=>{this.queuedPromise.then(e,i)})}return this.activePromise=t(),new Promise((e,i)=>{this.activePromise.then(r=>{this.activePromise=null,e(r)},r=>{this.activePromise=null,i(r)})})}dispose(){this.isDisposed=!0}},Pg=class{constructor(){this.current=Promise.resolve(null)}queue(t){return this.current=this.current.then(()=>t(),()=>t())}},Ig=(t,e)=>{let i=!0;const r=setTimeout(()=>{i=!1,e()},t);return{isTriggered:()=>i,dispose:()=>{clearTimeout(r),i=!1}}},kg=t=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,t())}),{isTriggered:()=>e,dispose:()=>{e=!1}}},cu=class{constructor(t){this.defaultDelay=t,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(t,e=this.defaultDelay){this.task=t,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((r,s)=>{this.doResolve=r,this.doReject=s}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const r=this.task;return this.task=null,r()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===_g?kg(i):Ig(e,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new Te),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},Mi=class{constructor(t){this.delayer=new cu(t),this.throttler=new lu}trigger(t,e){return this.delayer.trigger(()=>this.throttler.queue(t),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},uu=class{constructor(){this._isOpen=!1,this._promise=new Promise((t,e)=>{this._completePromise=t})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}};function zr(t,e){return e?new Promise((i,r)=>{const s=setTimeout(()=>{n.dispose(),i()},t),n=e.onCancellationRequested(()=>{clearTimeout(s),n.dispose(),r(new Te)})}):si(i=>zr(t,i))}var hu=class{constructor(t){this._size=0,this._isDisposed=!1,this.maxDegreeOfParalellism=t,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new O}whenIdle(){return this.size>0?ae.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(t){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,i)=>{this.outstandingPromises.push({factory:t,c:e,e:i}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,--this._size===0&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}},Hr=class extends hu{constructor(){super(1)}},fu=class{constructor(){this.queues=new Map,this.drainers=new Set,this.drainListeners=void 0,this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;const t=new Ao;return this.drainers.add(t),t.p}isDrained(){for(const[,t]of this.queues)if(t.size>0)return!1;return!0}queueSize(t,e=te){const i=e.getComparisonKey(t);return this.queues.get(i)?.size??0}queueFor(t,e,i=te){const r=i.getComparisonKey(t);let s=this.queues.get(r);if(!s){s=new Hr;const n=this.drainListenerCount++,o=ae.once(s.onDrained)(()=>{s?.dispose(),this.queues.delete(r),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(n),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new po),this.drainListeners.set(n,o),this.queues.set(r,s)}return s.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(const t of this.drainers)t.complete();this.drainers.clear()}dispose(){for(const[,t]of this.queues)t.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}},rn=class{constructor(t,e){this.timeoutToken=-1,this.runner=t,this.timeout=e,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(t=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,t)}get delay(){return this.timeout}set delay(t){this.timeout=t}isScheduled(){return this.timeoutToken!==-1}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}},Dg=class extends rn{constructor(t,e){super(t,e),this.units=[]}work(t){this.units.push(t),this.isScheduled()||this.schedule()}doRun(){const t=this.units;this.units=[],this.runner?.(t)}dispose(){this.units=[],super.dispose()}},du=class extends K{constructor(t,e){super(),this.options=t,this.handler=e,this.pendingWork=[],this.throttler=this._register(new Ur),this.disposed=!1,this.lastExecutionTime=0}get pending(){return this.pendingWork.length}work(t){if(this.disposed)return!1;if(typeof this.options.maxBufferedWork=="number"){if(this.throttler.value){if(this.pending+t.length>this.options.maxBufferedWork)return!1}else if(this.pending+t.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1}for(const i of t)this.pendingWork.push(i);const e=Date.now()-this.lastExecutionTime;return!this.throttler.value&&(!this.options.waitThrottleDelayBetweenWorkUnits||e>=this.options.throttleDelay)?this.doWork():!this.throttler.value&&this.options.waitThrottleDelayBetweenWorkUnits&&this.scheduleThrottler(Math.max(this.options.throttleDelay-e,0)),!0}doWork(){this.lastExecutionTime=Date.now(),this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&this.scheduleThrottler()}scheduleThrottler(t=this.options.throttleDelay){this.throttler.value=new rn(()=>{this.throttler.clear(),this.doWork()},t),this.throttler.value.schedule()}dispose(){super.dispose(),this.pendingWork.length=0,this.disposed=!0}},pu,sn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?sn=(t,e,i)=>{up(()=>{if(r)return;const s=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let r=!1;return{dispose(){r||(r=!0)}}}:sn=(t,e,i)=>{const r=t.requestIdleCallback(e,typeof i=="number"?{timeout:i}:void 0);let s=!1;return{dispose(){s||(s=!0,t.cancelIdleCallback(r))}}},pu=(t,e)=>sn(globalThis,t,e)})();var Cg=class{constructor(t,e){this._didRun=!1,this._executor=()=>{try{this._value=e()}catch(i){this._error=i}finally{this._didRun=!0}},this._handle=sn(t,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}},Rg=class extends Cg{constructor(t){super(globalThis,t)}};async function Lg(t,e,i){let r;for(let s=0;s{this.completeCallback=t,this.errorCallback=e})}complete(t){return new Promise(e=>{this.completeCallback(t),this.outcome={outcome:0,value:t},e()})}error(t){return new Promise(e=>{this.errorCallback(t),this.outcome={outcome:1,value:t},e()})}cancel(){return this.error(new Te)}},ht;(function(t){async function e(r){let s;const n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(ht||(ht={}));var mu;(function(t){t[t.Initial=0]="Initial",t[t.DoneOK=1]="DoneOK",t[t.DoneError=2]="DoneError"})(mu||(mu={}));var _2=class St{static fromArray(e){return new St(i=>{i.emitMany(e)})}static fromPromise(e){return new St(async i=>{i.emitMany(await e)})}static fromPromisesResolveOrder(e){return new St(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new St(async i=>{await Promise.all(e.map(async r=>{for await(const s of r)i.emitOne(s)}))})}static{this.EMPTY=St.fromArray([])}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new O,queueMicrotask(async()=>{const r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new St(async r=>{for await(const s of e)r.emitOne(i(s))})}map(e){return St.map(this,e)}static filter(e,i){return new St(async r=>{for await(const s of e)i(s)&&r.emitOne(s)})}filter(e){return St.filter(this,e)}static coalesce(e){return St.filter(e,i=>!!i)}coalesce(){return St.coalesce(this)}static async toPromise(e){const i=[];for await(const r of e)i.push(r);return i}toPromise(){return St.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};function Oo(t,e){return e&&(t.stack||t.stacktrace)?g(110,null,yu(t),vu(t.stack)||vu(t.stacktrace)):yu(t)}function vu(t){return Array.isArray(t)?t.join(` `):t}function yu(t){return t.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${t.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof t.code=="string"&&typeof t.errno=="number"&&typeof t.syscall=="string"?g(111,null,t.message):t.message||g(112,null)}function Ui(t=null,e=!1){if(!t)return g(113,null);if(Array.isArray(t)){const i=ir(t),r=Ui(i[0],e);return i.length>1?g(114,null,r,i.length):r}if(Re(t))return t;if(t.detail){const i=t.detail;if(i.error)return Oo(i.error,e);if(i.exception)return Oo(i.exception,e)}return t.stack?Oo(t,e):t.message?t.message:g(115,null)}var Lt;(function(t){t.serviceIds=new Map,t.DI_TARGET="$di$target",t.DI_DEPENDENCIES="$di$dependencies";function e(i){return i[t.DI_DEPENDENCIES]||[]}t.getServiceDependencies=e})(Lt||(Lt={}));var nn=le("instantiationService");function Ag(t,e,i){e[Lt.DI_TARGET]===e?e[Lt.DI_DEPENDENCIES].push({id:t,index:i}):(e[Lt.DI_DEPENDENCIES]=[{id:t,index:i}],e[Lt.DI_TARGET]=e)}function le(t){if(Lt.serviceIds.has(t))return Lt.serviceIds.get(t);const e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ag(e,i,s)};return e.toString=()=>t,Lt.serviceIds.set(t,e),e}function x2(t){return t}var ni=le("configurationService");function Fo(t){return t&&typeof t=="object"&&(!t.overrideIdentifier||typeof t.overrideIdentifier=="string")&&(!t.resource||t.resource instanceof I)}function Og(t){return t&&typeof t=="object"&&(!t.overrideIdentifiers||Array.isArray(t.overrideIdentifiers))&&!t.overrideIdentifier&&(!t.resource||t.resource instanceof I)}var wu;(function(t){t[t.APPLICATION=1]="APPLICATION",t[t.USER=2]="USER",t[t.USER_LOCAL=3]="USER_LOCAL",t[t.USER_REMOTE=4]="USER_REMOTE",t[t.WORKSPACE=5]="WORKSPACE",t[t.WORKSPACE_FOLDER=6]="WORKSPACE_FOLDER",t[t.DEFAULT=7]="DEFAULT",t[t.MEMORY=8]="MEMORY"})(wu||(wu={}));function To(t,e){const i=Object.create(null);for(const r in t)Su(i,r,t[r],e);return i}function Su(t,e,i,r){const s=e.split("."),n=s.pop();let o=t;for(let a=0;a"u"?i:n}function Tg(t){return t.replace(/[\[\]]/g,"")}var Eu;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(Eu||(Eu={}));var _u;(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(_u||(_u={}));var xu;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(xu||(xu={}));var Kr;(function(t){t.DEFAULT={allowTrailingComma:!0}})(Kr||(Kr={}));function Pu(t,e=!1){let i=0;const r=t.length;let s="",n=0,o=16,a=0;function l(m){let w=0,S=0;for(;w=48&&_<=57)S=S*16+_-48;else if(_>=65&&_<=70)S=S*16+_-65+10;else if(_>=97&&_<=102)S=S*16+_-97+10;else break;i++,w++}return w=r){m+=t.substring(w,i),a=2;break}const S=t.charCodeAt(i);if(S===34){m+=t.substring(w,i),i++;break}if(S===92){if(m+=t.substring(w,i),i++,i>=r){a=2;break}switch(t.charCodeAt(i++)){case 34:m+='"';break;case 92:m+="\\";break;case 47:m+="/";break;case 98:m+="\b";break;case 102:m+="\f";break;case 110:m+=` `;break;case 114:m+="\r";break;case 116:m+=" ";break;case 117:{const P=l(4);P>=0?m+=String.fromCharCode(P):a=4;break}default:a=5}w=i;continue}if(S>=0&&S<=31)if(an(S)){m+=t.substring(w,i),a=2;break}else a=6;i++}return m}function d(){if(s="",a=0,n=i,i>=r)return n=r,o=17;let m=t.charCodeAt(i);if(No(m)){do i++,s+=String.fromCharCode(m),m=t.charCodeAt(i);while(No(m));return o=15}if(an(m))return i++,s+=String.fromCharCode(m),m===13&&t.charCodeAt(i)===10&&(i++,s+=` `),o=14;switch(m){case 123:return i++,o=1;case 125:return i++,o=2;case 91:return i++,o=3;case 93:return i++,o=4;case 58:return i++,o=6;case 44:return i++,o=5;case 34:return i++,s=f(),o=10;case 47:{const w=i-1;if(t.charCodeAt(i+1)===47){for(i+=2;i=12&&m<=15);return m}return{setPosition:c,getPosition:()=>i,scan:e?v:d,getToken:()=>o,getTokenValue:()=>s,getTokenOffset:()=>n,getTokenLength:()=>i-n,getTokenError:()=>a}}function No(t){return t===32||t===9||t===11||t===12||t===160||t===5760||t>=8192&&t<=8203||t===8239||t===8287||t===12288||t===65279}function an(t){return t===10||t===13||t===8232||t===8233}function ur(t){return t>=48&&t<=57}var Iu;(function(t){t[t.nullCharacter=0]="nullCharacter",t[t.maxAsciiCharacter=127]="maxAsciiCharacter",t[t.lineFeed=10]="lineFeed",t[t.carriageReturn=13]="carriageReturn",t[t.lineSeparator=8232]="lineSeparator",t[t.paragraphSeparator=8233]="paragraphSeparator",t[t.nextLine=133]="nextLine",t[t.space=32]="space",t[t.nonBreakingSpace=160]="nonBreakingSpace",t[t.enQuad=8192]="enQuad",t[t.emQuad=8193]="emQuad",t[t.enSpace=8194]="enSpace",t[t.emSpace=8195]="emSpace",t[t.threePerEmSpace=8196]="threePerEmSpace",t[t.fourPerEmSpace=8197]="fourPerEmSpace",t[t.sixPerEmSpace=8198]="sixPerEmSpace",t[t.figureSpace=8199]="figureSpace",t[t.punctuationSpace=8200]="punctuationSpace",t[t.thinSpace=8201]="thinSpace",t[t.hairSpace=8202]="hairSpace",t[t.zeroWidthSpace=8203]="zeroWidthSpace",t[t.narrowNoBreakSpace=8239]="narrowNoBreakSpace",t[t.ideographicSpace=12288]="ideographicSpace",t[t.mathematicalSpace=8287]="mathematicalSpace",t[t.ogham=5760]="ogham",t[t._=95]="_",t[t.$=36]="$",t[t._0=48]="_0",t[t._1=49]="_1",t[t._2=50]="_2",t[t._3=51]="_3",t[t._4=52]="_4",t[t._5=53]="_5",t[t._6=54]="_6",t[t._7=55]="_7",t[t._8=56]="_8",t[t._9=57]="_9",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.ampersand=38]="ampersand",t[t.asterisk=42]="asterisk",t[t.at=64]="at",t[t.backslash=92]="backslash",t[t.bar=124]="bar",t[t.caret=94]="caret",t[t.closeBrace=125]="closeBrace",t[t.closeBracket=93]="closeBracket",t[t.closeParen=41]="closeParen",t[t.colon=58]="colon",t[t.comma=44]="comma",t[t.dot=46]="dot",t[t.doubleQuote=34]="doubleQuote",t[t.equals=61]="equals",t[t.exclamation=33]="exclamation",t[t.greaterThan=62]="greaterThan",t[t.lessThan=60]="lessThan",t[t.minus=45]="minus",t[t.openBrace=123]="openBrace",t[t.openBracket=91]="openBracket",t[t.openParen=40]="openParen",t[t.percent=37]="percent",t[t.plus=43]="plus",t[t.question=63]="question",t[t.semicolon=59]="semicolon",t[t.singleQuote=39]="singleQuote",t[t.slash=47]="slash",t[t.tilde=126]="tilde",t[t.backspace=8]="backspace",t[t.formFeed=12]="formFeed",t[t.byteOrderMark=65279]="byteOrderMark",t[t.tab=9]="tab",t[t.verticalTab=11]="verticalTab"})(Iu||(Iu={}));function Gr(t,e=[],i=Kr.DEFAULT){let r=null,s=[];const n=[];function o(l){Array.isArray(s)?s.push(l):r!==null&&(s[r]=l)}return ln(t,{onObjectBegin:()=>{const l={};o(l),n.push(s),s=l,r=null},onObjectProperty:l=>{r=l},onObjectEnd:()=>{s=n.pop()},onArrayBegin:()=>{const l=[];o(l),n.push(s),s=l,r=null},onArrayEnd:()=>{s=n.pop()},onLiteralValue:o,onError:(l,c,h)=>{e.push({error:l,offset:c,length:h})}},i),s[0]}function Ng(t,e=[],i=Kr.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function s(l){r.type==="property"&&(r.length=l-r.offset,r=r.parent)}function n(l){return r.children.push(l),l}ln(t,{onObjectBegin:l=>{r=n({type:"object",offset:l,length:-1,parent:r,children:[]})},onObjectProperty:(l,c,h)=>{r=n({type:"property",offset:c,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:l,offset:c,length:h,parent:r})},onObjectEnd:(l,c)=>{r.length=l+c-r.offset,r=r.parent,s(l+c)},onArrayBegin:(l,c)=>{r=n({type:"array",offset:l,length:-1,parent:r,children:[]})},onArrayEnd:(l,c)=>{r.length=l+c-r.offset,r=r.parent,s(l+c)},onLiteralValue:(l,c,h)=>{n({type:Qr(l),offset:c,length:h,parent:r,value:l}),s(c+h)},onSeparator:(l,c,h)=>{r.type==="property"&&(l===":"?r.colonOffset=c:l===","&&s(c))},onError:(l,c,h)=>{e.push({error:l,offset:c,length:h})}},i);const a=r.children[0];return a&&delete a.parent,a}function ku(t,e){if(!t)return;let i=t;for(const r of e)if(typeof r=="string"){if(i.type!=="object"||!Array.isArray(i.children))return;let s=!1;for(const n of i.children)if(Array.isArray(n.children)&&n.children[0].value===r){i=n.children[1],s=!0;break}if(!s)return}else{const s=r;if(i.type!=="array"||s<0||!Array.isArray(i.children)||s>=i.children.length)return;i=i.children[s]}return i}function ln(t,e,i=Kr.DEFAULT){const r=Pu(t,!1);function s(C){return C?()=>C(r.getTokenOffset(),r.getTokenLength()):()=>!0}function n(C){return C?ee=>C(ee,r.getTokenOffset(),r.getTokenLength()):()=>!0}const o=s(e.onObjectBegin),a=n(e.onObjectProperty),l=s(e.onObjectEnd),c=s(e.onArrayBegin),h=s(e.onArrayEnd),f=n(e.onLiteralValue),d=n(e.onSeparator),p=s(e.onComment),v=n(e.onError),m=i&&i.disallowComments,w=i&&i.allowTrailingComma;function S(){for(;;){const C=r.scan();switch(r.getTokenError()){case 4:_(14);break;case 5:_(15);break;case 3:_(13);break;case 1:m||_(11);break;case 2:_(12);break;case 6:_(16);break}switch(C){case 12:case 13:m?_(10):p();break;case 16:_(1);break;case 15:case 14:break;default:return C}}}function _(C,ee=[],Fe=[]){if(v(C),ee.length+Fe.length>0){let B=r.getToken();for(;B!==17;){if(ee.indexOf(B)!==-1){S();break}else if(Fe.indexOf(B)!==-1)break;B=S()}}}function P(C){const ee=r.getTokenValue();return C?f(ee):a(ee),S(),!0}function N(){switch(r.getToken()){case 11:{let C=0;try{C=JSON.parse(r.getTokenValue()),typeof C!="number"&&(_(2),C=0)}catch{_(2)}f(C);break}case 7:f(null);break;case 8:f(!0);break;case 9:f(!1);break;default:return!1}return S(),!0}function x(){return r.getToken()!==10?(_(3,[],[2,5]),!1):(P(!1),r.getToken()===6?(d(":"),S(),Z()||_(4,[],[2,5])):_(5,[],[2,5]),!0)}function A(){o(),S();let C=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(C||_(4,[],[]),d(","),S(),r.getToken()===2&&w)break}else C&&_(6,[],[]);x()||_(4,[],[2,5]),C=!0}return l(),r.getToken()!==2?_(7,[2],[]):S(),!0}function M(){c(),S();let C=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(C||_(4,[],[]),d(","),S(),r.getToken()===4&&w)break}else C&&_(6,[],[]);Z()||_(4,[],[4,5]),C=!0}return h(),r.getToken()!==4?_(8,[4],[]):S(),!0}function Z(){switch(r.getToken()){case 3:return M();case 1:return A();case 10:return P(!0);default:return N()}}return S(),r.getToken()===17?i.allowEmptyContent?!0:(_(4,[],[]),!1):Z()?(r.getToken()!==17&&_(9,[],[]),!0):(_(4,[],[]),!1)}function Qr(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}function Mg(t,e,i){let r,s,n,o,a;if(e){for(o=e.offset,a=o+e.length,n=o;n>0&&!cn(t,n-1);)n--;let P=a;for(;Po&&t.substring(N,x)!==P&&w.push({offset:N,length:x-N,content:P})}let _=m();if(_!==17){const P=d.getTokenOffset()+n,N=Mo(f,r);S(N,n,P)}for(;_!==17;){let P=d.getTokenOffset()+d.getTokenLength()+n,N=m(),x="";for(;!c&&(N===12||N===13);){const M=d.getTokenOffset()+n;S(" ",P,M),P=d.getTokenOffset()+d.getTokenLength()+n,x=N===12?v():"",N=m()}if(N===2)_!==1&&(h--,x=v());else if(N===4)_!==3&&(h--,x=v());else{switch(_){case 3:case 1:h++,x=v();break;case 5:case 12:x=v();break;case 13:c?x=v():x=" ";break;case 6:x=" ";break;case 10:if(N===6){x="";break}case 7:case 8:case 9:case 11:case 2:case 4:N===12||N===13?x=" ":N!==5&&N!==17&&(p=!0);break;case 16:p=!0;break}c&&(N===12||N===13)&&(x=v())}const A=d.getTokenOffset()+n;S(x,P,A),_=N}return w}function Mo(t,e){let i="";for(let r=0;r0&&(c=n.pop(),l=ku(a,n),l===void 0&&i!==void 0);)typeof c=="string"?i={[c]:i}:i=[i];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){const h=ku(l,[c]);if(h!==void 0)if(i===void 0){if(!h.parent)throw new Error("Malformed AST");const f=l.children.indexOf(h.parent);let d,p=h.parent.offset+h.parent.length;if(f>0){const v=l.children[f-1];d=v.offset+v.length}else d=l.offset+1,l.children.length>1&&(p=l.children[1].offset);return hr(t,{offset:d,length:p-d,content:""},r)}else return hr(t,{offset:h.offset,length:h.length,content:JSON.stringify(i)},r);else{if(i===void 0)return[];const f=`${JSON.stringify(c)}: ${JSON.stringify(i)}`,d=s?s(l.children.map(v=>v.children[0].value)):l.children.length;let p;if(d>0){const v=l.children[d-1];p={offset:v.offset+v.length,length:0,content:","+f}}else l.children.length===0?p={offset:l.offset+1,length:0,content:f}:p={offset:l.offset+1,length:0,content:f+","};return hr(t,p,r)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children))if(i!==void 0){const h=`${JSON.stringify(i)}`;let f;if(l.children.length===0||c===0)f={offset:l.offset+1,length:0,content:l.children.length===0?h:h+","};else{const d=c===-1||c>l.children.length?l.children.length:c,p=l.children[d-1];f={offset:p.offset+p.length,length:0,content:","+h}}return hr(t,f,r)}else{const h=c,f=l.children[h];let d;if(l.children.length===1)d={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===h){const p=l.children[h-1],v=p.offset+p.length,m=l.offset+l.length;d={offset:v,length:m-2-v,content:""}}else d={offset:f.offset,length:l.children[h+1].offset-f.offset,content:""};return hr(t,d,r)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${l.type}`);else return i===void 0?[]:hr(t,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(i)},r)}function hr(t,e,i){let r=Uo(t,e),s=e.offset,n=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;s>0&&!cn(r,s-1);)s--;for(;n=0;l--){const c=o[l];r=Uo(r,c),s=Math.min(s,c.offset),n=Math.max(n,c.offset+c.length),n+=c.content.length-c.length}const a=t.length-(r.length-n)-s;return[{offset:s,length:a,content:r.substring(s,n)}]}function Uo(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}function $g(t,e){const i=e.slice(0).sort((s,n)=>{const o=s.offset-n.offset;return o===0?s.length-n.length:o});let r=t.length;for(let s=i.length-1;s>=0;s--){const n=i[s];if(n.offset+n.length<=r)t=Uo(t,n);else throw new Error("Overlapping edit");r=n.offset}return t}function oi(t){if(!t||typeof t!="object"||t instanceof RegExp)return t;const e=Array.isArray(t)?[]:{};return Object.entries(t).forEach(([i,r])=>{e[i]=r&&typeof r=="object"?oi(r):r}),e}function qg(t){if(!t||typeof t!="object")return t;const e=[t];for(;e.length>0;){const i=e.shift();Object.freeze(i);for(const r in i)if(Du.call(i,r)){const s=i[r];typeof s=="object"&&!Object.isFrozen(s)&&!F1(s)&&e.push(s)}}return t}var Du=Object.prototype.hasOwnProperty;function jg(t,e){return Vo(t,e,new Set)}function Vo(t,e,i){if(Qe(t))return t;const r=e(t);if(typeof r<"u")return r;if(Array.isArray(t)){const s=[];for(const n of t)s.push(Vo(n,e,i));return s}if(Ne(t)){if(i.has(t))throw new Error("Cannot clone recursive data-structure");i.add(t);const s={};for(const n in t)Du.call(t,n)&&(s[n]=Vo(t[n],e,i));return i.delete(t),s}return t}function Jr(t,e,i=!0){return Ne(t)?(Ne(e)&&Object.keys(e).forEach(r=>{r in t?i&&(Ne(t[r])&&Ne(e[r])?Jr(t[r],e[r],i):t[r]=e[r]):t[r]=e[r]}),t):e}function $t(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0||typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;let i,r;if(Array.isArray(t)){if(t.length!==e.length)return!1;for(i=0;i{if(t===h)return!0;const f=JSON.stringify(h);if(f.length<30)return!0;const d=i.get(f);if(!d){const p={schemas:[h]};return i.set(f,p),r.set(h,p),!0}return d.schemas.push(h),r.set(h,d),e=!0,!1}),i.clear(),!e)return JSON.stringify(t);let n="$defs";for(;t.hasOwnProperty(n);)n+="_";const o=[];function a(h){return JSON.stringify(h,(f,d)=>{if(d!==h){const p=r.get(d);if(p&&p.schemas.length>1)return p.id||(p.id=`_${o.length}`,o.push(p.schemas[0])),{$ref:`#/${n}/${p.id}`}}return d})}const l=a(t),c=[];for(let h=0;h{for(const c of l)fr(c)&&o.push(c)},r=(...l)=>{for(const c of l)if(fr(c))for(const h in c){const f=c[h];fr(f)&&o.push(f)}},s=(...l)=>{for(const c of l)if(Array.isArray(c))for(const h of c)fr(h)&&o.push(h)},n=l=>{if(Array.isArray(l))for(const c of l)fr(c)&&o.push(c);else fr(l)&&o.push(l)},o=[t];let a=o.pop();for(;a;)e(a)&&(i(a.additionalItems,a.additionalProperties,a.not,a.contains,a.propertyNames,a.if,a.then,a.else,a.unevaluatedItems,a.unevaluatedProperties),r(a.definitions,a.$defs,a.properties,a.patternProperties,a.dependencies,a.dependentSchemas),s(a.anyOf,a.allOf,a.oneOf,a.prefixItems),n(a.items)),a=o.pop()}var Hg=class{constructor(){this.data=new Map}add(t,e){fo(Re(t)),fo(Ne(e)),fo(!this.data.has(t),"There is already an extension with this id"),this.data.set(t,e)}knows(t){return this.data.has(t)}as(t){return this.data.get(t)||null}dispose(){this.data.forEach(t=>{M1(t.dispose)&&t.dispose()}),this.data.clear()}},qt=new Hg,Cu={JSONContribution:"base.contributions.json"};function Ru(t){return t.length>0&&t.charAt(t.length-1)==="#"?t.substring(0,t.length-1):t}var Kg=class extends K{constructor(){super(...arguments),this.schemasById={},this.schemaAssociations={},this._onDidChangeSchema=this._register(new O),this.onDidChangeSchema=this._onDidChangeSchema.event,this._onDidChangeSchemaAssociations=this._register(new O),this.onDidChangeSchemaAssociations=this._onDidChangeSchemaAssociations.event}registerSchema(t,e,i){const r=Ru(t);this.schemasById[r]=e,this._onDidChangeSchema.fire(t),i&&i.add(ye(()=>{delete this.schemasById[r],this._onDidChangeSchema.fire(t)}))}registerSchemaAssociation(t,e){const i=Ru(t);return this.schemaAssociations[i]||(this.schemaAssociations[i]=[]),this.schemaAssociations[i].includes(e)||(this.schemaAssociations[i].push(e),this._onDidChangeSchemaAssociations.fire()),ye(()=>{const r=this.schemaAssociations[i];if(r){const s=r.indexOf(e);s!==-1&&(r.splice(s,1),r.length===0&&delete this.schemaAssociations[i],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(t){this._onDidChangeSchema.fire(t)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(t){const e=this.schemasById[t];return e?Bg(e):void 0}hasSchemaContent(t){return!!this.schemasById[t]}getSchemaAssociations(){return this.schemaAssociations}},Gg=new Kg;qt.add(Cu.JSONContribution,Gg);var Lu;(function(t){t.Multiline="multilineText",t.Singleline="singlelineText"})(Lu||(Lu={}));var mi={Configuration:"base.contributions.configuration"},Au;(function(t){t[t.APPLICATION=1]="APPLICATION",t[t.MACHINE=2]="MACHINE",t[t.APPLICATION_MACHINE=3]="APPLICATION_MACHINE",t[t.WINDOW=4]="WINDOW",t[t.RESOURCE=5]="RESOURCE",t[t.LANGUAGE_OVERRIDABLE=6]="LANGUAGE_OVERRIDABLE",t[t.MACHINE_OVERRIDABLE=7]="MACHINE_OVERRIDABLE"})(Au||(Au={}));var un={properties:{},patternProperties:{}},hn={properties:{},patternProperties:{}},fn={properties:{},patternProperties:{}},dn={properties:{},patternProperties:{}},pn={properties:{},patternProperties:{}},gn={properties:{},patternProperties:{}},Xr={properties:{},patternProperties:{}},Vi="vscode://schemas/settings/resourceLanguage",mn=qt.as(Cu.JSONContribution),Qg=class extends K{constructor(){super(),this.registeredConfigurationDefaults=[],this.overrideIdentifiers=new Set,this._onDidSchemaChange=this._register(new O),this.onDidSchemaChange=this._onDidSchemaChange.event,this._onDidUpdateConfiguration=this._register(new O),this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:g(1801,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},mn.registerSchema(Vi,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(t,e=!0){return this.registerConfigurations([t],e),t}registerConfigurations(t,e=!0){const i=new Set;this.doRegisterConfigurations(t,e,i),mn.registerSchema(Vi,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}deregisterConfigurations(t){const e=new Set;this.doDeregisterConfigurations(t,e),mn.registerSchema(Vi,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:e})}updateConfigurations({add:t,remove:e}){const i=new Set;this.doDeregisterConfigurations(e,i),this.doRegisterConfigurations(t,!1,i),mn.registerSchema(Vi,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(t){const e=new Set;this.doRegisterDefaultConfigurations(t,e),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:e,defaultsOverrides:!0})}doRegisterDefaultConfigurations(t,e){this.registeredConfigurationDefaults.push(...t);const i=[];for(const{overrides:r,source:s}of t)for(const n in r){e.add(n);const o=this.configurationDefaultsOverrides.get(n)??this.configurationDefaultsOverrides.set(n,{configurationDefaultOverrides:[]}).get(n),a=r[n];if(o.configurationDefaultOverrides.push({value:a,source:s}),ai.test(n)){const l=this.mergeDefaultConfigurationsForOverrideIdentifier(n,a,s,o.configurationDefaultOverrideValue);if(!l)continue;o.configurationDefaultOverrideValue=l,this.updateDefaultOverrideProperty(n,l,s),i.push(...Yr(n))}else{const l=this.mergeDefaultConfigurationsForConfigurationProperty(n,a,s,o.configurationDefaultOverrideValue);if(!l)continue;o.configurationDefaultOverrideValue=l;const c=this.configurationProperties[n];c&&(this.updatePropertyDefaultValue(n,c),this.updateSchema(n,c))}}this.doRegisterOverrideIdentifiers(i)}deregisterDefaultConfigurations(t){const e=new Set;this.doDeregisterDefaultConfigurations(t,e),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:e,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(t,e){for(const i of t){const r=this.registeredConfigurationDefaults.indexOf(i);r!==-1&&this.registeredConfigurationDefaults.splice(r,1)}for(const{overrides:i,source:r}of t)for(const s in i){const n=this.configurationDefaultsOverrides.get(s);if(!n)continue;const o=n.configurationDefaultOverrides.findIndex(a=>r?a.source?.id===r.id:a.value===i[s]);if(o!==-1){if(n.configurationDefaultOverrides.splice(o,1),n.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(s),ai.test(s)){let a;for(const l of n.configurationDefaultOverrides)a=this.mergeDefaultConfigurationsForOverrideIdentifier(s,l.value,l.source,a);a&&!pc(a.value)?(n.configurationDefaultOverrideValue=a,this.updateDefaultOverrideProperty(s,a,r)):(this.configurationDefaultsOverrides.delete(s),delete this.configurationProperties[s],delete this.defaultLanguageConfigurationOverridesNode.properties[s])}else{let a;for(const c of n.configurationDefaultOverrides)a=this.mergeDefaultConfigurationsForConfigurationProperty(s,c.value,c.source,a);n.configurationDefaultOverrideValue=a;const l=this.configurationProperties[s];l&&(this.updatePropertyDefaultValue(s,l),this.updateSchema(s,l))}e.add(s)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(t,e,i){const r={type:"object",default:e.value,description:g(1802,null,Tg(t)),$ref:Vi,defaultDefaultValue:e.value,source:i,defaultValueSource:i};this.configurationProperties[t]=r,this.defaultLanguageConfigurationOverridesNode.properties[t]=r}mergeDefaultConfigurationsForOverrideIdentifier(t,e,i,r){const s=r?.value||{},n=r?.source??new Map;if(!(n instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(const o of Object.keys(e)){const a=e[o];if(Ne(a)&&(Et(s[o])||Ne(s[o]))){if(s[o]={...s[o]??{},...a},i)for(const c in a)n.set(`${o}.${c}`,i)}else s[o]=a,i?n.set(o,i):n.delete(o)}return{value:s,source:n}}mergeDefaultConfigurationsForConfigurationProperty(t,e,i,r){const s=this.configurationProperties[t],n=r?.value??s?.defaultDefaultValue;let o=i;if(Ne(e)&&(s!==void 0&&s.type==="object"||s===void 0&&(Et(n)||Ne(n)))){if(o=r?.source??new Map,!(o instanceof Map)){console.error("defaultValueSource is not a Map");return}for(const l in e)i&&o.set(`${t}.${l}`,i);e={...Ne(n)?n:{},...e}}return{value:e,source:o}}deltaConfiguration(t){let e=!1;const i=new Set;t.removedDefaults&&(this.doDeregisterDefaultConfigurations(t.removedDefaults,i),e=!0),t.addedDefaults&&(this.doRegisterDefaultConfigurations(t.addedDefaults,i),e=!0),t.removedConfigurations&&this.doDeregisterConfigurations(t.removedConfigurations,i),t.addedConfigurations&&this.doRegisterConfigurations(t.addedConfigurations,!1,i),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i,defaultsOverrides:e})}notifyConfigurationSchemaUpdated(...t){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(t){this.doRegisterOverrideIdentifiers(t),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(t){for(const e of t)this.overrideIdentifiers.add(e);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(t,e,i){t.forEach(r=>{this.validateAndRegisterProperties(r,e,r.extensionInfo,r.restrictedProperties,void 0,i),this.configurationContributors.push(r),this.registerJSONConfiguration(r)})}doDeregisterConfigurations(t,e){const i=r=>{if(r.properties)for(const s in r.properties){e.add(s);const n=this.configurationProperties[s];n?.policy?.name&&this.policyConfigurations.delete(n.policy.name),delete this.configurationProperties[s],this.removeFromSchema(s,r.properties[s])}r.allOf?.forEach(s=>i(s))};for(const r of t){i(r);const s=this.configurationContributors.indexOf(r);s!==-1&&this.configurationContributors.splice(s,1)}}validateAndRegisterProperties(t,e=!0,i,r,s=4,n){s=Qe(t.scope)?s:t.scope;const o=t.properties;if(o)for(const l in o){const c=o[l];if(e&&Yg(l,c)){delete o[l];continue}c.source=i,c.defaultDefaultValue=o[l].default,this.updatePropertyDefaultValue(l,c),ai.test(l)?c.scope=void 0:(c.scope=Qe(c.scope)?s:c.scope,c.restricted=Qe(c.restricted)?!!r?.includes(l):c.restricted);const h=o[l].hasOwnProperty("included")&&!o[l].included,f=o[l].policy?.name;h?(this.excludedConfigurationProperties[l]=o[l],f&&(this.policyConfigurations.set(f,l),n.add(l)),delete o[l]):(n.add(l),f&&this.policyConfigurations.set(f,l),this.configurationProperties[l]=o[l],!o[l].deprecationMessage&&o[l].markdownDeprecationMessage&&(o[l].deprecationMessage=o[l].markdownDeprecationMessage))}const a=t.allOf;if(a)for(const l of a)this.validateAndRegisterProperties(l,e,i,r,s,n)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){const t=new Map;for(const[e,i]of this.configurationDefaultsOverrides)i.configurationDefaultOverrideValue&&t.set(e,i.configurationDefaultOverrideValue);return t}registerJSONConfiguration(t){const e=i=>{const r=i.properties;if(r)for(const n in r)this.updateSchema(n,r[n]);i.allOf?.forEach(e)};e(t)}updateSchema(t,e){switch(un.properties[t]=e,e.scope){case 1:hn.properties[t]=e;break;case 2:dn.properties[t]=e;break;case 3:fn.properties[t]=e;break;case 7:pn.properties[t]=e;break;case 4:gn.properties[t]=e;break;case 5:Xr.properties[t]=e;break;case 6:Xr.properties[t]=e,this.resourceLanguageSettingsSchema.properties[t]=e;break}}removeFromSchema(t,e){switch(delete un.properties[t],e.scope){case 1:delete hn.properties[t];break;case 2:delete dn.properties[t];break;case 3:delete fn.properties[t];break;case 7:delete pn.properties[t];break;case 4:delete gn.properties[t];break;case 5:case 6:delete Xr.properties[t],delete this.resourceLanguageSettingsSchema.properties[t];break}}updateOverridePropertyPatternKey(){for(const t of this.overrideIdentifiers.values()){const e=`[${t}]`,i={type:"object",description:g(1803,null),errorMessage:g(1804,null),$ref:Vi};this.updatePropertyDefaultValue(e,i),un.properties[e]=i,hn.properties[e]=i,fn.properties[e]=i,dn.properties[e]=i,pn.properties[e]=i,gn.properties[e]=i,Xr.properties[e]=i}}registerOverridePropertyPatternKey(){const t={type:"object",description:g(1805,null),errorMessage:g(1806,null),$ref:Vi};un.patternProperties[vi]=t,hn.patternProperties[vi]=t,fn.patternProperties[vi]=t,dn.patternProperties[vi]=t,pn.patternProperties[vi]=t,gn.patternProperties[vi]=t,Xr.patternProperties[vi]=t,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(t,e){const i=this.configurationDefaultsOverrides.get(t)?.configurationDefaultOverrideValue;let r,s;i&&(!e.disallowConfigurationDefault||!i.source)&&(r=i.value,s=i.source),Et(r)&&(r=e.defaultDefaultValue,s=void 0),Et(r)&&(r=Xg(e.type)),e.default=r,e.defaultValueSource=s}},Ou="\\[([^\\]]+)\\]",Fu=new RegExp(Ou,"g"),vi=`^(${Ou})+$`,ai=new RegExp(vi);function Yr(t){const e=[];if(ai.test(t)){let i=Fu.exec(t);for(;i?.length;){const r=i[1].trim();r&&e.push(r),i=Fu.exec(t)}}return Xt(e)}function Jg(t){return t.reduce((e,i)=>`${e}[${i}]`,"")}function Xg(t){switch(Array.isArray(t)?t[0]:t){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var vn=new Qg;qt.add(mi.Configuration,vn);function Yg(t,e){return t.trim()?ai.test(t)?g(1808,null,t):vn.getConfigurationProperties()[t]!==void 0?g(1809,null,t):e.policy?.name&&vn.getPolicyConfigurations().get(e.policy?.name)!==void 0?g(1810,null,t,e.policy?.name,vn.getPolicyConfigurations().get(e.policy?.name)):null:g(1807,null)}function Zr(t){return Object.isFrozen(t)?t:qg(t)}var Ae=class Ji{static createEmptyModel(e){return new Ji({},[],[],void 0,e)}constructor(e,i,r,s,n){this._contents=e,this._keys=i,this._overrides=r,this.raw=s,this.logService=n,this.overrideConfigurations=new Map}get rawConfiguration(){if(!this._rawConfiguration)if(this.raw){const e=(Array.isArray(this.raw)?this.raw:[this.raw]).map(i=>{if(i instanceof Ji)return i;const r=new Tu("",this.logService);return r.parseRaw(i),r.configurationModel});this._rawConfiguration=e.reduce((i,r)=>r===i?r:i.merge(r),e[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?on(this.contents,e):this.contents}inspect(e,i){const r=this;return{get value(){return Zr(r.rawConfiguration.getValue(e))},get override(){return i?Zr(r.rawConfiguration.getOverrideValue(e,i)):void 0},get merged(){return Zr(i?r.rawConfiguration.override(i).getValue(e):r.rawConfiguration.getValue(e))},get overrides(){const s=[];for(const{contents:n,identifiers:o,keys:a}of r.rawConfiguration.overrides){const l=new Ji(n,a,[],void 0,r.logService).getValue(e);l!==void 0&&s.push({identifiers:o,value:l})}return s.length?Zr(s):void 0}}}getOverrideValue(e,i){const r=this.getContentsForOverrideIdentifer(i);return r?e?on(r,e):r:void 0}getKeysForOverrideIdentifier(e){const i=[];for(const r of this.overrides)r.identifiers.includes(e)&&i.push(...r.keys);return Xt(i)}getAllOverrideIdentifiers(){const e=[];for(const i of this.overrides)e.push(...i.identifiers);return Xt(e)}override(e){let i=this.overrideConfigurations.get(e);return i||(i=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,i)),i}merge(...e){const i=oi(this.contents),r=oi(this.overrides),s=[...this.keys],n=this.raw?Array.isArray(this.raw)?[...this.raw]:[this.raw]:[this];for(const o of e)if(n.push(...o.raw?Array.isArray(o.raw)?o.raw:[o.raw]:[o]),!o.isEmpty()){this.mergeContents(i,o.contents);for(const a of o.overrides){const[l]=r.filter(c=>tr(c.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=Xt(l.keys)):r.push(oi(a))}for(const a of o.keys)s.indexOf(a)===-1&&s.push(a)}return new Ji(i,s,r,!n.length||n.every(o=>o instanceof Ji)?void 0:n,this.logService)}createOverrideConfigurationModel(e){const i=this.getContentsForOverrideIdentifer(e);if(!i||typeof i!="object"||!Object.keys(i).length)return this;const r={};for(const s of Xt([...Object.keys(this.contents),...Object.keys(i)])){let n=this.contents[s];const o=i[s];o&&(typeof n=="object"&&typeof o=="object"?(n=oi(n),this.mergeContents(n,o)):n=o),r[s]=n}return new Ji(r,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,i){for(const r of Object.keys(i)){if(r in e&&Ne(e[r])&&Ne(i[r])){this.mergeContents(e[r],i[r]);continue}e[r]=oi(i[r])}}getContentsForOverrideIdentifer(e){let i=null,r=null;const s=n=>{n&&(r?this.mergeContents(r,n):r=oi(n))};for(const n of this.overrides)n.identifiers.length===1&&n.identifiers[0]===e?i=n.contents:n.identifiers.includes(e)&&s(n.contents);return s(i),r}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(e,i){this.updateValue(e,i,!0)}setValue(e,i){this.updateValue(e,i,!1)}removeValue(e){const i=this.keys.indexOf(e);i!==-1&&(this.keys.splice(i,1),Fg(this.contents,e),ai.test(e)&&this.overrides.splice(this.overrides.findIndex(r=>tr(r.identifiers,Yr(e))),1))}updateValue(e,i,r){if(Su(this.contents,e,i,s=>this.logService.error(s)),r=r||this.keys.indexOf(e)===-1,r&&this.keys.push(e),ai.test(e)){const s=Yr(e),n={identifiers:s,keys:Object.keys(this.contents[e]),contents:To(this.contents[e],a=>this.logService.error(a))},o=this.overrides.findIndex(a=>tr(a.identifiers,s));o!==-1?this.overrides[o]=n:this.overrides.push(n)}}},Tu=class{constructor(t,e){this._name=t,this.logService=e,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[],this._parseErrors=[]}get configurationModel(){return this._configurationModel||Ae.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(t,e){if(!Qe(t)){const i=this.doParseContent(t);this.parseRaw(i,e)}}reparse(t){this._raw&&this.parseRaw(this._raw,t)}parseRaw(t,e){this._raw=t;const{contents:i,keys:r,overrides:s,restricted:n,hasExcludedProperties:o}=this.doParseRaw(t,e);this._configurationModel=new Ae(i,r,s,o?[t]:void 0,this.logService),this._restrictedConfigurations=n||[]}doParseContent(t){let e={},i=null,r=[];const s=[],n=[];function o(l){Array.isArray(r)?r.push(l):i!==null&&(r[i]=l)}const a={onObjectBegin:()=>{const l={};o(l),s.push(r),r=l,i=null},onObjectProperty:l=>{i=l},onObjectEnd:()=>{r=s.pop()},onArrayBegin:()=>{const l=[];o(l),s.push(r),r=l,i=null},onArrayEnd:()=>{r=s.pop()},onLiteralValue:o,onError:(l,c,h)=>{n.push({error:l,offset:c,length:h})}};if(t)try{ln(t,a),e=r[0]||{}}catch(l){this.logService.error(`Error while parsing settings file ${this._name}: ${l}`),this._parseErrors=[l]}return e}doParseRaw(t,e){const i=qt.as(mi.Configuration).getConfigurationProperties(),r=this.filter(t,i,!0,e);t=r.raw;const s=To(t,a=>this.logService.error(`Conflict in settings file ${this._name}: ${a}`)),n=Object.keys(t),o=this.toOverrides(t,a=>this.logService.error(`Conflict in settings file ${this._name}: ${a}`));return{contents:s,keys:n,overrides:o,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(t,e,i,r){let s=!1;if(!r?.scopes&&!r?.skipRestricted&&!r?.exclude?.length)return{raw:t,restricted:[],hasExcludedProperties:s};const n={},o=[];for(const a in t)if(ai.test(a)&&i){const l=this.filter(t[a],e,!1,r);n[a]=l.raw,s=s||l.hasExcludedProperties,o.push(...l.restricted)}else{const l=e[a];l?.restricted&&o.push(a),this.shouldInclude(a,l,r)?n[a]=t[a]:s=!0}return{raw:n,restricted:o,hasExcludedProperties:s}}shouldInclude(t,e,i){if(i.exclude?.includes(t))return!1;if(i.include?.includes(t))return!0;if(i.skipRestricted&&e?.restricted||i.skipUnregistered&&!e)return!1;const r=e?typeof e.scope<"u"?e.scope:4:void 0;return r===void 0||i.scopes===void 0?!0:i.scopes.includes(r)}toOverrides(t,e){const i=[];for(const r of Object.keys(t))if(ai.test(r)){const s={};for(const n in t[r])s[n]=t[r][n];i.push({identifiers:Yr(r),keys:Object.keys(s),contents:To(s,e)})}return i}},Zg=class extends K{constructor(t,e,i,r,s){super(),this.userSettingsResource=t,this.parseOptions=e,this.fileService=r,this.logService=s,this._onDidChange=this._register(new O),this.onDidChange=this._onDidChange.event,this.parser=new Tu(this.userSettingsResource.toString(),s),this._register(this.fileService.watch(i.dirname(this.userSettingsResource))),this._register(this.fileService.watch(this.userSettingsResource)),this._register(ae.any(ae.filter(this.fileService.onDidFilesChange,n=>n.contains(this.userSettingsResource)),ae.filter(this.fileService.onDidRunOperation,n=>(n.isOperation(0)||n.isOperation(3)||n.isOperation(1)||n.isOperation(4))&&i.isEqual(n.resource,t)))(()=>this._onDidChange.fire()))}async loadConfiguration(){try{const t=await this.fileService.readFile(this.userSettingsResource);return this.parser.parse(t.value.toString()||"{}",this.parseOptions),this.parser.configurationModel}catch{return Ae.createEmptyModel(this.logService)}}reparse(t){return t&&(this.parseOptions=t),this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}},e0=class{constructor(t,e,i,r,s,n,o,a,l,c,h,f,d){this.key=t,this.overrides=e,this._value=i,this.overrideIdentifiers=r,this.defaultConfiguration=s,this.policyConfiguration=n,this.applicationConfiguration=o,this.userConfiguration=a,this.localUserConfiguration=l,this.remoteUserConfiguration=c,this.workspaceConfiguration=h,this.folderConfigurationModel=f,this.memoryConfigurationModel=d}get value(){return Zr(this._value)}toInspectValue(t){return t?.value!==void 0||t?.override!==void 0||t?.overrides!==void 0?t:void 0}get defaultInspectValue(){return this._defaultInspectValue||(this._defaultInspectValue=this.defaultConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._defaultInspectValue}get defaultValue(){return this.defaultInspectValue.merged}get default(){return this.toInspectValue(this.defaultInspectValue)}get policyInspectValue(){return this._policyInspectValue===void 0&&(this._policyInspectValue=this.policyConfiguration?this.policyConfiguration.inspect(this.key):null),this._policyInspectValue}get policyValue(){return this.policyInspectValue?.merged}get policy(){return this.policyInspectValue?.value!==void 0?{value:this.policyInspectValue.value}:void 0}get applicationInspectValue(){return this._applicationInspectValue===void 0&&(this._applicationInspectValue=this.applicationConfiguration?this.applicationConfiguration.inspect(this.key):null),this._applicationInspectValue}get applicationValue(){return this.applicationInspectValue?.merged}get application(){return this.toInspectValue(this.applicationInspectValue)}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get userValue(){return this.userInspectValue.merged}get user(){return this.toInspectValue(this.userInspectValue)}get userLocalInspectValue(){return this._userLocalInspectValue||(this._userLocalInspectValue=this.localUserConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userLocalInspectValue}get userLocalValue(){return this.userLocalInspectValue.merged}get userLocal(){return this.toInspectValue(this.userLocalInspectValue)}get userRemoteInspectValue(){return this._userRemoteInspectValue||(this._userRemoteInspectValue=this.remoteUserConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userRemoteInspectValue}get userRemoteValue(){return this.userRemoteInspectValue.merged}get userRemote(){return this.toInspectValue(this.userRemoteInspectValue)}get workspaceInspectValue(){return this._workspaceInspectValue===void 0&&(this._workspaceInspectValue=this.workspaceConfiguration?this.workspaceConfiguration.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceInspectValue}get workspaceValue(){return this.workspaceInspectValue?.merged}get workspace(){return this.toInspectValue(this.workspaceInspectValue)}get workspaceFolderInspectValue(){return this._workspaceFolderInspectValue===void 0&&(this._workspaceFolderInspectValue=this.folderConfigurationModel?this.folderConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier):null),this._workspaceFolderInspectValue}get workspaceFolderValue(){return this.workspaceFolderInspectValue?.merged}get workspaceFolder(){return this.toInspectValue(this.workspaceFolderInspectValue)}get memoryInspectValue(){return this._memoryInspectValue===void 0&&(this._memoryInspectValue=this.memoryConfigurationModel.inspect(this.key,this.overrides.overrideIdentifier)),this._memoryInspectValue}get memoryValue(){return this.memoryInspectValue.merged}get memory(){return this.toInspectValue(this.memoryInspectValue)}},Wo=class Md{constructor(e,i,r,s,n,o,a,l,c,h){this._defaultConfiguration=e,this._policyConfiguration=i,this._applicationConfiguration=r,this._localUserConfiguration=s,this._remoteUserConfiguration=n,this._workspaceConfiguration=o,this._folderConfigurations=a,this._memoryConfiguration=l,this._memoryConfigurationByResource=c,this.logService=h,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new Ge,this._userConfiguration=null}getValue(e,i,r){return this.getConsolidatedConfigurationModel(e,i,r).getValue(e)}updateValue(e,i,r={}){let s;r.resource?(s=this._memoryConfigurationByResource.get(r.resource),s||(s=Ae.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(r.resource,s))):s=this._memoryConfiguration,i===void 0?s.removeValue(e):s.setValue(e,i),r.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,i,r){const s=this.getConsolidatedConfigurationModel(e,i,r),n=this.getFolderConfigurationModelForResource(i.resource,r),o=i.resource?this._memoryConfigurationByResource.get(i.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(const l of s.overrides)for(const c of l.identifiers)s.getOverrideValue(e,c)!==void 0&&a.add(c);return new e0(e,i,s.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,r?this._workspaceConfiguration:void 0,n||void 0,o)}keys(e){const i=this.getFolderConfigurationModelForResource(void 0,e);return{default:this._defaultConfiguration.keys.slice(0),user:this.userConfiguration.keys.slice(0),workspace:this._workspaceConfiguration.keys.slice(0),workspaceFolder:i?i.keys.slice(0):[]}}updateDefaultConfiguration(e){this._defaultConfiguration=e,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(e){this._policyConfiguration=e}updateApplicationConfiguration(e){this._applicationConfiguration=e,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(e){this._localUserConfiguration=e,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(e){this._remoteUserConfiguration=e,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(e){this._workspaceConfiguration=e,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(e,i){this._folderConfigurations.set(e,i),this._foldersConsolidatedConfigurations.delete(e)}deleteFolderConfiguration(e){this.folderConfigurations.delete(e),this._foldersConsolidatedConfigurations.delete(e)}compareAndUpdateDefaultConfiguration(e,i){const r=[];if(!i){const{added:s,updated:n,removed:o}=yi(this._defaultConfiguration,e);i=[...s,...n,...o]}for(const s of i)for(const n of Yr(s)){const o=this._defaultConfiguration.getKeysForOverrideIdentifier(n),a=e.getKeysForOverrideIdentifier(n),l=[...a.filter(c=>o.indexOf(c)===-1),...o.filter(c=>a.indexOf(c)===-1),...o.filter(c=>!$t(this._defaultConfiguration.override(n).getValue(c),e.override(n).getValue(c)))];r.push([n,l])}return this.updateDefaultConfiguration(e),{keys:i,overrides:r}}compareAndUpdatePolicyConfiguration(e){const{added:i,updated:r,removed:s}=yi(this._policyConfiguration,e),n=[...i,...r,...s];return n.length&&this.updatePolicyConfiguration(e),{keys:n,overrides:[]}}compareAndUpdateApplicationConfiguration(e){const{added:i,updated:r,removed:s,overrides:n}=yi(this.applicationConfiguration,e),o=[...i,...r,...s];return o.length&&this.updateApplicationConfiguration(e),{keys:o,overrides:n}}compareAndUpdateLocalUserConfiguration(e){const{added:i,updated:r,removed:s,overrides:n}=yi(this.localUserConfiguration,e),o=[...i,...r,...s];return o.length&&this.updateLocalUserConfiguration(e),{keys:o,overrides:n}}compareAndUpdateRemoteUserConfiguration(e){const{added:i,updated:r,removed:s,overrides:n}=yi(this.remoteUserConfiguration,e),o=[...i,...r,...s];return o.length&&this.updateRemoteUserConfiguration(e),{keys:o,overrides:n}}compareAndUpdateWorkspaceConfiguration(e){const{added:i,updated:r,removed:s,overrides:n}=yi(this.workspaceConfiguration,e),o=[...i,...r,...s];return o.length&&this.updateWorkspaceConfiguration(e),{keys:o,overrides:n}}compareAndUpdateFolderConfiguration(e,i){const r=this.folderConfigurations.get(e),{added:s,updated:n,removed:o,overrides:a}=yi(r,i),l=[...s,...n,...o];return(l.length||!r)&&this.updateFolderConfiguration(e,i),{keys:l,overrides:a}}compareAndDeleteFolderConfiguration(e){const i=this.folderConfigurations.get(e);if(!i)throw new Error("Unknown folder");this.deleteFolderConfiguration(e);const{added:r,updated:s,removed:n,overrides:o}=yi(i,void 0);return{keys:[...r,...s,...n],overrides:o}}get defaults(){return this._defaultConfiguration}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{const e=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new Ae(e.contents,e.keys,e.overrides,void 0,this.logService)}return this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}get workspaceConfiguration(){return this._workspaceConfiguration}get folderConfigurations(){return this._folderConfigurations}getConsolidatedConfigurationModel(e,i,r){let s=this.getConsolidatedConfigurationModelForResource(i,r);if(i.overrideIdentifier&&(s=s.override(i.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0){s=s.merge();for(const n of this._policyConfiguration.keys)s.setValue(n,this._policyConfiguration.getValue(n))}return s}getConsolidatedConfigurationModelForResource({resource:e},i){let r=this.getWorkspaceConsolidatedConfiguration();if(i&&e){const s=i.getFolder(e);s&&(r=this.getFolderConsolidatedConfiguration(s.uri)||r);const n=this._memoryConfigurationByResource.get(e);n&&(r=r.merge(n))}return r}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let i=this._foldersConsolidatedConfigurations.get(e);if(!i){const r=this.getWorkspaceConsolidatedConfiguration(),s=this._folderConfigurations.get(e);s?(i=r.merge(s),this._foldersConsolidatedConfigurations.set(e,i)):i=r}return i}getFolderConfigurationModelForResource(e,i){if(i&&e){const r=i.getFolder(e);if(r)return this._folderConfigurations.get(r.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys,raw:Array.isArray(this.applicationConfiguration.raw)?void 0:this.applicationConfiguration.raw},userLocal:{contents:this.localUserConfiguration.contents,overrides:this.localUserConfiguration.overrides,keys:this.localUserConfiguration.keys,raw:Array.isArray(this.localUserConfiguration.raw)?void 0:this.localUserConfiguration.raw},userRemote:{contents:this.remoteUserConfiguration.contents,overrides:this.remoteUserConfiguration.overrides,keys:this.remoteUserConfiguration.keys,raw:Array.isArray(this.remoteUserConfiguration.raw)?void 0:this.remoteUserConfiguration.raw},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,i)=>{const{contents:r,overrides:s,keys:n}=this._folderConfigurations.get(i);return e.push([i,{contents:r,overrides:s,keys:n}]),e},[])}}allKeys(){const e=new Set;return this._defaultConfiguration.keys.forEach(i=>e.add(i)),this.userConfiguration.keys.forEach(i=>e.add(i)),this._workspaceConfiguration.keys.forEach(i=>e.add(i)),this._folderConfigurations.forEach(i=>i.keys.forEach(r=>e.add(r))),[...e.values()]}allOverrideIdentifiers(){const e=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(i=>e.add(i)),this.userConfiguration.getAllOverrideIdentifiers().forEach(i=>e.add(i)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(i=>e.add(i)),this._folderConfigurations.forEach(i=>i.getAllOverrideIdentifiers().forEach(r=>e.add(r))),[...e.values()]}getAllKeysForOverrideIdentifier(e){const i=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(e).forEach(r=>i.add(r)),this.userConfiguration.getKeysForOverrideIdentifier(e).forEach(r=>i.add(r)),this._workspaceConfiguration.getKeysForOverrideIdentifier(e).forEach(r=>i.add(r)),this._folderConfigurations.forEach(r=>r.getKeysForOverrideIdentifier(e).forEach(s=>i.add(s))),[...i.values()]}static parse(e,i){const r=this.parseConfigurationModel(e.defaults,i),s=this.parseConfigurationModel(e.policy,i),n=this.parseConfigurationModel(e.application,i),o=this.parseConfigurationModel(e.userLocal,i),a=this.parseConfigurationModel(e.userRemote,i),l=this.parseConfigurationModel(e.workspace,i),c=e.folders.reduce((h,f)=>(h.set(I.revive(f[0]),this.parseConfigurationModel(f[1],i)),h),new Ge);return new Md(r,s,n,o,a,l,c,Ae.createEmptyModel(i),new Ge,i)}static parseConfigurationModel(e,i){return new Ae(e.contents,e.keys,e.overrides,e.raw,i)}},t0=class{constructor(t,e,i,r,s){this.change=t,this.previous=e,this.currentConfiguraiton=i,this.currentWorkspace=r,this.logService=s,this._marker=` `,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(const n of t.keys)this.affectedKeys.add(n);for(const[,n]of t.overrides)for(const o of n)this.affectedKeys.add(o);this._affectsConfigStr=this._marker;for(const n of this.affectedKeys)this._affectsConfigStr+=n+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Wo.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(t,e){const i=this._marker+t,r=this._affectsConfigStr.indexOf(i);if(r<0)return!1;const s=r+i.length;if(s>=this._affectsConfigStr.length)return!1;const n=this._affectsConfigStr.charCodeAt(s);if(n!==this._markerCode1&&n!==this._markerCode2)return!1;if(e){const o=this.previousConfiguration?this.previousConfiguration.getValue(t,e,this.previous?.workspace):void 0,a=this.currentConfiguraiton.getValue(t,e,this.currentWorkspace);return!$t(o,a)}return!0}};function yi(t,e){const{added:i,removed:r,updated:s}=Nu(e?.rawConfiguration,t?.rawConfiguration),n=[],o=t?.getAllOverrideIdentifiers()||[],a=e?.getAllOverrideIdentifiers()||[];if(e){const l=a.filter(c=>!o.includes(c));for(const c of l)n.push([c,e.getKeysForOverrideIdentifier(c)])}if(t){const l=o.filter(c=>!a.includes(c));for(const c of l)n.push([c,t.getKeysForOverrideIdentifier(c)])}if(e&&t){for(const l of o)if(a.includes(l)){const c=Nu({contents:t.getOverrideValue(void 0,l)||{},keys:t.getKeysForOverrideIdentifier(l)},{contents:e.getOverrideValue(void 0,l)||{},keys:e.getKeysForOverrideIdentifier(l)});n.push([l,[...c.added,...c.removed,...c.updated]])}}return{added:i,removed:r,updated:s,overrides:n}}function Nu(t,e){const i=t?e?t.keys.filter(n=>e.keys.indexOf(n)===-1):[...t.keys]:[],r=e?t?e.keys.filter(n=>t.keys.indexOf(n)===-1):[...e.keys]:[],s=[];if(t&&e){for(const n of e.keys)if(t.keys.indexOf(n)!==-1){const o=on(e.contents,n),a=on(t.contents,n);$t(o,a)||s.push(n)}}return{added:i,removed:r,updated:s}}function dr(t){return $o(t,0)}function $o(t,e){switch(typeof t){case"object":return t===null?li(349,e):Array.isArray(t)?r0(t,e):s0(t,e);case"string":return Mu(t,e);case"boolean":return i0(t,e);case"number":return li(t,e);case"undefined":return li(937,e);default:return li(617,e)}}function li(t,e){return(e<<5)-e+t|0}function i0(t,e){return li(t?433:863,e)}function Mu(t,e){e=li(149417,e);for(let i=0,r=t.length;i$o(r,i),e)}function s0(t,e){return e=li(181387,e),Object.keys(t).sort().reduce((i,r)=>(i=Mu(r,i),$o(t[r],i)),e)}var Uu;(function(t){t[t.BLOCK_SIZE=64]="BLOCK_SIZE",t[t.UNICODE_REPLACEMENT=65533]="UNICODE_REPLACEMENT"})(Uu||(Uu={}));function qo(t,e,i=32){const r=i-e,s=~((1<>>r)>>>0}function es(t,e=32){return t instanceof ArrayBuffer?Array.from(new Uint8Array(t)).map(i=>i.toString(16).padStart(2,"0")).join(""):(t>>>0).toString(16).padStart(e/4,"0")}var P2=class Ud{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const i=e.length;if(i===0)return;const r=this._buff;let s=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=e.charCodeAt(0),a=0);;){let l=o;if(Dp(o))if(a+1>>6,e[i++]=128|(r&63)>>>0):r<65536?(e[i++]=224|(r&61440)>>>12,e[i++]=128|(r&4032)>>>6,e[i++]=128|(r&63)>>>0):(e[i++]=240|(r&1835008)>>>18,e[i++]=128|(r&258048)>>>12,e[i++]=128|(r&4032)>>>6,e[i++]=128|(r&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),es(this._h0)+es(this._h1)+es(this._h2)+es(this._h3)+es(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=Ud._bigBlock32,i=this._buffDV;for(let f=0;f<64;f+=4)e.setUint32(f,i.getUint32(f,!1),!1);for(let f=64;f<320;f+=4)e.setUint32(f,qo(e.getUint32(f-12,!1)^e.getUint32(f-32,!1)^e.getUint32(f-56,!1)^e.getUint32(f-64,!1),1),!1);let r=this._h0,s=this._h1,n=this._h2,o=this._h3,a=this._h4,l,c,h;for(let f=0;f<80;f++)f<20?(l=s&n|~s&o,c=1518500249):f<40?(l=s^n^o,c=1859775393):f<60?(l=s&n|s&o|n&o,c=2400959708):(l=s^n^o,c=3395469782),h=qo(r,5)+l+a+c+e.getUint32(f*4,!1)&4294967295,a=o,o=n,n=qo(s,30),s=r,r=h;this._h0=this._h0+r&4294967295,this._h1=this._h1+s&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}},Vu;(function(t){t[t.LParen=0]="LParen",t[t.RParen=1]="RParen",t[t.Neg=2]="Neg",t[t.Eq=3]="Eq",t[t.NotEq=4]="NotEq",t[t.Lt=5]="Lt",t[t.LtEq=6]="LtEq",t[t.Gt=7]="Gt",t[t.GtEq=8]="GtEq",t[t.RegexOp=9]="RegexOp",t[t.RegexStr=10]="RegexStr",t[t.True=11]="True",t[t.False=12]="False",t[t.In=13]="In",t[t.Not=14]="Not",t[t.And=15]="And",t[t.Or=16]="Or",t[t.Str=17]="Str",t[t.QuotedStr=18]="QuotedStr",t[t.Error=19]="Error",t[t.EOF=20]="EOF"})(Vu||(Vu={}));function jo(...t){switch(t.length){case 1:return g(1832,null,t[0]);case 2:return g(1833,null,t[0],t[1]);case 3:return g(1834,null,t[0],t[1],t[2]);default:return}}var n0=g(1835,null),o0=g(1836,null),ts=class ql{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw ic(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){const i=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:i})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){const i=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:i})}else this._match(126)?this._addToken(9):this._error(jo("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(jo("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(jo("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){const i=this._start,r=this._input.substring(this._start,this._current),s={type:19,offset:this._start,lexeme:r};this._errors.push({offset:i,lexeme:r,additionalInfo:e}),this._tokens.push(s)}_string(){this.stringRe.lastIndex=this._start;const e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;const i=this._input.substring(this._start,this._current),r=ql._keywords.get(i);r?this._addToken(r):this._tokens.push({type:17,lexeme:i,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(n0);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,i=!1,r=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(o0);return}const n=this._input.charCodeAt(e);if(i)i=!1;else if(n===47&&!r){e++;break}else n===91?r=!0:n===92?i=!0:n===93&&(r=!1);e++}for(;e=this._input.length}},Me=new Map;Me.set("false",!1),Me.set("true",!0),Me.set("isMac",Mt),Me.set("isLinux",et),Me.set("isWindows",_e),Me.set("isWeb",ei),Me.set("isMacNative",Mt&&!ei),Me.set("isEdge",dp),Me.set("isFirefox",hp),Me.set("isChrome",Fc),Me.set("isSafari",fp);var is=new Map;function a0(t,e){return is.has(t)&&(console.warn(`A context key function with id '${t}' is already registered. Function collisions can lead to unexpected behavior.`),is.delete(t)),is.set(t,e),{dispose:()=>{is.delete(t)}}}function Wu(t){return is.get(t)}var l0=Object.prototype.hasOwnProperty,$u;(function(t){t[t.False=0]="False",t[t.True=1]="True",t[t.Defined=2]="Defined",t[t.Not=3]="Not",t[t.Equals=4]="Equals",t[t.NotEquals=5]="NotEquals",t[t.And=6]="And",t[t.Regex=7]="Regex",t[t.NotRegex=8]="NotRegex",t[t.Or=9]="Or",t[t.In=10]="In",t[t.NotIn=11]="NotIn",t[t.Greater=12]="Greater",t[t.GreaterEquals=13]="GreaterEquals",t[t.Smaller=14]="Smaller",t[t.SmallerEquals=15]="SmallerEquals",t[t.Function=16]="Function"})($u||($u={}));var c0={regexParsingWithErrorRecovery:!0},u0=g(1812,null),h0=g(1813,null),f0=g(1814,null),qu=g(1815,null),d0=g(1816,null),p0=g(1817,null),g0=g(1818,null),m0=g(1819,null),v0=class ks{static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}constructor(e=c0){this._config=e,this._scanner=new ts,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:u0,offset:0,lexeme:"",additionalInfo:h0});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{const i=this._expr();if(!this._isAtEnd()){const r=this._peek(),s=r.type===17?p0:void 0;throw this._parsingErrors.push({message:d0,offset:r.offset,lexeme:ts.getLexeme(r),additionalInfo:s}),ks._parseError}return i}catch(i){if(i!==ks._parseError)throw i;return}}_expr(){return this._or()}_or(){const e=[this._and()];for(;this._matchOne(16);){const i=this._and();e.push(i)}return e.length===1?e[0]:Je.or(...e)}_and(){const e=[this._term()];for(;this._matchOne(15);){const i=this._term();e.push(i)}return e.length===1?e[0]:Je.and(...e)}_term(){if(this._matchOne(2)){const e=this._peek();switch(e.type){case 11:return this._advance(),it.INSTANCE;case 12:return this._advance(),ft.INSTANCE;case 0:{this._advance();const i=this._expr();return this._consume(1,qu),i?.negate()}case 17:return this._advance(),ns.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){const e=this._peek();switch(e.type){case 11:return this._advance(),Je.true();case 12:return this._advance(),Je.false();case 0:{this._advance();const i=this._expr();return this._consume(1,qu),i}case 17:{if(e.lexeme.startsWith("@")){this._advance();const s=e.lexeme.substring(1);if(s.startsWith("!")){const o=s.substring(1),a=Wu(o);if(a)return Bo.createWithoutRegistration(s,()=>!a())}const n=Wu(s)||(()=>!1);return Bo.createWithoutRegistration(s,n)}const i=e.lexeme;if(this._advance(),this._matchOne(9)){const s=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),s.type!==10)throw this._errExpectedButGot("REGEX",s);const n=s.lexeme,o=n.lastIndexOf("/"),a=o===n.length-1?void 0:this._removeFlagsGY(n.substring(o+1));let l;try{l=new RegExp(n.substring(1,o),a)}catch{throw this._errExpectedButGot("REGEX",s)}return Jo.create(i,l)}switch(s.type){case 10:case 19:{const n=[s.lexeme];this._advance();let o=this._peek(),a=0;for(let d=0;d=0){const c=n.slice(a+1,l),h=n[l+1]==="i"?"i":"";try{o=new RegExp(c,h)}catch{throw this._errExpectedButGot("REGEX",s)}}}if(o===null)throw this._errExpectedButGot("REGEX",s);return Jo.create(i,o)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,f0);const s=this._value();return Je.notIn(i,s)}switch(this._peek().type){case 3:{this._advance();const s=this._value();if(this._previous().type===18)return Je.equals(i,s);switch(s){case"true":return Je.has(i);case"false":return Je.not(i);default:return Je.equals(i,s)}}case 4:{this._advance();const s=this._value();if(this._previous().type===18)return Je.notEquals(i,s);switch(s){case"true":return Je.not(i);case"false":return Je.has(i);default:return Je.notEquals(i,s)}}case 5:return this._advance(),Go.create(i,this._value());case 6:return this._advance(),Qo.create(i,this._value());case 7:return this._advance(),wn.create(i,this._value());case 8:return this._advance(),Ko.create(i,this._value());case 13:return this._advance(),Je.in(i,this._value());default:return Je.has(i)}}case 20:throw this._parsingErrors.push({message:g0,offset:e.offset,lexeme:"",additionalInfo:m0}),ks._parseError;default:throw this._errExpectedButGot(`true | false | KEY | KEY '=~' REGEX | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){const e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,i){if(this._check(e))return this._advance();throw this._errExpectedButGot(i,this._peek())}_errExpectedButGot(e,i,r){const s=g(1820,null,e,ts.getLexeme(i)),n=i.offset,o=ts.getLexeme(i);return this._parsingErrors.push({message:s,offset:n,lexeme:o,additionalInfo:r}),ks._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},Je=class{static false(){return it.INSTANCE}static true(){return ft.INSTANCE}static has(t){return ss.create(t)}static equals(t,e){return zo.create(t,e)}static notEquals(t,e){return Ho.create(t,e)}static regex(t,e){return Jo.create(t,e)}static in(t,e){return ju.create(t,e)}static notIn(t,e){return Bu.create(t,e)}static not(t){return ns.create(t)}static and(...t){return Hu.create(t,null,!0)}static or(...t){return Xo.create(t,null,!0)}static greater(t,e){return wn.create(t,e)}static greaterEquals(t,e){return Ko.create(t,e)}static smaller(t,e){return Go.create(t,e)}static smallerEquals(t,e){return Qo.create(t,e)}static function(t,e){return Bo.create(t,e)}static{this._parser=new v0({regexParsingWithErrorRecovery:!1})}static deserialize(t){return t==null?void 0:this._parser.parse(t)}};function rs(t,e){return t.cmp(e)}var Bo=class eo{static create(e,i){return a0(e,i),new eo(e,i)}static createWithoutRegistration(e,i){return new eo(e,i)}constructor(e,i){this.type=16,this.id=e,this.fn=i}cmp(e){return e.type!==this.type?this.type-e.type:Yo(this.id,e.id)}equals(e){return e.type===this.type&&this.id===e.id}substituteConstants(){return this}evaluate(e){return this.fn()}serialize(){return`@${this.id}`}keys(){return[]}map(e){return this}negate(){return eo.createWithoutRegistration(`!${this.id}`,()=>!this.fn())}},it=class Vd{static{this.INSTANCE=new Vd}constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}map(e){return this}negate(){return ft.INSTANCE}},ft=class Wd{static{this.INSTANCE=new Wd}constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}map(e){return this}negate(){return it.INSTANCE}},ss=class $d{static create(e,i=null){const r=Me.get(e);return typeof r=="boolean"?r?ft.INSTANCE:it.INSTANCE:new $d(e,i)}constructor(e,i){this.key=e,this.negated=i,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:Yo(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Me.get(this.key);return typeof e=="boolean"?e?ft.INSTANCE:it.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(e){return e.mapDefined(this.key)}negate(){return this.negated||(this.negated=ns.create(this.key,this)),this.negated}},zo=class qd{static create(e,i,r=null){if(typeof i=="boolean")return i?ss.create(e,r):ns.create(e,r);const s=Me.get(e);return typeof s=="boolean"?i===(s?"true":"false")?ft.INSTANCE:it.INSTANCE:new qd(e,i,r)}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Me.get(this.key);if(typeof e=="boolean"){const i=e?"true":"false";return this.value===i?ft.INSTANCE:it.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(e){return e.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Ho.create(this.key,this.value,this)),this.negated}},ju=class jd{static create(e,i){return new jd(e,i)}constructor(e,i){this.key=e,this.valueKey=i,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){const i=e.getValue(this.valueKey),r=e.getValue(this.key);return Array.isArray(i)?i.includes(r):typeof r=="string"&&typeof i=="object"&&i!==null?l0.call(i,r):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(e){return e.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Bu.create(this.key,this.valueKey)),this.negated}},Bu=class Bd{static create(e,i){return new Bd(e,i)}constructor(e,i){this.key=e,this.valueKey=i,this.type=11,this._negated=ju.create(e,i)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(e){return e.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Ho=class zd{static create(e,i,r=null){if(typeof i=="boolean")return i?ns.create(e,r):ss.create(e,r);const s=Me.get(e);return typeof s=="boolean"?i===(s?"true":"false")?it.INSTANCE:ft.INSTANCE:new zd(e,i,r)}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Me.get(this.key);if(typeof e=="boolean"){const i=e?"true":"false";return this.value===i?it.INSTANCE:ft.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(e){return e.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=zo.create(this.key,this.value,this)),this.negated}},ns=class Hd{static create(e,i=null){const r=Me.get(e);return typeof r=="boolean"?r?it.INSTANCE:ft.INSTANCE:new Hd(e,i)}constructor(e,i){this.key=e,this.negated=i,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:Yo(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Me.get(this.key);return typeof e=="boolean"?e?it.INSTANCE:ft.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(e){return e.mapNot(this.key)}negate(){return this.negated||(this.negated=ss.create(this.key,this)),this.negated}};function yn(t,e){if(typeof t=="string"){const i=parseFloat(t);isNaN(i)||(t=i)}return typeof t=="string"||typeof t=="number"?e(t):it.INSTANCE}var wn=class Kd{static create(e,i,r=null){return yn(i,s=>new Kd(e,s,r))}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Qo.create(this.key,this.value,this)),this.negated}},Ko=class Gd{static create(e,i,r=null){return yn(i,s=>new Gd(e,s,r))}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(e){return e.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Go.create(this.key,this.value,this)),this.negated}},Go=class Qd{static create(e,i,r=null){return yn(i,s=>new Qd(e,s,r))}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new Jd(e,s,r))}constructor(e,i,r){this.key=e,this.value=i,this.negated=r,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:Wi(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(e){return e.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=wn.create(this.key,this.value,this)),this.negated}},Jo=class Xd{static create(e,i){return new Xd(e,i)}constructor(e,i){this.key=e,this.regexp=i,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;const i=this.regexp?this.regexp.source:"",r=e.regexp?e.regexp.source:"";return ir?1:0}equals(e){if(e.type===this.type){const i=this.regexp?this.regexp.source:"",r=e.regexp?e.regexp.source:"";return this.key===e.key&&i===r}return!1}substituteConstants(){return this}evaluate(e){const i=e.getValue(this.key);return this.regexp?this.regexp.test(i):!1}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}map(e){return e.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=y0.create(this)),this.negated}},y0=class jl{static create(e){return new jl(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(e){return new jl(this._actual.map(e))}negate(){return this._actual}};function zu(t){let e=null;for(let i=0,r=t.length;ie.expr.length)return 1;for(let i=0,r=this.expr.length;i1;){const o=s[s.length-1];if(o.type!==9)break;s.pop();const a=s.pop(),l=s.length===0,c=Xo.create(o.expr.map(h=>Rr.create([h,a],null,r)),null,l);c&&(s.push(c),s.sort(rs))}if(s.length===1)return s[0];if(r){for(let o=0;oe.serialize()).join(" && ")}keys(){const e=[];for(const i of this.expr)e.push(...i.keys());return e}map(e){return new Rr(this.expr.map(i=>i.map(e)),null)}negate(){if(!this.negated){const e=[];for(const i of this.expr)e.push(i.negate());this.negated=Xo.create(e,this,!0)}return this.negated}},Xo=class Xi{static create(e,i,r){return Xi._normalizeArr(e,i,r)}constructor(e,i){this.expr=e,this.negated=i,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let i=0,r=this.expr.length;ie.serialize()).join(" || ")}keys(){const e=[];for(const i of this.expr)e.push(...i.keys());return e}map(e){return new Xi(this.expr.map(i=>i.map(e)),null)}negate(){if(!this.negated){const e=[];for(const i of this.expr)e.push(i.negate());for(;e.length>1;){const i=e.shift(),r=e.shift(),s=[];for(const n of Ku(i))for(const o of Ku(r))s.push(Hu.create([n,o],null,!1));e.unshift(Xi.create(s,null,!1))}this.negated=Xi.create(e,this,!0)}return this.negated}},w0=class to extends ss{static{this._info=[]}static all(){return to._info.values()}constructor(e,i,r){super(e,null),this._defaultValue=i,typeof r=="object"?to._info.push({...r,key:e}):r!==!0&&to._info.push({key:e,description:r,type:i!=null?typeof i:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return zo.create(this.key,e)}notEqualsTo(e){return Ho.create(this.key,e)}greater(e){return wn.create(this.key,e)}},I2=le("contextKeyService");function Yo(t,e){return te?1:0}function Wi(t,e,i,r){return ti?1:er?1:0}function Ku(t){return t.type===9?t.expr:[t]}var he=le("logService"),S0=le("loggerService"),T;(function(t){t[t.Off=0]="Off",t[t.Trace=1]="Trace",t[t.Debug=2]="Debug",t[t.Info=3]="Info",t[t.Warning=4]="Warning",t[t.Error=5]="Error"})(T||(T={}));var Zo=T.Info;function b0(t,e){return t!==T.Off&&t<=e}function pr(t,e=!1){let i="";for(let r=0;r0?" ":"")+s}return i}var ea=class extends K{constructor(){super(...arguments),this.level=Zo,this._onDidChangeLogLevel=this._register(new O),this.onDidChangeLogLevel=this._onDidChangeLogLevel.event}setLevel(t){this.level!==t&&(this.level=t,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(t){return b0(this.level,t)}canLog(t){return this._store.isDisposed?!1:this.checkLogLevel(t)}},E0=class extends ea{constructor(t){super(),this.logAlways=t}checkLogLevel(t){return this.logAlways||super.checkLogLevel(t)}trace(t,...e){this.canLog(T.Trace)&&this.log(T.Trace,pr([t,...e],!0))}debug(t,...e){this.canLog(T.Debug)&&this.log(T.Debug,pr([t,...e]))}info(t,...e){this.canLog(T.Info)&&this.log(T.Info,pr([t,...e]))}warn(t,...e){this.canLog(T.Warning)&&this.log(T.Warning,pr([t,...e]))}error(t,...e){if(this.canLog(T.Error))if(t instanceof Error){const i=Array.prototype.slice.call(arguments);i[0]=t.stack,this.log(T.Error,pr(i))}else this.log(T.Error,pr([t,...e]))}flush(){}},$i=class extends ea{constructor(t=Zo,e=!0){super(),this.useColors=e,this.setLevel(t)}trace(t,...e){this.canLog(T.Trace)&&(this.useColors?console.log("%cTRACE","color: #888",t,...e):console.log(t,...e))}debug(t,...e){this.canLog(T.Debug)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",t,...e):console.log(t,...e))}info(t,...e){this.canLog(T.Info)&&(this.useColors?console.log("%c INFO","color: #33f",t,...e):console.log(t,...e))}warn(t,...e){this.canLog(T.Warning)&&(this.useColors?console.warn("%c WARN","color: #993",t,...e):console.log(t,...e))}error(t,...e){this.canLog(T.Error)&&(this.useColors?console.error("%c ERR","color: #f33",t,...e):console.error(t,...e))}flush(){}},_0=class extends ea{constructor(t){super(),this.loggers=t,t.length&&this.setLevel(t[0].getLevel())}setLevel(t){for(const e of this.loggers)e.setLevel(t);super.setLevel(t)}trace(t,...e){for(const i of this.loggers)i.trace(t,...e)}debug(t,...e){for(const i of this.loggers)i.debug(t,...e)}info(t,...e){for(const i of this.loggers)i.info(t,...e)}warn(t,...e){for(const i of this.loggers)i.warn(t,...e)}error(t,...e){for(const i of this.loggers)i.error(t,...e)}flush(){for(const t of this.loggers)t.flush()}dispose(){for(const t of this.loggers)t.dispose();super.dispose()}},x0=class extends K{constructor(t,e,i){if(super(),this.logLevel=t,this.logsHome=e,this._loggers=new Ge,this._onDidChangeLoggers=this._register(new O),this.onDidChangeLoggers=this._onDidChangeLoggers.event,this._onDidChangeLogLevel=this._register(new O),this.onDidChangeLogLevel=this._onDidChangeLogLevel.event,this._onDidChangeVisibility=this._register(new O),this.onDidChangeVisibility=this._onDidChangeVisibility.event,i)for(const r of i)this._loggers.set(r.resource,{logger:void 0,info:r})}getLoggerEntry(t){return Re(t)?[...this._loggers.values()].find(e=>e.info.id===t):this._loggers.get(t)}getLogger(t){return this.getLoggerEntry(t)?.logger}createLogger(t,e){const i=this.toResource(t),r=Re(t)?t:e?.id??dr(i.toString()).toString(16);let s=this._loggers.get(i)?.logger;const n=e?.logLevel==="always"?T.Trace:e?.logLevel;s||(s=this.doCreateLogger(i,n??this.getLogLevel(i)??this.logLevel,{...e,id:r}));const o={logger:s,info:{resource:i,id:r,logLevel:n,name:e?.name,hidden:e?.hidden,group:e?.group,extensionId:e?.extensionId,when:e?.when}};return this.registerLogger(o.info),this._loggers.set(i,o),s}toResource(t){return Re(t)?j(this.logsHome,`${t}.log`):t}setLogLevel(t,e){if(I.isUri(t)){const i=t,r=e,s=this._loggers.get(i);s&&r!==s.info.logLevel&&(s.info.logLevel=r===this.logLevel?void 0:r,s.logger?.setLevel(r),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([i,r]))}else{this.logLevel=t;for(const[i,r]of this._loggers.entries())this._loggers.get(i)?.info.logLevel===void 0&&r.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(t,e){const i=this.getLoggerEntry(t);i&&e!==!i.info.hidden&&(i.info.hidden=!e,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,e]))}getLogLevel(t){let e;return t&&(e=this._loggers.get(t)?.info.logLevel),e??this.logLevel}registerLogger(t){const e=this._loggers.get(t.resource);e?e.info.hidden!==t.hidden&&this.setVisibility(t.resource,!t.hidden):(this._loggers.set(t.resource,{info:t,logger:void 0}),this._onDidChangeLoggers.fire({added:[t],removed:[]}))}deregisterLogger(t){const e=this.toResource(t),i=this._loggers.get(e);i&&(i.logger&&i.logger.dispose(),this._loggers.delete(e),this._onDidChangeLoggers.fire({added:[],removed:[i.info]}))}*getRegisteredLoggers(){for(const t of this._loggers.values())yield t.info}getRegisteredLogger(t){return this._loggers.get(t)?.info}dispose(){this._loggers.forEach(t=>t.logger?.dispose()),this._loggers.clear(),super.dispose()}},P0=class{constructor(){this.onDidChangeLogLevel=new O().event}setLevel(t){}getLevel(){return T.Info}trace(t,...e){}debug(t,...e){}info(t,...e){}warn(t,...e){}error(t,...e){}critical(t,...e){}dispose(){}flush(){}},I0=class extends P0{};function k0(t){if(t.verbose)return T.Trace;if(typeof t.logLevel=="string"){const e=C0(t.logLevel.toLowerCase());if(e!==void 0)return e}return Zo}function D0(t){switch(t){case T.Trace:return"trace";case T.Debug:return"debug";case T.Info:return"info";case T.Warning:return"warn";case T.Error:return"error";case T.Off:return"off"}}function C0(t){switch(t){case"trace":return T.Trace;case"debug":return T.Debug;case"info":return T.Info;case"warn":return T.Warning;case"error":return T.Error;case"critical":return T.Error;case"off":return T.Off}}var k2=new w0("logLevel",D0(T.Info)),Gu=le("policy"),Qu=class extends K{constructor(){super(...arguments),this.policyDefinitions={},this.policies=new Map,this._onDidChange=this._register(new O),this.onDidChange=this._onDidChange.event}async updatePolicyDefinitions(t){const e=Object.keys(this.policyDefinitions).length;return this.policyDefinitions={...t,...this.policyDefinitions},e!==Object.keys(this.policyDefinitions).length&&await this._updatePolicyDefinitions(this.policyDefinitions),Ri.reduce(this.policies.entries(),(i,[r,s])=>({...i,[r]:s}),{})}getPolicyValue(t){return this.policies.get(t)}serialize(){return Ri.reduce(Object.entries(this.policyDefinitions),(t,[e,i])=>({...t,[e]:{definition:i,value:this.policies.get(e)}}),{})}},Ju=class{constructor(){this.onDidChange=ae.None,this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}},R0=class extends K{get configurationModel(){return this._configurationModel}constructor(t){super(),this.logService=t,this._onDidChangeConfiguration=this._register(new O),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._configurationModel=Ae.createEmptyModel(this.logService)}async initialize(){return this.resetConfigurationModel(),this._register(qt.as(mi.Configuration).onDidUpdateConfiguration(({properties:t,defaultsOverrides:e})=>this.onDidUpdateConfiguration(Array.from(t),e))),this.configurationModel}reload(){return this.resetConfigurationModel(),this.configurationModel}onDidUpdateConfiguration(t,e){this.updateConfigurationModel(t,qt.as(mi.Configuration).getConfigurationProperties()),this._onDidChangeConfiguration.fire({defaults:this.configurationModel,properties:t})}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=Ae.createEmptyModel(this.logService);const t=qt.as(mi.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(t),t)}updateConfigurationModel(t,e){const i=this.getConfigurationDefaultOverrides();for(const r of t){const s=i[r],n=e[r];s!==void 0?this._configurationModel.setValue(r,s):n?this._configurationModel.setValue(r,oi(n.default)):this._configurationModel.removeValue(r)}}},L0=class{constructor(){this.onDidChangeConfiguration=ae.None,this.configurationModel=Ae.createEmptyModel(new I0)}async initialize(){return this.configurationModel}},ta=class extends K{get configurationModel(){return this._configurationModel}constructor(e,i,r){super(),this.defaultConfiguration=e,this.policyService=i,this.logService=r,this._onDidChangeConfiguration=this._register(new O),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._configurationModel=Ae.createEmptyModel(this.logService),this.configurationRegistry=qt.as(mi.Configuration)}async initialize(){return this.logService.trace("PolicyConfiguration#initialize"),this.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys),!1),this.update(await this.updatePolicyDefinitions(Object.keys(this.configurationRegistry.getExcludedConfigurationProperties())),!1),this._register(this.policyService.onDidChange(e=>this.onDidChangePolicies(e))),this._register(this.defaultConfiguration.onDidChangeConfiguration(async({properties:e})=>this.update(await this.updatePolicyDefinitions(e),!0))),this._configurationModel}async updatePolicyDefinitions(e){this.logService.trace("PolicyConfiguration#updatePolicyDefinitions",e);const i={},r=[],s=this.configurationRegistry.getConfigurationProperties(),n=this.configurationRegistry.getExcludedConfigurationProperties();for(const o of e){const a=s[o]??n[o];if(!a){r.push(o);continue}if(a.policy){if(a.type!=="string"&&a.type!=="number"&&a.type!=="array"&&a.type!=="object"&&a.type!=="boolean"){this.logService.warn(`Policy ${a.policy.name} has unsupported type ${a.type}`);continue}const{defaultValue:l,previewFeature:c}=a.policy;r.push(o),i[a.policy.name]={type:a.type==="number"?"number":a.type==="boolean"?"boolean":"string",previewFeature:c,defaultValue:l}}}return pc(i)||await this.policyService.updatePolicyDefinitions(i),r}onDidChangePolicies(e){this.logService.trace("PolicyConfiguration#onDidChangePolicies",e);const i=this.configurationRegistry.getPolicyConfigurations(),r=ir(e.map(s=>i.get(s)));this.update(r,!0)}update(e,i){this.logService.trace("PolicyConfiguration#update",e);const r=this.configurationRegistry.getConfigurationProperties(),s=this.configurationRegistry.getExcludedConfigurationProperties(),n=[],o=this._configurationModel.isEmpty();for(const a of e){const l=r[a]??s[a],c=l?.policy?.name;if(c){let h=this.policyService.getPolicyValue(c);if(Re(h)&&l.type!=="string")try{h=this.parse(h)}catch(f){this.logService.error(`Error parsing policy value ${c}:`,H(f));continue}(o?h!==void 0:!$t(this._configurationModel.getValue(a),h))&&n.push([a,h])}else this._configurationModel.getValue(a)!==void 0&&n.push([a,void 0])}if(n.length){this.logService.trace("PolicyConfiguration#changed",n);const a=this._configurationModel;this._configurationModel=Ae.createEmptyModel(this.logService);for(const l of a.keys)this._configurationModel.setValue(l,a.getValue(l));for(const[l,c]of n)c===void 0?this._configurationModel.removeValue(l):this._configurationModel.setValue(l,c);i&&this._onDidChangeConfiguration.fire(this._configurationModel)}}parse(e){let i={},r=null,s=[];const n=[],o=[];function a(c){if(Array.isArray(s))s.push(c);else if(r!==null){if(s[r]!==void 0)throw new Error(`Duplicate property found: ${r}`);s[r]=c}}if(e&&(ln(e,{onObjectBegin:()=>{const c={};a(c),n.push(s),s=c,r=null},onObjectProperty:c=>{r=c},onObjectEnd:()=>{s=n.pop()},onArrayBegin:()=>{const c=[];a(c),n.push(s),s=c,r=null},onArrayEnd:()=>{s=n.pop()},onLiteralValue:a,onError:(c,h,f)=>{o.push({error:c,offset:h,length:f})}}),i=s[0]||{}),o.length>0)throw new Error(o.map(c=>H(c.error)).join(` `));return i}};ta=__decorate([__param(1,Gu),__param(2,he)],ta);var A0=class extends K{constructor(t,e,i,r){super(),this.settingsResource=t,this.logService=r,this._onDidChangeConfiguration=this._register(new O),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this.defaultConfiguration=this._register(new R0(r)),this.policyConfiguration=i instanceof Ju?new L0:this._register(new ta(this.defaultConfiguration,i,r)),this.userConfiguration=this._register(new Zg(this.settingsResource,{},Ro,e,r)),this.configuration=new Wo(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,Ae.createEmptyModel(r),Ae.createEmptyModel(r),Ae.createEmptyModel(r),Ae.createEmptyModel(r),new Ge,Ae.createEmptyModel(r),new Ge,r),this.configurationEditing=new O0(t,e,this),this.reloadConfigurationScheduler=this._register(new rn(()=>this.reloadConfiguration(),50)),this._register(this.defaultConfiguration.onDidChangeConfiguration(({defaults:s,properties:n})=>this.onDidDefaultConfigurationChange(s,n))),this._register(this.policyConfiguration.onDidChangeConfiguration(s=>this.onDidPolicyConfigurationChange(s))),this._register(this.userConfiguration.onDidChange(()=>this.reloadConfigurationScheduler.schedule()))}async initialize(){const[t,e,i]=await Promise.all([this.defaultConfiguration.initialize(),this.policyConfiguration.initialize(),this.userConfiguration.loadConfiguration()]);this.configuration=new Wo(t,e,Ae.createEmptyModel(this.logService),i,Ae.createEmptyModel(this.logService),Ae.createEmptyModel(this.logService),new Ge,Ae.createEmptyModel(this.logService),new Ge,this.logService)}getConfigurationData(){return this.configuration.toData()}getValue(t,e){const i=typeof t=="string"?t:void 0,r=Fo(t)?t:Fo(e)?e:{};return this.configuration.getValue(i,r,void 0)}async updateValue(t,e,i,r,s){const n=Og(i)?i:Fo(i)?{resource:i.resource,overrideIdentifiers:i.overrideIdentifier?[i.overrideIdentifier]:void 0}:void 0,o=n?r:i;if(o!==void 0&&o!==3&&o!==2)throw new Error(`Unable to write ${t} to target ${o}.`);n?.overrideIdentifiers&&(n.overrideIdentifiers=Xt(n.overrideIdentifiers),n.overrideIdentifiers=n.overrideIdentifiers.length?n.overrideIdentifiers:void 0);const a=this.inspect(t,{resource:n?.resource,overrideIdentifier:n?.overrideIdentifiers?n.overrideIdentifiers[0]:void 0});if(a.policyValue!==void 0)throw new Error(`Unable to write ${t} because it is configured in system policy.`);if($t(e,a.defaultValue)&&(e=void 0),n?.overrideIdentifiers?.length&&n.overrideIdentifiers.length>1){const c=n.overrideIdentifiers.sort(),h=this.configuration.localUserConfiguration.overrides.find(f=>tr([...f.identifiers].sort(),c));h&&(n.overrideIdentifiers=h.identifiers)}const l=n?.overrideIdentifiers?.length?[Jg(n.overrideIdentifiers),t]:[t];await this.configurationEditing.write(l,e),await this.reloadConfiguration()}inspect(t,e={}){return this.configuration.inspect(t,e,void 0)}keys(){return this.configuration.keys(void 0)}async reloadConfiguration(){const t=await this.userConfiguration.loadConfiguration();this.onDidChangeUserConfiguration(t)}onDidChangeUserConfiguration(t){const e=this.configuration.toData(),i=this.configuration.compareAndUpdateLocalUserConfiguration(t);this.trigger(i,e,2)}onDidDefaultConfigurationChange(t,e){const i=this.configuration.toData(),r=this.configuration.compareAndUpdateDefaultConfiguration(t,e);this.trigger(r,i,7)}onDidPolicyConfigurationChange(t){const e=this.configuration.toData(),i=this.configuration.compareAndUpdatePolicyConfiguration(t);this.trigger(i,e,7)}trigger(t,e,i){const r=new t0(t,{data:e},this.configuration,void 0,this.logService);r.source=i,this._onDidChangeConfiguration.fire(r)}},O0=class{constructor(t,e,i){this.settingsResource=t,this.fileService=e,this.configurationService=i,this.queue=new Hr}write(t,e){return this.queue.queue(()=>this.doWriteConfiguration(t,e))}async doWriteConfiguration(t,e){let i;try{i=(await this.fileService.readFile(this.settingsResource)).value.toString()}catch(n){if(n.fileOperationResult===1)i="{}";else throw n}const r=[];if(Gr(i,r,{allowTrailingComma:!0,allowEmptyContent:!0}),r.length>0)throw new Error("Unable to write into the settings file. Please open the file to correct errors/warnings in the file and try again.");const s=this.getEdits(i,t,e);i=$g(i,s),await this.fileService.writeFile(this.settingsResource,W.fromString(i))}getEdits(t,e,i){const{tabSize:r,insertSpaces:s,eol:n}=this.formattingOptions;if(!e.length){const o=JSON.stringify(i,null,s?" ".repeat(r):" ");return[{content:o,length:o.length,offset:0}]}return Wg(t,e,i,{tabSize:r,insertSpaces:s,eol:n})}get formattingOptions(){if(!this._formattingOptions){let t=yo===3||yo===2?` `:`\r `;const e=this.configurationService.getValue("files.eol",{overrideIdentifier:"jsonc"});e&&typeof e=="string"&&e!=="auto"&&(t=e),this._formattingOptions={eol:t,insertSpaces:!!this.configurationService.getValue("editor.insertSpaces",{overrideIdentifier:"jsonc"}),tabSize:this.configurationService.getValue("editor.tabSize",{overrideIdentifier:"jsonc"})}}return this._formattingOptions}},Xu=le("downloadService"),F0=class{constructor(){this._value="",this._pos=0}reset(t){return this._value=t,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;e--,this._valueLen--){const i=this._value.charCodeAt(e);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to!1,i=()=>!1){return new Ds(new N0(e,i))}static forPaths(e=!1){return new Ds(new Yu(void 0,!e))}static forStrings(){return new Ds(new F0)}static forConfigKeys(){return new Ds(new T0)}constructor(e){this._iter=e}clear(){this._root=void 0}fill(e,i){if(i){const r=i.slice(0);oc(r);for(const s of r)this.set(s,e)}else{const r=e.slice(0);oc(r);for(const s of r)this.set(s[0],s[1])}}set(e,i){const r=this._iter.reset(e);let s;this._root||(this._root=new Sn,this._root.segment=r.value());const n=[];for(s=this._root;;){const a=r.cmp(s.segment);if(a>0)s.left||(s.left=new Sn,s.left.segment=r.value()),n.push([-1,s]),s=s.left;else if(a<0)s.right||(s.right=new Sn,s.right.segment=r.value()),n.push([1,s]),s=s.right;else if(r.hasNext())r.next(),s.mid||(s.mid=new Sn,s.mid.segment=r.value()),n.push([0,s]),s=s.mid;else break}const o=qi.unwrap(s.value);s.value=qi.wrap(i),s.key=e;for(let a=n.length-1;a>=0;a--){const l=n[a][1];l.updateHeight();const c=l.balanceFactor();if(c<-1||c>1){const h=n[a][0],f=n[a+1][0];if(h===1&&f===1)n[a][1]=l.rotateLeft();else if(h===-1&&f===-1)n[a][1]=l.rotateRight();else if(h===1&&f===-1)l.right=n[a+1][1]=n[a+1][1].rotateRight(),n[a][1]=l.rotateLeft();else if(h===-1&&f===1)l.left=n[a+1][1]=n[a+1][1].rotateLeft(),n[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(n[a-1][0]){case-1:n[a-1][1].left=n[a][1];break;case 1:n[a-1][1].right=n[a][1];break;case 0:n[a-1][1].mid=n[a][1];break}else this._root=n[0][1]}}return o}get(e){return qi.unwrap(this._getNode(e)?.value)}_getNode(e){const i=this._iter.reset(e);let r=this._root;for(;r;){const s=i.cmp(r.segment);if(s>0)r=r.left;else if(s<0)r=r.right;else if(i.hasNext())i.next(),r=r.mid;else break}return r}has(e){const i=this._getNode(e);return!(i?.value===void 0&&i?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,i){const r=this._iter.reset(e),s=[];let n=this._root;for(;n;){const o=r.cmp(n.segment);if(o>0)s.push([-1,n]),n=n.left;else if(o<0)s.push([1,n]),n=n.right;else if(r.hasNext())r.next(),s.push([0,n]),n=n.mid;else break}if(n){if(i?(n.left=void 0,n.mid=void 0,n.right=void 0,n.height=1):(n.key=void 0,n.value=void 0),!n.mid&&!n.value)if(n.left&&n.right){const o=this._min(n.right);if(o.key){const{key:a,value:l,segment:c}=o;this._delete(o.key,!1),n.key=a,n.value=l,n.segment=c}}else{const o=n.left??n.right;if(s.length>0){const[a,l]=s[s.length-1];switch(a){case-1:l.left=o;break;case 0:l.mid=o;break;case 1:l.right=o;break}}else this._root=o}for(let o=s.length-1;o>=0;o--){const a=s[o][1];a.updateHeight();const l=a.balanceFactor();if(l>1?(a.right.balanceFactor()>=0||(a.right=a.right.rotateRight()),s[o][1]=a.rotateLeft()):l<-1&&(a.left.balanceFactor()<=0||(a.left=a.left.rotateLeft()),s[o][1]=a.rotateRight()),o>0)switch(s[o-1][0]){case-1:s[o-1][1].left=s[o][1];break;case 1:s[o-1][1].right=s[o][1];break;case 0:s[o-1][1].mid=s[o][1];break}else this._root=s[0][1]}}}_min(e){for(;e.left;)e=e.left;return e}findSubstr(e){const i=this._iter.reset(e);let r=this._root,s;for(;r;){const n=i.cmp(r.segment);if(n>0)r=r.left;else if(n<0)r=r.right;else if(i.hasNext())i.next(),s=qi.unwrap(r.value)||s,r=r.mid;else break}return r&&qi.unwrap(r.value)||s}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,i){const r=this._iter.reset(e);let s=this._root;for(;s;){const n=r.cmp(s.segment);if(n>0)s=s.left;else if(n<0)s=s.right;else if(r.hasNext())r.next(),s=s.mid;else return s.mid?this._entries(s.mid):i?qi.unwrap(s.value):void 0}}hasElementOrSubtree(e){return this._findSuperstrOrElement(e,!0)!==void 0}forEach(e){for(const[i,r]of this)e(r,i)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){const i=[];return this._dfsEntries(e,i),i[Symbol.iterator]()}_dfsEntries(e,i){e&&(e.left&&this._dfsEntries(e.left,i),e.value!==void 0&&i.push([e.key,qi.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,i),e.right&&this._dfsEntries(e.right,i))}_isBalanced(){const e=i=>{if(!i)return!0;const r=i.balanceFactor();return r<-1||r>1?!1:e(i.left)&&e(i.right)};return e(this._root)}},Pe=le("fileService");function mr(t){return t.create===!0}var dt;(function(t){t[t.Unknown=0]="Unknown",t[t.File=1]="File",t[t.Directory=2]="Directory",t[t.SymbolicLink=64]="SymbolicLink"})(dt||(dt={}));var vr;(function(t){t[t.Readonly=1]="Readonly",t[t.Locked=2]="Locked"})(vr||(vr={}));var th;(function(t){t[t.UPDATED=2]="UPDATED",t[t.ADDED=4]="ADDED",t[t.DELETED=8]="DELETED"})(th||(th={}));var ih;(function(t){t[t.None=0]="None",t[t.FileReadWrite=2]="FileReadWrite",t[t.FileOpenReadWriteClose=4]="FileOpenReadWriteClose",t[t.FileReadStream=16]="FileReadStream",t[t.FileFolderCopy=8]="FileFolderCopy",t[t.PathCaseSensitive=1024]="PathCaseSensitive",t[t.Readonly=2048]="Readonly",t[t.Trash=4096]="Trash",t[t.FileWriteUnlock=8192]="FileWriteUnlock",t[t.FileAtomicRead=16384]="FileAtomicRead",t[t.FileAtomicWrite=32768]="FileAtomicWrite",t[t.FileAtomicDelete=65536]="FileAtomicDelete",t[t.FileClone=131072]="FileClone"})(ih||(ih={}));function xt(t){return!!(t.capabilities&2)}function ia(t){return!!(t.capabilities&8)}function rh(t){return!!(t.capabilities&131072)}function wi(t){return!!(t.capabilities&4)}function ra(t){return!!(t.capabilities&16)}function sa(t){return xt(t)?!!(t.capabilities&16384):!1}function sh(t){return xt(t)?!!(t.capabilities&32768):!1}function M0(t){return!!(t.capabilities&65536)}var $;(function(t){t.FileExists="EntryExists",t.FileNotFound="EntryNotFound",t.FileNotADirectory="EntryNotADirectory",t.FileIsADirectory="EntryIsADirectory",t.FileExceedsStorageQuota="EntryExceedsStorageQuota",t.FileTooLarge="EntryTooLarge",t.FileWriteLocked="EntryWriteLocked",t.NoPermissions="NoPermissions",t.Unavailable="Unavailable",t.Unknown="Unknown"})($||($={}));var na=class Yd extends Error{static create(e,i){const r=new Yd(e.toString(),i);return U0(r,i),r}constructor(e,i){super(e),this.code=i}};function ci(t,e){return na.create(t,e)}function ji(t){return t||ci(g(2018,null),$.Unknown)}function U0(t,e){return t.name=e?`${e} (FileSystemError)`:"FileSystemError",t}function bn(t){if(!t)return $.Unknown;if(t instanceof na)return t.code;const e=/^(.+) \(FileSystemError\)$/.exec(t.name);if(!e)return $.Unknown;switch(e[1]){case $.FileExists:return $.FileExists;case $.FileIsADirectory:return $.FileIsADirectory;case $.FileNotADirectory:return $.FileNotADirectory;case $.FileNotFound:return $.FileNotFound;case $.FileTooLarge:return $.FileTooLarge;case $.FileWriteLocked:return $.FileWriteLocked;case $.NoPermissions:return $.NoPermissions;case $.Unavailable:return $.Unavailable}return $.Unknown}function Ue(t){if(t instanceof rt)return t.fileOperationResult;switch(bn(t)){case $.FileNotFound:return 1;case $.FileIsADirectory:return 0;case $.FileNotADirectory:return 9;case $.FileWriteLocked:return 5;case $.NoPermissions:return 6;case $.FileExists:return 4;case $.FileTooLarge:return 7;default:return 10}}var nh;(function(t){t[t.CREATE=0]="CREATE",t[t.DELETE=1]="DELETE",t[t.MOVE=2]="MOVE",t[t.COPY=3]="COPY",t[t.WRITE=4]="WRITE"})(nh||(nh={}));var yr=class{constructor(t,e,i){this.resource=t,this.operation=e,this.target=i}isOperation(t){return this.operation===t}},oh;(function(t){t[t.UPDATED=0]="UPDATED",t[t.ADDED=1]="ADDED",t[t.DELETED=2]="DELETED"})(oh||(oh={}));var V0=class io{static{this.MIXED_CORRELATION=null}constructor(e,i){this.ignorePathCasing=i,this.correlationId=void 0,this.added=new Fi(()=>{const r=gr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawAdded.map(s=>[s,!0])),r}),this.updated=new Fi(()=>{const r=gr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawUpdated.map(s=>[s,!0])),r}),this.deleted=new Fi(()=>{const r=gr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawDeleted.map(s=>[s,!0])),r}),this.rawAdded=[],this.rawUpdated=[],this.rawDeleted=[];for(const r of e){switch(r.type){case 1:this.rawAdded.push(r.resource);break;case 0:this.rawUpdated.push(r.resource);break;case 2:this.rawDeleted.push(r.resource);break}this.correlationId!==io.MIXED_CORRELATION&&(typeof r.cId=="number"?this.correlationId===void 0?this.correlationId=r.cId:this.correlationId!==r.cId&&(this.correlationId=io.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=io.MIXED_CORRELATION))}}contains(e,...i){return this.doContains(e,{includeChildren:!1},...i)}affects(e,...i){return this.doContains(e,{includeChildren:!0},...i)}doContains(e,i,...r){if(!e)return!1;const s=r.length>0;return!!((!s||r.includes(1))&&(this.added.value.get(e)||i.includeChildren&&this.added.value.findSuperstr(e))||(!s||r.includes(0))&&(this.updated.value.get(e)||i.includeChildren&&this.updated.value.findSuperstr(e))||(!s||r.includes(2))&&(this.deleted.value.findSubstr(e)||i.includeChildren&&this.deleted.value.findSuperstr(e)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(e){return this.correlationId===e}hasCorrelation(){return typeof this.correlationId=="number"}};function W0(t,e,i){return!t||!e||t===e||e.length>t.length?!1:(e.charAt(e.length-1)!==tt&&(e+=tt),i?xo(t,e):t.indexOf(e)===0)}var rt=class extends Error{constructor(t,e,i){super(t),this.fileOperationResult=e,this.options=i}},oa=class extends rt{constructor(t,e,i,r){super(t,e,r),this.fileOperationResult=e,this.size=i}},aa=class extends rt{constructor(t,e,i){super(t,2,i),this.stat=e}},ah;(function(t){t[t.FILE_IS_DIRECTORY=0]="FILE_IS_DIRECTORY",t[t.FILE_NOT_FOUND=1]="FILE_NOT_FOUND",t[t.FILE_NOT_MODIFIED_SINCE=2]="FILE_NOT_MODIFIED_SINCE",t[t.FILE_MODIFIED_SINCE=3]="FILE_MODIFIED_SINCE",t[t.FILE_MOVE_CONFLICT=4]="FILE_MOVE_CONFLICT",t[t.FILE_WRITE_LOCKED=5]="FILE_WRITE_LOCKED",t[t.FILE_PERMISSION_DENIED=6]="FILE_PERMISSION_DENIED",t[t.FILE_TOO_LARGE=7]="FILE_TOO_LARGE",t[t.FILE_INVALID_PATH=8]="FILE_INVALID_PATH",t[t.FILE_NOT_DIRECTORY=9]="FILE_NOT_DIRECTORY",t[t.FILE_OTHER_ERROR=10]="FILE_OTHER_ERROR"})(ah||(ah={}));var lh;(function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER",t[t.PULL_REQUEST=3]="PULL_REQUEST"})(lh||(lh={}));var la="";function ch(t){if(!(typeof t.size!="number"||typeof t.mtime!="number"))return t.mtime.toString(29)+t.size.toString(31)}var $0=class st{static{this.KB=1024}static{this.MB=st.KB*st.KB}static{this.GB=st.MB*st.KB}static{this.TB=st.GB*st.KB}static formatSize(e){return hc(e)||(e=0),e=200&&t.res.statusCode<300||t.res.statusCode===1223}function uh(t){return t.res.statusCode===204}async function B0(t){return uh(t)?null:(await Ni(t.stream)).toString()}async function wr(t){if(!ca(t))throw new Error("Server returned "+t.res.statusCode);return B0(t)}async function En(t){if(!ca(t))throw new Error("Server returned "+t.res.statusCode);if(uh(t))return null;const i=(await Ni(t.stream)).toString();try{return JSON.parse(i)}catch(r){throw r.message+=`: `+i,r}}var ua=[],hh=void 0,fh=void 0;function z0(t=!0,e=!0){if(hh===t&&fh===e)return;hh=t,fh=e;const i=qt.as(mi.Configuration),r=ua;ua=[{id:"http",order:15,title:g(2209,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:e,markdownDescription:g(2210,null),restricted:!0}}},{id:"http",order:15,title:g(2211,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:g(2212,null),restricted:!0}}},{id:"http",order:15,title:g(2213,null),type:"object",scope:t?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:g(2214,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:g(2215,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:g(2216,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:g(2217,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:g(2218,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[g(2219,null),g(2220,null),g(2221,null),g(2222,null)],default:"override",markdownDescription:g(2223,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:g(2224,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:g(2225,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:g(2226,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0}}}],i.updateConfigurations({add:ua,remove:r})}z0();var ha=class{constructor(e,i){this.requestService=e,this.fileService=i}async download(e,i,r=de.None){if(e.scheme===ie.file||e.scheme===ie.vscodeRemote){await this.fileService.copy(e,i);return}const s={type:"GET",url:e.toString(!0)},n=await this.requestService.request(s,r);if(n.res.statusCode===200)await this.fileService.writeFile(i,n.stream);else{const o=await wr(n);throw new Error(`Expected 200, got back ${n.res.statusCode} instead. ${o}`)}}};ha=__decorate([__param(0,os),__param(1,Pe)],ha);var ui=le("environmentService"),Pt=ui;import{homedir as H0,tmpdir as K0}from"os";var G0=60,Q0=G0*60,fa=Q0*24,L2=fa*7,A2=fa*30,O2=fa*365;function J0(t){return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+(t.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}function ce(t,e,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");const n=`$memoize$${e}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var dh=/^([^.]+\..+)[:=](.+)$/,ue=class{get appRoot(){return pi(en.asFileUri("").fsPath)}get userHome(){return I.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return I.file(G(this.userDataPath,"User"))}get tmpDir(){return I.file(this.paths.tmpDir)}get cacheHome(){return I.file(this.userDataPath)}get stateResource(){return j(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:ie.vscodeUserData})}get userDataSyncHome(){return j(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){const t=J0(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=G(this.userDataPath,"logs",t)}return I.file(this.args.logsPath)}get sync(){return this.args.sync}get machineSettingsResource(){return j(I.file(G(this.userDataPath,"Machine")),"settings.json")}get workspaceStorageHome(){return j(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return j(this.appSettingsHome,"History")}get keyboardLayoutResource(){return j(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){const t=Wt.VSCODE_PORTABLE;return t?I.file(G(t,"argv.json")):j(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return I.file(G(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){const t=this.args["builtin-extensions-dir"];return t?Oi(t):di(G(en.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){const t=this.args["extensions-download-dir"];return t?I.file(Oi(t)):I.file(G(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){const t=this.args["extensions-dir"];if(t)return Oi(t);const e=Wt.VSCODE_EXTENSIONS;if(e)return e;const i=Wt.VSCODE_PORTABLE;return i?G(i,"extensions"):j(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get extensionDevelopmentLocationURI(){const t=this.args.extensionDevelopmentPath;if(Array.isArray(t))return t.map(e=>/^[^:/?#]+?:\/\//.test(e)?I.parse(e):I.file(di(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(t=>t==="ui"||t==="workspace"||t==="web"?t:"workspace")}get extensionTestsLocationURI(){const t=this.args.extensionTestsPath;if(t)return/^[^:/?#]+?:\/\//.test(t)?I.parse(t):I.file(di(t))}get disableExtensions(){if(this.args["disable-extensions"])return!0;const t=this.args["disable-extension"];if(t){if(typeof t=="string")return[t];if(Array.isArray(t)&&t.length>0)return t}return!1}get debugExtensionHost(){return X0(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!Wt.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(t=>!dh.test(t))}get extensionLogLevel(){const t=[];for(const e of this.args.log||[]){const i=dh.exec(e);i&&i[1]&&i[2]&&t.push([i[1],i[2]])}return t.length?t:void 0}get serviceMachineIdResource(){return j(I.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){const t=Wt.VSCODE_PORTABLE;return t?I.file(G(t,"policy.json")):j(this.userHome,this.productService.dataFolderName,"policy.json")}}get editSessionId(){return this.args.editSessionId}get continueOn(){return this.args.continueOn}set continueOn(t){this.args.continueOn=t}get args(){return this._args}constructor(t,e,i){this._args=t,this.paths=e,this.productService=i}};__decorate([ce],ue.prototype,"appRoot",null),__decorate([ce],ue.prototype,"userHome",null),__decorate([ce],ue.prototype,"userDataPath",null),__decorate([ce],ue.prototype,"appSettingsHome",null),__decorate([ce],ue.prototype,"tmpDir",null),__decorate([ce],ue.prototype,"cacheHome",null),__decorate([ce],ue.prototype,"stateResource",null),__decorate([ce],ue.prototype,"userRoamingDataHome",null),__decorate([ce],ue.prototype,"userDataSyncHome",null),__decorate([ce],ue.prototype,"sync",null),__decorate([ce],ue.prototype,"machineSettingsResource",null),__decorate([ce],ue.prototype,"workspaceStorageHome",null),__decorate([ce],ue.prototype,"localHistoryHome",null),__decorate([ce],ue.prototype,"keyboardLayoutResource",null),__decorate([ce],ue.prototype,"argvResource",null),__decorate([ce],ue.prototype,"isExtensionDevelopment",null),__decorate([ce],ue.prototype,"untitledWorkspacesHome",null),__decorate([ce],ue.prototype,"builtinExtensionsPath",null),__decorate([ce],ue.prototype,"extensionsPath",null),__decorate([ce],ue.prototype,"extensionDevelopmentLocationURI",null),__decorate([ce],ue.prototype,"extensionDevelopmentKind",null),__decorate([ce],ue.prototype,"extensionTestsLocationURI",null),__decorate([ce],ue.prototype,"debugExtensionHost",null),__decorate([ce],ue.prototype,"logLevel",null),__decorate([ce],ue.prototype,"extensionLogLevel",null),__decorate([ce],ue.prototype,"serviceMachineIdResource",null),__decorate([ce],ue.prototype,"disableTelemetry",null),__decorate([ce],ue.prototype,"disableWorkspaceTrust",null),__decorate([ce],ue.prototype,"useInMemorySecretStorage",null),__decorate([ce],ue.prototype,"policyFile",null);function X0(t,e){return Y0(t["inspect-extensions"],t["inspect-brk-extensions"],5870,e,t.debugId,t.extensionEnvironment)}function Y0(t,e,i,r,s,n){const a=Number(e||t)||(r?null:i),l=a?!!e:!1;let c;if(n)try{c=JSON.parse(n)}catch{}return{port:a,break:l,debugId:s,env:c}}import*as ph from"os";import*as Si from"path";var Z0=process.env.VSCODE_CWD||process.cwd();function em(t,e){const i=tm(t,e),r=[i];return Si.isAbsolute(i)||r.unshift(Z0),Si.resolve(...r)}function tm(t,e){process.env.VSCODE_DEV&&(e="code-oss-dev");const i=process.env.VSCODE_PORTABLE;if(i)return Si.join(i,"user-data");let r=process.env.VSCODE_APPDATA;if(r)return Si.join(r,e);const s=t["user-data-dir"];if(s)return s;switch(process.platform){case"win32":if(r=process.env.APPDATA,!r){const n=process.env.USERPROFILE;if(typeof n!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");r=Si.join(n,"AppData","Roaming")}break;case"darwin":r=Si.join(ph.homedir(),"Library","Application Support");break;case"linux":r=process.env.XDG_CONFIG_HOME||Si.join(ph.homedir(),".config");break;default:throw new Error("Platform not supported")}return Si.join(r,e)}var im=class extends ue{constructor(t,e){super(t,{homeDir:H0(),tmpDir:K0(),userDataDir:em(t,e.nameShort)},e)}},da="Offline";function gh(t){return t instanceof rm?!0:t instanceof Error&&t.name===da&&t.message===da}var rm=class extends Error{constructor(){super(da),this.name=this.message}},sm="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",pa=new RegExp(sm),nm="__web_extension",mh="extensionInstallSource",om="dependecyOrPackExtensionInstall",am="clientTargetPlatform",vh;(function(t){t.COMMAND="command",t.SETTINGS_SYNC="settingsSync"})(vh||(vh={}));function yh(t){switch(t){case"win32-x64":return"Windows 64 bit";case"win32-arm64":return"Windows ARM";case"linux-x64":return"Linux 64 bit";case"linux-arm64":return"Linux ARM 64";case"linux-armhf":return"Linux ARM";case"alpine-x64":return"Alpine Linux 64 bit";case"alpine-arm64":return"Alpine ARM 64";case"darwin-x64":return"Mac";case"darwin-arm64":return"Mac Silicon";case"web":return"Web";case"universal":return"universal";case"unknown":return"unknown";case"undefined":return"undefined"}}function lm(t){switch(t){case"win32-x64":return"win32-x64";case"win32-arm64":return"win32-arm64";case"linux-x64":return"linux-x64";case"linux-arm64":return"linux-arm64";case"linux-armhf":return"linux-armhf";case"alpine-x64":return"alpine-x64";case"alpine-arm64":return"alpine-arm64";case"darwin-x64":return"darwin-x64";case"darwin-arm64":return"darwin-arm64";case"web":return"web";case"universal":return"universal";default:return"unknown"}}function wh(t,e){switch(t){case 3:return e==="x64"?"win32-x64":e==="arm64"?"win32-arm64":"unknown";case 2:return e==="x64"?"linux-x64":e==="arm64"?"linux-arm64":e==="arm"?"linux-armhf":"unknown";case"alpine":return e==="x64"?"alpine-x64":e==="arm64"?"alpine-arm64":"unknown";case 1:return e==="x64"?"darwin-x64":e==="arm64"?"darwin-arm64":"unknown";case 0:return"web"}}function Sr(t,e){return e==="web"&&!t.includes("web")}function ga(t,e,i){return Sr(e,i)?!1:t==="undefined"||t==="universal"?!0:t==="unknown"?!1:t===i}function cm(t){return t&&typeof t=="object"&&typeof t.id=="string"&&(!t.uuid||typeof t.uuid=="string")}var Sh;(function(t){t.NoneOrRelevance="NoneOrRelevance",t.LastUpdatedDate="LastUpdatedDate",t.Title="Title",t.PublisherName="PublisherName",t.InstallCount="InstallCount",t.PublishedDate="PublishedDate",t.AverageRating="AverageRating",t.WeightedRating="WeightedRating"})(Sh||(Sh={}));var bh;(function(t){t[t.Default=0]="Default",t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"})(bh||(bh={}));var Eh;(function(t){t.Category="Category",t.ExtensionId="ExtensionId",t.ExtensionName="ExtensionName",t.ExcludeWithFlags="ExcludeWithFlags",t.Featured="Featured",t.SearchText="SearchText",t.Tag="Tag",t.Target="Target"})(Eh||(Eh={}));var _h;(function(t){t.Install="install",t.Uninstall="uninstall"})(_h||(_h={}));var xh;(function(t){t[t.None=1]="None",t[t.Install=2]="Install",t[t.Update=3]="Update",t[t.Migrate=4]="Migrate"})(xh||(xh={}));var bi=le("extensionGalleryService"),Ph;(function(t){t.Timeout="Timeout",t.Cancelled="Cancelled",t.Failed="Failed",t.DownloadFailedWriting="DownloadFailedWriting",t.Offline="Offline"})(Ph||(Ph={}));var _n=class extends Error{constructor(t,e){super(t),this.code=e,this.name=e}},Ih;(function(t){t.NotFound="NotFound",t.Unsupported="Unsupported",t.Deprecated="Deprecated",t.Malicious="Malicious",t.Incompatible="Incompatible",t.IncompatibleApi="IncompatibleApi",t.IncompatibleTargetPlatform="IncompatibleTargetPlatform",t.ReleaseVersionNotFound="ReleaseVersionNotFound",t.Invalid="Invalid",t.Download="Download",t.DownloadSignature="DownloadSignature",t.DownloadFailedWriting="DownloadFailedWriting",t.UpdateMetadata="UpdateMetadata",t.Extract="Extract",t.Scanning="Scanning",t.ScanningExtension="ScanningExtension",t.ReadRemoved="ReadRemoved",t.UnsetRemoved="UnsetRemoved",t.Delete="Delete",t.Rename="Rename",t.IntializeDefaultProfile="IntializeDefaultProfile",t.AddToProfile="AddToProfile",t.InstalledExtensionNotFound="InstalledExtensionNotFound",t.PostInstall="PostInstall",t.CorruptZip="CorruptZip",t.IncompleteZip="IncompleteZip",t.PackageNotSigned="PackageNotSigned",t.SignatureVerificationInternal="SignatureVerificationInternal",t.SignatureVerificationFailed="SignatureVerificationFailed",t.NotAllowed="NotAllowed",t.Gallery="Gallery",t.Cancelled="Cancelled",t.Unknown="Unknown",t.Internal="Internal"})(Ih||(Ih={}));var Oe;(function(t){t.NotSigned="NotSigned",t.Success="Success",t.RequiredArgumentMissing="RequiredArgumentMissing",t.InvalidArgument="InvalidArgument",t.PackageIsUnreadable="PackageIsUnreadable",t.UnhandledException="UnhandledException",t.SignatureManifestIsMissing="SignatureManifestIsMissing",t.SignatureManifestIsUnreadable="SignatureManifestIsUnreadable",t.SignatureIsMissing="SignatureIsMissing",t.SignatureIsUnreadable="SignatureIsUnreadable",t.CertificateIsUnreadable="CertificateIsUnreadable",t.SignatureArchiveIsUnreadable="SignatureArchiveIsUnreadable",t.FileAlreadyExists="FileAlreadyExists",t.SignatureArchiveIsInvalidZip="SignatureArchiveIsInvalidZip",t.SignatureArchiveHasSameSignatureFile="SignatureArchiveHasSameSignatureFile",t.PackageIntegrityCheckFailed="PackageIntegrityCheckFailed",t.SignatureIsInvalid="SignatureIsInvalid",t.SignatureManifestIsInvalid="SignatureManifestIsInvalid",t.SignatureIntegrityCheckFailed="SignatureIntegrityCheckFailed",t.EntryIsMissing="EntryIsMissing",t.EntryIsTampered="EntryIsTampered",t.Untrusted="Untrusted",t.CertificateRevoked="CertificateRevoked",t.SignatureIsNotValid="SignatureIsNotValid",t.UnknownError="UnknownError",t.PackageIsInvalidZip="PackageIsInvalidZip",t.SignatureArchiveHasTooManyEntries="SignatureArchiveHasTooManyEntries"})(Oe||(Oe={}));var we=class extends Error{constructor(t,e){super(t),this.code=e,this.name=e}},ma=le("extensionManagementService"),F2=le("IGlobalExtensionEnablementService"),T2=le("IExtensionTipsService"),Bi=le("IAllowedExtensionsService");async function va(t,e){let i;try{i=await e.resolve(t)}catch(r){if(r.fileOperationResult===1)return 0;throw r}return i.children?(await Promise.all(i.children.map(s=>va(s.resource,e)))).reduce((s,n)=>s+n,0):i.size??0}var N2=_c(1930,"Extensions"),M2=_c(1931,"Preferences"),um="extensions.gallery.useUnpkgResourceApi",ya="extensions.allowed",kh="extensions.user.cache",hm="extensions.builtin.cache",Dh="undefined_publisher",fm=["AI","Azure","Chat","Data Science","Debuggers","Extension Packs","Education","Formatters","Keymaps","Language Packs","Linters","Machine Learning","Notebooks","Programming Languages","SCM Providers","Snippets","Testing","Themes","Visualization","Other"],Ch;(function(t){t[t.System=0]="System",t[t.User=1]="User"})(Ch||(Ch={}));var Rh;(function(t){t.WIN32_X64="win32-x64",t.WIN32_ARM64="win32-arm64",t.LINUX_X64="linux-x64",t.LINUX_ARM64="linux-arm64",t.LINUX_ARMHF="linux-armhf",t.ALPINE_X64="alpine-x64",t.ALPINE_ARM64="alpine-arm64",t.DARWIN_X64="darwin-x64",t.DARWIN_ARM64="darwin-arm64",t.WEB="web",t.UNIVERSAL="universal",t.UNKNOWN="unknown",t.UNDEFINED="undefined"})(Rh||(Rh={}));var br=class{constructor(t){this.value=t,this._lower=t.toLowerCase()}static equals(t,e){if(typeof t>"u"||t===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof t=="string"||typeof e=="string"){const i=typeof t=="string"?t:t.value,r=typeof e=="string"?e:e.value;return Ti(i,r)}return t._lower===e._lower}static toKey(t){return typeof t=="string"?t.toLowerCase():t._lower}},dm=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(t){this._map.delete(br.toKey(t))}get(t){return this._map.get(br.toKey(t))}has(t){return this._map.has(br.toKey(t))}set(t,e){this._map.set(br.toKey(t),e)}values(){return this._map.values()}forEach(t){this._map.forEach(t)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};function Lh(t){return pm(t)}function pm(t){return t.contributes&&t.contributes.localizations?t.contributes.localizations.length>0:!1}function gm(t){return t.map(e=>{const[i,r]=e.split("@");return{proposalName:i,version:r?parseInt(r):void 0}})}function mm(t){return t.map(e=>e.split("@")[0])}var U2=le("IBuiltinExtensionsScannerService"),vm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ym(t){return vm.test(t)}var pt=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);const t=new Uint8Array(16),e=[];for(let i=0;i<256;i++)e.push(i.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=0,s="";return s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s+="-",s+=e[t[r++]],s+=e[t[r++]],s+="-",s+=e[t[r++]],s+=e[t[r++]],s+="-",s+=e[t[r++]],s+=e[t[r++]],s+="-",s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s+=e[t[r++]],s}})();function wm(t){if(zs===2&&/^penguin(\.|$)/i.test(t))return"chromebook"}function Sm(t,e,i,r,s,n,o,a,l,c,h){const f=Object.create(null);f["common.machineId"]=n,f["common.macMachineId"]=o,f["common.sqmId"]=a,f["common.devDeviceId"]=l,f.sessionID=pt()+Date.now(),f.commitHash=r,f.version=s,f["common.platformVersion"]=(t||"").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/,"$1$2$3"),f["common.platform"]=sp(zs),f["common.nodePlatform"]=Tc,f["common.nodeArch"]=i,f["common.product"]=h||"desktop",c&&(f["common.msftInternal"]=c);let d=0;const p=Date.now();Object.defineProperties(f,{timestamp:{get:()=>new Date,enumerable:!0},"common.timesincesessionstart":{get:()=>Date.now()-p,enumerable:!0},"common.sequence":{get:()=>d++,enumerable:!0}}),np&&(f["common.snap"]="true");const v=wm(e);return v&&(f["common.platformDetail"]=v),f}function bm(t){const e=Wt.USERDNSDOMAIN;if(!e)return!1;const i=e.toLowerCase();return t.some(r=>i===r)}var jt=le("telemetryService"),V2=le("customEndpointTelemetryService"),Em="telemetry.machineId",_m="telemetry.macMachineId",xm="telemetry.sqmId",Pm="telemetry.devDeviceId",Im="crashReporting",xn="crashReporting.enabled",Ah="telemetry.enableCrashReporter",wa="telemetry.enableTelemetry",Oh;(function(t){t[t.NONE=0]="NONE",t[t.CRASH=1]="CRASH",t[t.ERROR=2]="ERROR",t[t.USAGE=3]="USAGE"})(Oh||(Oh={}));var Fh;(function(t){t.OFF="off",t.ON="all"})(Fh||(Fh={}));var W2=le("mainProcessPerformanceTelemetryService"),Sa=class{constructor(t){this.value=t,this.isTrustedTelemetryValue=!0}},km=class{constructor(){this.telemetryLevel=0,this.sessionId="someValue.sessionId",this.machineId="someValue.machineId",this.macMachineId="someValue.macMachineId",this.sqmId="someValue.sqmId",this.devDeviceId="someValue.devDeviceId",this.firstSessionDate="someValue.firstSessionDate",this.sendErrorTelemetry=!1}registerAuthId(){}publicLog(){}publicLog2(){}publicLogError(){}publicLogError2(){}publicLogCapture(){}setExperimentProperty(){}},Dm=new km,Cm="telemetry",$2={id:Cm,name:g(2238,null)};function Th(t,e){return!e.isBuilt&&!e.disableTelemetry?!0:!(e.disableTelemetry||!t.enableTelemetry)}function Nh(t){const e=t.getValue(xn),i=t.getValue(Ah);if(t.getValue(wa)===!1||i===!1)return 0;switch(e??"all"){case"all":return 3;case"off":return 0}}function Rm(t,e){const i=t.msftInternalDomains||[],r=e.getValue("telemetry.internalTesting");return bm(i)||r}function Lm(t){return[t.appRoot,t.extensionsPath,t.userHome.fsPath,t.tmpDir.fsPath,t.userDataPath]}function Am(t,e){if(!t||!t.includes("/")&&!t.includes("\\"))return t;let i=t;const r=[];for(const a of e)for(;;){const l=a.exec(t);if(!l)break;r.push([l.index,a.lastIndex])}const s=/^[\\\/]?(node_modules|node_modules\.asar)[\\\/]/,n=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w-\._]+(\\\\|\\|\/))+[\w-\._]*/g;let o=0;for(i="";;){const a=n.exec(t);if(!a)break;const l=r.some(([c,h])=>a.index",o=n.lastIndex)}return o`;return t}function Mh(t,e){return jg(t,i=>{if(i instanceof Sa||Object.hasOwnProperty.call(i,"isTrustedTelemetryValue"))return i.value;if(typeof i=="string"){let r=i.replaceAll("%20"," ");r=Am(r,e);for(const s of e)r=r.replace(s,"");return r=Om(r),r}})}function J(t,e){return t.uuid&&e.uuid?t.uuid===e.uuid:t.id===e.id?!0:Ks(t.id,e.id)===0}var Fm=/^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/,gt=class ro{static create(e){const i=e.manifest?e.manifest.version:e.version,r=e.manifest?e.targetPlatform:e.properties.targetPlatform;return new ro(e.identifier,i,r)}static parse(e){const i=Fm.exec(e);return i&&i[1]&&i[2]?new ro({id:i[1]},i[2],i[4]||void 0):null}constructor(e,i,r="undefined"){this.identifier=e,this.version=i,this.targetPlatform=r,this.id=e.id}toString(){return`${this.id}-${this.version}${this.targetPlatform!=="undefined"?`-${this.targetPlatform}`:""}`}equals(e){return e instanceof ro?J(this,e)&&this.version===e.version&&this.targetPlatform===e.targetPlatform:!1}},Tm=/^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;function ba(t){const e=Tm.exec(t);return e&&e[1]?[Pn(e[1]),e[2]]:[Pn(t),void 0]}function Uh(t,e){return`${t}.${e}`}function Pn(t){return t.toLowerCase()}function wt(t,e){return Pn(Uh(t??Dh,e))}function Vh(t,e){const i=[],r=s=>{for(const n of i)if(n.some(o=>J(e(o),e(s))))return n;return null};for(const s of t){const n=r(s);n?n.push(s):i.push([s])}return i}function Nm(t){return{id:t.identifier.id,name:t.manifest.name,galleryId:null,publisherId:t.publisherId,publisherName:t.manifest.publisher,publisherDisplayName:t.publisherDisplayName,dependencies:t.manifest.extensionDependencies&&t.manifest.extensionDependencies.length>0}}function Ea(t){return{id:new Sa(t.identifier.id),name:new Sa(t.name),extensionVersion:t.version,galleryId:t.identifier.uuid,publisherId:t.publisherId,publisherName:t.publisher,publisherDisplayName:t.publisherDisplayName,isPreReleaseVersion:t.properties.isPreReleaseVersion,dependencies:!!(t.properties.dependencies&&t.properties.dependencies.length>0),isSigned:t.isSigned,...t.telemetryData}}var q2=new br("pprice.better-merge");async function Mm(t,e){if(!et)return!1;let i;try{i=(await t.readFile(I.file("/etc/os-release"))).value.toString()}catch{try{i=(await t.readFile(I.file("/usr/lib/os-release"))).value.toString()}catch(s){e.debug("Error while getting the os-release file.",H(s))}}return!!i&&(i.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function Wh(t,e){const i=await Mm(t,e),r=wh(i?"alpine":zs,Nc);return e.debug("ComputeTargetPlatform:",r),r}function Um(t,e){return e.some(i=>Re(i)?Ks(t.id.split(".")[0],i)===0:J(t,i))}async function Vm(t,e,i){let r=i&&i.get("storage.serviceMachineId",-1)||null;if(r)return r;try{const n=(await e.readFile(t.serviceMachineIdResource)).value.toString();r=ym(n)?n:null}catch{r=null}if(!r){r=pt();try{await e.writeFile(t.serviceMachineIdResource,W.fromString(r))}catch{}}return i?.store("storage.serviceMachineId",r,-1,1),r}async function Wm(t,e,i,r,s,n){const o={"X-Market-Client-Id":`VSCode ${$h(t)}`,"User-Agent":`VSCode ${$h(t)} (Code)`};if(Th(t,e)&&Nh(i)===3){const a=await Vm(e,r,s);o["X-Market-User-Id"]=a,o["VSCode-SessionId"]=n.machineId||a}return o}function $h(t){return t.vscodeVersion}var as;(function(t){t[t.Ignore=0]="Ignore",t[t.Info=1]="Info",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.AI=4]="AI"})(as||(as={})),(function(t){const e="error",i="warning",r="warn",s="info",n="ignore";function o(l){return l?Ti(e,l)?t.Error:Ti(i,l)||Ti(r,l)?t.Warning:Ti(s,l)?t.Info:t.Ignore:t.Ignore}t.fromValue=o;function a(l){switch(l){case t.Error:return e;case t.Warning:return i;case t.Info:return s;default:return n}}t.toString=a})(as||(as={}));var $e=as,In={},X={exports:In};(function(t,e){if(typeof In=="object"&&typeof X=="object")X.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var i=e();for(var r in i)(typeof In=="object"?In:t)[r]=i[r]}})(typeof self<"u"?self:void 0,(function(){return(function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(r,s,n){i.o(r,s)||Object.defineProperty(r,s,{enumerable:!0,get:n})},i.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},i.t=function(r,s){if(1&s&&(r=i(r)),8&s||4&s&&typeof r=="object"&&r&&r.__esModule)return r;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&s&&typeof r!="string")for(var o in r)i.d(n,o,function(a){return r[a]}.bind(null,o));return n},i.n=function(r){var s=r&&r.__esModule?function(){return r.default}:function(){return r};return i.d(s,"a",s),s},i.o=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)},i.p="",i(i.s=0)})([function(t,e,i){(function(r){var s;e=t.exports=ne,s=typeof r=="object"&&r.env&&r.env.NODE_DEBUG&&/\bsemver\b/i.test(r.env.NODE_DEBUG)?function(){var y=Array.prototype.slice.call(arguments,0);y.unshift("SEMVER"),console.log.apply(console,y)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var n=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,a=e.re=[],l=e.src=[],c=0,h=c++;l[h]="0|[1-9]\\d*";var f=c++;l[f]="[0-9]+";var d=c++;l[d]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var p=c++;l[p]="("+l[h]+")\\.("+l[h]+")\\.("+l[h]+")";var v=c++;l[v]="("+l[f]+")\\.("+l[f]+")\\.("+l[f]+")";var m=c++;l[m]="(?:"+l[h]+"|"+l[d]+")";var w=c++;l[w]="(?:"+l[f]+"|"+l[d]+")";var S=c++;l[S]="(?:-("+l[m]+"(?:\\."+l[m]+")*))";var _=c++;l[_]="(?:-?("+l[w]+"(?:\\."+l[w]+")*))";var P=c++;l[P]="[0-9A-Za-z-]+";var N=c++;l[N]="(?:\\+("+l[P]+"(?:\\."+l[P]+")*))";var x=c++,A="v?"+l[p]+l[S]+"?"+l[N]+"?";l[x]="^"+A+"$";var M="[v=\\s]*"+l[v]+l[_]+"?"+l[N]+"?",Z=c++;l[Z]="^"+M+"$";var C=c++;l[C]="((?:<|>)?=?)";var ee=c++;l[ee]=l[f]+"|x|X|\\*";var Fe=c++;l[Fe]=l[h]+"|x|X|\\*";var B=c++;l[B]="[v=\\s]*("+l[Fe]+")(?:\\.("+l[Fe]+")(?:\\.("+l[Fe]+")(?:"+l[S]+")?"+l[N]+"?)?)?";var nt=c++;l[nt]="[v=\\s]*("+l[ee]+")(?:\\.("+l[ee]+")(?:\\.("+l[ee]+")(?:"+l[_]+")?"+l[N]+"?)?)?";var k=c++;l[k]="^"+l[C]+"\\s*"+l[B]+"$";var D=c++;l[D]="^"+l[C]+"\\s*"+l[nt]+"$";var L=c++;l[L]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var R=c++;l[R]="(?:~>?)";var U=c++;l[U]="(\\s*)"+l[R]+"\\s+",a[U]=new RegExp(l[U],"g");var z=c++;l[z]="^"+l[R]+l[B]+"$";var re=c++;l[re]="^"+l[R]+l[nt]+"$";var Se=c++;l[Se]="(?:\\^)";var ke=c++;l[ke]="(\\s*)"+l[Se]+"\\s+",a[ke]=new RegExp(l[ke],"g");var Gt=c++;l[Gt]="^"+l[Se]+l[B]+"$";var Ii=c++;l[Ii]="^"+l[Se]+l[nt]+"$";var Qt=c++;l[Qt]="^"+l[C]+"\\s*("+M+")$|^$";var Yi=c++;l[Yi]="^"+l[C]+"\\s*("+A+")$|^$";var Ft=c++;l[Ft]="(\\s*)"+l[C]+"\\s*("+M+"|"+l[B]+")",a[Ft]=new RegExp(l[Ft],"g");var Rs=c++;l[Rs]="^\\s*("+l[B]+")\\s+-\\s+("+l[B]+")\\s*$";var Ls=c++;l[Ls]="^\\s*("+l[nt]+")\\s+-\\s+("+l[nt]+")\\s*$";var Kl=c++;l[Kl]="(<|>)?=?\\s*\\*";for(var ki=0;ki<35;ki++)s(ki,l[ki]),a[ki]||(a[ki]=new RegExp(l[ki]));function Di(y,b){if(y instanceof ne)return y;if(typeof y!="string"||y.length>n||!(b?a[Z]:a[x]).test(y))return null;try{return new ne(y,b)}catch{return null}}function ne(y,b){if(y instanceof ne){if(y.loose===b)return y;y=y.version}else if(typeof y!="string")throw new TypeError("Invalid Version: "+y);if(y.length>n)throw new TypeError("version is longer than "+n+" characters");if(!(this instanceof ne))return new ne(y,b);s("SemVer",y,b),this.loose=b;var E=y.trim().match(b?a[Z]:a[x]);if(!E)throw new TypeError("Invalid Version: "+y);if(this.raw=y,this.major=+E[1],this.minor=+E[2],this.patch=+E[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");E[4]?this.prerelease=E[4].split(".").map((function(F){if(/^[0-9]+$/.test(F)){var V=+F;if(V>=0&&V=0;)typeof this.prerelease[E]=="number"&&(this.prerelease[E]++,E=-2);E===-1&&this.prerelease.push(0)}b&&(this.prerelease[0]===b?isNaN(this.prerelease[1])&&(this.prerelease=[b,0]):this.prerelease=[b,0]);break;default:throw new Error("invalid increment argument: "+y)}return this.format(),this.raw=this.version,this},e.inc=function(y,b,E,F){typeof E=="string"&&(F=E,E=void 0);try{return new ne(y,E).inc(b,F).version}catch{return null}},e.diff=function(y,b){if(no(y,b))return null;var E=Di(y),F=Di(b);if(E.prerelease.length||F.prerelease.length){for(var V in E)if((V==="major"||V==="minor"||V==="patch")&&E[V]!==F[V])return"pre"+V;return"prerelease"}for(var V in E)if((V==="major"||V==="minor"||V==="patch")&&E[V]!==F[V])return V},e.compareIdentifiers=Zi;var Gl=/^[0-9]+$/;function Zi(y,b){var E=Gl.test(y),F=Gl.test(b);return E&&F&&(y=+y,b=+b),E&&!F?-1:F&&!E?1:yb?1:0}function Jt(y,b,E){return new ne(y,E).compare(new ne(b,E))}function As(y,b,E){return Jt(y,b,E)>0}function Os(y,b,E){return Jt(y,b,E)<0}function no(y,b,E){return Jt(y,b,E)===0}function Ql(y,b,E){return Jt(y,b,E)!==0}function oo(y,b,E){return Jt(y,b,E)>=0}function ao(y,b,E){return Jt(y,b,E)<=0}function Fs(y,b,E,F){var V;switch(b){case"===":typeof y=="object"&&(y=y.version),typeof E=="object"&&(E=E.version),V=y===E;break;case"!==":typeof y=="object"&&(y=y.version),typeof E=="object"&&(E=E.version),V=y!==E;break;case"":case"=":case"==":V=no(y,E,F);break;case"!=":V=Ql(y,E,F);break;case">":V=As(y,E,F);break;case">=":V=oo(y,E,F);break;case"<":V=Os(y,E,F);break;case"<=":V=ao(y,E,F);break;default:throw new TypeError("Invalid operator: "+b)}return V}function bt(y,b){if(y instanceof bt){if(y.loose===b)return y;y=y.value}if(!(this instanceof bt))return new bt(y,b);s("comparator",y,b),this.loose=b,this.parse(y),this.semver===Ar?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}e.rcompareIdentifiers=function(y,b){return Zi(b,y)},e.major=function(y,b){return new ne(y,b).major},e.minor=function(y,b){return new ne(y,b).minor},e.patch=function(y,b){return new ne(y,b).patch},e.compare=Jt,e.compareLoose=function(y,b){return Jt(y,b,!0)},e.rcompare=function(y,b,E){return Jt(b,y,E)},e.sort=function(y,b){return y.sort((function(E,F){return e.compare(E,F,b)}))},e.rsort=function(y,b){return y.sort((function(E,F){return e.rcompare(E,F,b)}))},e.gt=As,e.lt=Os,e.eq=no,e.neq=Ql,e.gte=oo,e.lte=ao,e.cmp=Fs,e.Comparator=bt;var Ar={};function Ee(y,b){if(y instanceof Ee)return y.loose===b?y:new Ee(y.raw,b);if(y instanceof bt)return new Ee(y.value,b);if(!(this instanceof Ee))return new Ee(y,b);if(this.loose=b,this.raw=y,this.set=y.split(/\s*\|\|\s*/).map((function(E){return this.parseRange(E.trim())}),this).filter((function(E){return E.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+y);this.format()}function Ye(y){return!y||y.toLowerCase()==="x"||y==="*"}function r1(y,b,E,F,V,Ve,oe,ot,De,Ke,Tt,Ce,Be){return((b=Ye(E)?"":Ye(F)?">="+E+".0.0":Ye(V)?">="+E+"."+F+".0":">="+b)+" "+(ot=Ye(De)?"":Ye(Ke)?"<"+(+De+1)+".0.0":Ye(Tt)?"<"+De+"."+(+Ke+1)+".0":Ce?"<="+De+"."+Ke+"."+Tt+"-"+Ce:"<="+ot)).trim()}function s1(y,b){for(var E=0;E0){var F=y[E].semver;if(F.major===b.major&&F.minor===b.minor&&F.patch===b.patch)return!0}return!1}return!0}function Ts(y,b,E){try{b=new Ee(b,E)}catch{return!1}return b.test(y)}function lo(y,b,E,F){var V,Ve,oe,ot,De;switch(y=new ne(y,F),b=new Ee(b,F),E){case">":V=As,Ve=ao,oe=Os,ot=">",De=">=";break;case"<":V=Os,Ve=oo,oe=As,ot="<",De="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ts(y,b,F))return!1;for(var Ke=0;Ke=0.0.0")),Ce=Ce||at,Be=Be||at,V(at.semver,Ce.semver,F)?Ce=at:oe(at.semver,Be.semver,F)&&(Be=at)})),Ce.operator===ot||Ce.operator===De||(!Be.operator||Be.operator===ot)&&Ve(y,Be.semver)||Be.operator===De&&oe(y,Be.semver))return!1}return!0}bt.prototype.parse=function(y){var b=this.loose?a[Qt]:a[Yi],E=y.match(b);if(!E)throw new TypeError("Invalid comparator: "+y);this.operator=E[1],this.operator==="="&&(this.operator=""),E[2]?this.semver=new ne(E[2],this.loose):this.semver=Ar},bt.prototype.toString=function(){return this.value},bt.prototype.test=function(y){return s("Comparator.test",y,this.loose),this.semver===Ar||(typeof y=="string"&&(y=new ne(y,this.loose)),Fs(y,this.operator,this.semver,this.loose))},bt.prototype.intersects=function(y,b){if(!(y instanceof bt))throw new TypeError("a Comparator is required");var E;if(this.operator==="")return E=new Ee(y.value,b),Ts(this.value,E,b);if(y.operator==="")return E=new Ee(this.value,b),Ts(y.semver,E,b);var F=!(this.operator!==">="&&this.operator!==">"||y.operator!==">="&&y.operator!==">"),V=!(this.operator!=="<="&&this.operator!=="<"||y.operator!=="<="&&y.operator!=="<"),Ve=this.semver.version===y.semver.version,oe=!(this.operator!==">="&&this.operator!=="<="||y.operator!==">="&&y.operator!=="<="),ot=Fs(this.semver,"<",y.semver,b)&&(this.operator===">="||this.operator===">")&&(y.operator==="<="||y.operator==="<"),De=Fs(this.semver,">",y.semver,b)&&(this.operator==="<="||this.operator==="<")&&(y.operator===">="||y.operator===">");return F||V||Ve&&oe||ot||De},e.Range=Ee,Ee.prototype.format=function(){return this.range=this.set.map((function(y){return y.join(" ").trim()})).join("||").trim(),this.range},Ee.prototype.toString=function(){return this.range},Ee.prototype.parseRange=function(y){var b=this.loose;y=y.trim(),s("range",y,b);var E=b?a[Ls]:a[Rs];y=y.replace(E,r1),s("hyphen replace",y),y=y.replace(a[Ft],"$1$2$3"),s("comparator trim",y,a[Ft]),y=(y=(y=y.replace(a[U],"$1~")).replace(a[ke],"$1^")).split(/\s+/).join(" ");var F=b?a[Qt]:a[Yi],V=y.split(" ").map((function(Ve){return(function(oe,ot){return s("comp",oe),oe=(function(De,Ke){return De.trim().split(/\s+/).map((function(Tt){return(function(Ce,Be){s("caret",Ce,Be);var at=Be?a[Ii]:a[Gt];return Ce.replace(at,(function(kt,q,Y,ge,ve){var ze;return s("caret",Ce,kt,q,Y,ge,ve),Ye(q)?ze="":Ye(Y)?ze=">="+q+".0.0 <"+(+q+1)+".0.0":Ye(ge)?ze=q==="0"?">="+q+"."+Y+".0 <"+q+"."+(+Y+1)+".0":">="+q+"."+Y+".0 <"+(+q+1)+".0.0":ve?(s("replaceCaret pr",ve),ve.charAt(0)!=="-"&&(ve="-"+ve),ze=q==="0"?Y==="0"?">="+q+"."+Y+"."+ge+ve+" <"+q+"."+Y+"."+(+ge+1):">="+q+"."+Y+"."+ge+ve+" <"+q+"."+(+Y+1)+".0":">="+q+"."+Y+"."+ge+ve+" <"+(+q+1)+".0.0"):(s("no pr"),ze=q==="0"?Y==="0"?">="+q+"."+Y+"."+ge+" <"+q+"."+Y+"."+(+ge+1):">="+q+"."+Y+"."+ge+" <"+q+"."+(+Y+1)+".0":">="+q+"."+Y+"."+ge+" <"+(+q+1)+".0.0"),s("caret return",ze),ze}))})(Tt,Ke)})).join(" ")})(oe,ot),s("caret",oe),oe=(function(De,Ke){return De.trim().split(/\s+/).map((function(Tt){return(function(Ce,Be){var at=Be?a[re]:a[z];return Ce.replace(at,(function(kt,q,Y,ge,ve){var ze;return s("tilde",Ce,kt,q,Y,ge,ve),Ye(q)?ze="":Ye(Y)?ze=">="+q+".0.0 <"+(+q+1)+".0.0":Ye(ge)?ze=">="+q+"."+Y+".0 <"+q+"."+(+Y+1)+".0":ve?(s("replaceTilde pr",ve),ve.charAt(0)!=="-"&&(ve="-"+ve),ze=">="+q+"."+Y+"."+ge+ve+" <"+q+"."+(+Y+1)+".0"):ze=">="+q+"."+Y+"."+ge+" <"+q+"."+(+Y+1)+".0",s("tilde return",ze),ze}))})(Tt,Ke)})).join(" ")})(oe,ot),s("tildes",oe),oe=(function(De,Ke){return s("replaceXRanges",De,Ke),De.split(/\s+/).map((function(Tt){return(function(Ce,Be){Ce=Ce.trim();var at=Be?a[D]:a[k];return Ce.replace(at,(function(kt,q,Y,ge,ve,ze){s("xRange",Ce,kt,q,Y,ge,ve,ze);var Jl=Ye(Y),Or=Jl||Ye(ge),Fr=Or||Ye(ve);return q==="="&&Fr&&(q=""),Jl?kt=q===">"||q==="<"?"<0.0.0":"*":q&&Fr?(Or&&(ge=0),Fr&&(ve=0),q===">"?(q=">=",Or?(Y=+Y+1,ge=0,ve=0):Fr&&(ge=+ge+1,ve=0)):q==="<="&&(q="<",Or?Y=+Y+1:ge=+ge+1),kt=q+Y+"."+ge+"."+ve):Or?kt=">="+Y+".0.0 <"+(+Y+1)+".0.0":Fr&&(kt=">="+Y+"."+ge+".0 <"+Y+"."+(+ge+1)+".0"),s("xRange return",kt),kt}))})(Tt,Ke)})).join(" ")})(oe,ot),s("xrange",oe),oe=(function(De,Ke){return s("replaceStars",De,Ke),De.trim().replace(a[Kl],"")})(oe,ot),s("stars",oe),oe})(Ve,b)})).join(" ").split(/\s+/);return this.loose&&(V=V.filter((function(Ve){return!!Ve.match(F)}))),V=V.map((function(Ve){return new bt(Ve,b)}))},Ee.prototype.intersects=function(y,b){if(!(y instanceof Ee))throw new TypeError("a Range is required");return this.set.some((function(E){return E.every((function(F){return y.set.some((function(V){return V.every((function(Ve){return F.intersects(Ve,b)}))}))}))}))},e.toComparators=function(y,b){return new Ee(y,b).set.map((function(E){return E.map((function(F){return F.value})).join(" ").trim().split(" ")}))},Ee.prototype.test=function(y){if(!y)return!1;typeof y=="string"&&(y=new ne(y,this.loose));for(var b=0;b",E)},e.outside=lo,e.prerelease=function(y,b){var E=Di(y,b);return E&&E.prerelease.length?E.prerelease:null},e.intersects=function(y,b,E){return y=new Ee(y,E),b=new Ee(b,E),y.intersects(b)},e.coerce=function(y){if(y instanceof ne)return y;if(typeof y!="string")return null;var b=y.match(a[L]);return b==null?null:Di((b[1]||"0")+"."+(b[2]||"0")+"."+(b[3]||"0"))}}).call(this,i(1))},function(t,e){var i,r,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(w){if(i===setTimeout)return setTimeout(w,0);if((i===n||!i)&&setTimeout)return i=setTimeout,setTimeout(w,0);try{return i(w,0)}catch{try{return i.call(null,w,0)}catch{return i.call(this,w,0)}}}(function(){try{i=typeof setTimeout=="function"?setTimeout:n}catch{i=n}try{r=typeof clearTimeout=="function"?clearTimeout:o}catch{r=o}})();var l,c=[],h=!1,f=-1;function d(){h&&l&&(h=!1,l.length?c=l.concat(c):f=-1,c.length&&p())}function p(){if(!h){var w=a(d);h=!0;for(var S=c.length;S;){for(l=c,c=[];++f1)for(var _=1;_=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,Km=/^-(\d{4})(\d{2})(\d{2})$/;function Gm(t){return t=t.trim(),t==="*"||jh.test(t)}function xa(t){if(!Gm(t))return null;if(t=t.trim(),t==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};const e=t.match(jh);return e?{hasCaret:e[1]==="^",hasGreaterEquals:e[1]===">=",majorBase:e[2]==="x"?0:parseInt(e[2],10),majorMustEqual:e[2]!=="x",minorBase:e[4]==="x"?0:parseInt(e[4],10),minorMustEqual:e[4]!=="x",patchBase:e[6]==="x"?0:parseInt(e[6],10),patchMustEqual:e[6]!=="x",preRelease:e[8]||null}:null}function Pa(t){if(!t)return null;const e=t.majorBase,i=t.majorMustEqual,r=t.minorBase;let s=t.minorMustEqual;const n=t.patchBase;let o=t.patchMustEqual;t.hasCaret&&(e===0||(s=!1),o=!1);let a=0;if(t.preRelease){const l=Km.exec(t.preRelease);if(l){const[,c,h,f]=l;a=Date.UTC(Number(c),Number(h)-1,Number(f))}}return{majorBase:e,majorMustEqual:i,minorBase:r,minorMustEqual:s,patchBase:n,patchMustEqual:o,isMinimum:t.hasGreaterEquals,notBefore:a}}function Qm(t,e,i){let r;typeof t=="string"?r=Pa(xa(t)):r=t;let s;e instanceof Date?s=e.getTime():typeof e=="string"&&(s=new Date(e).getTime());let n;if(typeof i=="string"?n=Pa(xa(i)):n=i,!r||!n)return!1;const o=r.majorBase,a=r.minorBase,l=r.patchBase;let c=n.majorBase,h=n.minorBase,f=n.patchBase;const d=n.notBefore;let p=n.majorMustEqual,v=n.minorMustEqual,m=n.patchMustEqual;return n.isMinimum?o>c?!0:oh?!0:a=f:(o===1&&c===0&&(!p||!v||!m)&&(c=1,h=0,f=0,p=!0,v=!1,m=!1),oc?!p:ah?!v:lf?!m:!(s&&s"u"&&typeof r.browser>"u")return o.push([$e.Error,g(1990,null,"activationEvents","main","browser")]),o}if(typeof r.extensionKind<"u"&&typeof r.main>"u"&&o.push([$e.Warning,g(1991,null,"extensionKind")]),typeof r.main<"u"){if(typeof r.main!="string")return o.push([$e.Error,g(1992,null,"main")]),o;{const c=j(i,r.main);su(c,i)||o.push([$e.Warning,g(1993,null,c.path,i.path)])}}if(typeof r.browser<"u"){if(typeof r.browser!="string")return o.push([$e.Error,g(1994,null,"browser")]),o;{const c=j(i,r.browser);su(c,i)||o.push([$e.Warning,g(1995,null,c.path,i.path)])}}if(!$m(r.version))return o.push([$e.Error,g(1996,null)]),o;const a=[];if(!Xm(t,e,r,s,a))for(const c of a)o.push([$e.Error,c]);if(n&&r.enabledApiProposals?.length){const c=[];if(!Ia([...r.enabledApiProposals],c))for(const h of c)o.push([$e.Error,h])}return o}function Xm(t,e,i,r,s){return r||typeof i.main>"u"&&typeof i.browser>"u"||i.publisher==="TypeScriptTeam"&&i.name==="native-preview"?!0:Bh(t,e,i.engines.vscode,s)}function ls(t,e,i){return t==="*"||Bh(e,i,t)}function Ia(t,e){if(t.length===0)return!0;const i=Array.isArray(e)?e:void 0,r=(i?void 0:e)??Hm,s=[],n=gm(t);for(const{proposalName:o,version:a}of n){if(!a)continue;r[o]?.version!==a&&s.push(o)}return s.length?(i&&(s.length===1?i.push(g(1997,null,s[0])):i.push(g(1998,null,s.slice(0,s.length-1).map(o=>`'${o}'`).join(", "),s[s.length-1]))),!1):!0}function Bh(t,e,i,r=[]){const s=Pa(xa(i));if(!s)return r.push(g(1999,null,i)),!1;if(s.majorBase===0){if(!s.majorMustEqual||!s.minorMustEqual)return r.push(g(2e3,null,i)),!1}else if(!s.majorMustEqual)return r.push(g(2001,null,i)),!1;return Qm(t,e,s)?!0:(r.push(g(2002,null,t,i)),!1)}function zh(t){if(!Array.isArray(t))return!1;for(let e=0,i=t.length;e200)return t;if(typeof t=="object"){switch(t.$mid){case 1:return I.revive(t);case 2:return new RegExp(t.source,t.flags);case 17:return new Date(t.source)}if(t instanceof W||t instanceof Uint8Array)return t;if(Array.isArray(t))for(let i=0;ithis.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((i,r)=>this.acceptExternal(r,i)),e.deleted?.forEach(i=>this.acceptExternal(i,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,i){if(this.state===At.Closed)return;let r=!1;Qe(i)?r=this.cache.delete(e):this.cache.get(e)!==i&&(this.cache.set(e,i),r=!0),r&&this._onDidChangeStorage.fire({key:e,external:!0})}get items(){return this.cache}get size(){return this.cache.size}async init(){this.state===At.None&&(this.state=At.Initialized,this.options.hint!==cs.STORAGE_DOES_NOT_EXIST&&(this.cache=await this.database.getItems()))}cursorDiskKVGet(e){return this.database.cursorDiskKVGet(e)}cursorDiskKVSet(e,i){return this.database.cursorDiskKVSet(e,i)}cursorDiskKVClearPrefix(e){return this.database.cursorDiskKVClearPrefix(e)}get(e,i){const r=this.cache.get(e);return Qe(r)?i:r}getBoolean(e,i){const r=this.get(e);return Qe(r)?i:r==="true"}getNumber(e,i){const r=this.get(e);return Qe(r)?i:parseInt(r,10)}getObject(e,i){const r=this.get(e);return Qe(r)?i:tv(r)}async set(e,i,r=!1){if(this.state===At.Closed)return;if(Qe(i))return this.delete(e,r);const s=Ne(i)||Array.isArray(i)?ev(i):String(i);if(this.cache.get(e)!==s)return this.cache.set(e,s),this.pendingInserts.set(e,s),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:r}),this.doFlush()}async delete(e,i=!1){if(!(this.state===At.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async optimize(){if(this.state!==At.Closed)return await this.flush(0),this.database.optimize()}async close(){return this.pendingClose||(this.pendingClose=this.doClose()),this.pendingClose}async doClose(){this.state=At.Closed;try{await this.doFlush(0)}catch{}await this.database.close(()=>this.cache)}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async flush(e){if(!(this.state===At.Closed||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===cs.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}async whenFlushed(){if(this.hasPending)return new Promise(e=>this.whenFlushedCallbacks.push(e))}isInMemory(){return this.options.hint===cs.STORAGE_IN_MEMORY}},E9=le("contextService");function rv(t){const e=t;return typeof e?.id=="string"&&I.isUri(e.uri)}function sv(t){const e=t;return typeof e?.id=="string"&&I.isUri(e.configPath)}var Kh;(function(t){t[t.EMPTY=1]="EMPTY",t[t.FOLDER=2]="FOLDER",t[t.WORKSPACE=3]="WORKSPACE"})(Kh||(Kh={}));var Gh="code-workspace",_9=`.${Gh}`,x9=[{name:g(2652,null),extensions:[Gh]}],qe=le("IUriIdentityService"),Qh;(function(t){t.Settings="settings",t.Keybindings="keybindings",t.Snippets="snippets",t.Prompts="prompts",t.Tasks="tasks",t.Extensions="extensions",t.GlobalState="globalState"})(Qh||(Qh={}));function nv(t){const e=t;return!!(e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.isDefault=="boolean"&&typeof e.name=="string"&&I.isUri(e.location)&&I.isUri(e.globalStorageHome)&&I.isUri(e.settingsResource)&&I.isUri(e.keybindingsResource)&&I.isUri(e.tasksResource)&&I.isUri(e.snippetsHome)&&I.isUri(e.promptsHome)&&I.isUri(e.extensionsResource))}var Ot=le("IUserDataProfilesService");function kn(t,e,i,r,s,n){return{id:t,name:e,location:i,isDefault:!1,icon:s?.icon,globalStorageHome:n&&s?.useDefaultFlags?.globalState?n.globalStorageHome:j(i,"globalStorage"),settingsResource:n&&s?.useDefaultFlags?.settings?n.settingsResource:j(i,"settings.json"),keybindingsResource:n&&s?.useDefaultFlags?.keybindings?n.keybindingsResource:j(i,"keybindings.json"),tasksResource:n&&s?.useDefaultFlags?.tasks?n.tasksResource:j(i,"tasks.json"),snippetsHome:n&&s?.useDefaultFlags?.snippets?n.snippetsHome:j(i,"snippets"),promptsHome:n&&s?.useDefaultFlags?.prompts?n.promptsHome:j(i,"prompts"),extensionsResource:n&&s?.useDefaultFlags?.extensions?n.extensionsResource:j(i,"extensions.json"),cacheHome:j(r,t),useDefaultFlags:s?.useDefaultFlags,isTransient:s?.transient,workspaces:s?.workspaces}}var Ca=class extends K{static{this.PROFILES_KEY="userDataProfiles"}static{this.PROFILE_ASSOCIATIONS_KEY="profileAssociations"}get defaultProfile(){return this.profiles[0]}get profiles(){return[...this.profilesObject.profiles,...this.transientProfilesObject.profiles]}constructor(e,i,r,s){super(),this.environmentService=e,this.fileService=i,this.uriIdentityService=r,this.logService=s,this._onDidChangeProfiles=this._register(new O),this.onDidChangeProfiles=this._onDidChangeProfiles.event,this._onWillCreateProfile=this._register(new O),this.onWillCreateProfile=this._onWillCreateProfile.event,this._onWillRemoveProfile=this._register(new O),this.onWillRemoveProfile=this._onWillRemoveProfile.event,this._onDidResetWorkspaces=this._register(new O),this.onDidResetWorkspaces=this._onDidResetWorkspaces.event,this.profileCreationPromises=new Map,this.transientProfilesObject={profiles:[],emptyWindows:new Map},this.profilesHome=j(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=j(this.environmentService.cacheHome,"CachedProfilesData")}init(){this._profilesObject=void 0}get profilesObject(){if(!this._profilesObject){const e=this.createDefaultProfile(),i=[e];try{for(const s of this.getStoredProfiles()){if(!s.name||!Re(s.name)||!s.location){this.logService.warn("Skipping the invalid stored profile",s.location||s.name);continue}i.push(kn(cr(s.location),s.name,s.location,this.profilesCacheHome,{icon:s.icon,useDefaultFlags:s.useDefaultFlags},e))}}catch(s){this.logService.error(s)}const r=new Map;if(i.length)try{const s=this.getStoredProfileAssociations();if(s.workspaces)for(const[n,o]of Object.entries(s.workspaces)){const a=I.parse(n),l=i.find(c=>c.id===o);if(l){const c=l.workspaces?l.workspaces.slice(0):[];c.push(a),l.workspaces=c}}if(s.emptyWindows)for(const[n,o]of Object.entries(s.emptyWindows)){const a=i.find(l=>l.id===o);a&&r.set(n,a)}}catch(s){this.logService.error(s)}this._profilesObject={profiles:i,emptyWindows:r}}return this._profilesObject}createDefaultProfile(){const e=kn("__default__profile__",g(2605,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){const i="Temp",r=new RegExp(`${ar(i)}\\s(\\d+)`);let s=0;for(const o of this.profiles){const a=r.exec(o.name),l=a?parseInt(a[1]):0;s=l>s?l:s}const n=`${i} ${s+1}`;return this.createProfile(dr(pt()).toString(16),n,{transient:!0},e)}async createNamedProfile(e,i,r){return this.createProfile(dr(pt()).toString(16),e,i,r)}async createProfile(e,i,r,s){return await this.doCreateProfile(e,i,r,s)}async doCreateProfile(e,i,r,s){if(!Re(i)||!i)throw new Error("Name of the profile is mandatory and must be of type `string`");let n=this.profileCreationPromises.get(i);return n||(n=(async()=>{try{if(this.profiles.find(h=>h.id===e||!h.isTransient&&!r?.transient&&h.name===i))throw new Error(`Profile with ${i} name already exists`);const a=s?this.getWorkspace(s):void 0;I.isUri(a)&&(r={...r,workspaces:[a]});const l=kn(e,i,j(this.profilesHome,e),this.profilesCacheHome,r,this.defaultProfile);await this.fileService.createFolder(l.location);const c=[];return this._onWillCreateProfile.fire({profile:l,join(h){c.push(h)}}),await ht.settled(c),a&&!I.isUri(a)&&this.updateEmptyWindowAssociation(a,l,!!l.isTransient),this.updateProfiles([l],[],[]),l}finally{this.profileCreationPromises.delete(i)}})(),this.profileCreationPromises.set(i,n)),n}async updateProfile(e,i){const r=[];for(const n of this.profiles){let o;if(e.id===n.id)n.isDefault?i.workspaces&&(o=n,o.workspaces=i.workspaces):o=kn(n.id,i.name??n.name,n.location,this.profilesCacheHome,{icon:i.icon===null?void 0:i.icon??n.icon,transient:i.transient??n.isTransient,useDefaultFlags:i.useDefaultFlags??n.useDefaultFlags,workspaces:i.workspaces??n.workspaces},this.defaultProfile);else if(i.workspaces){const a=n.workspaces?.filter(l=>!i.workspaces?.some(c=>this.uriIdentityService.extUri.isEqual(l,c)));n.workspaces?.length!==a?.length&&(o=n,o.workspaces=a)}o&&r.push(o)}if(!r.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],r);const s=this.profiles.find(n=>n.id===e.id);if(!s)throw new Error(`Profile '${e.name}' was not updated`);return s}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");const i=this.profiles.find(s=>s.id===e.id);if(!i)throw new Error(`Profile '${e.name}' does not exist`);const r=[];this._onWillRemoveProfile.fire({profile:i,join(s){r.push(s)}});try{await Promise.allSettled(r)}catch(s){this.logService.error(s)}this.updateProfiles([],[i],[]);try{await this.fileService.del(i.cacheHome,{recursive:!0})}catch(s){Ue(s)!==1&&this.logService.error(s)}}async setProfileForWorkspace(e,i){const r=this.profiles.find(n=>n.id===i.id);if(!r)throw new Error(`Profile '${i.name}' does not exist`);const s=this.getWorkspace(e);if(I.isUri(s)){const n=r.workspaces?[...r.workspaces]:[];n.some(o=>this.uriIdentityService.extUri.isEqual(o,s))||(n.push(s),await this.updateProfile(r,{workspaces:n}))}else this.updateEmptyWindowAssociation(s,r,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,i=!1){const r=this.getWorkspace(e);if(I.isUri(r)){const s=this.getProfileForWorkspace(e);s&&this.updateProfile(s,{workspaces:s.workspaces?.filter(n=>!this.uriIdentityService.extUri.isEqual(n,r))})}else this.updateEmptyWindowAssociation(r,void 0,i),this.updateStoredProfiles(this.profiles)}async resetWorkspaces(){this.transientProfilesObject.emptyWindows.clear(),this.profilesObject.emptyWindows.clear();for(const e of this.profiles)e.workspaces=void 0;this.updateProfiles([],[],this.profiles),this._onDidResetWorkspaces.fire()}async cleanUp(){if(await this.fileService.exists(this.profilesHome)){const e=await this.fileService.resolve(this.profilesHome);await Promise.all((e.children||[]).filter(i=>i.isDirectory&&this.profiles.every(r=>!this.uriIdentityService.extUri.isEqual(r.location,i.resource))).map(i=>this.fileService.del(i.resource,{recursive:!0})))}}async cleanUpTransientProfiles(){const e=this.transientProfilesObject.profiles.filter(i=>!this.isProfileAssociatedToWorkspace(i));await Promise.allSettled(e.map(i=>this.removeProfile(i)))}getProfileForWorkspace(e){const i=this.getWorkspace(e);return I.isUri(i)?this.profiles.find(r=>r.workspaces?.some(s=>this.uriIdentityService.extUri.isEqual(s,i))):this.profilesObject.emptyWindows.get(i)??this.transientProfilesObject.emptyWindows.get(i)}getWorkspace(e){return rv(e)?e.uri:sv(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(i=>this.uriIdentityService.extUri.isEqual(i.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(i=>this.uriIdentityService.extUri.isEqual(i.location,e.location)))}updateProfiles(e,i,r){const s=[...this.profiles,...e],n=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];const o=[];for(let a of s){if(i.some(l=>a.id===l.id)){for(const l of[...this.profilesObject.emptyWindows.keys()])a.id===this.profilesObject.emptyWindows.get(l)?.id&&this.profilesObject.emptyWindows.delete(l);continue}if(!a.isDefault){a=r.find(c=>a.id===c.id)??a;const l=n.find(c=>a.id===c.id);if(a.isTransient)this.transientProfilesObject.profiles.push(a);else if(l){for(const[c,h]of this.transientProfilesObject.emptyWindows.entries())if(a.id===h.id){this.transientProfilesObject.emptyWindows.delete(c),this.profilesObject.emptyWindows.set(c,a);break}}}a.workspaces?.length===0&&(a.workspaces=void 0),o.push(a)}this.updateStoredProfiles(o),this.triggerProfilesChanges(e,i,r)}triggerProfilesChanges(e,i,r){this._onDidChangeProfiles.fire({added:e,removed:i,updated:r,all:this.profiles})}updateEmptyWindowAssociation(e,i,r){r=i?.isTransient?!0:r,r?i?this.transientProfilesObject.emptyWindows.set(e,i):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),i?this.profilesObject.emptyWindows.set(e,i):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){const i=[],r={},s={};for(const n of e)if(!n.isTransient&&(n.isDefault||i.push({location:n.location,name:n.name,icon:n.icon,useDefaultFlags:n.useDefaultFlags}),n.workspaces))for(const o of n.workspaces)r[o.toString()]=n.id;for(const[n,o]of this.profilesObject.emptyWindows.entries())s[n.toString()]=o.id;this.saveStoredProfileAssociations({workspaces:r,emptyWindows:s}),this.saveStoredProfiles(i),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};Ca=__decorate([__param(0,ui),__param(1,Pe),__param(2,qe),__param(3,he)],Ca);var ov="__$__isNewStorageMarker",Dn="__$__targetStorageMarker",av=le("storageService"),_r;(function(t){t[t.NONE=0]="NONE",t[t.SHUTDOWN=1]="SHUTDOWN"})(_r||(_r={}));var Jh;(function(t){t[t.APPLICATION=-1]="APPLICATION",t[t.PROFILE=0]="PROFILE",t[t.WORKSPACE=1]="WORKSPACE"})(Jh||(Jh={}));var Xh;(function(t){t[t.USER=0]="USER",t[t.MACHINE=1]="MACHINE"})(Xh||(Xh={}));function lv(t){const e=t.get(Dn);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}var I9=class e1 extends K{static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}constructor(e={flushInterval:e1.DEFAULT_FLUSH_INTERVAL}){super(),this._onDidChangeValue=this._register(new mo),this._onDidChangeTarget=this._register(new mo),this.onDidChangeTarget=this._onDidChangeTarget.event,this._onWillSaveState=this._register(new O),this.onWillSaveState=this._onWillSaveState.event,this.runFlushWhenIdle=this._register(new Ur),this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0,this.onDiskShouldSaveCallbacks=[],this.flushWhenIdleScheduler=this._register(new rn(()=>this.doFlushWhenIdle(),e.flushInterval))}onDidChangeValue(e,i,r){return ae.filter(this._onDidChangeValue.event,s=>s.scope===e&&(i===void 0||s.key===i),r)}doFlushWhenIdle(){this.runFlushWhenIdle.value=pu(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){_t([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Da("code/willInitStorage");try{await this.doInitialize()}finally{Da("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,i){const{key:r,external:s}=i;if(r===Dn){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:r,target:this.getKeyTargets(e)[r],external:s})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,i,r){return this.getStorage(i)?.get(e,r)}getBoolean(e,i,r){return this.getStorage(i)?.getBoolean(e,r)}getNumber(e,i,r){return this.getStorage(i)?.getNumber(e,r)}getObject(e,i,r){return this.getStorage(i)?.getObject(e,r)}storeAll(e,i){this.withPausedEmitters(()=>{for(const r of e)this.store(r.key,r.value,r.scope,r.target,i)})}store(e,i,r,s,n=!1){if(Qe(i)){this.remove(e,r,n);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,r,s),this.getStorage(r)?.set(e,i,n)})}remove(e,i,r=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,i,void 0),this.getStorage(i)?.delete(e,r)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,i){const r=[],s=this.getKeyTargets(e);for(const n of Object.keys(s))s[n]===i&&r.push(n);return r}updateKeyTarget(e,i,r,s=!1){const n=this.getKeyTargets(i);typeof r=="number"?n[e]!==r&&(n[e]=r,this.getStorage(i)?.set(Dn,JSON.stringify(n),s)):typeof n[e]=="number"&&(delete n[e],this.getStorage(i)?.set(Dn,JSON.stringify(n),s))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){const i=this.getStorage(e);return i?lv(i):Object.create(null)}isNew(e){return this.getBoolean(ov,e)===!0}async cursorDiskKVGet(e){return this.getStorage(-1)?.cursorDiskKVGet(e)}async cursorDiskKVSet(e,i){return this.getStorage(-1)?.cursorDiskKVSet(e,i)}async cursorDiskKVClearPrefix(e){return this.getStorage(-1)?.cursorDiskKVClearPrefix(e)}cursorDiskKVOnShouldSave(e){return this.onDiskShouldSaveCallbacks.push(e),{dispose:()=>{this.onDiskShouldSaveCallbacks=this.onDiskShouldSaveCallbacks.filter(i=>i!==e)}}}async flush(e=_r.NONE){this._onWillSaveState.fire({reason:e});const i=this.getStorage(-1),r=this.getStorage(0),s=this.getStorage(1);switch(e){case _r.NONE:for(const n of this.onDiskShouldSaveCallbacks)try{n().catch(console.error)}catch{}await ht.settled([i?.whenFlushed()??Promise.resolve(),r?.whenFlushed()??Promise.resolve(),s?.whenFlushed()??Promise.resolve()]);break;case _r.SHUTDOWN:for(const n of this.onDiskShouldSaveCallbacks)try{await n()}catch(o){console.error(o)}await ht.settled([i?.flush(0)??Promise.resolve(),r?.flush(0)??Promise.resolve(),s?.flush(0)??Promise.resolve()]);break}}async log(){const e=this.getStorage(-1)?.items??new Map,i=this.getStorage(0)?.items??new Map,r=this.getStorage(1)?.items??new Map;return cv(e,i,r,this.getLogDetails(-1)??"",this.getLogDetails(0)??"",this.getLogDetails(1)??"")}async optimize(e){return await this.flush(),this.getStorage(e)?.optimize()}async switch(e,i){return this.emitWillSaveState(_r.NONE),nv(e)?this.switchToProfile(e,i):this.switchToWorkspace(e,i)}canSwitchProfile(e,i){return!(e.id===i.id||Yh(i)&&Yh(e))}switchData(e,i,r){this.withPausedEmitters(()=>{const s=new Set;for(const[n,o]of e)s.add(n),i.get(n)!==o&&this.emitDidChangeValue(r,{key:n,external:!0});for(const[n]of i.items)s.has(n)||this.emitDidChangeValue(r,{key:n,external:!0})})}};function Yh(t){return t.isDefault||!!t.useDefaultFlags?.globalState}async function cv(t,e,i,r,s,n){const o=m=>{try{return JSON.parse(m)}catch{return m}},a=new Map,l=new Map;t.forEach((m,w)=>{a.set(w,m),l.set(w,o(m))});const c=new Map,h=new Map;e.forEach((m,w)=>{c.set(w,m),h.set(w,o(m))});const f=new Map,d=new Map;i.forEach((m,w)=>{f.set(w,m),d.set(w,o(m))}),console.group(r!==s?`Storage: Application (path: ${r})`:`Storage: Application & Profile (path: ${r}, default profile)`);const p=[];if(a.forEach((m,w)=>{p.push({key:w,value:m})}),console.table(p),console.groupEnd(),console.log(l),r!==s){console.group(`Storage: Profile (path: ${s}, profile specific)`);const m=[];c.forEach((w,S)=>{m.push({key:S,value:w})}),console.table(m),console.groupEnd(),console.log(h)}console.group(`Storage: Workspace (path: ${n})`);const v=[];f.forEach((m,w)=>{v.push({key:w,value:m})}),console.table(v),console.groupEnd(),console.log(d)}var vt,Ra=globalThis.vscode;if(typeof Ra<"u"&&typeof Ra.context<"u"){const t=Ra.context.configuration();if(t)vt=t.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(vt=globalThis._VSCODE_PRODUCT_JSON,Wt.VSCODE_DEV,Wt.VSCODE_DEV_ONBOARDING&&Object.assign(vt,{nameShort:`${vt.nameShort} Onboarding`,nameLong:`${vt.nameLong} Onboarding`,dataFolderName:`${vt.dataFolderName}-onboarding`,serverDataFolderName:vt.serverDataFolderName?`${vt.serverDataFolderName}-onboarding`:void 0}),!vt.version){const t=globalThis._VSCODE_PACKAGE_JSON;Object.assign(vt,{version:t.version})}}else vt={},Object.keys(vt).length===0&&Object.assign(vt,{version:"1.94.0-dev",nameShort:"Cursor Dev",nameLong:"Cursor Dev",applicationName:"cursor",dataFolderName:".cursor",urlProtocol:"cursor",reportIssueUrl:"https://github.com/getcursor/cursor/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/getcursor/cursor/",serverLicenseUrl:"https://github.com/getcursor/cursor/"});var Bt=vt,Zh;(function(t){t.ExtensionQueryService="ExtensionQueryService",t.ExtensionLatestVersionUri="ExtensionLatestVersionUriTemplate",t.ExtensionStatisticsUri="ExtensionStatisticsUriTemplate",t.WebExtensionStatisticsUri="WebExtensionStatisticsUriTemplate",t.PublisherViewUri="PublisherViewUriTemplate",t.ExtensionDetailsViewUri="ExtensionDetailsViewUriTemplate",t.ExtensionRatingViewUri="ExtensionRatingViewUriTemplate",t.ExtensionResourceUri="ExtensionResourceUriTemplate",t.ContactSupportUri="ContactSupportUri",t.ReportIssueUri="ReportIssueUri"})(Zh||(Zh={}));var ef;(function(t){t.None="None",t.IncludeVersions="IncludeVersions",t.IncludeFiles="IncludeFiles",t.IncludeCategoryAndTags="IncludeCategoryAndTags",t.IncludeSharedAccounts="IncludeSharedAccounts",t.IncludeVersionProperties="IncludeVersionProperties",t.ExcludeNonValidated="ExcludeNonValidated",t.IncludeInstallationTargets="IncludeInstallationTargets",t.IncludeAssetUri="IncludeAssetUri",t.IncludeStatistics="IncludeStatistics",t.IncludeLatestVersionOnly="IncludeLatestVersionOnly",t.Unpublished="Unpublished",t.IncludeNameConflictInfo="IncludeNameConflictInfo",t.IncludeLatestPrereleaseAndStableVersionOnly="IncludeLatestPrereleaseAndStableVersionOnly"})(ef||(ef={}));var us=le("IExtensionGalleryManifestService");function zi(t,e){const[i,r]=e.split("/");for(const s of t.resources){const[n,o]=s.type.split("/");if(n===i){if(!r||o===r)return s.id;break}}}var La=ei?"web":wh(zs,Nc),uv="https://marketplace.cursorapi.com/",hv="https://localhost:8000/",fv=(Bt.extensionMaxVersions?Object.keys(Bt.extensionMaxVersions):[]).map(t=>t.toLowerCase()),dv=["39a52826-2472-403d-8410-37905302f26a","94d8b289-9db0-4c3c-b4f3-a3294c789678","d7f9f831-2239-4783-9d06-18d27f285818","033f8d91-0c9e-44cd-a3d2-b35fc4fd12da","73a45d83-83c7-4b22-bebf-c9130b0ab3f3","5dfd8b1d-4334-491c-87dc-399d73599a8a","1b129845-b202-4b23-8fe1-724f80b0bdc6"],pv="1b129845-b202-4b23-8fe1-724f80b0",gv=t=>{const e=Bt.extensionMaxVersions;return e?e[t.toLowerCase()]!==void 0:!1},hs=t=>{const e=Bt.extensionMaxVersions;if(!e)return!0;for(const i of fv)if(i===wt(t.publisher,t.name).toLowerCase()){const r=e[i].maxVersion,s=r===void 0?!0:jm(t.version,r),n=e[i].minVersion,o=n===void 0?!0:qm(t.version,n);return s&&o}return!0},fs="X-Market-Search-Activity-Id",Aa="Activityid",Oa="Server",Fa="X-Vss-E2eid",He={Icon:"Microsoft.VisualStudio.Services.Icons.Default",Details:"Microsoft.VisualStudio.Services.Content.Details",Changelog:"Microsoft.VisualStudio.Services.Content.Changelog",Manifest:"Microsoft.VisualStudio.Code.Manifest",VSIX:"Microsoft.VisualStudio.Services.VSIXPackage",License:"Microsoft.VisualStudio.Services.Content.License",Repository:"Microsoft.VisualStudio.Services.Links.Source",Signature:"Microsoft.VisualStudio.Services.VsixSignature"},zt={Dependency:"Microsoft.VisualStudio.Code.ExtensionDependencies",ExtensionPack:"Microsoft.VisualStudio.Code.ExtensionPack",Engine:"Microsoft.VisualStudio.Code.Engine",PreRelease:"Microsoft.VisualStudio.Code.PreRelease",EnabledApiProposals:"Microsoft.VisualStudio.Code.EnabledApiProposals",LocalizedLanguages:"Microsoft.VisualStudio.Code.LocalizedLanguages",WebExtension:"Microsoft.VisualStudio.Code.WebExtension",SponsorLink:"Microsoft.VisualStudio.Code.SponsorLink",SupportLink:"Microsoft.VisualStudio.Services.Links.Support",ExecutesCode:"Microsoft.VisualStudio.Code.ExecutesCode",Private:"PrivateMarketplace"},mv=10,vv={pageNumber:1,pageSize:mv,sortBy:"NoneOrRelevance",sortOrder:0,flags:[],criteria:[],assetTypes:[]},tf;(function(t){t[t.Release=0]="Release",t[t.Prerelease=1]="Prerelease",t[t.Latest=2]="Latest"})(tf||(tf={}));var Cn=class Pi{constructor(e=vv){this.state=e}get pageNumber(){return this.state.pageNumber}get pageSize(){return this.state.pageSize}get sortBy(){return this.state.sortBy}get sortOrder(){return this.state.sortOrder}get flags(){return this.state.flags}get criteria(){return this.state.criteria}get assetTypes(){return this.state.assetTypes}get source(){return this.state.source}get searchText(){const e=this.state.criteria.filter(i=>i.filterType==="SearchText")[0];return e&&e.value?e.value:""}withPage(e,i=this.state.pageSize){return new Pi({...this.state,pageNumber:e,pageSize:i})}withFilter(e,...i){const r=[...this.state.criteria,...i.length?i.map(s=>({filterType:e,value:s})):[{filterType:e}]];return new Pi({...this.state,criteria:r})}withSortBy(e){return new Pi({...this.state,sortBy:e})}withSortOrder(e){return new Pi({...this.state,sortOrder:e})}withFlags(...e){return new Pi({...this.state,flags:Xt(e)})}withAssetTypes(...e){return new Pi({...this.state,assetTypes:e})}withSource(e){return new Pi({...this.state,source:e})}};function Ta(t,e){const i=(t||[]).filter(r=>r.statisticName===e)[0];return i?i.value:0}function yv(t){const e="Microsoft.VisualStudio.Code.Translation.";return t.files.filter(r=>r.assetType.indexOf(e)===0).reduce((r,s)=>{const n=hi(t,s.assetType);return n&&r.push([s.assetType.substring(e.length),n]),r},[])}function wv(t){if(t.properties){const e=t.properties.filter(s=>s.key===He.Repository),i=new RegExp("((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.git)(/)?"),r=e.filter(s=>i.test(s.value))[0];return r?{uri:r.value,fallbackUri:r.value}:null}return hi(t,He.Repository)}function Sv(t){return{uri:`${t.fallbackAssetUri}/${He.VSIX}?redirect=true${t.targetPlatform?`&targetPlatform=${t.targetPlatform}`:""}`,fallbackUri:`${t.fallbackAssetUri}/${He.VSIX}${t.targetPlatform?`?targetPlatform=${t.targetPlatform}`:""}`}}function hi(t,e){return t.files.filter(r=>r.assetType===e)[0]?{uri:`${t.assetUri}/${e}${t.targetPlatform?`?targetPlatform=${t.targetPlatform}`:""}`,fallbackUri:`${t.fallbackAssetUri}/${e}${t.targetPlatform?`?targetPlatform=${t.targetPlatform}`:""}`}:null}function rf(t,e){const i=t.properties?t.properties.filter(s=>s.key===e):[],r=i.length>0&&i[0].value;return r?r.split(",").map(s=>Pn(s)):[]}function bv(t){return rf(t,zt.Dependency)}function Na(t){const e=t.properties?t.properties.filter(i=>i.key===zt.Engine):[];return e.length>0&&e[0].value||""}function ds(t){const e=t.properties?t.properties.filter(i=>i.key===zt.PreRelease):[];return e.length>0&&e[0].value==="true"}function Ev(t){const e=t.properties?t.properties.filter(i=>i.key===zt.Private):[];return e.length>0&&e[0].value==="true"}function _v(t){const e=t.properties?t.properties.filter(i=>i.key===zt.ExecutesCode):[];return e.length>0?e[0].value==="true":void 0}function Ma(t){const e=t.properties?t.properties.filter(r=>r.key===zt.EnabledApiProposals):[],i=e.length>0&&e[0].value||"";return i?i.split(","):[]}function xv(t){const e=t.properties?t.properties.filter(r=>r.key===zt.LocalizedLanguages):[],i=e.length>0&&e[0].value||"";return i?i.split(","):[]}function Pv(t){return t.properties?.find(e=>e.key===zt.SponsorLink)?.value}function Iv(t){return t.properties?.find(e=>e.key===zt.SupportLink)?.value}function kv(t){return t.indexOf("preview")!==-1}function Rn(t){return t.targetPlatform?lm(t.targetPlatform):"undefined"}function ps(t){const e=Xt(t.versions.map(Rn)),i=!!t.tags?.includes(nm),r=e.indexOf("web");return i?r===-1&&e.push("web"):r!==-1&&e.splice(r,1),e}function sf(t,e){for(let i=0;i0&&t[s-1].version===r.version;)s--;s!==i&&(t.splice(i,1),t.splice(s,0,r))}}return t}function nf(t,e,i){t.telemetryData={index:e,querySource:i,queryActivityId:t.queryContext?.[fs]}}function Ln(t,e,i,r,s){const n=t.versions[0],o={manifest:hi(e,He.Manifest),readme:hi(e,He.Details),changelog:hi(e,He.Changelog),license:hi(e,He.License),repository:wv(e),download:Sv(e),icon:hi(e,He.Icon),signature:hi(e,He.Signature),coreTranslations:yv(e)},a=zi(r,"ExtensionDetailsViewUriTemplate"),l=zi(r,"PublisherViewUriTemplate"),c=zi(r,"ExtensionRatingViewUriTemplate");return{type:"gallery",identifier:{id:wt(t.publisher.publisherName,t.extensionName),uuid:t.extensionId},name:t.extensionName,version:e.version,displayName:t.displayName,publisherId:t.publisher.publisherId,publisher:t.publisher.publisherName,publisherDisplayName:t.publisher.displayName,publisherDomain:t.publisher.domain?{link:t.publisher.domain,verified:!!t.publisher.isDomainVerified}:void 0,publisherSponsorLink:Pv(n),description:t.shortDescription??"",installCount:Ta(t.statistics,"install"),rating:Ta(t.statistics,"averagerating"),ratingCount:Ta(t.statistics,"ratingcount"),categories:t.categories||[],tags:t.tags||[],releaseDate:Date.parse(t.releaseDate),lastUpdated:Date.parse(t.lastUpdated),allTargetPlatforms:i,assets:o,properties:{dependencies:bv(e),extensionPack:rf(e,zt.ExtensionPack),engine:Na(e),enabledApiProposals:Ma(e),localizedLanguages:xv(e),targetPlatform:Rn(e),isPreReleaseVersion:ds(e),executesCode:_v(e)},hasPreReleaseVersion:ds(n),hasReleaseVersion:!0,private:Ev(n),preview:kv(t.flags),isSigned:!!o.signature,queryContext:s,supportLink:Iv(n),detailsLink:a?or(a,{publisher:t.publisher.publisherName,name:t.extensionName}):void 0,publisherLink:l?or(l,{publisher:t.publisher.publisherName}):void 0,ratingLink:c?or(c,{publisher:t.publisher.publisherName,name:t.extensionName}):void 0}}var An=class{constructor(e,i,r,s,n,o,a,l,c,h,f){this.assignmentService=i,this.requestService=r,this.logService=s,this.environmentService=n,this.telemetryService=o,this.fileService=a,this.productService=l,this.configurationService=c,this.allowedExtensionsService=h,this.extensionGalleryManifestService=f,this.bearerTokenProvider=()=>Promise.resolve(void 0),this.extensionsControlUrl=l.extensionsGallery?.controlUrl,this.unpkgResourceApi=l.extensionsGallery?.extensionUrlTemplate,this.extensionsEnabledWithApiProposalVersion=l.extensionsEnabledWithApiProposalVersion?.map(d=>d.toLowerCase())??[],this.commonHeadersPromise=Wm(l,this.environmentService,this.configurationService,this.fileService,e,this.telemetryService)}registerBearerTokenProvider(e){this.bearerTokenProvider=e}isEnabled(){return this.extensionGalleryManifestService.isEnabled()}async getExtensions(e,i,r){const s=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!s)throw new Error("No extension gallery service configured.");const n=de.isCancellationToken(i)?{}:i,o=de.isCancellationToken(i)?i:r,a=n.preferResourceApi&&(this.configurationService.getValue(um)??!1)?await this.getResourceApi(s):void 0,l=a?await this.getExtensionsUsingResourceApi(e,n,a,s,o):await this.getExtensionsUsingQueryApi(e,n,s,o),c=l.map(f=>f.identifier.uuid),h=[];for(const f of e)f.uuid&&!c.includes(f.uuid)&&h.push({...f,uuid:void 0});if(h.length){this.telemetryService.publicLog2("galleryService:additionalQueryByName",{count:h.length});const f=await this.getExtensionsUsingQueryApi(h,n,s,o);l.push(...f)}return l}async getResourceApi(e){const i=zi(e,"ExtensionLatestVersionUriTemplate");if(!i)return;if(this.productService.quality!=="stable")return{uri:i,fallback:this.unpkgResourceApi};const r=await this.assignmentService?.getTreatment("extensions.gallery.useResourceApi")??"unpkg";if(r==="marketplace")return{uri:i,fallback:this.unpkgResourceApi};if(r==="unpkg"&&this.unpkgResourceApi)return{uri:this.unpkgResourceApi}}async getExtensionsUsingQueryApi(e,i,r,s){const n=[],o=[],a=[],l=[];let c=!0;for(const d of e)d.uuid?o.push(d.uuid):n.push(d.id),d.version?l.push({id:d.id,uuid:d.uuid,version:d.version}):a.push({id:d.id,uuid:d.uuid,includePreRelease:!!d.preRelease}),c=c&&!!d.hasPreRelease&&!d.preRelease;if(!o.length&&!n.length)return[];let h=new Cn().withPage(1,e.length);o.length&&(h=h.withFilter("ExtensionId",...o)),n.length&&(h=h.withFilter("ExtensionName",...n)),i.queryAllVersions&&(h=h.withFlags(...h.flags,"IncludeVersions")),i.source&&(h=h.withSource(i.source));const{extensions:f}=await this.queryGalleryExtensions(h,{targetPlatform:i.targetPlatform??La,includePreRelease:a,versions:l,compatible:!!i.compatible,productVersion:i.productVersion??{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion},isQueryForReleaseVersionFromPreReleaseVersion:c},r,s);return i.source&&f.forEach((d,p)=>nf(d,p,i.source)),f}async getExtensionsUsingResourceApi(e,i,r,s,n){const o=[],a=[],l=[];for(const c of e)pa.test(c.id)&&(c.version?a.push(c):l.push(c));if(await Promise.allSettled(l.map(async c=>{let h;try{try{h=await this.getLatestGalleryExtension(c,i,r.uri,s,n)}catch(f){if(!r.fallback)throw f;this.logService.error(`Error while getting the latest version for the extension ${c.id} from ${r.uri}. Trying the fallback ${r.fallback}`,H(f)),this.telemetryService.publicLog2("galleryService:fallbacktounpkg",{extension:c.id,preRelease:!!c.preRelease,compatible:!!i.compatible}),h=await this.getLatestGalleryExtension(c,i,r.fallback,s,n)}if(h==="NOT_FOUND"){c.uuid&&a.push(c);return}h&&o.push(h)}catch(f){this.logService.error(`Error while getting the latest version for the extension ${c.id}.`,H(f)),this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!i.compatible,fromFallback:!!r.fallback}),a.push(c)}})),a.length){const c=await this.getExtensionsUsingQueryApi(a,i,s,n);o.push(...c)}return o}async getLatestGalleryExtension(e,i,r,s,n){const[o,a]=e.id.split("."),l=I.parse(or(r,{publisher:o,name:a})),c=await this.getLatestRawGalleryExtension(e.id,l,n);if(!c)return"NOT_FOUND";const h=ps(c),f=await this.getRawGalleryExtensionVersion(c,{targetPlatform:i.targetPlatform??La,compatible:!!i.compatible,productVersion:i.productVersion??{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion},version:e.preRelease?1:0},h);return f?Ln(c,f,h,s):null}async getCompatibleExtension(e,i,r,s={version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion}){return Sr(e.allTargetPlatforms,r)?null:await this.isExtensionCompatible(e,i,r)?e:this.allowedExtensionsService.isAllowed({id:e.identifier.id,publisherDisplayName:e.publisherDisplayName})!==!0?null:(await this.getExtensions([{...e.identifier,preRelease:i,hasPreRelease:e.hasPreReleaseVersion}],{compatible:!0,productVersion:s,queryAllVersions:!0,targetPlatform:r},de.None))[0]??null}async isExtensionCompatible(e,i,r,s={version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion}){if(!hs(e)||this.allowedExtensionsService.isAllowed(e)!==!0||!ga(e.properties.targetPlatform,e.allTargetPlatforms,r)||!i&&e.properties.isPreReleaseVersion)return!1;let n=e.properties.engine;if(!n){const o=await this.getManifest(e,de.None);if(!o)throw new Error("Manifest was not found");n=o.engines.vscode}return e.identifier.id==="typescriptteam.native-preview"?!0:!(!ls(n,s.vscodeVersion,s.date)||!this.areApiProposalsCompatible(e.identifier,e.properties.enabledApiProposals))}areApiProposalsCompatible(e,i){return!i||!this.extensionsEnabledWithApiProposalVersion.includes(e.id.toLowerCase())?!0:Ia(i)}async isValidVersion(e,i,{targetPlatform:r,compatible:s,productVersion:n,version:o},a,l){if(Re(o)){if(i.version!==o)return!1}else if((o===0||o===1)&&ds(i)!==(o===1))return!1;const c=Rn(i);if(!ga(c,l,r))return!1;if(s){if(this.allowedExtensionsService.isAllowed({id:e,publisherDisplayName:a,version:i.version,prerelease:ds(i),targetPlatform:c})!==!0)return!1;try{const h=await this.getEngine(e,i);if(!ls(h,n.vscodeVersion,n.date))return!1}catch(h){return this.logService.error(`Error while getting the engine for the version ${i.version}.`,H(h)),!1}}return!0}async query(e,i){const r=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!r)throw new Error("No extension gallery service configured.");let s=e.text||"";const n=e.pageSize??50;let o=new Cn().withPage(1,n);s?(s=s.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(f,d,p)=>(o=o.withFilter("Category",p||d),"")),s=s.replace(/\btag:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(f,d,p)=>(o=o.withFilter("Tag",p||d),"")),s=s.replace(/\bfeatured(\s+|\b|$)/g,()=>(o=o.withFilter("Featured"),"")),s=s.trim(),s&&(s=s.length<200?s:s.substring(0,200),o=o.withFilter("SearchText",s)),r.capabilities.extensionQuery.sorting?.some(f=>f.name==="NoneOrRelevance")&&(o=o.withSortBy("NoneOrRelevance"))):r.capabilities.extensionQuery.sorting?.some(f=>f.name==="InstallCount")&&(o=o.withSortBy("InstallCount")),e.sortBy&&r.capabilities.extensionQuery.sorting?.some(f=>f.name===e.sortBy)&&(o=o.withSortBy(e.sortBy)),typeof e.sortOrder=="number"&&(o=o.withSortOrder(e.sortOrder)),e.source&&(o=o.withSource(e.source));const a=async(f,d)=>{const{extensions:p,total:v}=await this.queryGalleryExtensions(f,{targetPlatform:La,compatible:!1,includePreRelease:!!e.includePreRelease,productVersion:e.productVersion??{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion}},r,d);return p.forEach((m,w)=>nf(m,(f.pageNumber-1)*f.pageSize+w,e.source)),{extensions:p,total:v}},{extensions:l,total:c}=await a(o,i),h=async(f,d)=>{if(d.isCancellationRequested)throw new Te;const{extensions:p}=await a(o.withPage(f+1),d);return p};return{firstPage:l,total:c,pageSize:o.pageSize,getPage:h}}async queryGalleryExtensions(e,i,r,s){return this.productService.quality!=="stable"&&await this.assignmentService?.getTreatment("useLatestPrereleaseAndStableVersionFlag")?this.queryGalleryExtensionsUsingIncludeLatestPrereleaseAndStableVersionFlag(e,i,r,s):this.queryGalleryExtensionsWithAllVersionsAsFallback(e,i,r,s)}async queryGalleryExtensionsWithAllVersionsAsFallback(e,i,r,s){const n=e.flags;e.flags.includes("IncludeLatestVersionOnly")&&e.flags.includes("IncludeVersions")&&(e=e.withFlags(...e.flags.filter(d=>d!=="IncludeVersions"))),!e.flags.includes("IncludeLatestVersionOnly")&&!e.flags.includes("IncludeVersions")&&(e=e.withFlags(...e.flags,"IncludeLatestVersionOnly")),(i.versions?.length||i.isQueryForReleaseVersionFromPreReleaseVersion)&&(e=e.withFlags(...e.flags.filter(d=>d!=="IncludeLatestVersionOnly"),"IncludeVersions")),e=e.withFlags(...e.flags,"IncludeAssetUri","IncludeCategoryAndTags","IncludeFiles","IncludeStatistics","IncludeVersionProperties");const{galleryExtensions:o,total:a,context:l}=await this.queryRawGalleryExtensions(e,r,s);if(!e.flags.includes("IncludeLatestVersionOnly")){const d=[];for(const p of o){const v=ps(p),m={id:wt(p.publisher.publisherName,p.extensionName),uuid:p.extensionId},w=Dt(i.includePreRelease)?i.includePreRelease:!!i.includePreRelease.find(_=>J(_,m))?.includePreRelease,S=await this.getRawGalleryExtensionVersion(p,{compatible:i.compatible,targetPlatform:i.targetPlatform,productVersion:i.productVersion,version:i.versions?.find(_=>J(_,m))?.version??(w?2:0)},v);S&&d.push(Ln(p,S,v,r,l))}return{extensions:d,total:a}}const h=[],f=new Map;for(let d=0;dJ(P,v))?.includePreRelease,w=ps(p);if(i.compatible&&(Sr(w,i.targetPlatform)||this.allowedExtensionsService.isAllowed({id:v.id,publisherDisplayName:p.publisher.displayName})!==!0))continue;const S=await this.getRawGalleryExtensionVersion(p,{compatible:i.compatible,targetPlatform:i.targetPlatform,productVersion:i.productVersion,version:i.versions?.find(P=>J(P,v))?.version??(m?2:0)},w),_=S?Ln(p,S,w,r,l):null;!_||_.properties.isPreReleaseVersion&&(!m||!_.hasReleaseVersion)||!_.properties.isPreReleaseVersion&&_.properties.targetPlatform!==i.targetPlatform&&_.hasPreReleaseVersion?f.set(p.extensionId,d):h.push([d,_])}if(f.size){const d=new Us,p=new Cn().withFlags(...n.filter(m=>m!=="IncludeLatestVersionOnly"),"IncludeVersions").withPage(1,f.size).withFilter("ExtensionId",...f.keys()),{extensions:v}=await this.queryGalleryExtensions(p,i,r,s);this.telemetryService.publicLog2("galleryService:additionalQuery",{duration:d.elapsed(),count:f.size});for(const m of v){const w=f.get(m.identifier.uuid);h.push([w,m])}}return{extensions:h.sort((d,p)=>d[0]-p[0]).map(([,d])=>d),total:a}}async queryGalleryExtensionsUsingIncludeLatestPrereleaseAndStableVersionFlag(e,i,r,s){i.versions?.length?e=e.withFlags(...e.flags.filter(c=>c!=="IncludeLatestVersionOnly"&&c!=="IncludeLatestPrereleaseAndStableVersionOnly"),"IncludeVersions"):e.flags.includes("IncludeVersions")||(e=(Dt(i.includePreRelease)?i.includePreRelease:i.includePreRelease.every(({includePreRelease:h})=>h))?e.withFlags(...e.flags.filter(h=>h!=="IncludeLatestPrereleaseAndStableVersionOnly"),"IncludeLatestVersionOnly"):e.withFlags(...e.flags.filter(h=>h!=="IncludeLatestVersionOnly"),"IncludeLatestPrereleaseAndStableVersionOnly")),e.flags.includes("IncludeVersions")&&(e.flags.includes("IncludeLatestVersionOnly")||e.flags.includes("IncludeLatestPrereleaseAndStableVersionOnly"))&&(e=e.withFlags(...e.flags.filter(c=>c!=="IncludeLatestVersionOnly"&&c!=="IncludeLatestPrereleaseAndStableVersionOnly"),"IncludeVersions")),e=e.withFlags(...e.flags,"IncludeAssetUri","IncludeCategoryAndTags","IncludeFiles","IncludeStatistics","IncludeVersionProperties");const{galleryExtensions:n,total:o,context:a}=await this.queryRawGalleryExtensions(e,r,s),l=[];for(let c=0;cJ(m,f))?.version??((Dt(i.includePreRelease)?i.includePreRelease:i.includePreRelease.find(m=>J(m,f))?.includePreRelease)?2:0),v=await this.getRawGalleryExtensionVersion(h,{compatible:i.compatible,targetPlatform:i.targetPlatform,productVersion:i.productVersion,version:p},d);v&&l.push(Ln(h,v,d,r,a))}return{extensions:l,total:o}}async getRawGalleryExtensionVersion(e,i,r){const s={id:wt(e.publisher.publisherName,e.extensionName),uuid:e.extensionId},n=sf(e.versions,i.targetPlatform);if(i.compatible&&Sr(r,i.targetPlatform))return null;const o=Re(i.version)?i.version:void 0;for(let a=0;av.name==="Unpublished");n&&(e=e.withFilter("ExcludeWithFlags",String(n.value)));const o={filters:[{criteria:e.criteria.reduce((v,m)=>{const w=i.capabilities.extensionQuery.filtering?.find(S=>S.name===m.filterType);return w&&v.push({filterType:w.value,value:m.value}),v},[]),pageNumber:e.pageNumber,pageSize:e.pageSize,sortBy:i.capabilities.extensionQuery.sorting?.find(v=>v.name===e.sortBy)?.value,sortOrder:e.sortOrder}],assetTypes:e.assetTypes,flags:e.flags.reduce((v,m)=>{const w=i.capabilities.extensionQuery.flags?.find(S=>S.name===m);return w&&(v|=w.value),v},0)};this.isCursorMarketplaceUrlForAuthHeaders(s)||o.filters.forEach(v=>{v.criteria=v.criteria.filter(m=>{const w=m.value;if(!w)return!0;const S=i.capabilities.extensionQuery.filtering?.find(_=>_.value===m.filterType);return!(S?.name==="ExtensionName"&&w.toLowerCase().startsWith("anysphere.")||S?.name==="ExtensionId"&&(dv.includes(w.toLowerCase())||w.toLowerCase().startsWith(pv)))})});const a=JSON.stringify(o),c={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=3.0-preview.1","Accept-Encoding":"gzip","Content-Length":String(a.length)};if(this.isCursorMarketplaceUrlForAuthHeaders(s)){const v=await this.bearerTokenProvider();v&&(c.Authorization=`Bearer ${v}`),c["x-cursor-client-version"]=this.productService.version}const h=new Us;let f,d,p=0;try{if(f=await this.requestService.request({type:"POST",url:s,data:a,headers:c},r),f.res.statusCode&&f.res.statusCode>=400&&f.res.statusCode<500)return{galleryExtensions:[],total:p};const v=await En(f);if(v){const m=v.results[0];let w=m.extensions;const S=m.resultMetadata&&m.resultMetadata.filter(_=>_.metadataType==="ResultCount")[0];return p=S&&S.metadataItems.filter(_=>_.name==="TotalCount")[0].count||0,w.forEach((_,P)=>{let N=_.versions;gv(wt(_.publisher.publisherName,_.extensionName))&&N.find(A=>hs({name:_.extensionName,publisher:_.publisher.publisherName,version:A.version}))!==void 0&&(N=N.filter(A=>hs({name:_.extensionName,publisher:_.publisher.publisherName,version:A.version})),N.length>0&&(w[P]={..._,versions:N}));const x=N.filter(A=>{const M=Na(A);return M===""||ls(M,this.productService.vscodeVersion,this.productService.date)});x.length0&&(w[P]={..._,versions:N}))}),{galleryExtensions:w,total:p,context:f.res.headers.activityid?{[fs]:f.res.headers.activityid}:{}}}return{galleryExtensions:[],total:p}}catch(v){if(Ci(v))throw d="Cancelled",v;{const m=H(v);throw d=gh(v)?"Offline":m.startsWith("XHR timeout")?"Timeout":"Failed",new _n(m,d)}}finally{this.telemetryService.publicLog2("galleryService:query",{filterTypes:e.criteria.map(v=>v.filterType),flags:e.flags,sortBy:e.sortBy,sortOrder:String(e.sortOrder),pageNumber:String(e.pageNumber),source:e.source,searchTextLength:e.searchText.length,requestBodySize:String(a.length),duration:h.elapsed(),success:!!f&&ca(f),responseBodySize:f?.res.headers["Content-Length"],statusCode:f?String(f.res.statusCode):void 0,errorCode:d,count:String(p),server:this.getHeaderValue(f?.res.headers,Oa),activityId:this.getHeaderValue(f?.res.headers,Aa),endToEndId:this.getHeaderValue(f?.res.headers,Fa)})}}getHeaderValue(e,i){const r=e?.[i.toLowerCase()];return Array.isArray(r)?r[0]:r}async getLatestRawGalleryExtension(e,i,r){let s;const n=new Us;let o;try{const l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=7.2-preview","Accept-Encoding":"gzip"};if(o=await this.requestService.request({type:"GET",url:i.toString(!0),headers:l,timeout:1e4},r),o.res.statusCode===404)return s="NotFound",null;if(o.res.statusCode&&o.res.statusCode!==200)throw s="GalleryServiceError:"+o.res.statusCode,new Error("Unexpected HTTP response: "+o.res.statusCode);const c=await En(o);return c||(s="NoData"),c}catch(a){if(Ci(a))s="Cancelled";else{const l=H(a);s=gh(a)?"Offline":l.startsWith("XHR timeout")?"Timeout":"Failed"}throw a}finally{this.telemetryService.publicLog2("galleryService:getLatest",{extension:e,host:i.authority,duration:n.elapsed(),errorCode:s,server:this.getHeaderValue(o?.res.headers,Oa),activityId:this.getHeaderValue(o?.res.headers,Aa),endToEndId:this.getHeaderValue(o?.res.headers,Fa)})}}async reportStatistic(e,i,r,s){const n=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!n)return;let o;if(ei){const h=zi(n,"WebExtensionStatisticsUriTemplate");if(!h)return;o=or(h,{publisher:e,name:i,version:r,statTypeValue:s==="install"?"1":"3"})}else{const h=zi(n,"ExtensionStatisticsUriTemplate");if(!h)return;o=or(h,{publisher:e,name:i,version:r,statTypeName:s})}if(!this.isCursorMarketplaceUrlForAuthHeaders(o))return;const a=ei?"api-version=6.1-preview.1":"*/*;api-version=4.0-preview.1",c={...await this.commonHeadersPromise,Accept:a};try{await this.requestService.request({type:"POST",url:o,headers:c},de.None)}catch{}}async download(e,i,r){this.logService.trace("ExtensionGalleryService#download",e.identifier.id);const s=Ea(e),n=new Date().getTime(),o=r===2?"install":r===3?"update":"",a=o?{uri:`${e.assets.download.uri}${I.parse(e.assets.download.uri).query?"&":"?"}${o}=true`,fallbackUri:`${e.assets.download.fallbackUri}${I.parse(e.assets.download.fallbackUri).query?"&":"?"}${o}=true`}:e.assets.download,l=e.queryContext?.[fs]?{[fs]:e.queryContext[fs]}:void 0,c=await this.getAsset(e.identifier.id,a,He.VSIX,e.version,l?{headers:l}:void 0);try{await this.fileService.writeFile(i,c.stream)}catch(h){try{await this.fileService.del(i)}catch(f){this.logService.warn(`Error while deleting the file ${i.toString()}`,H(f))}throw new _n(H(h),"DownloadFailedWriting")}this.telemetryService.publicLog("galleryService:downloadVSIX",{...s,duration:new Date().getTime()-n})}async downloadSignatureArchive(e,i){if(!e.assets.signature)throw new Error("No signature asset found");this.logService.trace("ExtensionGalleryService#downloadSignatureArchive",e.identifier.id);const r=await this.getAsset(e.identifier.id,e.assets.signature,He.Signature,e.version);try{await this.fileService.writeFile(i,r.stream)}catch(s){try{await this.fileService.del(i)}catch(n){this.logService.warn(`Error while deleting the file ${i.toString()}`,H(n))}throw new _n(H(s),"DownloadFailedWriting")}}async getReadme(e,i){if(e.assets.readme){const r=await this.getAsset(e.identifier.id,e.assets.readme,He.Details,e.version,{},i);return await wr(r)||""}return""}async getManifest(e,i){if(e.assets.manifest){const r=await this.getAsset(e.identifier.id,e.assets.manifest,He.Manifest,e.version,{},i),s=await wr(r);return s?JSON.parse(s):null}return null}async getManifestFromRawExtensionVersion(e,i,r){const s=hi(i,He.Manifest);if(!s)throw new Error("Manifest was not found");const n={"Accept-Encoding":"gzip"},o=await this.getAsset(e,s,He.Manifest,i.version,{headers:n});return await En(o)}async getCoreTranslation(e,i){const r=e.assets.coreTranslations.filter(s=>s[0]===i.toUpperCase())[0];if(r){const s=await this.getAsset(e.identifier.id,r[1],r[0],e.version),n=await wr(s);return n?JSON.parse(n):null}return null}async getChangelog(e,i){if(e.assets.changelog){const r=await this.getAsset(e.identifier.id,e.assets.changelog,He.Changelog,e.version,{},i);return await wr(r)||""}return""}async getAllCompatibleVersions(e,i,r){const s=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!s)throw new Error("No extension gallery service configured.");let n=new Cn().withFlags("IncludeVersions","IncludeCategoryAndTags","IncludeFiles","IncludeVersionProperties").withPage(1,1);e.uuid?n=n.withFilter("ExtensionId",e.uuid):n=n.withFilter("ExtensionName",e.id);const{galleryExtensions:o}=await this.queryRawGalleryExtensions(n,s,de.None);if(!o.length)return[];const a=ps(o[0]);if(Sr(a,r))return[];const l=[],c={version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion};await Promise.all(o[0].versions.map(async d=>{try{await this.isValidVersion(e.id,d,{compatible:!0,productVersion:c,targetPlatform:r,version:i?2:0},o[0].publisher.displayName,a)&&this.areApiProposalsCompatible(e,Ma(d))&&l.push(d)}catch{}}));const h=[],f=new Set;for(const d of sf(l,r))f.has(d.version)||(f.add(d.version),h.push({version:d.version,date:d.lastUpdated,isPreReleaseVersion:ds(d)}));return h}async getAsset(e,i,r,s,n={},o=de.None){const a=await this.commonHeadersPromise,l={type:"GET"},c={...a,...n.headers||{}};n={...n,...l,headers:c};const h=i.uri,f=i.fallbackUri,d={...n,url:h};let p;try{if(p=await this.requestService.request(d,o),p.res.statusCode===200)return p;const v=await wr(p);throw new Error(`Expected 200, got back ${p.res.statusCode} instead. ${v}`)}catch(v){if(Ci(v))throw v;const m=H(v);this.telemetryService.publicLog2("galleryService:cdnFallback",{extension:e,assetType:r,message:m,extensionVersion:s,server:this.getHeaderValue(p?.res.headers,Oa),activityId:this.getHeaderValue(p?.res.headers,Aa),endToEndId:this.getHeaderValue(p?.res.headers,Fa)});const w={...n,url:f};return this.requestService.request(w,o)}}async getEngine(e,i){let r=Na(i);if(!r){this.telemetryService.publicLog2("galleryService:engineFallback",{extension:e,extensionVersion:i.version});const s=await this.getManifestFromRawExtensionVersion(e,i,de.None);if(!s)throw new Error("Manifest was not found");r=s.engines.vscode}return r}async getExtensionsControlManifest(){if(!this.isEnabled())throw new Error("No extension gallery service configured.");if(!this.extensionsControlUrl)return{malicious:[],deprecated:{},search:[]};let e;this.logService.info("Getting extensions control");try{if(e=await Promise.race([this.requestService.request({type:"GET",url:this.extensionsControlUrl,timeout:3e3},de.None),new Promise((a,l)=>{setTimeout(()=>{l(new Error("Timeout getting extensions control"))},3e3)})]),e.res.statusCode!==200)throw new Error("Could not get extensions report.")}catch(a){return this.logService.error("Error getting extensions control manifest",a),{malicious:[],deprecated:{},search:[]}}const i=await En(e),r=[],s={},n=[],o=[];if(i){for(const a of i.malicious)pa.test(a)?r.push({id:a}):r.push(a);if(i.migrateToPreRelease)for(const[a,l]of Object.entries(i.migrateToPreRelease))(!l.engine||ls(l.engine,this.productService.vscodeVersion,this.productService.date))&&(s[a.toLowerCase()]={disallowInstall:!0,extension:{id:l.id,displayName:l.displayName,autoMigrate:{storage:!!l.migrateStorage},preRelease:!0}});if(i.deprecated)for(const[a,l]of Object.entries(i.deprecated))l&&(s[a.toLowerCase()]=Dt(l)?{}:l);if(i.search)for(const a of i.search)n.push(a);if(Array.isArray(i.extensionsEnabledWithPreRelease))for(const a of i.extensionsEnabledWithPreRelease)o.push(a.toLowerCase())}return{malicious:r,deprecated:s,search:n,extensionsEnabledWithPreRelease:o}}};An=__decorate([__param(2,os),__param(3,he),__param(4,ui),__param(5,jt),__param(6,Pe),__param(7,mt),__param(8,ni),__param(9,Bi),__param(10,us)],An);var of=class extends An{constructor(e,i,r,s,n,o,a,l,c,h){super(e,void 0,i,r,s,n,o,a,l,c,h)}};of=__decorate([__param(0,av),__param(1,os),__param(2,he),__param(3,ui),__param(4,jt),__param(5,Pe),__param(6,mt),__param(7,ni),__param(8,Bi),__param(9,us)],of);var Ua=class extends An{constructor(e,i,r,s,n,o,a,l,c){super(void 0,void 0,e,i,r,s,n,o,a,l,c)}};Ua=__decorate([__param(0,os),__param(1,he),__param(2,ui),__param(3,jt),__param(4,Pe),__param(5,mt),__param(6,ni),__param(7,Bi),__param(8,us)],Ua);var af=le("IExtensionSignatureVerificationService"),Va=class{constructor(e,i){this.logService=e,this.telemetryService=i}vsceSign(){return this.moduleLoadingPromise||(this.moduleLoadingPromise=this.resolveVsceSign()),this.moduleLoadingPromise}async resolveVsceSign(){return import("@vscode/vsce-sign")}async verify(e,i,r,s,n){let o;try{o=await this.vsceSign()}catch(h){this.logService.error("Could not load vsce-sign module",H(h)),this.logService.info(`Extension signature verification is not done: ${e}`);return}const a=new Date().getTime();let l;try{this.logService.trace(`Verifying extension signature for ${e}...`),l=await o.verify(r,s,this.logService.getLevel()===T.Trace)}catch(h){l={code:Oe.UnknownError,didExecute:!1,output:H(h)}}const c=new Date().getTime()-a;return this.logService.info(`Extension signature verification result for ${e}: ${l.code}. ${fc(l.internalCode)?`Internal Code: ${l.internalCode}. `:""}Executed: ${l.didExecute}. Duration: ${c}ms.`),this.logService.trace(`Extension signature verification output for ${e}: ${l.output}`),this.telemetryService.publicLog2("extensionsignature:verification",{extensionId:e,extensionVersion:i,code:l.code,internalCode:l.internalCode,duration:c,didExecute:l.didExecute,clientTargetPlatform:n}),{code:l.code}}};Va=__decorate([__param(0,he),__param(1,jt)],Va);var Dv=t=>g(1932,null,t),lf=g(1933,null,"anysphere.csharp"),Hi=class{constructor(e,i,r){this.logger=e,this.extensionManagementService=i,this.extensionGalleryService=r}get location(){}async listExtensions(e,i,r){let s=await this.extensionManagementService.getInstalled(1,r);const n=fm.map(a=>a.toLowerCase());if(i&&i!==""){if(n.indexOf(i.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}s=s.filter(a=>a.manifest.categories?a.manifest.categories.map(c=>c.toLowerCase()).indexOf(i.toLowerCase())>-1:!1)}else if(i===""){this.logger.info("Possible Categories: "),n.forEach(a=>{this.logger.info(a)});return}this.location&&this.logger.info(g(1934,null,this.location)),s=s.sort((a,l)=>a.identifier.id.localeCompare(l.identifier.id));let o;for(const a of s)o!==a.identifier.id&&(o=a.identifier.id,this.logger.info(e?`${o}@${a.manifest.version}`:o))}async installExtensions(e,i,r,s){const n=[];try{e.length&&this.logger.info(this.location?g(1935,null,this.location):g(1936,null));const o=[],a=[],l=(h,f,d)=>{a.push({id:h,version:f!=="prerelease"?f:void 0,installOptions:{...r,isBuiltin:d,installPreReleaseVersion:f==="prerelease"||r.installPreReleaseVersion}})};for(const h of e)if(h instanceof I)o.push({vsix:h,installOptions:r});else{const[f,d]=ba(h);l(f,d,!1)}for(const h of i)if(h instanceof I)o.push({vsix:h,installOptions:{...r,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{const[f,d]=ba(h);l(f,d,!0)}const c=await this.extensionManagementService.getInstalled(void 0,r.profileLocation);if(o.length&&await Promise.all(o.map(async({vsix:h,installOptions:f})=>{try{await this.installVSIX(h,f,s,c)}catch(d){this.logger.error(d),n.push(h.toString())}})),a.length){const h=await this.installGalleryExtensions(a,c,s);n.push(...h)}}catch(o){throw this.logger.error(g(1937,null,H(o))),o}if(n.length)throw new Error(g(1938,null,n.join(", ")))}async updateExtensions(e){const i=await this.extensionManagementService.getInstalled(1,e),r=[];for(const a of i)a.identifier.uuid&&r.push({...a.identifier,preRelease:a.preRelease});this.logger.trace(g(1939,null,r.length));const s=await this.extensionGalleryService.getExtensions(r,{compatible:!0},de.None),n=[];for(const a of s)for(const l of i)J(l.identifier,a.identifier)&&_a(a.version,l.manifest.version)&&n.push({extension:a,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:e,isApplicationScoped:l.isApplicationScoped}});if(!n.length){this.logger.info(g(1940,null));return}this.logger.info(g(1941,null,n.map(a=>a.extension.identifier.id).join(", ")));const o=await this.extensionManagementService.installGalleryExtensions(n);for(const a of o)a.error?this.logger.error(g(1942,null,a.identifier.id,H(a.error))):this.logger.info(g(1943,null,a.identifier.id,a.local?.manifest.version))}async installGalleryExtensions(e,i,r){if(e=e.filter(a=>{const{id:l,version:c,installOptions:h}=a,f=i.find(d=>J(d.identifier,{id:l}));if(f){if(!r&&(!c||c==="prerelease"&&f.preRelease))return this.logger.info(g(1944,null,l,f.manifest.version,l)),!1;if(c&&f.manifest.version===c)return this.logger.info(g(1945,null,`${l}@${c}`)),!1;f.preRelease&&c!=="prerelease"&&(h.preRelease=!1)}return!0}),!e.length)return[];const s=[],n=[],o=await this.getGalleryExtensions(e);if(await Promise.all(e.map(async({id:a,version:l,installOptions:c})=>{const h=o.get(a.toLowerCase());if(!h){this.logger.error(`${Dv(l?`${a}@${l}`:a)} ${lf}`),s.push(a);return}try{const d=await this.extensionGalleryService.getManifest(h,de.None);if(d&&!this.validateExtensionKind(d))return}catch(d){this.logger.error(d.message||d.stack||d),s.push(a);return}const f=i.find(d=>J(d.identifier,h.identifier));if(f){if(h.version===f.manifest.version){this.logger.info(g(1946,null,l?`${a}@${l}`:a));return}this.logger.info(g(1947,null,a,h.version))}c.isBuiltin?this.logger.info(l?g(1948,null,a,l):g(1949,null,a)):this.logger.info(l?g(1950,null,a,l):g(1951,null,a)),n.push({extension:h,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||f?.isApplicationScoped}})})),n.length){const a=await this.extensionManagementService.installGalleryExtensions(n);for(const l of a)l.error?(this.logger.error(g(1952,null,l.identifier.id,H(l.error))),s.push(l.identifier.id)):this.logger.info(g(1953,null,l.identifier.id,l.local?.manifest.version))}return s}async installVSIX(e,i,r,s){const n=await this.extensionManagementService.getManifest(e);if(!n)throw new Error("Invalid vsix");if(await this.validateVSIX(n,r,i.profileLocation,s))try{await this.extensionManagementService.install(e,{...i,installGivenVersion:!0}),this.logger.info(g(1954,null,cr(e)))}catch(a){if(Ci(a))this.logger.info(g(1955,null,cr(e)));else throw a}}async getGalleryExtensions(e){const i=new Map,r=e.some(n=>n.installOptions.installPreReleaseVersion),s=await this.extensionManagementService.getTargetPlatform();for(const n of e)if(pa.test(n.id)){const o=await this.extensionGalleryService.getExtensions([{...n,preRelease:r}],{targetPlatform:s},de.None);for(const a of o)i.set(a.identifier.id.toLowerCase(),a),i.set(n.id.toLowerCase(),a)}return i}validateExtensionKind(e){return!0}async validateVSIX(e,i,r,s){if(!i){const n={id:wt(e.publisher,e.name)},o=s.find(a=>J(n,a.identifier)&&_a(a.manifest.version,e.version));if(o)return this.logger.info(g(1956,null,o.identifier.id,o.manifest.version,e.version)),!1}return this.validateExtensionKind(e)}async uninstallExtensions(e,i,r){const s=async o=>{if(o instanceof I){const a=await this.extensionManagementService.getManifest(o);return Uh(a.publisher,a.name)}return o},n=[];for(const o of e){const a=await s(o),c=(await this.extensionManagementService.getInstalled(void 0,r)).filter(h=>J(h.identifier,{id:a}));if(!c.length)throw new Error(`${this.notInstalled(a)} ${lf}`);if(c.some(h=>h.type===0)){this.logger.info(g(1957,null,a));return}if(!i&&c.some(h=>h.isBuiltin)){this.logger.info(g(1958,null,a));return}this.logger.info(g(1959,null,a));for(const h of c)await this.extensionManagementService.uninstall(h,{profileLocation:r}),n.push(h);this.location?this.logger.info(g(1960,null,a,this.location)):this.logger.info(g(1961,null,a))}}async locateExtension(e){const i=await this.extensionManagementService.getInstalled();e.forEach(r=>{i.forEach(s=>{if(s.identifier.id===r&&s.location.scheme===ie.file){this.logger.info(s.location.fsPath);return}})})}notInstalled(e){return this.location?g(1962,null,e,this.location):g(1963,null,e)}};Hi=__decorate([__param(1,ma),__param(2,bi)],Hi);var cf;(function(t){t.ERROR_PROFILE_NOT_FOUND="ERROR_PROFILE_NOT_FOUND",t.ERROR_INVALID_CONTENT="ERROR_INVALID_CONTENT"})(cf||(cf={}));var On=class extends Error{constructor(t,e){super(t),this.code=e}},Ei=le("IExtensionsProfileScannerService"),Wa=class extends K{constructor(e,i,r,s,n){super(),this.extensionsLocation=e,this.fileService=i,this.userDataProfilesService=r,this.uriIdentityService=s,this.logService=n,this._onAddExtensions=this._register(new O),this.onAddExtensions=this._onAddExtensions.event,this._onDidAddExtensions=this._register(new O),this.onDidAddExtensions=this._onDidAddExtensions.event,this._onRemoveExtensions=this._register(new O),this.onRemoveExtensions=this._onRemoveExtensions.event,this._onDidRemoveExtensions=this._register(new O),this.onDidRemoveExtensions=this._onDidRemoveExtensions.event,this.resourcesAccessQueueMap=new Ge}scanProfileExtensions(e,i){return this.withProfileExtensions(e,void 0,i)}async addExtensionsToProfile(e,i,r){const s=[],n=[];try{return await this.withProfileExtensions(i,o=>{const a=[];if(r)a.push(...o);else for(const l of o)e.some(([c])=>J(c.identifier,l.identifier)&&(c.manifest.version!==l.version||c.location.toString()!==l.location.toString()))?s.push(l):a.push(l);for(const[l,c]of e){const h=a.findIndex(d=>J(d.identifier,l.identifier)&&d.version===l.manifest.version&&d.location.toString()===l.location.toString()),f={identifier:l.identifier,version:l.manifest.version,location:l.location,metadata:c};h===-1?(n.push(f),a.push(f)):a.splice(h,1,f)}return n.length&&this._onAddExtensions.fire({extensions:n,profileLocation:i}),s.length&&this._onRemoveExtensions.fire({extensions:s,profileLocation:i}),a}),n.length&&this._onDidAddExtensions.fire({extensions:n,profileLocation:i}),s.length&&this._onDidRemoveExtensions.fire({extensions:s,profileLocation:i}),n}catch(o){throw n.length&&this._onDidAddExtensions.fire({extensions:n,error:o,profileLocation:i}),s.length&&this._onDidRemoveExtensions.fire({extensions:s,error:o,profileLocation:i}),o}}async updateMetadata(e,i){const r=[];return await this.withProfileExtensions(i,s=>{const n=[];for(const o of s){const a=e.find(([l])=>J(l.identifier,o.identifier)&&l.manifest.version===o.version);a&&(o.metadata={...o.metadata,...a[1]},r.push(o)),n.push(o)}return n}),r}async removeExtensionsFromProfile(e,i){const r=[];try{await this.withProfileExtensions(i,s=>{const n=[];for(const o of s)e.some(a=>J(o.identifier,a))?r.push(o):n.push(o);return r.length&&this._onRemoveExtensions.fire({extensions:r,profileLocation:i}),n}),r.length&&this._onDidRemoveExtensions.fire({extensions:r,profileLocation:i})}catch(s){throw r.length&&this._onDidRemoveExtensions.fire({extensions:r,error:s,profileLocation:i}),s}}async withProfileExtensions(e,i,r){return this.getResourceAccessQueue(e).queue(async()=>{let s=[],n;try{const o=await this.fileService.readFile(e);n=JSON.parse(o.value.toString().trim()||"[]")}catch(o){if(Ue(o)!==1)throw o;if(this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)&&(n=await this.migrateFromOldDefaultProfileExtensionsLocation()),!n&&r?.bailOutWhenFileNotFound)throw new On(H(o),"ERROR_PROFILE_NOT_FOUND")}if(n){Array.isArray(n)||this.throwInvalidConentError(e);let o=!1;for(const a of n){uf(a)||this.throwInvalidConentError(e);let l;if(Re(a.relativeLocation)&&a.relativeLocation)l=this.resolveExtensionLocation(a.relativeLocation);else if(Re(a.location)){this.logService.warn(`Extensions profile: Ignoring extension with invalid location: ${a.location}`);continue}else{l=I.revive(a.location);const h=this.toRelativePath(l);h&&(o=!0,a.relativeLocation=h)}Et(a.metadata?.hasPreReleaseVersion)&&a.metadata?.preRelease&&(o=!0,a.metadata.hasPreReleaseVersion=!0);const c=a.metadata?.id??a.identifier.uuid;s.push({identifier:c?{id:a.identifier.id,uuid:c}:{id:a.identifier.id},location:l,version:a.version,metadata:a.metadata})}o&&await this.fileService.writeFile(e,W.fromString(JSON.stringify(n)))}if(i){s=i(s);const o=s.map(a=>({identifier:a.identifier,version:a.version,location:a.location.toJSON(),relativeLocation:this.toRelativePath(a.location),metadata:a.metadata}));await this.fileService.writeFile(e,W.fromString(JSON.stringify(o)))}return s})}throwInvalidConentError(e){throw new On(`Invalid extensions content in ${e.toString()}`,"ERROR_INVALID_CONTENT")}toRelativePath(e){return this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(e),this.extensionsLocation)?this.uriIdentityService.extUri.basename(e):void 0}resolveExtensionLocation(e){return this.uriIdentityService.extUri.joinPath(this.extensionsLocation,e)}async migrateFromOldDefaultProfileExtensionsLocation(){return this._migrationPromise||(this._migrationPromise=(async()=>{const e=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.location,"extensions.json"),i=this.uriIdentityService.extUri.joinPath(this.extensionsLocation,".init-default-profile-extensions");let r;try{r=(await this.fileService.readFile(e)).value.toString()}catch(n){if(Ue(n)===1)return;throw n}this.logService.info("Migrating extensions from old default profile location",e.toString());let s;try{const n=JSON.parse(r);Array.isArray(n)&&n.every(o=>uf(o))?s=n:this.logService.warn("Skipping migrating from old default profile locaiton: Found invalid data",n)}catch(n){this.logService.error(n)}if(s)try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,W.fromString(JSON.stringify(s)),{overwrite:!1}),this.logService.info("Migrated extensions from old default profile location to new location",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString())}catch(n){if(Ue(n)===3)this.logService.info("Migration from old default profile location to new location is done by another window",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString());else throw n}try{await this.fileService.del(e)}catch(n){Ue(n)!==1&&this.logService.error(n)}try{await this.fileService.del(i)}catch(n){Ue(n)!==1&&this.logService.error(n)}return s})()),this._migrationPromise}getResourceAccessQueue(e){let i=this.resourcesAccessQueueMap.get(e);return i||(i=new Hr,this.resourcesAccessQueueMap.set(e,i)),i}};Wa=__decorate([__param(1,Pe),__param(2,Ot),__param(3,qe),__param(4,he)],Wa);function uf(t){return Ne(t)&&cm(t.identifier)&&(Cv(t.location)||Re(t.location)&&t.location)&&(Et(t.relativeLocation)||Re(t.relativeLocation))&&t.version&&Re(t.version)}function Cv(t){return t?Re(t.path)&&Re(t.scheme):!1}function $a(t){switch(t){case 1:return g(116,null);case 2:return g(117,null);case 3:return g(118,null);case 4:return g(119,null);case 5:return g(120,null);case 6:return g(121,null);case 7:return g(122,null);case 8:return g(123,null);case 9:return g(124,null);default:return""}}function Rv(t,e,i,r){try{Lv(t,e,i,r)}catch(s){t.error(s?.message??s)}return e}function Lv(t,e,i,r){const s=(n,o,a)=>{const l=n[o];if(Re(l)){const c=l,h=c.length;if(h>1&&c[0]==="%"&&c[h-1]==="%"){const f=c.substr(1,h-2);let d=i[f];d===void 0&&r&&(d=r[f]);const p=typeof d=="string"?d:d?.message,v=r?.[f],m=typeof v=="string"?v:v?.message;if(!p){m||t.warn(`[${e.name}]: ${g(1964,null,f)}`);return}if(a&&(o==="title"||o==="category")&&m&&m!==p){const w={value:p,original:m};n[o]=w}else n[o]=p}}else if(Ne(l))for(const c in l)l.hasOwnProperty(c)&&(c==="commands"?s(l,c,!0):s(l,c,a));else if(Array.isArray(l))for(let c=0;cthis._onDidChangeCache.fire(0))),this._register(this.userExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(1)))}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=Wh(this.fileService,this.logService)),this._targetPlatformPromise}async scanAllExtensions(e,i){const[r,s]=await Promise.all([this.scanSystemExtensions(e),this.scanUserExtensions(i)]);return this.dedupExtensions(r,s,[],await this.getTargetPlatform(),!0)}async scanSystemExtensions(e){const i=[];i.push(this.scanDefaultSystemExtensions(e.language)),i.push(this.scanDevSystemExtensions(e.language,!!e.checkControlFile));const[r,s]=await Promise.all(i);return this.applyScanOptions([...r,...s],0,{pickLatest:!1})}async scanUserExtensions(e){this.logService.trace("Started scanning user extensions",e.profileLocation);const i=this.uriIdentityService.extUri.isEqual(e.profileLocation,this.userDataProfilesService.defaultProfile.extensionsResource)?{bailOutWhenFileNotFound:!0}:void 0,r=await this.createExtensionScannerInput(e.profileLocation,!0,1,e.language,!0,i,e.productVersion??this.getProductVersion()),s=e.useCache&&!r.devMode?this.userExtensionsCachedScanner:this.extensionsScanner;let n;try{n=await s.scanExtensions(r)}catch(o){if(o instanceof On&&o.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions(),n=await s.scanExtensions(r);else throw o}return n=await this.applyScanOptions(n,1,{includeInvalid:e.includeInvalid,pickLatest:!0}),this.logService.trace("Scanned user extensions:",n.length),n}async scanAllUserExtensions(e={includeInvalid:!0,includeAllVersions:!0}){const i=await this.createExtensionScannerInput(this.userExtensionsLocation,!1,1,void 0,!0,void 0,this.getProductVersion()),r=await this.extensionsScanner.scanExtensions(i);return this.applyScanOptions(r,1,{includeAllVersions:e.includeAllVersions,includeInvalid:e.includeInvalid})}async scanExtensionsUnderDevelopment(e,i){if(this.environmentService.isExtensionDevelopment&&this.environmentService.extensionDevelopmentLocationURI){const r=(await Promise.all(this.environmentService.extensionDevelopmentLocationURI.filter(s=>s.scheme===ie.file).map(async s=>{const n=await this.createExtensionScannerInput(s,!1,1,i.language,!1,void 0,this.getProductVersion());return(await this.extensionsScanner.scanOneOrMultipleExtensions(n)).map(a=>(a.type=e.find(l=>J(l.identifier,a.identifier))?.type??a.type,this.extensionsScanner.validate(a,n)))}))).flat();return this.applyScanOptions(r,"development",{includeInvalid:i.includeInvalid,pickLatest:!0})}return[]}async scanExistingExtension(e,i,r){const s=await this.createExtensionScannerInput(e,!1,i,r.language,!0,void 0,this.getProductVersion()),n=await this.extensionsScanner.scanExtension(s);return!n||!r.includeInvalid&&!n.isValid?null:n}async scanOneOrMultipleExtensions(e,i,r){const s=await this.createExtensionScannerInput(e,!1,i,r.language,!0,void 0,this.getProductVersion()),n=await this.extensionsScanner.scanOneOrMultipleExtensions(s);return this.applyScanOptions(n,i,{includeInvalid:r.includeInvalid,pickLatest:!0})}async scanMultipleExtensions(e,i,r){const s=[];return await Promise.all(e.map(async n=>{const o=await this.scanOneOrMultipleExtensions(n,i,r);s.push(...o)})),this.applyScanOptions(s,i,{includeInvalid:r.includeInvalid,pickLatest:!0})}async updateManifestMetadata(e,i){const r=j(e,"package.json"),s=(await this.fileService.readFile(r)).value.toString(),n=JSON.parse(s);n.__metadata={...n.__metadata,...i},await this.fileService.writeFile(j(e,"package.json"),W.fromString(JSON.stringify(n,null," ")))}async initializeDefaultProfileExtensions(){try{await this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource,{bailOutWhenFileNotFound:!0})}catch(e){if(e instanceof On&&e.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions();else throw e}}async doInitializeDefaultProfileExtensions(){return this.initializeDefaultProfileExtensionsPromise||(this.initializeDefaultProfileExtensionsPromise=(async()=>{try{this.logService.info("Started initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString());const e=await this.scanAllUserExtensions({includeInvalid:!0});if(e.length)await this.extensionsProfileScannerService.addExtensionsToProfile(e.map(i=>[i,i.metadata]),this.userDataProfilesService.defaultProfile.extensionsResource);else try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,W.fromString(JSON.stringify([])))}catch(i){Ue(i)!==1&&this.logService.warn("Failed to create default profile extensions manifest in extensions installation folder.",this.userExtensionsLocation.toString(),H(i))}this.logService.info("Completed initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString())}catch(e){this.logService.error(e)}finally{this.initializeDefaultProfileExtensionsPromise=void 0}})()),this.initializeDefaultProfileExtensionsPromise}async applyScanOptions(e,i,r={}){return r.includeAllVersions||(e=this.dedupExtensions(i===0?e:void 0,i===1?e:void 0,i==="development"?e:void 0,await this.getTargetPlatform(),!!r.pickLatest)),r.includeInvalid||(e=e.filter(s=>s.isValid)),e.sort((s,n)=>{const o=Ct(s.location.fsPath),a=Ct(n.location.fsPath);return oa?1:0})}dedupExtensions(e,i,r,s,n){const o=(l,c,h)=>{if(l.isValid&&!c.isValid)return!1;if(l.isValid===c.isValid){if(n&&_a(l.manifest.version,c.manifest.version))return this.logService.debug(`Skipping extension ${c.location.path} with lower version ${c.manifest.version} in favour of ${l.location.path} with version ${l.manifest.version}`),!1;if(Bm(l.manifest.version,c.manifest.version)){if(l.type===0)return this.logService.debug(`Skipping extension ${c.location.path} in favour of system extension ${l.location.path} with same version`),!1;if(l.targetPlatform===s)return this.logService.debug(`Skipping extension ${c.location.path} from different target platform ${c.targetPlatform}`),!1}}return h?this.logService.warn(`Overwriting user extension ${l.location.path} with ${c.location.path}.`):this.logService.debug(`Overwriting user extension ${l.location.path} with ${c.location.path}.`),!0},a=new dm;return e?.forEach(l=>{const c=a.get(l.identifier.id);(!c||o(c,l,!1))&&a.set(l.identifier.id,l)}),i?.forEach(l=>{const c=a.get(l.identifier.id);if(!c&&e&&l.type===0){this.logService.debug(`Skipping obsolete system extension ${l.location.path}.`);return}(!c||o(c,l,!1))&&a.set(l.identifier.id,l)}),r?.forEach(l=>{const c=a.get(l.identifier.id);(!c||o(c,l,!0))&&a.set(l.identifier.id,l),a.set(l.identifier.id,l)}),[...a.values()]}async scanDefaultSystemExtensions(e){this.logService.trace("Started scanning system extensions");const i=await this.createExtensionScannerInput(this.systemExtensionsLocation,!1,0,e,!0,void 0,this.getProductVersion()),s=await(i.devMode?this.extensionsScanner:this.systemExtensionsCachedScanner).scanExtensions(i);return this.logService.trace("Scanned system extensions:",s.length),s}async scanDevSystemExtensions(e,i){const r=this.environmentService.isBuilt?[]:this.productService.builtInExtensions;if(!r?.length)return[];this.logService.trace("Started scanning dev system extensions");const s=i?await this.getBuiltInExtensionControl():{},n=[],o=I.file(di(G(en.asFileUri("").fsPath,"..",".build","builtInExtensions")));for(const l of r){const c=s[l.name]||"marketplace";switch(c){case"disabled":break;case"marketplace":n.push(j(o,l.name));break;default:n.push(I.file(c));break}}const a=await Promise.all(n.map(async l=>this.extensionsScanner.scanExtension(await this.createExtensionScannerInput(l,!1,0,e,!0,void 0,this.getProductVersion()))));return this.logService.trace("Scanned dev system extensions:",a.length),ir(a)}async getBuiltInExtensionControl(){try{const e=await this.fileService.readFile(this.extensionsControlLocation);return JSON.parse(e.value.toString())}catch{return{}}}async createExtensionScannerInput(e,i,r,s,n,o,a){const l=await this.getTranslations(s??Vt),c=await this.getMtime(e),h=i&&!this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)?this.userDataProfilesService.defaultProfile.extensionsResource:void 0,f=h?await this.getMtime(h):void 0;return new gs(e,c,h,f,i,o,r,n,a.vscodeVersion,a.date,this.productService.commit,!this.environmentService.isBuilt,s,l)}async getMtime(e){try{const i=await this.fileService.stat(e);if(typeof i.mtime=="number")return i.mtime}catch{}}getProductVersion(){return{vscodeVersion:this.productService.vscodeVersion,version:this.productService.version,date:this.productService.date}}};ja=__decorate([__param(4,Ot),__param(5,Ei),__param(6,Pe),__param(7,he),__param(8,ui),__param(9,mt),__param(10,qe),__param(11,nn)],ja);var gs=class{constructor(t,e,i,r,s,n,o,a,l,c,h,f,d,p){this.location=t,this.mtime=e,this.applicationExtensionslocation=i,this.applicationExtensionslocationMtime=r,this.profile=s,this.profileScanOptions=n,this.type=o,this.validate=a,this.productVersion=l,this.productDate=c,this.productCommit=h,this.devMode=f,this.language=d,this.translations=p}static createNlsConfiguration(t){return{language:t.language,pseudo:t.language==="pseudo",devMode:t.devMode,translations:t.translations}}static equals(t,e){return ru(t.location,e.location)&&t.mtime===e.mtime&&ru(t.applicationExtensionslocation,e.applicationExtensionslocation)&&t.applicationExtensionslocationMtime===e.applicationExtensionslocationMtime&&t.profile===e.profile&&$t(t.profileScanOptions,e.profileScanOptions)&&t.type===e.type&&t.validate===e.validate&&t.productVersion===e.productVersion&&t.productDate===e.productDate&&t.productCommit===e.productCommit&&t.devMode===e.devMode&&t.language===e.language&&qa.equals(t.translations,e.translations)}},Tn=class extends K{constructor(e,i,r,s,n,o){super(),this.extensionsProfileScannerService=e,this.uriIdentityService=i,this.fileService=r,this.environmentService=n,this.logService=o,this.extensionsEnabledWithApiProposalVersion=s.extensionsEnabledWithApiProposalVersion?.map(a=>a.toLowerCase())??[]}async scanExtensions(e){return e.profile?this.scanExtensionsFromProfile(e):this.scanExtensionsFromLocation(e)}async scanExtensionsFromLocation(e){const i=await this.fileService.resolve(e.location);if(!i.children?.length)return[];const r=await Promise.all(i.children.map(async s=>{if(!s.isDirectory||e.type===1&&cr(s.resource).indexOf(".")===0)return null;const n=new gs(s.resource,e.mtime,e.applicationExtensionslocation,e.applicationExtensionslocationMtime,e.profile,e.profileScanOptions,e.type,e.validate,e.productVersion,e.productDate,e.productCommit,e.devMode,e.language,e.translations);return this.scanExtension(n)}));return ir(r).sort((s,n)=>s.location.path!0,e);if(e.applicationExtensionslocation&&!this.uriIdentityService.extUri.isEqual(e.location,e.applicationExtensionslocation)){i=i.filter(s=>!s.metadata?.isApplicationScoped);const r=await this.scanExtensionsFromProfileResource(e.applicationExtensionslocation,s=>!!s.metadata?.isBuiltin||!!s.metadata?.isApplicationScoped,e);i.push(...r)}return i}async scanExtensionsFromProfileResource(e,i,r){const s=await this.extensionsProfileScannerService.scanProfileExtensions(e,r.profileScanOptions);if(!s.length)return[];const n=await Promise.all(s.map(async o=>{if(i(o)){const a=new gs(o.location,r.mtime,r.applicationExtensionslocation,r.applicationExtensionslocationMtime,r.profile,r.profileScanOptions,r.type,r.validate,r.productVersion,r.productDate,r.productCommit,r.devMode,r.language,r.translations);return this.scanExtension(a,o)}return null}));return ir(n)}async scanOneOrMultipleExtensions(e){try{if(await this.fileService.exists(j(e.location,"package.json"))){const i=await this.scanExtension(e);return i?[i]:[]}else return await this.scanExtensions(e)}catch(i){return this.logService.error(`Error scanning extensions at ${e.location.path}:`,H(i)),[]}}async scanExtension(e,i){const r=[];let s=!0,n;try{n=await this.scanExtensionManifest(e.location)}catch(d){if(i){r.push([$e.Error,H(d)]),s=!1;const[p,v]=i.identifier.id.split(".");n={name:v,publisher:p,version:i.version,engines:{vscode:""}}}else return e.type!==0&&this.logService.error(d),null}n.publisher||(n.publisher=Dh);let o;i?o={...i.metadata,size:n.__metadata?.size}:n.__metadata&&(o={installedTimestamp:n.__metadata.installedTimestamp,size:n.__metadata.size,targetPlatform:n.__metadata.targetPlatform}),delete n.__metadata;const a=wt(n.publisher,n.name),l=o?.id?{id:a,uuid:o.id}:{id:a},c=o?.isSystem?0:e.type,h=c===0||!!o?.isBuiltin;try{n=await this.translateManifest(e.location,n,gs.createNlsConfiguration(e))}catch(d){this.logService.warn("Failed to translate manifest",H(d))}let f={type:c,identifier:l,manifest:n,location:e.location,isBuiltin:h,targetPlatform:o?.targetPlatform??"undefined",publisherDisplayName:o?.publisherDisplayName,metadata:o,isValid:s,validations:r,preRelease:!!o?.preRelease};return e.validate&&(f=this.validate(f,e)),n.enabledApiProposals&&(!this.environmentService.isBuilt||this.extensionsEnabledWithApiProposalVersion.includes(a.toLowerCase()))&&(n.originalEnabledApiProposals=n.enabledApiProposals,n.enabledApiProposals=mm([...n.enabledApiProposals])),f}validate(e,i){let r=e.isValid;const s=this.environmentService.isBuilt&&this.extensionsEnabledWithApiProposalVersion.includes(e.identifier.id.toLowerCase()),n=Jm(i.productVersion,i.productDate,i.location,e.manifest,e.isBuiltin,s);for(const[o,a]of n)o===$e.Error&&(r=!1,this.logService.error(this.formatMessage(i.location,a)));return e.isValid=r,e.validations=[...e.validations,...n],e}async scanExtensionManifest(e){const i=j(e,"package.json");let r;try{r=(await this.fileService.readFile(i)).value.toString()}catch(n){throw Ue(n)!==1&&this.logService.error(this.formatMessage(e,g(1965,null,i.path,n.message))),n}let s;try{s=JSON.parse(r)}catch(n){const o=[];Gr(r,o);for(const a of o)this.logService.error(this.formatMessage(e,g(1966,null,i.path,a.offset,a.length,$a(a.error))));throw n}if(Qr(s)!=="object"){const n=this.formatMessage(e,g(1967,null,i.path));throw this.logService.error(n),new Error(n)}return s}async translateManifest(e,i,r){const s=await this.getLocalizedMessages(e,i,r);if(s)try{const n=[],o=await this.resolveOriginalMessageBundle(s.default,n);if(n.length>0)return n.forEach(l=>{this.logService.error(this.formatMessage(e,g(1968,null,s.default?.path,$a(l.error))))}),i;if(Qr(s)!=="object")return this.logService.error(this.formatMessage(e,g(1969,null,s.default?.path))),i;const a=s.values||Object.create(null);return Rv(this.logService,i,a,o)}catch{}return i}async getLocalizedMessages(e,i,r){const s=j(e,"package.nls.json"),n=(c,h)=>{h.forEach(f=>{this.logService.error(this.formatMessage(e,g(1970,null,c?.path,$a(f.error))))})},o=c=>{this.logService.error(this.formatMessage(e,g(1971,null,c?.path)))},a=`${i.publisher}.${i.name}`,l=r.translations[a];if(l)try{const c=I.file(l),h=(await this.fileService.readFile(c)).value.toString(),f=[],d=Gr(h,f);return f.length>0?(n(c,f),{values:void 0,default:s}):Qr(d)!=="object"?(o(c),{values:void 0,default:s}):{values:d.contents?d.contents.package:void 0,default:s}}catch{return{values:void 0,default:s}}else{if(!await this.fileService.exists(s))return;let h;try{h=await this.findMessageBundles(e,r)}catch{return}if(!h.localized)return{values:void 0,default:h.original};try{const f=(await this.fileService.readFile(h.localized)).value.toString(),d=[],p=Gr(f,d);return d.length>0?(n(h.localized,d),{values:void 0,default:h.original}):Qr(p)!=="object"?(o(h.localized),{values:void 0,default:h.original}):{values:p,default:h.original}}catch{return{values:void 0,default:h.original}}}}async resolveOriginalMessageBundle(e,i){if(e)try{const r=(await this.fileService.readFile(e)).value.toString();return Gr(r,i)}catch{}}findMessageBundles(e,i){return new Promise((r,s)=>{const n=o=>{const a=j(e,`package.nls.${o}.json`);this.fileService.exists(a).then(l=>{l&&r({localized:a,original:j(e,"package.nls.json")});const c=o.lastIndexOf("-");c===-1?r({localized:j(e,"package.nls.json"),original:null}):(o=o.substring(0,c),n(o))})};if(i.devMode||i.pseudo||!i.language)return r({localized:j(e,"package.nls.json"),original:null});n(i.language)})}formatMessage(e,i){return`[${e.path}]: ${i}`}};Tn=__decorate([__param(0,Ei),__param(1,qe),__param(2,Pe),__param(3,mt),__param(4,ui),__param(5,he)],Tn);var Nn=class extends Tn{constructor(e,i,r,s,n,o,a,l){super(r,s,n,o,a,l),this.currentProfile=e,this.userDataProfilesService=i,this.cacheValidatorThrottler=this._register(new Mi(3e3)),this._onDidChangeCache=this._register(new O),this.onDidChangeCache=this._onDidChangeCache.event}async scanExtensions(e){const i=this.getCacheFile(e),r=await this.readExtensionCache(i);if(this.input=e,r&&r.input&&gs.equals(r.input,this.input))return this.logService.debug("Using cached extensions scan result",e.type===0?"system":"user",e.location.toString()),this.cacheValidatorThrottler.trigger(()=>this.validateCache()),r.result.map(n=>(n.location=I.revive(n.location),n));const s=await super.scanExtensions(e);return await this.writeExtensionCache(i,{input:e,result:s}),s}async readExtensionCache(e){try{const i=await this.fileService.readFile(e),r=JSON.parse(i.value.toString());return{result:r.result,input:Er(r.input)}}catch(i){this.logService.debug("Error while reading the extension cache file:",e.path,H(i))}return null}async writeExtensionCache(e,i){try{await this.fileService.writeFile(e,W.fromString(JSON.stringify(i)))}catch(r){this.logService.debug("Error while writing the extension cache file:",e.path,H(r))}}async validateCache(){if(!this.input)return;const e=this.getCacheFile(this.input),i=await this.readExtensionCache(e);if(!i)return;const r=i.result,s=JSON.parse(JSON.stringify(await super.scanExtensions(this.input)));if(!$t(s,r))try{this.logService.info("Invalidating Cache",r,s),await this.fileService.del(e),this._onDidChangeCache.fire()}catch(n){this.logService.error(n)}}getCacheFile(e){const i=this.getProfile(e);return this.uriIdentityService.extUri.joinPath(i.cacheHome,e.type===0?hm:kh)}getProfile(e){return e.type===0?this.userDataProfilesService.defaultProfile:e.profile?this.uriIdentityService.extUri.isEqual(e.location,this.currentProfile.extensionsResource)?this.currentProfile:this.userDataProfilesService.profiles.find(i=>this.uriIdentityService.extUri.isEqual(e.location,i.extensionsResource))??this.currentProfile:this.userDataProfilesService.defaultProfile}};Nn=__decorate([__param(1,Ot),__param(2,Ei),__param(3,qe),__param(4,Pe),__param(5,mt),__param(6,ui),__param(7,he)],Nn);var Av=class extends ja{constructor(t,e,i,r,s,n,o,a,l,c,h,f){super(t,e,j(i,".cursor-dev","extensions","control.json"),r,s,n,o,a,l,c,h,f),this.translationsPromise=(async()=>{if(Ac)try{const d=await this.fileService.readFile(I.file(Ac));return JSON.parse(d.value.toString())}catch{}return Object.create(null)})()}getTranslations(t){return this.translationsPromise}};import*as Ov from"fs";import*as fe from"fs";import{tmpdir as Fv}from"os";import{promisify as ms}from"util";var Tv=new Ms(1e4);function Ba(t){return Mv(t,"NFC",Tv)}var U9=new Ms(1e4),Nv=/[^\u0000-\u0080]/;function Mv(t,e,i){if(!t)return t;const r=i.get(t);if(r)return r;let s;return Nv.test(t)?s=t.normalize(e):s=t,i.set(t,s),s}var xr;(function(t){t[t.UNLINK=0]="UNLINK",t[t.MOVE=1]="MOVE"})(xr||(xr={}));async function hf(t,e=xr.UNLINK,i){if(Np(t))throw new Error("rimraf - will refuse to recursively delete root");return e===xr.UNLINK?za(t):Uv(t,i)}async function Uv(t,e=Wp(Fv())){try{try{await fe.promises.rename(t,e)}catch(i){return i.code==="ENOENT"?void 0:za(t)}za(e).catch(i=>{})}catch(i){if(i.code!=="ENOENT")throw i}}async function za(t){return fe.promises.rm(t,{recursive:!0,force:!0,maxRetries:3})}async function Mn(t,e){return Wv(await(e?Vv(t):fe.promises.readdir(t)))}async function Vv(t){try{return await fe.promises.readdir(t,{withFileTypes:!0})}catch(r){console.warn("[node.js fs] readdir with filetypes failed with error: ",r)}const e=[],i=await Mn(t);for(const r of i){let s=!1,n=!1,o=!1;try{const a=await fe.promises.lstat(G(t,r));s=a.isFile(),n=a.isDirectory(),o=a.isSymbolicLink()}catch(a){console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}e.push({name:r,isFile:()=>s,isDirectory:()=>n,isSymbolicLink:()=>o})}return e}function Wv(t){return t.map(e=>typeof e=="string"?Mt?Ba(e):e:(e.name=Mt?Ba(e.name):e.name,e))}async function $v(t){const e=await Mn(t),i=[];for(const r of e)await yt.existsDirectory(G(t,r))&&i.push(r);return i}var yt;(function(t){async function e(s){let n;try{if(n=await fe.promises.lstat(s),!n.isSymbolicLink())return{stat:n}}catch{}try{return{stat:await fe.promises.stat(s),symbolicLink:n?.isSymbolicLink()?{dangling:!1}:void 0}}catch(o){if(o.code==="ENOENT"&&n)return{stat:n,symbolicLink:{dangling:!0}};if(_e&&o.code==="EACCES")try{return{stat:await fe.promises.stat(await fe.promises.readlink(s)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&n)return{stat:n,symbolicLink:{dangling:!0}};throw a}throw o}}t.stat=e;async function i(s){try{const{stat:n,symbolicLink:o}=await t.stat(s);return n.isFile()&&o?.dangling!==!0}catch{}return!1}t.existsFile=i;async function r(s){try{const{stat:n,symbolicLink:o}=await t.stat(s);return n.isDirectory()&&o?.dangling!==!0}catch{}return!1}t.existsDirectory=r})(yt||(yt={}));var qv=new fu;function jv(t,e,i){return qv.queueFor(I.file(t),()=>{const r=Hv(i);return new Promise((s,n)=>zv(t,e,r,o=>o?n(o):s()))},Ro)}var ff=!0;function Bv(t){ff=t}function zv(t,e,i,r){if(!ff)return fe.writeFile(t,e,{mode:i.mode,flag:i.flag},r);fe.open(t,i.flag,i.mode,(s,n)=>{if(s)return r(s);fe.writeFile(n,e,o=>{if(o)return fe.close(n,()=>r(o));fe.fdatasync(n,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),Bv(!1)),fe.close(n,l=>r(l))))})})}function Hv(t){return t?{mode:typeof t.mode=="number"?t.mode:438,flag:typeof t.flag=="string"?t.flag:"w"}:{mode:438,flag:"w"}}async function Kv(t,e,i=6e4){if(t!==e)try{_e&&typeof i=="number"?await df(t,e,Date.now(),i):await fe.promises.rename(t,e)}catch(r){if(t.toLowerCase()!==e.toLowerCase()&&r.code==="EXDEV"||t.endsWith("."))await pf(t,e,{preserveSymlinks:!1}),await hf(t,xr.MOVE);else throw r}}async function df(t,e,i,r,s=0){try{return await fe.promises.rename(t,e)}catch(n){if(n.code!=="EACCES"&&n.code!=="EPERM"&&n.code!=="EBUSY")throw n;if(Date.now()-i>=r)throw console.error(`[node.js fs] rename failed after ${s} retries with error: ${n}`),n;if(s===0){let o=!1;try{const{stat:a}=await yt.stat(e);a.isFile()||(o=!0)}catch{}if(o)throw n}return await zr(Math.min(100,s*10)),df(t,e,i,r,s+1)}}async function pf(t,e,i){return mf(t,e,{root:{source:t,target:e},options:i,handledSourcePaths:new Set})}var gf=511;async function mf(t,e,i){if(i.handledSourcePaths.has(t))return;i.handledSourcePaths.add(t);const{stat:r,symbolicLink:s}=await yt.stat(t);if(s){if(i.options.preserveSymlinks)try{return await Jv(t,e,i)}catch{}if(s.dangling)return}return r.isDirectory()?Gv(t,e,r.mode&gf,i):Qv(t,e,r.mode&gf)}async function Gv(t,e,i,r){await fe.promises.mkdir(e,{recursive:!0,mode:i});const s=await Mn(t);for(const n of s)await mf(G(t,n),G(e,n),r)}async function Qv(t,e,i){await fe.promises.copyFile(t,e),await fe.promises.chmod(e,i)}async function Jv(t,e,i){let r=await fe.promises.readlink(t);Br(r,i.root.source,!et)&&(r=G(i.root.target,r.substr(i.root.source.length+1))),await fe.promises.symlink(r,e)}var pe=new class{get read(){return(t,e,i,r,s)=>new Promise((n,o)=>{fe.read(t,e,i,r,s,(a,l,c)=>a?o(a):n({bytesRead:l,buffer:c}))})}get write(){return(t,e,i,r,s)=>new Promise((n,o)=>{fe.write(t,e,i,r,s,(a,l,c)=>a?o(a):n({bytesWritten:l,buffer:c}))})}get fdatasync(){return ms(fe.fdatasync)}get open(){return ms(fe.open)}get close(){return ms(fe.close)}get realpath(){return ms(fe.realpath)}get ftruncate(){return ms(fe.ftruncate)}async exists(t){try{return await fe.promises.access(t),!0}catch{return!1}}get readdir(){return Mn}get readDirsInDir(){return $v}get writeFile(){return jv}get rm(){return hf}get rename(){return Kv}get copy(){return pf}};import{createWriteStream as vf,promises as yf}from"fs";var wf="end of central directory record signature not found",Xv=new RegExp(wf),Un=class extends Error{constructor(t,e){let i=e.message;switch(t){case"CorruptZip":i=`Corrupt ZIP: ${i}`;break}super(i),this.type=t,this.cause=e}};function Yv(t){const e=t.externalFileAttributes>>16||33188;return[448,56,7].map(i=>e&i).reduce((i,r)=>i+r,e&61440)}function Sf(t){if(t instanceof Un)return t;let e;return Xv.test(t.message)&&(e="CorruptZip"),new Un(e,t)}function Zv(t,e,i,r,s,n){const o=pi(e),a=G(r,o);if(!a.startsWith(r))return Promise.reject(new Error(g(145,null,e)));const l=G(r,e);let c;return n.onCancellationRequested(()=>{c?.destroy()}),Promise.resolve(yf.mkdir(a,{recursive:!0})).then(()=>new Promise((h,f)=>{if(!n.isCancellationRequested)try{c=vf(l,{mode:i}),c.once("close",()=>h()),c.once("error",f),t.once("error",f),t.pipe(c)}catch(d){f(d)}}))}function e4(t,e,i,r){let s=si(()=>Promise.resolve()),n=0;const o=r.onCancellationRequested(()=>{s.cancel(),t.close()});return new Promise((a,l)=>{const c=new Pg,h=f=>{f.isCancellationRequested||(n++,t.readEntry())};t.once("error",l),t.once("close",()=>s.then(()=>{r.isCancellationRequested||t.entryCount===n?a():l(new Un("Incomplete",new Error(g(146,null,n,t.entryCount))))},l)),t.readEntry(),t.on("entry",f=>{if(r.isCancellationRequested)return;if(!i.sourcePathRegex.test(f.fileName)){h(r);return}const d=f.fileName.replace(i.sourcePathRegex,"");if(/\/$/.test(d)){const m=G(e,d);s=si(w=>yf.mkdir(m,{recursive:!0}).then(()=>h(w)).then(void 0,l));return}const p=Ef(t,f),v=Yv(f);s=si(m=>c.queue(()=>p.then(w=>Zv(w,d,v,e,i,m).then(()=>h(m)))).then(null,l))})}).finally(()=>o.dispose())}async function bf(t,e=!1){const{open:i}=await import("yauzl");return new Promise((r,s)=>{i(t,e?{lazyEntries:!0}:void 0,(n,o)=>{n?s(Sf(n)):r(dc(o))})})}function Ef(t,e){return new Promise((i,r)=>{t.openReadStream(e,(s,n)=>{s?r(Sf(s)):i(dc(n))})})}async function t4(t,e){const{ZipFile:i}=await import("yazl");return new Promise((r,s)=>{const n=new i;e.forEach(a=>{a.contents?n.addBuffer(typeof a.contents=="string"?Buffer.from(a.contents,"utf8"):a.contents,a.path):a.localPath&&n.addFile(a.localPath,a.path)}),n.end();const o=vf(t);n.outputStream.pipe(o),n.outputStream.once("error",s),o.once("error",s),o.once("finish",()=>r(t))})}function i4(t,e,i={},r){const s=new RegExp(i.sourcePath?`^${i.sourcePath}`:"");let n=bf(t,!0);return i.overwrite&&(n=n.then(o=>pe.rm(e).then(()=>o))),n.then(o=>e4(o,e,{sourcePathRegex:s},r))}function r4(t,e){return bf(t).then(i=>new Promise((r,s)=>{i.on("entry",n=>{n.fileName===e&&Ef(i,n).then(o=>r(o),o=>s(o))}),i.once("close",()=>s(new Error(g(147,null,e))))}))}function _f(t,e){return r4(t,e).then(i=>new Promise((r,s)=>{const n=[];i.once("error",s),i.on("data",o=>n.push(o)),i.on("end",()=>r(Buffer.concat(n)))}))}var W9=new Uint32Array(10),xf;(function(t){t[t.InitialConsonant=4352]="InitialConsonant",t[t.Vowel=4449]="Vowel",t[t.FinalConsonant=4520]="FinalConsonant",t[t.CompatibilityJamo=12593]="CompatibilityJamo"})(xf||(xf={}));var Pf;(function(t){t[t.NUL=0]="NUL",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z"})(Pf||(Pf={}));var If;(function(t){t[t.fa=24934]="fa",t[t.fg=26470]="fg",t[t.fq=29030]="fq",t[t.fr=29286]="fr",t[t.ft=29798]="ft",t[t.fv=30310]="fv",t[t.fx=30822]="fx",t[t.hk=27496]="hk",t[t.hl=27752]="hl",t[t.ho=28520]="ho",t[t.ml=27757]="ml",t[t.nj=27246]="nj",t[t.nl=27758]="nl",t[t.np=28782]="np",t[t.qt=29809]="qt",t[t.rt=29810]="rt",t[t.sg=26483]="sg",t[t.sw=30579]="sw"})(If||(If={}));var $9=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),q9=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),j9=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),B9=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);function kf(...t){return function(e,i){for(let r=0,s=t.length;r0?[{start:0,end:e.length}]:[]:null}function s4(t,e){const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?null:[{start:i,end:i+t.length}]}function n4(t,e){return Ha(t.toLowerCase(),e.toLowerCase(),0,0)}function Ha(t,e,i,r){if(i===t.length)return[];if(r===e.length)return null;if(t[i]===e[r]){let s=null;return(s=Ha(t,e,i+1,r+1))?Lf({start:r,end:r+1},s):null}return Ha(t,e,i,r+1)}function Ka(t){return 97<=t&&t<=122}function Vn(t){return 65<=t&&t<=90}function Ga(t){return 48<=t&&t<=57}function o4(t){return t===32||t===9||t===10||t===13}var a4=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(t=>a4.add(t.charCodeAt(0)));function Rf(t){return Ka(t)||Vn(t)||Ga(t)}function Lf(t,e){return e.length===0?e=[t]:t.end===e[0].start?e[0].start=t.start:e.unshift(t),e}function Af(t,e){for(let i=e;i0&&!Rf(t.charCodeAt(i-1)))return i}return t.length}function Qa(t,e,i,r){if(i===t.length)return[];if(r===e.length)return null;if(t[i]!==e[r].toLowerCase())return null;{let s=null,n=r+1;for(s=Qa(t,e,i+1,r+1);!s&&(n=Af(e,n)).6}function u4(t){const{upperPercent:e,lowerPercent:i,alphaPercent:r,numericPercent:s}=t;return i>.2&&e<.8&&r>.6&&s<.2}function h4(t){let e=0,i=0,r=0,s=0;for(let n=0;n60&&(e=e.substring(0,60));const i=l4(e);if(!u4(i)){if(!c4(i))return null;e=e.toLowerCase()}let r=null,s=0;for(t=t.toLowerCase();s"u"||Ya.isThemeColor(d.color))}t.isThemeIcon=n;const o=new RegExp(`^\\$\\((${t.iconNameExpression}(?:${t.iconModifierExpression})?)\\)$`);function a(d){const p=o.exec(d);if(!p)return;const[,v]=p;return{id:v}}t.fromString=a;function l(d){return{id:d}}t.fromId=l;function c(d,p){let v=d.id;const m=v.lastIndexOf("~");return m!==-1&&(v=v.substring(0,m)),p&&(v=`${v}~${p}`),{id:v}}t.modify=c;function h(d){const p=d.id.lastIndexOf("~");if(p!==-1)return d.id.substring(p+1)}t.getModifier=h;function f(d,p){return d.id===p.id&&d.color?.id===p.color?.id}t.isEqual=f})(vs||(vs={}));var Za=new RegExp(`\\$\\(${vs.iconNameExpression}(?:${vs.iconModifierExpression})?\\)`,"g"),p4=new RegExp(`(\\\\)?${Za.source}`,"g");function g4(t){return t.replace(p4,(e,i)=>i?e:`\\${e}`)}var tw=new RegExp(`\\\\${Za.source}`,"g"),iw=new RegExp(`(\\s)?(\\\\)?${Za.source}(\\s)?`,"g"),rw=new RegExp(`\\$\\(${vs.iconNameCharacter}+\\)`,"g"),Uf;(function(t){t[t.Paragraph=0]="Paragraph",t[t.Break=1]="Break"})(Uf||(Uf={}));var Ki=class t1{static lift(e){const i=new t1(e.value,e);return i.uris=e.uris,i.baseUri=e.baseUri?I.revive(e.baseUri):void 0,i}constructor(e="",i=!1){if(this.value=e,typeof this.value!="string")throw E1("value");typeof i=="boolean"?(this.isTrusted=i,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=i.isTrusted??void 0,this.supportThemeIcons=i.supportThemeIcons??!1,this.supportHtml=i.supportHtml??!1)}appendText(e,i=0){return this.value+=m4(this.supportThemeIcons?g4(e):e).replace(/([ \t]+)/g,(r,s)=>" ".repeat(s.length)).replace(/\>/gm,"\\>").replace(/\n/g,i===1?`\\ `:` `),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,i){return this.value+=` ${v4(i,e)} `,this}appendLink(e,i,r){return this.value+="[",this.value+=this._escape(i,"]"),this.value+="](",this.value+=this._escape(String(e),")"),r&&(this.value+=` "${this._escape(this._escape(r,'"'),")")}"`),this.value+=")",this}_escape(e,i){const r=new RegExp(ar(i),"g");return e.replace(r,(s,n)=>e.charAt(n-1)!=="\\"?`\\${s}`:s)}};function m4(t){return t.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function v4(t,e){const i=t.match(/^`+/gm)?.reduce((s,n)=>s.length>n.length?s:n).length??0,r=i>=3?i+1:3;return[`${"`".repeat(r)}${e}`,t,`${"`".repeat(r)}`].join(` `)}var el=class extends K{constructor(e,i){super(),this.productService=e,this.allowedExtensionsService=i}async canInstall(e){const i=this.allowedExtensionsService.isAllowed({id:e.identifier.id,publisherDisplayName:e.publisherDisplayName});if(i!==!0)return new Ki(g(1909,null,i.value));if(!await this.isExtensionPlatformCompatible(e)){const r=ei?"https://aka.ms/vscode-web-extensions-guide":"https://aka.ms/vscode-platform-specific-extensions";return new Ki(`${g(1910,null,e.displayName??e.identifier.id,this.productService.nameLong,yh(await this.getTargetPlatform()))} [${g(1911,null)}](${r})`)}return!0}async isExtensionPlatformCompatible(e){const i=await this.getTargetPlatform();return e.allTargetPlatforms.some(r=>ga(r,e.allTargetPlatforms,i))}};el=__decorate([__param(0,mt),__param(1,Bi)],el);var tl=class extends el{get onInstallExtension(){return this._onInstallExtension.event}get onDidInstallExtensions(){return this._onDidInstallExtensions.event}get onUninstallExtension(){return this._onUninstallExtension.event}get onDidUninstallExtension(){return this._onDidUninstallExtension.event}get onDidUpdateExtensionMetadata(){return this._onDidUpdateExtensionMetadata.event}constructor(e,i,r,s,n,o,a){super(n,o),this.galleryService=e,this.telemetryService=i,this.uriIdentityService=r,this.logService=s,this.userDataProfilesService=a,this.lastReportTimestamp=0,this.installingExtensions=new Map,this.uninstallingExtensions=new Map,this._onInstallExtension=this._register(new O),this._onDidInstallExtensions=this._register(new O),this._onUninstallExtension=this._register(new O),this._onDidUninstallExtension=this._register(new O),this._onDidUpdateExtensionMetadata=this._register(new O),this.participants=[],this._register(ye(()=>{this.installingExtensions.forEach(({task:l})=>l.cancel()),this.uninstallingExtensions.forEach(l=>l.cancel()),this.installingExtensions.clear(),this.uninstallingExtensions.clear()}))}async installFromGallery(e,i={}){try{const s=(await this.installGalleryExtensions([{extension:e,options:i}])).find(({identifier:n})=>J(n,e.identifier));if(s?.local)return s?.local;throw s?.error?s.error:new we(`Unknown error while installing extension ${e.identifier.id}`,"Unknown")}catch(r){throw Ie(r)}}async installGalleryExtensions(e){if(!this.galleryService.isEnabled())throw new we(g(1912,null),"NotAllowed");const i=[],r=[];return await Promise.allSettled(e.map(async({extension:s,options:n})=>{try{const o=await this.checkAndGetCompatibleVersion(s,!!n?.installGivenVersion,!!n?.installPreReleaseVersion,n.productVersion??{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion});r.push({...o,options:n})}catch(o){i.push({identifier:s.identifier,operation:2,source:s,error:o,profileLocation:n.profileLocation??this.getCurrentExtensionsManifestLocation()})}})),r.length&&i.push(...await this.installExtensions(r)),i}async uninstall(e,i){return this.logService.trace("ExtensionManagementService#uninstall",e.identifier.id),this.uninstallExtensions([{extension:e,options:i}])}async toggleAppliationScope(e,i){if(Lh(e.manifest)||e.isBuiltin)return e;if(e.isApplicationScoped){let r=await this.updateMetadata(e,{isApplicationScoped:!1},this.userDataProfilesService.defaultProfile.extensionsResource);this.uriIdentityService.extUri.isEqual(i,this.userDataProfilesService.defaultProfile.extensionsResource)||(r=await this.copyExtension(e,this.userDataProfilesService.defaultProfile.extensionsResource,i));for(const s of this.userDataProfilesService.profiles){const n=(await this.getInstalled(1,s.extensionsResource)).find(o=>J(o.identifier,e.identifier));n?this._onDidUpdateExtensionMetadata.fire({local:n,profileLocation:s.extensionsResource}):this._onDidUninstallExtension.fire({identifier:e.identifier,profileLocation:s.extensionsResource})}return r}else{const r=this.uriIdentityService.extUri.isEqual(i,this.userDataProfilesService.defaultProfile.extensionsResource)?await this.updateMetadata(e,{isApplicationScoped:!0},this.userDataProfilesService.defaultProfile.extensionsResource):await this.copyExtension(e,i,this.userDataProfilesService.defaultProfile.extensionsResource,{isApplicationScoped:!0});return this._onDidInstallExtensions.fire([{identifier:r.identifier,operation:2,local:r,profileLocation:this.userDataProfilesService.defaultProfile.extensionsResource,applicationScoped:!0}]),r}}getExtensionsControlManifest(){const e=new Date().getTime();return(!this.extensionsControlManifest||e-this.lastReportTimestamp>1e3*60*5)&&(this.extensionsControlManifest=this.updateControlCache(),this.lastReportTimestamp=e),this.extensionsControlManifest}registerParticipant(e){this.participants.push(e)}async resetPinnedStateForAllUserExtensions(e){try{await this.joinAllSettled(this.userDataProfilesService.profiles.map(async i=>{const r=await this.getInstalled(1,i.extensionsResource);await this.joinAllSettled(r.map(async s=>{s.pinned!==e&&await this.updateMetadata(s,{pinned:e},i.extensionsResource)}))}))}catch(i){throw this.logService.error("Error while resetting pinned state for all user extensions",H(i)),i}}async installExtensions(e){const i=new Map,r=new Map,s=[],n=(l,c)=>`${gt.create(l).toString()}-${c.toString()}`,o=(l,c,h,f)=>{if(!I.isUri(c)){if(r.has(`${c.identifier.id.toLowerCase()}-${h.profileLocation.toString()}`))return;const v=this.installingExtensions.get(n(c,h.profileLocation));if(v){if(f&&this.canWaitForTask(f,v.task)){const m=v.task.identifier;this.logService.info("Waiting for already requested installing extension",m.id,f.identifier.id,h.profileLocation.toString()),v.waitingTasks.push(f),s.push(ae.toPromise(ae.filter(this.onDidInstallExtensions,w=>w.some(S=>J(S.identifier,m)))).then(w=>{if(this.logService.info("Finished waiting for already requested installing extension",m.id,f.identifier.id,h.profileLocation.toString()),!w.find(_=>J(_.identifier,m))?.local)throw new Error(`Extension ${m.id} is not installed`)}))}return}}const d=this.createInstallExtensionTask(l,c,h),p=`${wt(l.publisher,l.name)}-${h.profileLocation.toString()}`;r.set(p,{task:d,root:f}),this._onInstallExtension.fire({identifier:d.identifier,source:c,profileLocation:h.profileLocation}),this.logService.info("Installing extension:",d.identifier.id,h),I.isUri(c)||this.installingExtensions.set(n(c,h.profileLocation),{task:d,waitingTasks:[]})};try{for(const{manifest:c,extension:h,options:f}of e){const d=f.isApplicationScoped||f.isBuiltin||Lh(c),p={...f,installOnlyNewlyAddedFromExtensionPack:f.installOnlyNewlyAddedFromExtensionPack??!I.isUri(h),isApplicationScoped:d,profileLocation:d?this.userDataProfilesService.defaultProfile.extensionsResource:f.profileLocation??this.getCurrentExtensionsManifestLocation(),productVersion:f.productVersion??{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion}},v=I.isUri(h)?void 0:this.installingExtensions.get(n(h,p.profileLocation));v?(this.logService.info("Extension is already requested to install",v.task.identifier.id,p.profileLocation.toString()),s.push(v.task.waitUntilTaskIsFinished())):o(c,h,p,void 0)}await Promise.all([...r.values()].map(async({task:c})=>{if(c.options.donotIncludePackAndDependencies)this.logService.info("Installing the extension without checking dependencies and pack",c.identifier.id);else try{const h=await this.getAllDepsAndPackExtensions(c.identifier,c.manifest,!!c.options.installOnlyNewlyAddedFromExtensionPack,!!c.options.installPreReleaseVersion,c.options.productVersion,I.isUri(c.source)?void 0:c.source.queryContext),f=await this.getInstalled(void 0,c.options.profileLocation,c.options.productVersion),d={...c.options,context:{...c.options.context,[om]:!0}};for(const{gallery:p,manifest:v}of Xt(h,({gallery:m})=>m.identifier.id)){const m=f.find(w=>J(w.identifier,p.identifier));m&&m.isApplicationScoped===!!d.isApplicationScoped||o(v,p,d,c)}}catch(h){if(I.isUri(c.source))sc(c.manifest.extensionDependencies)&&this.logService.warn("Cannot install dependencies of extension:",c.identifier.id,h.message),sc(c.manifest.extensionPack)&&this.logService.warn("Cannot install packed extensions of extension:",c.identifier.id,h.message);else throw this.logService.error("Error while preparing to install dependencies and extension packs of the extension:",c.identifier.id),h}}));const l=await this.getOtherProfilesToUpdateExtension([...r.values()].map(({task:c})=>c));for(const[c,h]of l)o(h.manifest,h.source,{...h.options,profileLocation:c},void 0);await this.joinAllSettled([...r.entries()].map(async([c,{task:h}])=>{const f=new Date().getTime();let d;try{d=await h.run(),await this.joinAllSettled(this.participants.map(p=>p.postInstall(d,h.source,h.options,de.None)),"PostInstall")}catch(p){const v=Ie(p);throw I.isUri(h.source)||il(this.telemetryService,h.operation===3?"extensionGallery:update":"extensionGallery:install",{extensionData:Ea(h.source),error:v,source:h.options.context?.[mh]}),i.set(c,{error:v,identifier:h.identifier,operation:h.operation,source:h.source,context:h.options.context,profileLocation:h.options.profileLocation,applicationScoped:h.options.isApplicationScoped}),this.logService.error("Error while installing the extension",h.identifier.id,H(v),h.options.profileLocation.toString()),v}if(!I.isUri(h.source)){const p=h.operation===3,v=p?void 0:(new Date().getTime()-h.source.lastUpdated)/1e3;if(il(this.telemetryService,p?"extensionGallery:update":"extensionGallery:install",{extensionData:Ea(h.source),verificationStatus:h.verificationStatus,duration:new Date().getTime()-f,durationSinceUpdate:v,source:h.options.context?.[mh]}),ei&&h.operation!==3)try{await this.galleryService.reportStatistic(d.manifest.publisher,d.manifest.name,d.manifest.version,"install")}catch{}}i.set(c,{local:d,identifier:h.identifier,operation:h.operation,source:h.source,context:h.options.context,profileLocation:h.options.profileLocation,applicationScoped:d.isApplicationScoped})})),s.length&&await this.joinAllSettled(s)}catch(l){const c=(d,p,v)=>{const m=[];d.manifest.extensionDependencies?.length&&m.push(...d.manifest.extensionDependencies),d.manifest.extensionPack?.length&&m.push(...d.manifest.extensionPack);for(const w of m){if(v.includes(w.toLowerCase()))continue;v.push(w.toLowerCase());const S=i.get(`${w.toLowerCase()}-${p.toString()}`);S?.local&&(v=c(S.local,p,v))}return v},h=d=>({identifier:d.identifier,operation:2,source:d.source,context:d.options.context,profileLocation:d.options.profileLocation,error:l}),f=[];for(const[d,{task:p,root:v}]of r){const m=i.get(d);m?m.local&&v&&!i.get(`${v.identifier.id.toLowerCase()}-${p.options.profileLocation.toString()}`)?.local&&(f.push(this.createUninstallExtensionTask(m.local,{versionOnly:!0,profileLocation:p.options.profileLocation})),i.set(d,h(p))):(p.cancel(),i.set(d,h(p)))}for(const[d,{task:p}]of r){const v=i.get(d);if(!v?.local||p.options.donotIncludePackAndDependencies)continue;c(v.local,p.options.profileLocation,[v.local.identifier.id.toLowerCase()]).slice(1).some(w=>r.has(`${w.toLowerCase()}-${p.options.profileLocation.toString()}`)&&!i.get(`${w.toLowerCase()}-${p.options.profileLocation.toString()}`)?.local)&&(f.push(this.createUninstallExtensionTask(v.local,{versionOnly:!0,profileLocation:p.options.profileLocation})),i.set(d,h(p)))}f.length&&await Promise.allSettled(f.map(async d=>{try{await d.run(),this.logService.info("Rollback: Uninstalled extension",d.extension.identifier.id)}catch(p){this.logService.warn("Rollback: Error while uninstalling extension",d.extension.identifier.id,H(p))}}))}finally{for(const{task:l}of r.values())l.source&&!I.isUri(l.source)&&this.installingExtensions.delete(n(l.source,l.options.profileLocation))}const a=[...i.values()];for(const l of a)l.local&&this.logService.info("Extension installed successfully:",l.identifier.id,l.profileLocation.toString());return this._onDidInstallExtensions.fire(a),a}async getOtherProfilesToUpdateExtension(e){const i=[],r=new Ge;for(const s of e)if(!(s.operation!==3||s.options.isApplicationScoped||s.options.pinned||s.options.installGivenVersion||I.isUri(s.source)))for(const n of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(n.extensionsResource,s.options.profileLocation))continue;let o=r.get(n.extensionsResource);o||(o=await this.getInstalled(1,n.extensionsResource),r.set(n.extensionsResource,o));const a=o.find(l=>J(l.identifier,s.identifier));a&&!a.pinned&&i.push([n.extensionsResource,s])}return i}canWaitForTask(e,i){for(const[,{task:r,waitingTasks:s}]of this.installingExtensions.entries())if(r===e&&(s.includes(i)||s.some(n=>this.canWaitForTask(n,i)))||r===i&&s[0]&&!this.canWaitForTask(e,s[0]))return!1;return!0}async joinAllSettled(e,i){const r=[],s=[],n=await Promise.allSettled(e);for(const a of n)a.status==="fulfilled"?r.push(a.value):s.push(Ie(a.reason,i));if(!s.length)return r;if(s.length===1)throw s[0];let o=new we("","Unknown");for(const a of s)o=new we(o.message?`${o.message}, ${a.message}`:a.message,a.code!=="Unknown"&&a.code!=="Internal"?a.code:o.code);throw o}async getAllDepsAndPackExtensions(e,i,r,s,n,o){if(!this.galleryService.isEnabled())return[];const a=[],l=[],c=async(h,f)=>{a.push(h);let d=f.extensionDependencies||[];const p=[...d];if(f.extensionPack)for(const v of f.extensionPack)p.every(m=>!J({id:m},{id:v}))&&p.push(v);if(p.length){const v=p.filter(m=>a.every(w=>!J(w,{id:m})));if(v.length){const m=await this.galleryService.getExtensions(v.map(w=>({id:w,preRelease:s})),{},de.None,o);for(const w of m){if(a.find(P=>J(P,w.identifier)))continue;const S=d.some(P=>J({id:P},w.identifier));let _;try{_=await this.checkAndGetCompatibleVersion(w,!1,s,n)}catch(P){if(S)throw P;this.logService.info("Skipping the packed extension as it cannot be installed",w.identifier.id,H(P));continue}l.push({gallery:_.extension,manifest:_.manifest}),await c(_.extension.identifier,_.manifest)}}}};return await c(e,i),l}async checkAndGetCompatibleVersion(e,i,r,s){let n;const o=await this.getExtensionsControlManifest();if(Um(e.identifier,o.malicious))throw new we(g(1913,null,e.identifier.id),"Malicious");const a=o.deprecated[e.identifier.id.toLowerCase()];if(a?.extension?.autoMigrate){if(this.logService.info(`The '${e.identifier.id}' extension is deprecated, fetching the compatible '${a.extension.id}' extension instead.`),n=(await this.galleryService.getExtensions([{id:a.extension.id,preRelease:a.extension.preRelease}],{targetPlatform:await this.getTargetPlatform(),compatible:!0,productVersion:s},de.None))[0],!n)throw new we(g(1914,null,e.identifier.id,a.extension.id),"Deprecated")}else{if(await this.canInstall(e)!==!0){const c=await this.getTargetPlatform();throw new we(g(1915,null,e.identifier.id,this.productService.nameLong,yh(c)),"IncompatibleTargetPlatform")}if(n=await this.getCompatibleVersion(e,i,r,s),!n){const c=[];throw Ia(e.properties.enabledApiProposals??[],c)?!r&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],{},de.None,e.queryContext))[0]?new we(g(1917,null,e.displayName??e.identifier.id),"ReleaseVersionNotFound"):new we(g(1918,null,e.identifier.id,this.productService.nameLong,this.productService.version,this.productService.vscodeVersion),"Incompatible"):new we(g(1916,null,e.displayName??e.identifier.id,c[0]),"IncompatibleApi")}}this.logService.info("Getting Manifest...",n.identifier.id);const l=await this.galleryService.getManifest(n,de.None);if(l===null)throw new we(`Missing manifest for extension ${n.identifier.id}`,"Invalid");if(l.version!==n.version)throw new we(`Cannot install '${n.identifier.id}' extension because of version mismatch in Marketplace`,"Invalid");return{extension:n,manifest:l}}async getCompatibleVersion(e,i,r,s){const n=await this.getTargetPlatform();let o=null;return!i&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion!==r&&(o=(await this.galleryService.getExtensions([{...e.identifier,preRelease:r}],{targetPlatform:n,compatible:!0,productVersion:s},de.None,e.queryContext)).filter(hs)[0]||null),!o&&await this.galleryService.isExtensionCompatible(e,r,n,s)&&(o=e),o||(i?o=(await this.galleryService.getExtensions([{...e.identifier,version:e.version}],{targetPlatform:n,compatible:!0,productVersion:s},de.None,e.queryContext)).filter(hs)[0]||null:o=await this.galleryService.getCompatibleExtension(e,r,n,s)),o}async uninstallExtensions(e){const i=(f,d)=>`${f.identifier.id.toLowerCase()}${d.versionOnly?`-${f.manifest.version}`:""}@${d.profileLocation.toString()}`,r=(f,d)=>{const p=this.createUninstallExtensionTask(f,d);return this.uninstallingExtensions.set(i(p.extension,d),p),this.logService.info("Uninstalling extension from the profile:",`${f.identifier.id}@${f.manifest.version}`,d.profileLocation.toString()),this._onUninstallExtension.fire({identifier:f.identifier,profileLocation:d.profileLocation,applicationScoped:f.isApplicationScoped}),p},s=(f,d,p)=>{p?this.logService.error("Failed to uninstall extension from the profile:",`${f.identifier.id}@${f.manifest.version}`,d.profileLocation.toString(),p.message):this.logService.info("Successfully uninstalled extension from the profile",`${f.identifier.id}@${f.manifest.version}`,d.profileLocation.toString()),il(this.telemetryService,"extensionGallery:uninstall",{extensionData:Nm(f),error:p}),this._onDidUninstallExtension.fire({identifier:f.identifier,error:p?.code,profileLocation:d.profileLocation,applicationScoped:f.isApplicationScoped})},n=[],o=[],a=[],l=[],c=new Ge,h=async f=>{let d=c.get(f);return d||c.set(f,d=await this.getInstalled(1,f)),d};for(const{extension:f,options:d}of e){const p={...d,profileLocation:f.isApplicationScoped?this.userDataProfilesService.defaultProfile.extensionsResource:d?.profileLocation??this.getCurrentExtensionsManifestLocation()},v=this.uninstallingExtensions.get(i(f,p));if(v?(this.logService.info("Extensions is already requested to uninstall",f.identifier.id),a.push(v.waitUntilTaskIsFinished())):n.push(r(f,p)),p.remove){l.push(f);for(const m of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(m.extensionsResource,p.profileLocation))continue;const S=(await h(m.extensionsResource)).find(_=>J(_.identifier,f.identifier));if(S){const _={...p,profileLocation:m.extensionsResource},P=this.uninstallingExtensions.get(i(S,_));P?(this.logService.info("Extensions is already requested to uninstall",S.identifier.id),a.push(P.waitUntilTaskIsFinished())):n.push(r(S,_))}}}}try{for(const f of n.slice(0)){const d=await h(f.options.profileLocation);if(f.options.donotIncludePack)this.logService.info("Uninstalling the extension without including packed extension",`${f.extension.identifier.id}@${f.extension.manifest.version}`);else{const p=this.getAllPackExtensionsToUninstall(f.extension,d);for(const v of p)this.uninstallingExtensions.has(i(v,f.options))?this.logService.info("Extensions is already requested to uninstall",v.identifier.id):n.push(r(v,f.options))}f.options.donotCheckDependents?this.logService.info("Uninstalling the extension without checking dependents",`${f.extension.identifier.id}@${f.extension.manifest.version}`):this.checkForDependents(n.map(p=>p.extension),d,f.extension)}await this.joinAllSettled(n.map(async f=>{try{if(await f.run(),await this.joinAllSettled(this.participants.map(d=>d.postUninstall(f.extension,f.options,de.None))),f.extension.identifier.uuid)try{await this.galleryService.reportStatistic(f.extension.manifest.publisher,f.extension.manifest.name,f.extension.manifest.version,"uninstall")}catch{}}catch(d){const p=Ie(d);throw s(f.extension,f.options,p),p}finally{o.push(f)}})),a.length&&await this.joinAllSettled(a);for(const f of n)s(f.extension,f.options);l.length&&await this.joinAllSettled(l.map(f=>this.removeExtension(f)))}catch(f){const d=Ie(f);for(const p of n){try{p.cancel()}catch{}o.includes(p)||s(p.extension,p.options,d)}throw d}finally{for(const f of n)this.uninstallingExtensions.delete(i(f.extension,f.options))||this.logService.warn("Uninstallation task is not found in the cache",f.extension.identifier.id)}}checkForDependents(e,i,r){for(const s of e){const n=this.getDependents(s,i);if(n.length){const o=n.filter(a=>!e.some(l=>J(l.identifier,a.identifier)));if(o.length)throw new Error(this.getDependentsErrorMessage(s,o,r))}}}getDependentsErrorMessage(e,i,r){return r===e?i.length===1?g(1919,null,r.manifest.displayName||r.manifest.name,i[0].manifest.displayName||i[0].manifest.name):i.length===2?g(1920,null,r.manifest.displayName||r.manifest.name,i[0].manifest.displayName||i[0].manifest.name,i[1].manifest.displayName||i[1].manifest.name):g(1921,null,r.manifest.displayName||r.manifest.name,i[0].manifest.displayName||i[0].manifest.name,i[1].manifest.displayName||i[1].manifest.name):i.length===1?g(1922,null,r.manifest.displayName||r.manifest.name,e.manifest.displayName||e.manifest.name,i[0].manifest.displayName||i[0].manifest.name):i.length===2?g(1923,null,r.manifest.displayName||r.manifest.name,e.manifest.displayName||e.manifest.name,i[0].manifest.displayName||i[0].manifest.name,i[1].manifest.displayName||i[1].manifest.name):g(1924,null,r.manifest.displayName||r.manifest.name,e.manifest.displayName||e.manifest.name,i[0].manifest.displayName||i[0].manifest.name,i[1].manifest.displayName||i[1].manifest.name)}getAllPackExtensionsToUninstall(e,i,r=[]){if(r.indexOf(e)!==-1)return[];r.push(e);const s=e.manifest.extensionPack?e.manifest.extensionPack:[];if(s.length){const n=i.filter(a=>!a.isBuiltin&&s.some(l=>J({id:l},a.identifier))),o=[];for(const a of n)o.push(...this.getAllPackExtensionsToUninstall(a,i,r));return[...n,...o]}return[]}getDependents(e,i){return i.filter(r=>r.manifest.extensionDependencies&&r.manifest.extensionDependencies.some(s=>J({id:s},e.identifier)))}async updateControlCache(){try{return this.logService.trace("ExtensionManagementService.updateControlCache"),await this.galleryService.getExtensionsControlManifest()}catch(e){return this.logService.trace("ExtensionManagementService.refreshControlCache - failed to get extension control manifest",H(e)),{malicious:[],deprecated:{},search:[]}}}};tl=__decorate([__param(0,bi),__param(1,jt),__param(2,qe),__param(3,he),__param(4,mt),__param(5,Bi),__param(6,Ot)],tl);function Ie(t,e){if(t instanceof we)return t;let i;return t instanceof _n?i=new we(t.message,t.code==="DownloadFailedWriting"?"DownloadFailedWriting":"Gallery"):i=new we(t.message,Ci(t)?"Cancelled":e??"Internal"),i.stack=t.stack,i}function il(t,e,{extensionData:i,verificationStatus:r,duration:s,error:n,source:o,durationSinceUpdate:a}){t.publicLog(e,{...i,source:o,duration:s,durationSinceUpdate:a,success:!n,errorcode:n?.code,verificationStatus:r===Oe.Success?"Verified":r??"Unverified"})}var Vf=class{constructor(){this.barrier=new uu}async waitUntilTaskIsFinished(){return await this.barrier.wait(),this.cancellablePromise}run(){return this.cancellablePromise||(this.cancellablePromise=si(t=>this.doRun(t))),this.barrier.open(),this.cancellablePromise}cancel(){this.cancellablePromise||(this.cancellablePromise=si(t=>new Promise((e,i)=>{const r=t.onCancellationRequested(()=>{r.dispose(),i(new Te)})})),this.barrier.open()),this.cancellablePromise.cancel()}};function rl(t){let e="Extract";return t instanceof Un&&(t.type==="CorruptZip"?e="CorruptZip":t.type==="Incomplete"&&(e="IncompleteZip")),Ie(t,e)}async function sl(t){let e;try{e=await _f(t,"extension/package.json")}catch(i){throw rl(i)}try{return JSON.parse(e.toString("utf8"))}catch{throw new we(g(1982,null),"Invalid")}}var $n,nl=class extends K{static{$n=this}static{this.SignatureArchiveExtension=".sigzip"}constructor(e,i,r,s,n,o,a){super(),this.fileService=i,this.extensionGalleryService=r,this.extensionSignatureVerificationService=s,this.telemetryService=n,this.uriIdentityService=o,this.logService=a,this.extensionsDownloadDir=e.extensionsDownloadLocation,this.extensionsTrashDir=o.extUri.joinPath(e.extensionsDownloadLocation,".trash"),this.cache=20,this.cleanUpPromise=this.cleanUp()}async download(e,i,r,s){await this.cleanUpPromise;const n=await this.downloadVSIX(e,i);if(!r)return{location:n,verificationStatus:void 0};if(!e.isSigned)return{location:n,verificationStatus:Oe.NotSigned};let o;try{o=await this.downloadSignatureArchive(e);const a=(await this.extensionSignatureVerificationService.verify(e.identifier.id,e.version,n.fsPath,o.fsPath,s))?.code;if(a===Oe.PackageIsInvalidZip||a===Oe.SignatureArchiveIsInvalidZip){try{await this.delete(n)}catch(l){this.logService.error(l)}throw new we(wf,"CorruptZip")}return{location:n,verificationStatus:a}}catch(a){try{await this.delete(n)}catch(l){this.logService.error(l)}throw a}finally{if(o)try{await this.delete(o)}catch(a){this.logService.error(a)}}}async downloadVSIX(e,i){try{const r=j(this.extensionsDownloadDir,this.getName(e)),s=await this.doDownload(e,"vsix",async()=>{await this.downloadFile(e,r,n=>this.extensionGalleryService.download(e,n,i));try{await this.validate(r.fsPath,"extension/package.json")}catch(n){try{await this.fileService.del(r)}catch(o){this.logService.warn(`Error while deleting: ${r.path}`,H(o))}throw n}},2);return s>1&&this.telemetryService.publicLog2("extensiongallery:downloadvsix:retry",{extensionId:e.identifier.id,attempts:s}),r}catch(r){throw Ie(r,"Download")}}async downloadSignatureArchive(e){try{const i=j(this.extensionsDownloadDir,`${this.getName(e)}${$n.SignatureArchiveExtension}`),r=await this.doDownload(e,"sigzip",async()=>{await this.extensionGalleryService.downloadSignatureArchive(e,i);try{await this.validate(i.fsPath,".signature.p7s")}catch(s){try{await this.fileService.del(i)}catch(n){this.logService.warn(`Error while deleting: ${i.path}`,H(n))}throw s}},2);return r>1&&this.telemetryService.publicLog2("extensiongallery:downloadsigzip:retry",{extensionId:e.identifier.id,attempts:r}),i}catch(i){throw Ie(i,"DownloadSignature")}}async downloadFile(e,i,r){if(this.logService.info("Started downloading extension:",e.identifier.id,e.version,i.toString()),await this.fileService.exists(i)){this.logService.info("No need to download extension as it exists already.",e.identifier.id,e.version,i.toString());return}if(i.scheme!==ie.file){this.logService.info("Downloading extension from web:",e.identifier.id,e.version,i.toString()),await r(i);return}const s=j(this.extensionsDownloadDir,`.${pt()}`);try{await r(s)}catch(n){try{await this.fileService.del(s)}catch{}throw n}try{await pe.rename(s.fsPath,i.fsPath,120*1e3)}catch(n){try{await this.fileService.del(s)}catch{}let o=!1;try{o=await this.fileService.exists(i)}catch{}if(o)this.logService.info("Rename failed because the file was downloaded by another source. So ignoring renaming.",e.identifier.id,i.path);else throw this.logService.info(`Rename failed because of ${H(n)}. Deleted the file from downloaded location`,s.path),n}}async doDownload(e,i,r,s){let n=1;for(;;)try{return await r(),n}catch(o){if(n++>s)throw o;this.logService.warn(`Failed downloading ${i}. ${H(o)}. Retry again...`,e.identifier.id)}}async validate(e,i){try{await _f(e,i)}catch(r){throw rl(r)}}async delete(e){await this.cleanUpPromise;const i=this.uriIdentityService.extUri.relativePath(this.extensionsDownloadDir,e);i?await this.fileService.move(e,this.uriIdentityService.extUri.joinPath(this.extensionsTrashDir,i),!0):await this.fileService.del(e)}async cleanUp(){try{if(!await this.fileService.exists(this.extensionsDownloadDir)){this.logService.trace("Extension VSIX downloads cache dir does not exist");return}try{await this.fileService.del(this.extensionsTrashDir,{recursive:!0})}catch(i){Ue(i)!==1&&this.logService.error(i)}const e=await this.fileService.resolve(this.extensionsDownloadDir,{resolveMetadata:!0});if(e.children){const i=[],r=[],s=[];for(const a of e.children)if(a.name.endsWith($n.SignatureArchiveExtension))s.push(a.resource);else{const l=gt.parse(a.name);l&&r.push([l,a])}const n=Vh(r,([a])=>a),o=[];for(const a of n)a.sort((l,c)=>qh(l[0].version,c[0].version)),i.push(...a.slice(1).map(l=>l[1].resource)),o.push(a[0][1]);o.sort((a,l)=>a.mtime-l.mtime),i.push(...o.slice(0,Math.max(0,o.length-this.cache)).map(a=>a.resource)),i.push(...s),await ht.settled(i.map(a=>(this.logService.trace("Deleting from cache",a.path),this.fileService.del(a))))}}catch(e){this.logService.error(e)}}getName(e){return gt.create(e).toString().toLowerCase()}};nl=$n=__decorate([__param(0,Pt),__param(1,Pe),__param(2,bi),__param(3,af),__param(4,jt),__param(5,qe),__param(6,he)],nl);import{fork as y4}from"child_process";var ol=class extends K{constructor(e,i){super(),this.userDataProfilesService=e,this.logService=i,this.processesLimiter=new hu(5)}async postUninstall(e){const i=this.parseScript(e,"uninstall");i&&(this.logService.info(e.identifier.id,e.manifest.version,"Running post uninstall script"),await this.processesLimiter.queue(async()=>{try{await this.runLifecycleHook(i.script,"uninstall",i.args,!0,e),this.logService.info("Finished running post uninstall script",e.identifier.id,e.manifest.version)}catch(r){this.logService.error("Failed to run post uninstall script",e.identifier.id,e.manifest.version),this.logService.error(r)}}));try{await pe.rm(this.getExtensionStoragePath(e))}catch(r){this.logService.error("Error while removing extension storage path",e.identifier.id),this.logService.error(r)}}parseScript(e,i){const r=`vscode:${i}`;if(e.location.scheme===ie.file&&e.manifest&&e.manifest.scripts&&typeof e.manifest.scripts[r]=="string"){const s=e.manifest.scripts[r].split(" ");return s.length<2||s[0]!=="node"||!s[1]?(this.logService.warn(e.identifier.id,e.manifest.version,`${r} should be a node script`),null):{script:G(e.location.fsPath,s[1]),args:s.slice(2)||[]}}return null}runLifecycleHook(e,i,r,s,n){return new Promise((o,a)=>{const l=this.start(e,i,r,n);let c;const h=f=>{c&&(clearTimeout(c),c=null),f?a(f):o(void 0)};l.on("error",f=>{h(Ui(f)||"Unknown")}),l.on("exit",(f,d)=>{h(f?`post-${i} process exited with code ${f}`:void 0)}),s&&(c=setTimeout(()=>{c=null,l.kill(),a("timed out")},5e3))})}start(e,i,r,s){const n={silent:!0,execArgv:void 0},o=y4(e,[`--type=extension-post-${i}`,...r],n);o.stdout.setEncoding("utf8"),o.stderr.setEncoding("utf8");const a=ae.fromNodeEventEmitter(o.stdout,"data"),l=ae.fromNodeEventEmitter(o.stderr,"data");this._register(a(f=>this.logService.info(s.identifier.id,s.manifest.version,`post-${i}`,f))),this._register(l(f=>this.logService.error(s.identifier.id,s.manifest.version,`post-${i}`,f)));const c=ae.any(ae.map(a,f=>({data:`%c${f}`,format:[""]}),this._store),ae.map(l,f=>({data:`%c${f}`,format:["color: red"]}),this._store));return ae.debounce(c,(f,d)=>f?{data:f.data+d.data,format:[...f.format,...d.format]}:{data:d.data,format:d.format},100,void 0,void 0,void 0,this._store)(f=>{console.group(s.identifier.id),console.log(f.data,...f.format),console.groupEnd()}),o}getExtensionStoragePath(e){return G(this.userDataProfilesService.defaultProfile.globalStorageHome.fsPath,e.identifier.id.toLowerCase())}};ol=__decorate([__param(0,Ot),__param(1,he)],ol);var w4=class extends K{constructor(t,e,i,r,s){super(),this.userDataProfilesService=t,this.fileService=e,this.uriIdentityService=i,this.logService=s,this._register(r.onDidInstallExtensions(n=>this.onDidInstallExtensions(n))),this._register(r.onDidUninstallExtension(n=>this.onDidUnInstallExtension(n)))}onDidInstallExtensions(t){for(const e of t)e.local&&this.invalidate(e.profileLocation)}onDidUnInstallExtension(t){t.error||this.invalidate(t.profileLocation)}async invalidate(t){if(t)for(const e of this.userDataProfilesService.profiles)this.uriIdentityService.extUri.isEqual(e.extensionsResource,t)&&await this.deleteUserCacheFile(e);else await this.deleteUserCacheFile(this.userDataProfilesService.defaultProfile)}async deleteUserCacheFile(t){try{await this.fileService.del(this.uriIdentityService.extUri.joinPath(t.cacheHome,kh))}catch(e){Ue(e)!==1&&this.logService.error(e)}}},S4=class extends K{constructor(t,e,i,r,s,n,o){super(),this.extensionManagementService=t,this.extensionsScannerService=e,this.userDataProfilesService=i,this.extensionsProfileScannerService=r,this.uriIdentityService=s,this.fileService=n,this.logService=o,this._onDidChangeExtensionsByAnotherSource=this._register(new O),this.onDidChangeExtensionsByAnotherSource=this._onDidChangeExtensionsByAnotherSource.event,this.allExtensions=new Map,this.extensionsProfileWatchDisposables=this._register(new po),this.initialize().then(null,a=>o.error("Error while initializing Extensions Watcher",H(a)))}async initialize(){await this.extensionsScannerService.initializeDefaultProfileExtensions(),await this.onDidChangeProfiles(this.userDataProfilesService.profiles),this.registerListeners(),await this.deleteExtensionsNotInProfiles()}registerListeners(){this._register(this.userDataProfilesService.onDidChangeProfiles(t=>this.onDidChangeProfiles(t.added))),this._register(this.extensionsProfileScannerService.onAddExtensions(t=>this.onAddExtensions(t))),this._register(this.extensionsProfileScannerService.onDidAddExtensions(t=>this.onDidAddExtensions(t))),this._register(this.extensionsProfileScannerService.onRemoveExtensions(t=>this.onRemoveExtensions(t))),this._register(this.extensionsProfileScannerService.onDidRemoveExtensions(t=>this.onDidRemoveExtensions(t))),this._register(this.fileService.onDidFilesChange(t=>this.onDidFilesChange(t)))}async onDidChangeProfiles(t){try{t.length&&await Promise.all(t.map(e=>(this.extensionsProfileWatchDisposables.set(e.id,mc(this.fileService.watch(this.uriIdentityService.extUri.dirname(e.extensionsResource)),this.fileService.watch(e.extensionsResource))),this.populateExtensionsFromProfile(e.extensionsResource))))}catch(e){throw this.logService.error(e),e}}async onAddExtensions(t){for(const e of t.extensions)this.addExtensionWithKey(this.getKey(e.identifier,e.version),t.profileLocation)}async onDidAddExtensions(t){for(const e of t.extensions){const i=this.getKey(e.identifier,e.version);t.error?this.removeExtensionWithKey(i,t.profileLocation):this.addExtensionWithKey(i,t.profileLocation)}}async onRemoveExtensions(t){for(const e of t.extensions)this.removeExtensionWithKey(this.getKey(e.identifier,e.version),t.profileLocation)}async onDidRemoveExtensions(t){const e=[],i=[];for(const r of t.extensions){const s=this.getKey(r.identifier,r.version);t.error?this.addExtensionWithKey(s,t.profileLocation):(this.removeExtensionWithKey(s,t.profileLocation),this.allExtensions.has(s)||(this.logService.debug("Extension is removed from all profiles",r.identifier.id,r.version),i.push(this.extensionManagementService.scanInstalledExtensionAtLocation(r.location).then(n=>{n?e.push(n):this.logService.info("Extension not found at the location",r.location.toString())},n=>this.logService.error(n)))))}try{await Promise.all(i),e.length&&await this.deleteExtensionsNotInProfiles(e)}catch(r){this.logService.error(r)}}onDidFilesChange(t){for(const e of this.userDataProfilesService.profiles)t.contains(e.extensionsResource,0,1)&&this.onDidExtensionsProfileChange(e.extensionsResource)}async onDidExtensionsProfileChange(t){const e=[],i=[],r=await this.extensionsProfileScannerService.scanProfileExtensions(t),s=new Set,n=new Set;for(const[o,a]of this.allExtensions)a.has(t)&&n.add(o);for(const o of r){const a=this.getKey(o.identifier,o.version);s.add(a),n.has(a)||(e.push(o.identifier),this.addExtensionWithKey(a,t))}for(const o of n)if(!s.has(o)){const a=this.fromKey(o);a&&(i.push(a.identifier),this.removeExtensionWithKey(o,t))}(e.length||i.length)&&this._onDidChangeExtensionsByAnotherSource.fire({added:e.length?{extensions:e,profileLocation:t}:void 0,removed:i.length?{extensions:i,profileLocation:t}:void 0})}async populateExtensionsFromProfile(t){const e=await this.extensionsProfileScannerService.scanProfileExtensions(t);for(const i of e)this.addExtensionWithKey(this.getKey(i.identifier,i.version),t)}async deleteExtensionsNotInProfiles(t){t||(t=(await this.extensionManagementService.scanAllUserInstalledExtensions()).filter(i=>!this.allExtensions.has(this.getKey(i.identifier,i.manifest.version)))),t.length&&await this.extensionManagementService.deleteExtensions(...t)}addExtensionWithKey(t,e){let i=this.allExtensions.get(t);i||this.allExtensions.set(t,i=new ho(r=>this.uriIdentityService.extUri.getComparisonKey(r))),i.add(e)}removeExtensionWithKey(t,e){const i=this.allExtensions.get(t);i&&i.delete(e),i?.size||this.allExtensions.delete(t)}getKey(t,e){return`${br.toKey(t.id)}@${e}`}fromKey(t){const[e,i]=ba(t);return i?{identifier:{id:e},version:i}:void 0}},b4=ma,al=".vsctmp",ll=class extends tl{constructor(e,i,r,s,n,o,a,l,c,h,f,d,p,v,m){super(e,i,v,r,d,p,m),this.environmentService=s,this.extensionsScannerService=n,this.extensionsProfileScannerService=o,this.downloadService=a,this.instantiationService=l,this.fileService=c,this.configurationService=h,this.extensionGalleryManifestService=f,this.extractingGalleryExtensions=new Map,this.knownDirectories=new ho;const w=this._register(l.createInstance(ol));this.extensionsScanner=this._register(l.createInstance(cl,_=>w.postUninstall(_))),this.manifestCache=this._register(new w4(m,c,v,this,this.logService)),this.extensionsDownloader=this._register(l.createInstance(nl));const S=this._register(new S4(this,this.extensionsScannerService,m,o,v,c,r));this._register(S.onDidChangeExtensionsByAnotherSource(_=>this.onDidChangeExtensionsFromAnotherSource(_))),this.watchForExtensionsNotInstalledBySystem()}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=Wh(this.fileService,this.logService)),this._targetPlatformPromise}async zip(e){this.logService.trace("ExtensionManagementService#zip",e.identifier.id);const i=await this.collectFiles(e),r=await t4(j(this.extensionsDownloader.extensionsDownloadDir,pt()).fsPath,i);return I.file(r)}async getManifest(e){const{location:i,cleanup:r}=await this.downloadVsix(e),s=Oi(i.fsPath);try{return await sl(s)}finally{await r()}}getInstalled(e,i=this.userDataProfilesService.defaultProfile.extensionsResource,r={version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion}){return this.extensionsScanner.scanExtensions(e??null,i,r)}scanAllUserInstalledExtensions(){return this.extensionsScanner.scanAllUserExtensions()}scanInstalledExtensionAtLocation(e){return this.extensionsScanner.scanUserExtensionAtLocation(e)}async install(e,i={}){this.logService.trace("ExtensionManagementService#install",e.toString());const{location:r,cleanup:s}=await this.downloadVsix(e);try{const n=await sl(Oi(r.fsPath)),o=wt(n.publisher,n.name);if(o!=="typescriptteam.native-preview"){if(n.engines&&n.engines.vscode&&!ls(n.engines.vscode,this.productService.vscodeVersion,this.productService.date))throw new Error(g(1972,null,o,this.productService.vscodeVersion))}const a=this.allowedExtensionsService.isAllowed({id:o,version:n.version,publisherDisplayName:void 0});if(a!==!0)throw new Error(g(1973,null,a.value));const c=(await this.installExtensions([{manifest:n,extension:r,options:i}])).find(({identifier:h})=>J(h,{id:o}));if(c?.local)return c.local;throw c?.error?c.error:Ie(new Error(`Unknown error while installing extension ${o}`))}finally{await s()}}async installFromLocation(e,i){this.logService.trace("ExtensionManagementService#installFromLocation",e.toString());const r=await this.extensionsScanner.scanUserExtensionAtLocation(e);if(!r||!r.manifest.name||!r.manifest.version)throw new Error(`Cannot find a valid extension from the location ${e.toString()}`);return await this.addExtensionsToProfile([[r,{source:"resource"}]],i),this.logService.info("Successfully installed extension",r.identifier.id,i.toString()),r}async installExtensionsFromProfile(e,i,r){this.logService.trace("ExtensionManagementService#installExtensionsFromProfile",e,i.toString(),r.toString());const s=(await this.getInstalled(1,i)).filter(n=>e.some(o=>J(o,n.identifier)));if(s.length){const n=await Promise.all(s.map(o=>this.extensionsScanner.scanMetadata(o,i)));await this.addExtensionsToProfile(s.map((o,a)=>[o,n[a]]),r),this.logService.info("Successfully installed extensions",s.map(o=>o.identifier.id),r.toString())}return s}async updateMetadata(e,i,r){return this.logService.trace("ExtensionManagementService#updateMetadata",e.identifier.id),i.isPreReleaseVersion&&(i.preRelease=!0,i.hasPreReleaseVersion=!0),i.isMachineScoped===!1&&(i.isMachineScoped=void 0),i.isBuiltin===!1&&(i.isBuiltin=void 0),i.pinned===!1&&(i.pinned=void 0),e=await this.extensionsScanner.updateMetadata(e,i,r),this.manifestCache.invalidate(r),this._onDidUpdateExtensionMetadata.fire({local:e,profileLocation:r}),e}removeExtension(e){return this.extensionsScanner.deleteExtension(e,"remove")}copyExtension(e,i,r,s){return this.extensionsScanner.copyExtension(e,i,r,s)}copyExtensions(e,i){return this.extensionsScanner.copyExtensions(e,i,{version:this.productService.version,date:this.productService.date,vscodeVersion:this.productService.vscodeVersion})}deleteExtensions(...e){return this.extensionsScanner.setExtensionsForRemoval(...e)}async cleanUp(){this.logService.trace("ExtensionManagementService#cleanUp");try{await this.extensionsScanner.cleanUp()}catch(e){this.logService.error(e)}}async download(e,i,r){const{location:s}=await this.downloadExtension(e,i,!r);return s}async downloadVsix(e){if(e.scheme===ie.file)return{location:e,async cleanup(){}};this.logService.trace("Downloading extension from",e.toString());const i=j(this.extensionsDownloader.extensionsDownloadDir,pt());return await this.downloadService.download(e,i),this.logService.info("Downloaded extension to",i.toString()),{location:i,cleanup:async()=>{try{await this.fileService.del(i)}catch(s){this.logService.error(s)}}}}getCurrentExtensionsManifestLocation(){return this.userDataProfilesService.defaultProfile.extensionsResource}createInstallExtensionTask(e,i,r){const s=i instanceof I?new gt({id:wt(e.publisher,e.name)},e.version):gt.create(i);return this.instantiationService.createInstance(ul,s,e,i,r,(n,o)=>{if(i instanceof I)return this.extractVSIX(s,i,r,o);let a=this.extractingGalleryExtensions.get(s.toString());return a||(this.extractingGalleryExtensions.set(s.toString(),a=this.downloadAndExtractGalleryExtension(s,i,n,r,o)),a.finally(()=>this.extractingGalleryExtensions.delete(s.toString()))),a},this.extensionsScanner)}createUninstallExtensionTask(e,i){return new E4(e,i,this.extensionsProfileScannerService)}async downloadAndExtractGalleryExtension(e,i,r,s,n){const{verificationStatus:o,location:a}=await this.downloadExtension(i,r,!s.donotVerifySignature,s.context?.[am]);try{if(n.isCancellationRequested)throw new Te;const l=await sl(a.fsPath);if(!new gt(i.identifier,i.version).equals(new gt({id:wt(l.publisher,l.name)},l.version)))throw new we(g(1974,null,i.identifier.id),"Invalid");const c=await this.extensionsScanner.extractUserExtension(e,a.fsPath,!1,n);if(o!==Oe.Success&&this.environmentService.isBuilt)try{await this.extensionsDownloader.delete(a)}catch(h){this.logService.warn("Error while deleting the downloaded file",a.toString(),H(h))}return{local:c,verificationStatus:o}}catch(l){try{await this.extensionsDownloader.delete(a)}catch(c){this.logService.warn("Error while deleting the downloaded file",a.toString(),H(c))}throw Ie(l)}}async downloadExtension(e,i,r,s){r&&(r=!1);const{location:n,verificationStatus:o}=await this.extensionsDownloader.download(e,i,r,s),a=(await this.extensionGalleryManifestService.getExtensionGalleryManifest())?.capabilities.signing?.allRepositorySigned;if(o!==Oe.Success&&!(o===Oe.NotSigned&&!a)&&r&&this.environmentService.isBuilt&&!(et&&this.productService.quality==="stable")){try{await this.extensionsDownloader.delete(n)}catch(l){this.logService.warn("Error while deleting the downloaded file",n.toString(),H(l))}if(!o)throw new we(g(1975,null),"SignatureVerificationInternal");switch(o){case Oe.PackageIntegrityCheckFailed:case Oe.SignatureIsInvalid:case Oe.SignatureManifestIsInvalid:case Oe.SignatureIntegrityCheckFailed:case Oe.EntryIsMissing:case Oe.EntryIsTampered:case Oe.Untrusted:case Oe.CertificateRevoked:case Oe.SignatureIsNotValid:case Oe.SignatureArchiveHasTooManyEntries:case Oe.NotSigned:throw new we(g(1976,null,o),"SignatureVerificationFailed")}throw new we(g(1977,null,o),"SignatureVerificationInternal")}return{location:n,verificationStatus:o}}async extractVSIX(e,i,r,s){return{local:await this.extensionsScanner.extractUserExtension(e,Oi(i.fsPath),Dt(r.keepExisting)?!r.keepExisting:!0,s)}}async collectFiles(e){const i=async s=>{let n=await pe.readdir(s);n=n.map(l=>G(s,l));const o=await Promise.all(n.map(l=>Ov.promises.stat(l)));let a=Promise.resolve([]);return o.forEach((l,c)=>{const h=n[c];l.isFile()&&(a=a.then(f=>[...f,h])),l.isDirectory()&&(a=a.then(f=>i(h).then(d=>[...f,...d])))}),a};return(await i(e.location.fsPath)).map(s=>({path:`extension/${Wc(e.location.fsPath,s)}`,localPath:s}))}async onDidChangeExtensionsFromAnotherSource({added:e,removed:i}){if(i){const r=e&&this.uriIdentityService.extUri.isEqual(i.profileLocation,e.profileLocation)?i.extensions.filter(s=>e.extensions.every(n=>!J(n,s))):i.extensions;for(const s of r)this.logService.info("Extensions removed from another source",s.id,i.profileLocation.toString()),this._onDidUninstallExtension.fire({identifier:s,profileLocation:i.profileLocation})}if(e){const s=(await this.getInstalled(1,e.profileLocation)).filter(n=>e.extensions.some(o=>J(o,n.identifier)));this._onDidInstallExtensions.fire(s.map(n=>(this.logService.info("Extensions added from another source",n.identifier.id,e.profileLocation.toString()),{identifier:n.identifier,local:n,profileLocation:e.profileLocation,operation:1})))}}async watchForExtensionsNotInstalledBySystem(){this._register(this.extensionsScanner.onExtract(i=>this.knownDirectories.add(i)));const e=await this.fileService.resolve(this.extensionsScannerService.userExtensionsLocation);for(const i of e.children??[])i.isDirectory&&this.knownDirectories.add(i.resource);this._register(this.fileService.watch(this.extensionsScannerService.userExtensionsLocation)),this._register(this.fileService.onDidFilesChange(i=>this.onDidFilesChange(i)))}async onDidFilesChange(e){if(!e.affects(this.extensionsScannerService.userExtensionsLocation,1))return;const i=[];for(const r of e.rawAdded){if(this.knownDirectories.has(r)||!this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(r),this.extensionsScannerService.userExtensionsLocation)||this.uriIdentityService.extUri.isEqual(r,this.uriIdentityService.extUri.joinPath(this.extensionsScannerService.userExtensionsLocation,".obsolete"))||this.uriIdentityService.extUri.basename(r).startsWith(".")||this.uriIdentityService.extUri.basename(r).endsWith(al))continue;try{if(!(await this.fileService.stat(r)).isDirectory)continue}catch(n){Ue(n)!==1&&this.logService.error(n);continue}const s=await this.extensionsScanner.scanUserExtensionAtLocation(r);s&&s.installedTimestamp===void 0&&(this.knownDirectories.add(r),i.push(s))}i.length&&(await this.addExtensionsToProfile(i.map(r=>[r,void 0]),this.userDataProfilesService.defaultProfile.extensionsResource),this.logService.info("Added extensions to default profile from external source",i.map(r=>r.identifier.id)))}async addExtensionsToProfile(e,i){const r=e.map(s=>s[0]);await this.extensionsScanner.unsetExtensionsForRemoval(...r.map(s=>gt.create(s))),await this.extensionsProfileScannerService.addExtensionsToProfile(e,i),this._onDidInstallExtensions.fire(r.map(s=>({local:s,identifier:s.identifier,operation:1,profileLocation:i})))}};ll=__decorate([__param(0,bi),__param(1,jt),__param(2,he),__param(3,Pt),__param(4,Fn),__param(5,Ei),__param(6,Xu),__param(7,nn),__param(8,Pe),__param(9,ni),__param(10,us),__param(11,mt),__param(12,Bi),__param(13,qe),__param(14,Ot)],ll);var cl=class extends K{constructor(e,i,r,s,n,o,a){super(),this.beforeRemovingExtension=e,this.fileService=i,this.extensionsScannerService=r,this.extensionsProfileScannerService=s,this.uriIdentityService=n,this.telemetryService=o,this.logService=a,this._onExtract=this._register(new O),this.onExtract=this._onExtract.event,this.scanAllExtensionPromise=new Ge,this.scanUserExtensionsPromise=new Ge,this.obsoletedResource=j(this.extensionsScannerService.userExtensionsLocation,".obsolete"),this.obsoleteFileLimiter=new Hr}async cleanUp(){await this.removeTemporarilyDeletedFolders(),await this.deleteExtensionsMarkedForRemoval(),await this.initializeExtensionSize()}async scanExtensions(e,i,r){try{const s={includeInvalid:!0,profileLocation:i,productVersion:r};let n=[];if(e===null||e===0){let o=this.scanAllExtensionPromise.get(i);o||(o=this.extensionsScannerService.scanAllExtensions({},s).finally(()=>this.scanAllExtensionPromise.delete(i)),this.scanAllExtensionPromise.set(i,o)),n.push(...await o)}else if(e===1){let o=this.scanUserExtensionsPromise.get(i);o||(o=this.extensionsScannerService.scanUserExtensions(s).finally(()=>this.scanUserExtensionsPromise.delete(i)),this.scanUserExtensionsPromise.set(i,o)),n.push(...await o)}return n=e!==null?n.filter(o=>o.type===e):n,await Promise.all(n.map(o=>this.toLocalExtension(o)))}catch(s){throw Ie(s,"Scanning")}}async scanAllUserExtensions(){try{const e=await this.extensionsScannerService.scanAllUserExtensions();return await Promise.all(e.map(i=>this.toLocalExtension(i)))}catch(e){throw Ie(e,"Scanning")}}async scanUserExtensionAtLocation(e){try{const i=await this.extensionsScannerService.scanExistingExtension(e,1,{includeInvalid:!0});if(i)return await this.toLocalExtension(i)}catch(i){this.logService.error(i)}return null}async extractUserExtension(e,i,r,s){const n=e.toString(),o=I.file(G(this.extensionsScannerService.userExtensionsLocation.fsPath,`.${pt()}`)),a=I.file(G(this.extensionsScannerService.userExtensionsLocation.fsPath,n));if(await this.fileService.exists(a)){if(!r)try{return await this.scanLocalExtension(a,1)}catch(l){this.logService.warn(`Error while scanning the existing extension at ${a.path}. Deleting the existing extension and extracting it.`,H(l))}try{await this.deleteExtensionFromLocation(e.id,a,"removeExisting")}catch{throw new we(g(1978,null,a.fsPath,e.id),"Delete")}}try{if(s.isCancellationRequested)throw new Te;try{this.logService.trace(`Started extracting the extension from ${i} to ${a.fsPath}`),await i4(i,o.fsPath,{sourcePath:"extension",overwrite:!0},s),this.logService.info(`Extracted extension to ${a}:`,e.id)}catch(c){throw rl(c)}const l={installedTimestamp:Date.now(),targetPlatform:e.targetPlatform};try{l.size=await va(o,this.fileService)}catch(c){this.logService.warn(`Error while getting the size of the extracted extension : ${o.fsPath}`,H(c))}try{await this.extensionsScannerService.updateManifestMetadata(o,l)}catch(c){throw this.telemetryService.publicLog2("extension:extract",{extensionId:e.id,code:`${Ue(c)}`}),Ie(c,"UpdateMetadata")}if(s.isCancellationRequested)throw new Te;try{this.logService.trace(`Started renaming the extension from ${o.fsPath} to ${a.fsPath}`),await this.rename(o.fsPath,a.fsPath),this.logService.info("Renamed to",a.fsPath)}catch(c){if(c.code==="ENOTEMPTY"){this.logService.info("Rename failed because extension was installed by another source. So ignoring renaming.",e.id);try{await this.fileService.del(o,{recursive:!0})}catch{}}else throw this.logService.info(`Rename failed because of ${H(c)}. Deleted from extracted location`,o),c}this._onExtract.fire(a)}catch(l){try{await this.fileService.del(o,{recursive:!0})}catch{}throw l}return this.scanLocalExtension(a,1)}async scanMetadata(e,i){return(await this.getScannedExtension(e,i))?.metadata}async getScannedExtension(e,i){return(await this.extensionsProfileScannerService.scanProfileExtensions(i)).find(s=>J(s.identifier,e.identifier))}async updateMetadata(e,i,r){try{await this.extensionsProfileScannerService.updateMetadata([[e,i]],r)}catch(s){throw this.telemetryService.publicLog2("extension:extract",{extensionId:e.identifier.id,code:`${Ue(s)}`,isProfile:!!r}),Ie(s,"UpdateMetadata")}return this.scanLocalExtension(e.location,e.type,r)}async setExtensionsForRemoval(...e){const i=[];for(const s of e)await this.fileService.exists(s.location)&&i.push(s);const r=i.map(s=>gt.create(s));await this.withRemovedExtensions(s=>r.forEach(n=>{s[n.toString()]=!0,this.logService.info("Marked extension as removed",n.toString())}))}async unsetExtensionsForRemoval(...e){try{const i=[];return await this.withRemovedExtensions(r=>e.forEach(s=>{r[s.toString()]?(i.push(!0),delete r[s.toString()]):i.push(!1)})),i}catch(i){throw Ie(i,"UnsetRemoved")}}async deleteExtension(e,i){this.uriIdentityService.extUri.isEqualOrParent(e.location,this.extensionsScannerService.userExtensionsLocation)&&(await this.deleteExtensionFromLocation(e.identifier.id,e.location,i),await this.unsetExtensionsForRemoval(gt.create(e)))}async copyExtension(e,i,r,s){const n=await this.getScannedExtension(e,i),o=await this.getScannedExtension(e,r);if(s={...n?.metadata,...s},o)if(this.uriIdentityService.extUri.isEqual(o.location,e.location))await this.extensionsProfileScannerService.updateMetadata([[e,{...o.metadata,...s}]],r);else{const a=await this.scanLocalExtension(o.location,e.type,r);await this.extensionsProfileScannerService.removeExtensionsFromProfile([a.identifier],r),await this.extensionsProfileScannerService.addExtensionsToProfile([[e,{...o.metadata,...s}]],r)}else await this.extensionsProfileScannerService.addExtensionsToProfile([[e,s]],r);return this.scanLocalExtension(e.location,e.type,r)}async copyExtensions(e,i,r){const s=await this.scanExtensions(1,e,r),n=await Promise.all(s.filter(o=>!o.isApplicationScoped).map(async o=>[o,await this.scanMetadata(o,e)]));await this.extensionsProfileScannerService.addExtensionsToProfile(n,i)}async deleteExtensionFromLocation(e,i,r){this.logService.trace(`Deleting ${r} extension from disk`,e,i.fsPath);const s=this.uriIdentityService.extUri.joinPath(this.uriIdentityService.extUri.dirname(i),`${this.uriIdentityService.extUri.basename(i)}.${dr(pt()).toString(16)}${al}`);await this.rename(i.fsPath,s.fsPath),await this.fileService.del(s,{recursive:!0}),this.logService.info(`Deleted ${r} extension from disk`,e,i.fsPath)}withRemovedExtensions(e){return this.obsoleteFileLimiter.queue(async()=>{let i;try{i=(await this.fileService.readFile(this.obsoletedResource,"utf8")).value.toString()}catch(s){if(Ue(s)!==1)throw s}let r={};if(i)try{r=JSON.parse(i)}catch{}if(e)if(e(r),Object.keys(r).length)await this.fileService.writeFile(this.obsoletedResource,W.fromString(JSON.stringify(r)));else try{await this.fileService.del(this.obsoletedResource)}catch(s){if(Ue(s)!==1)throw s}return r})}async rename(e,i){try{await pe.rename(e,i,120*1e3)}catch(r){throw Ie(r,"Rename")}}async scanLocalExtension(e,i,r){try{if(r){const n=(await this.extensionsScannerService.scanUserExtensions({profileLocation:r})).find(o=>this.uriIdentityService.extUri.isEqual(o.location,e));if(n)return await this.toLocalExtension(n)}else{const s=await this.extensionsScannerService.scanExistingExtension(e,i,{includeInvalid:!0});if(s)return await this.toLocalExtension(s)}throw new we(g(1979,null,e.path),"ScanningExtension")}catch(s){throw Ie(s,"ScanningExtension")}}async toLocalExtension(e){let i;try{i=await this.fileService.resolve(e.location)}catch{}let r,s;return i?.children&&(r=i.children.find(({name:n})=>/^readme(\.txt|\.md|)$/i.test(n))?.resource,s=i.children.find(({name:n})=>/^changelog(\.txt|\.md|)$/i.test(n))?.resource),{identifier:e.identifier,type:e.type,isBuiltin:e.isBuiltin||!!e.metadata?.isBuiltin,location:e.location,manifest:e.manifest,targetPlatform:e.targetPlatform,validations:e.validations,isValid:e.isValid,readmeUrl:r,changelogUrl:s,publisherDisplayName:e.metadata?.publisherDisplayName,publisherId:e.metadata?.publisherId||null,isApplicationScoped:!!e.metadata?.isApplicationScoped,isMachineScoped:!!e.metadata?.isMachineScoped,isPreReleaseVersion:!!e.metadata?.isPreReleaseVersion,hasPreReleaseVersion:!!e.metadata?.hasPreReleaseVersion,preRelease:e.preRelease,installedTimestamp:e.metadata?.installedTimestamp,updated:!!e.metadata?.updated,pinned:!!e.metadata?.pinned,private:!!e.metadata?.private,isWorkspaceScoped:!1,source:e.metadata?.source??(e.identifier.uuid?"gallery":"vsix"),size:e.metadata?.size??0}}async initializeExtensionSize(){const e=await this.extensionsScannerService.scanAllUserExtensions();await Promise.all(e.map(async i=>{if(fc(i.metadata?.installedTimestamp)&&Et(i.metadata?.size)){const r=await va(i.location,this.fileService);await this.extensionsScannerService.updateManifestMetadata(i.location,{size:r})}}))}async deleteExtensionsMarkedForRemoval(){let e;try{e=await this.withRemovedExtensions()}catch(n){throw Ie(n,"ReadRemoved")}if(Object.keys(e).length===0){this.logService.debug("No extensions are marked as removed.");return}this.logService.debug("Deleting extensions marked as removed:",Object.keys(e));const i=await this.scanAllUserExtensions(),r=new Set;for(const n of i)e[gt.create(n).toString()]||r.add(n.identifier.id.toLowerCase());try{const n=Vh(i,o=>o.identifier);await ht.settled(n.map(async o=>{const a=o.sort((l,c)=>qh(l.manifest.version,c.manifest.version))[0];r.has(a.identifier.id.toLowerCase())||await this.beforeRemovingExtension(a)}))}catch(n){this.logService.error(n)}const s=i.filter(n=>n.installedTimestamp&&e[gt.create(n).toString()]);await Promise.allSettled(s.map(n=>this.deleteExtension(n,"marked for removal")))}async removeTemporarilyDeletedFolders(){this.logService.trace("ExtensionManagementService#removeTempDeleteFolders");let e;try{e=await this.fileService.resolve(this.extensionsScannerService.userExtensionsLocation)}catch(i){Ue(i)!==1&&this.logService.error(i);return}if(e?.children)try{await Promise.allSettled(e.children.map(async i=>{if(!(!i.isDirectory||!i.name.endsWith(al))){this.logService.trace("Deleting the temporarily deleted folder",i.resource.toString());try{await this.fileService.del(i.resource,{recursive:!0}),this.logService.trace("Deleted the temporarily deleted folder",i.resource.toString())}catch(r){Ue(r)!==1&&this.logService.error(r)}}}))}catch{}}};cl=__decorate([__param(1,Pe),__param(2,Fn),__param(3,Ei),__param(4,qe),__param(5,jt),__param(6,he)],cl);var ul=class extends Vf{get operation(){return this.options.operation??this._operation}get verificationStatus(){return this._verificationStatus}constructor(e,i,r,s,n,o,a,l,c,h,f,d){super(),this.extensionKey=e,this.manifest=i,this.source=r,this.options=s,this.extractExtensionFn=n,this.extensionsScanner=o,this.uriIdentityService=a,this.galleryService=l,this.userDataProfilesService=c,this.extensionsScannerService=h,this.extensionsProfileScannerService=f,this.logService=d,this._operation=2,this.identifier=this.extensionKey.identifier}async doRun(e){const r=(await this.extensionsScanner.scanExtensions(1,this.options.profileLocation,this.options.productVersion)).find(a=>J(a.identifier,this.identifier));r&&(this._operation=3);const s={isApplicationScoped:this.options.isApplicationScoped||r?.isApplicationScoped,isMachineScoped:this.options.isMachineScoped||r?.isMachineScoped,isBuiltin:this.options.isBuiltin||r?.isBuiltin,isSystem:r?.type===0?!0:void 0,installedTimestamp:Date.now(),pinned:this.options.installGivenVersion?!0:this.options.pinned??r?.pinned,source:this.source instanceof I?"vsix":"gallery"};let n;if(this.source instanceof I){if(r&&this.extensionKey.equals(new gt(r.identifier,r.manifest.version)))try{await this.extensionsScanner.deleteExtension(r,"existing")}catch{throw new Error(g(1980,null,this.manifest.displayName||this.manifest.name))}const a=await this.unsetIfRemoved(this.extensionKey);if(a)try{await this.extensionsScanner.deleteExtension(a,"existing")}catch{throw new Error(g(1981,null,this.manifest.displayName||this.manifest.name))}}else{if(s.id=this.source.identifier.uuid,s.publisherId=this.source.publisherId,s.publisherDisplayName=this.source.publisherDisplayName,s.targetPlatform=this.source.properties.targetPlatform,s.updated=!!r,s.private=this.source.private,s.isPreReleaseVersion=this.source.properties.isPreReleaseVersion,s.hasPreReleaseVersion=r?.hasPreReleaseVersion||this.source.properties.isPreReleaseVersion,s.preRelease=Dt(this.options.preRelease)?this.options.preRelease:this.options.installPreReleaseVersion||this.source.properties.isPreReleaseVersion||r?.preRelease,r&&r.type!==0&&r.manifest.version===this.source.version&&!(!["undefined","web"].includes(r.targetPlatform)&&this.source.properties.targetPlatform!=="web"&&r.targetPlatform!==this.source.properties.targetPlatform))return this.extensionsScanner.updateMetadata(r,s,this.options.profileLocation);n=await this.unsetIfRemoved(this.extensionKey)}if(e.isCancellationRequested)throw Ie(new Te);if(!n){const a=await this.extractExtensionFn(this.operation,e);n=a.local,this._verificationStatus=a.verificationStatus}if(this.uriIdentityService.extUri.isEqual(this.userDataProfilesService.defaultProfile.extensionsResource,this.options.profileLocation))try{await this.extensionsScannerService.initializeDefaultProfileExtensions()}catch(a){throw Ie(a,"IntializeDefaultProfile")}if(e.isCancellationRequested)throw Ie(new Te);try{await this.extensionsProfileScannerService.addExtensionsToProfile([[n,s]],this.options.profileLocation,!n.isValid)}catch(a){throw Ie(a,"AddToProfile")}const o=await this.extensionsScanner.scanLocalExtension(n.location,1,this.options.profileLocation);if(!o)throw new we("Cannot find the installed extension","InstalledExtensionNotFound");return this.source instanceof I&&this.updateMetadata(n,e),o}async unsetIfRemoved(e){const[i]=await this.extensionsScanner.unsetExtensionsForRemoval(e);if(i)return this.logService.info("Removed the extension from removed list:",e.id),(await this.extensionsScanner.scanAllUserExtensions()).find(s=>gt.create(s).equals(e))}async updateMetadata(e,i){try{let[r]=await this.galleryService.getExtensions([{id:e.identifier.id,version:e.manifest.version}],i);if(r||([r]=await this.galleryService.getExtensions([{id:e.identifier.id}],i)),r){const s={id:r.identifier.uuid,publisherDisplayName:r.publisherDisplayName,publisherId:r.publisherId,isPreReleaseVersion:r.properties.isPreReleaseVersion,hasPreReleaseVersion:e.hasPreReleaseVersion||r.properties.isPreReleaseVersion,preRelease:r.properties.isPreReleaseVersion||this.options.installPreReleaseVersion};await this.extensionsScanner.updateMetadata(e,s,this.options.profileLocation)}}catch{}}};ul=__decorate([__param(6,qe),__param(7,bi),__param(8,Ot),__param(9,Fn),__param(10,Ei),__param(11,he)],ul);var E4=class extends Vf{constructor(t,e,i){super(),this.extension=t,this.options=e,this.extensionsProfileScannerService=i}doRun(t){return this.extensionsProfileScannerService.removeExtensionsFromProfile([this.extension.identifier],this.options.profileLocation)}},hl=class extends Av{constructor(e,i,r,s,n,o,a,l){super(I.file(n.builtinExtensionsPath),I.file(n.extensionsPath),n.userHome,e.defaultProfile,e,i,r,s,n,o,a,l)}};hl=__decorate([__param(0,Ot),__param(1,Ei),__param(2,Pe),__param(3,he),__param(4,Pt),__param(5,mt),__param(6,qe),__param(7,nn)],hl);async function Wf(t,e,i,r,s,n){let o;try{await _4(t,e,i,r,s,n)}catch(a){o=a}finally{o&&s.errorTransformer&&(o=s.errorTransformer(o)),typeof o<"u"&&i.error(o),i.end()}}async function _4(t,e,i,r,s,n){fl(n);const o=await t.open(e,{create:!1});try{fl(n);let a=0,l=0,c=s&&typeof s.length=="number"?s.length:void 0,h=W.alloc(Math.min(s.bufferSize,typeof c=="number"?c:s.bufferSize)),f=s&&typeof s.position=="number"?s.position:0,d=0;do l=await t.read(o,f,h.buffer,d,h.byteLength-d),f+=l,d+=l,a+=l,typeof c=="number"&&(c-=l),d===h.byteLength&&(await i.write(r(h)),h=W.alloc(Math.min(s.bufferSize,typeof c=="number"?c:s.bufferSize)),d=0);while(l>0&&(typeof c!="number"||c>0)&&fl(n)&&x4(a,s));if(d>0){let p=d;typeof c=="number"&&(p=Math.min(d,c)),i.write(r(h.slice(0,p)))}}catch(a){throw ji(a)}finally{await t.close(o)}}function fl(t){if(t.isCancellationRequested)throw tc();return!0}function x4(t,e){if(typeof e?.limits?.size=="number"&&t>e.limits.size)throw ci(g(2051,null),$.FileTooLarge);return!0}function P4(t){return(t.scheme==="file"||t.scheme==="vscode-remote")&&t.path.endsWith(".mdc")}var I4=`--- description: globs: alwaysApply: true --- `,dl,pl=class extends K{static{dl=this}constructor(e){super(),this.logService=e,this.BUFFER_SIZE=256*1024,this._onDidChangeFileSystemProviderRegistrations=this._register(new O),this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event,this._onWillActivateFileSystemProvider=this._register(new O),this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event,this._onDidChangeFileSystemProviderCapabilities=this._register(new O),this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event,this.provider=new Map,this._onDidRunOperation=this._register(new O),this.onDidRunOperation=this._onDidRunOperation.event,this.internalOnDidFilesChange=this._register(new O),this._onDidUncorrelatedFilesChange=this._register(new O),this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event,this._onDidWatchError=this._register(new O),this.onDidWatchError=this._onDidWatchError.event,this.activeWatchers=new Map,this.writeQueue=this._register(new fu)}registerNotebookCellChecker(e){return this.notebookCellExistsChecker=e,ye(()=>{this.notebookCellExistsChecker=void 0})}registerProvider(e,i){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);Da(`code/registerFilesystem/${e}`);const r=new lt;return this.provider.set(e,i),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:i}),r.add(i.onDidChangeFile(s=>{const n=new V0(s,!this.isPathCaseSensitive(i));this.internalOnDidFilesChange.fire(n),n.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(n)})),typeof i.onDidWatchError=="function"&&r.add(i.onDidWatchError(s=>this._onDidWatchError.fire(new Error(s)))),r.add(i.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:i,scheme:e}))),ye(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:i}),this.provider.delete(e),_t(r)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){const i=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(r){i.push(r)}}),!this.provider.has(e)&&await ht.settled(i)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,i){const r=this.provider.get(e.scheme);return!!(r&&r.capabilities&i)}listCapabilities(){return Ri.map(this.provider,([e,i])=>({scheme:e,capabilities:i.capabilities}))}async withProvider(e){if(!Eg(e))throw new rt(g(2024,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);const i=this.provider.get(e.scheme);if(!i){const r=new er;throw r.message=g(2025,null,e.toString()),r}return i}async withReadProvider(e){const i=await this.withProvider(e);if(wi(i)||xt(i)||ra(i))return i;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){const i=await this.withProvider(e);if(wi(i)||xt(i))return i;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,i){try{return await this.doResolveFile(e,i)}catch(r){throw bn(r)===$.FileNotFound?new rt(g(2026,null,this.resourceForError(e)),1):ji(r)}}async doResolveFile(e,i){const r=await this.withProvider(e),s=this.isPathCaseSensitive(r),n=i?.resolveTo,o=i?.resolveSingleChildDescendants,a=i?.resolveMetadata,l=await r.stat(e);let c;return this.toFileStat(r,e,l,void 0,!!a,(h,f)=>(c||(c=gr.forUris(()=>!s),c.set(e,!0),n&&c.fill(!0,n)),c.get(h.resource)||c.findSuperstr(h.resource.with({query:null,fragment:null}))?!0:h.isDirectory&&o?f===1:!1))}async toFileStat(e,i,r,s,n,o){const{providerExtUri:a}=this.getExtUri(e),l={resource:i,name:a.basename(i),isFile:(r.type&dt.File)!==0,isDirectory:(r.type&dt.Directory)!==0,isSymbolicLink:(r.type&dt.SymbolicLink)!==0,mtime:r.mtime,ctime:r.ctime,size:r.size,readonly:!!((r.permissions??0)&vr.Readonly)||!!(e.capabilities&2048),locked:!!((r.permissions??0)&vr.Locked),etag:ch({mtime:r.mtime,size:r.size}),children:void 0};if(l.isDirectory&&o(l,s)){try{const c=await e.readdir(i),h=await ht.settled(c.map(async([f,d])=>{try{const p=a.joinPath(i,f),v=n?await e.stat(p):{type:d};return await this.toFileStat(e,p,v,c.length,n,o)}catch(p){return this.logService.trace(p),null}}));l.children=ir(h)}catch(c){this.logService.trace(c),l.children=[]}return l}return l}async resolveAll(e){return ht.settled(e.map(async i=>{try{return{stat:await this.doResolveFile(i.resource,i.options),success:!0}}catch(r){return this.logService.trace(r),{stat:void 0,success:!1}}}))}async stat(e){const i=await this.withProvider(e),r=await i.stat(e);return this.toFileStat(i,e,r,void 0,!0,()=>!1)}async exists(e){if(e.scheme===ie.vscodeNotebookCell)return this.notebookCellExistsChecker?await this.notebookCellExistsChecker(e):(console.log(`[fileService.exists] Can't check if notebook cell exists: ${e.toString()}`),!1);const i=await this.withProvider(e);try{return!!await i.stat(e)}catch{return!1}}async canCreateFile(e,i){try{await this.doValidateCreateFile(e,i)}catch(r){return r}return!0}async doValidateCreateFile(e,i){if(!i?.overwrite&&await this.exists(e))throw new rt(g(2027,null,this.resourceForError(e)),3,i)}async createFile(e,i=W.fromString(""),r){P4(e)&&i.toString().trim()===""&&(i=W.fromString(I4)),await this.doValidateCreateFile(e,r);const s=await this.writeFile(e,i);return this._onDidRunOperation.fire(new yr(e,0,s)),s}async writeFile(e,i,r){const s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:n}=this.getExtUri(s);let o=r;if(sh(s)&&!o?.atomic){const a=s.enforceAtomicWriteFile?.(e);a&&(o={...r,atomic:a})}try{let{stat:a,buffer:l}=await this.validateWriteFile(s,e,i,o);a||await this.mkdirp(s,n.dirname(e)),l||(l=await this.peekBufferForWriting(s,i)),!wi(s)||xt(s)&&l instanceof W||xt(s)&&sh(s)&&o?.atomic?await this.doWriteUnbuffered(s,e,o,l):await this.doWriteBuffered(s,e,o,l instanceof W?tg(l):l),this._onDidRunOperation.fire(new yr(e,4))}catch(a){throw new rt(g(2028,null,this.resourceForError(e),ji(a).toString()),Ue(a),o)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,i){let r;if(xt(e)&&!(i instanceof W))if(Qs(i)){const s=await Bp(i,3);s.ended?r=W.concat(s.buffer):r=s}else r=jp(i,s=>W.concat(s),3);else r=i;return r}async validateWriteFile(e,i,r,s){const n=!!s?.unlock;if(n&&!(e.capabilities&8192))throw new Error(g(2029,null,this.resourceForError(i)));if(!!s?.atomic){if(!(e.capabilities&32768))throw new Error(g(2030,null,this.resourceForError(i)));if(!(e.capabilities&2))throw new Error(g(2031,null,this.resourceForError(i)));if(n)throw new Error(g(2032,null,this.resourceForError(i)))}let a;try{a=await e.stat(i)}catch{return Object.create(null)}if((a.type&dt.Directory)!==0)throw new rt(g(2033,null,this.resourceForError(i)),0,s);this.throwIfFileIsReadonly(i,a);let l;if(typeof s?.mtime=="number"&&typeof s.etag=="string"&&s.etag!==la&&typeof a.mtime=="number"&&typeof a.size=="number"&&s.mtime{this.writeQueue.queueFor(i,async()=>{try{const a=await this.doReadFile(e,i,r,s);n(a)}catch(a){o(a)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,i,r,s){const n=await this.doReadFileStream(e,i,{...r,preferUnbuffered:!0},s);return{...n,value:await Ni(n.value)}}async readFileStream(e,i,r){const s=await this.withReadProvider(e);return this.doReadFileStream(s,e,i,r)}async doReadFileStream(e,i,r,s){const n=new sr(s);let o=r;sa(e)&&e.enforceAtomicReadFile?.(i)&&(o={...r,atomic:!0});const a=this.validateReadFile(i,o).then(c=>c,c=>{throw n.dispose(!0),c});let l;try{return typeof o?.etag=="string"&&o.etag!==la&&await a,o?.atomic&&sa(e)||!(wi(e)||ra(e))||xt(e)&&o?.preferUnbuffered?l=this.readFileUnbuffered(e,i,o):ra(e)?l=this.readFileStreamed(e,i,n.token,o):l=this.readFileBuffered(e,i,n.token,o),l.on("end",()=>n.dispose()),l.on("error",()=>n.dispose()),{...await a,value:l}}catch(c){throw l&&await Qc(l),this.restoreReadError(c,i,o)}}restoreReadError(e,i,r){const s=g(2035,null,this.resourceForError(i),ji(e).toString());return e instanceof aa?new aa(s,e.stat,r):e instanceof oa?new oa(s,e.fileOperationResult,e.size,e.options):new rt(s,Ue(e),r)}readFileStreamed(e,i,r,s=Object.create(null)){const n=e.readFileStream(i,s,r);return Jc(n,{data:o=>o instanceof W?o:W.wrap(o),error:o=>this.restoreReadError(o,i,s)},o=>W.concat(o))}readFileBuffered(e,i,r,s=Object.create(null)){const n=sg();return Wf(e,i,n,o=>o,{...s,bufferSize:this.BUFFER_SIZE,errorTransformer:o=>this.restoreReadError(o,i,s)},r),n}readFileUnbuffered(e,i,r){const s=Js(n=>W.concat(n));return(async()=>{try{let n;r?.atomic&&sa(e)?n=await e.readFile(i,{atomic:!0}):n=await e.readFile(i),typeof r?.position=="number"&&(n=n.slice(r.position)),typeof r?.length=="number"&&(n=n.slice(0,r.length)),this.validateReadFileLimits(i,n.byteLength,r),s.end(W.wrap(n))}catch(n){s.error(n),s.end()}})(),s}async validateReadFile(e,i){const r=await this.resolve(e,{resolveMetadata:!0});if(r.isDirectory)throw new rt(g(2036,null,this.resourceForError(e)),0,i);if(typeof i?.etag=="string"&&i.etag!==la&&i.etag===r.etag)throw new aa(g(2037,null),r,i);return this.validateReadFileLimits(e,r.size,i),r}validateReadFileLimits(e,i,r){if(typeof r?.limits?.size=="number"&&i>r.limits.size)throw new oa(g(2038,null,this.resourceForError(e)),7,i,r)}async canMove(e,i,r){return this.doCanMoveCopy(e,i,"move",r)}async canCopy(e,i,r){return this.doCanMoveCopy(e,i,"copy",r)}async doCanMoveCopy(e,i,r,s){if(e.toString()!==i.toString())try{const n=r==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),o=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(i),i);await this.doValidateMoveCopy(n,e,o,i,r,s)}catch(n){return n}return!0}async move(e,i,r){const s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(i),i),o=await this.doMoveCopy(s,e,n,i,"move",!!r),a=await this.resolve(i,{resolveMetadata:!0});return this._onDidRunOperation.fire(new yr(e,o==="move"?2:3,a)),a}async copy(e,i,r){const s=await this.withReadProvider(e),n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(i),i),o=await this.doMoveCopy(s,e,n,i,"copy",!!r),a=await this.resolve(i,{resolveMetadata:!0});return this._onDidRunOperation.fire(new yr(e,o==="copy"?3:2,a)),a}async doMoveCopy(e,i,r,s,n,o){if(i.toString()===s.toString())return n;const{exists:a,isSameResourceWithDifferentPathCase:l}=await this.doValidateMoveCopy(e,i,r,s,n,o);if(a&&!l&&o&&await this.del(s,{recursive:!0}),await this.mkdirp(r,this.getExtUri(r).providerExtUri.dirname(s)),n==="copy"){if(e===r&&ia(e))await e.copy(i,s,{overwrite:o});else{const c=await this.resolve(i);c.isDirectory?await this.doCopyFolder(e,c,r,s):await this.doCopyFile(e,i,r,s)}return n}else return e===r?(await e.rename(i,s,{overwrite:o}),n):(await this.doMoveCopy(e,i,r,s,"copy",o),await this.del(i,{recursive:!0}),"copy")}async doCopyFile(e,i,r,s){if(wi(e)&&wi(r))return this.doPipeBuffered(e,i,r,s);if(wi(e)&&xt(r))return this.doPipeBufferedToUnbuffered(e,i,r,s);if(xt(e)&&wi(r))return this.doPipeUnbufferedToBuffered(e,i,r,s);if(xt(e)&&xt(r))return this.doPipeUnbuffered(e,i,r,s)}async doCopyFolder(e,i,r,s){await r.mkdir(s),Array.isArray(i.children)&&await ht.settled(i.children.map(async n=>{const o=this.getExtUri(r).providerExtUri.joinPath(s,n.name);return n.isDirectory?this.doCopyFolder(e,await this.resolve(n.resource),r,o):this.doCopyFile(e,n.resource,r,o)}))}async doValidateMoveCopy(e,i,r,s,n,o){let a=!1;if(e===r){const{providerExtUri:c,isPathCaseSensitive:h}=this.getExtUri(e);if(h||(a=c.isEqual(i,s)),a&&n==="copy")throw new Error(g(2039,null,this.resourceForError(i),this.resourceForError(s)));if(!a&&c.isEqualOrParent(s,i))throw new Error(g(2040,null,this.resourceForError(i),this.resourceForError(s)))}const l=await this.exists(s);if(l&&!a){if(!o)throw new rt(g(2041,null,this.resourceForError(i),this.resourceForError(s)),4);if(e===r){const{providerExtUri:c}=this.getExtUri(e);if(c.isEqualOrParent(i,s))throw new Error(g(2042,null,this.resourceForError(i),this.resourceForError(s)))}}return{exists:l,isSameResourceWithDifferentPathCase:a}}getExtUri(e){const i=this.isPathCaseSensitive(e);return{providerExtUri:i?te:wg,isPathCaseSensitive:i}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){const i=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(i,e);const r=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new yr(e,0,r)),r}async mkdirp(e,i){const r=[],{providerExtUri:s}=this.getExtUri(e);for(;!s.isEqual(i,s.dirname(i));)try{if(((await e.stat(i)).type&dt.Directory)===0)throw new Error(g(2043,null,this.resourceForError(i)));break}catch(n){if(bn(n)!==$.FileNotFound)throw n;r.push(s.basename(i)),i=s.dirname(i)}for(let n=r.length-1;n>=0;n--){i=s.joinPath(i,r[n]);try{await e.mkdir(i)}catch(o){if(bn(o)!==$.FileExists)throw o}}}async canDelete(e,i){try{await this.doValidateDelete(e,i)}catch(r){return r}return!0}async doValidateDelete(e,i){const r=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),s=!!i?.useTrash;if(s&&!(r.capabilities&4096))throw new Error(g(2044,null,this.resourceForError(e)));const n=i?.atomic;if(n&&!(r.capabilities&65536))throw new Error(g(2045,null,this.resourceForError(e)));if(s&&n)throw new Error(g(2046,null,this.resourceForError(e)));let o;try{o=await r.stat(e)}catch{}if(o)this.throwIfFileIsReadonly(e,o);else throw new rt(g(2047,null,this.resourceForError(e)),1);if(!!!i?.recursive){const l=await this.resolve(e);if(l.isDirectory&&Array.isArray(l.children)&&l.children.length>0)throw new Error(g(2048,null,this.resourceForError(e)))}return r}async del(e,i){const r=await this.doValidateDelete(e,i);let s=i;if(M0(r)&&!s?.atomic){const l=r.enforceAtomicDelete?.(e);l&&(s={...i,atomic:l})}const n=!!s?.useTrash,o=!!s?.recursive,a=s?.atomic??!1;await r.delete(e,{recursive:o,useTrash:n,atomic:a}),this._onDidRunOperation.fire(new yr(e,1))}async cloneFile(e,i){const r=await this.withProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(i),i);if(!(r===s&&this.getExtUri(r).providerExtUri.isEqual(e,i)))return r===s&&rh(r)?r.cloneFile(e,i):(await this.mkdirp(s,this.getExtUri(s).providerExtUri.dirname(i)),r===s&&ia(r)?this.writeQueue.queueFor(e,()=>r.copy(e,i,{overwrite:!0}),this.getExtUri(r).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(r,e,s,i),this.getExtUri(r).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,i){return this.watch(e,{...i,correlationId:dl.WATCHER_CORRELATION_IDS++})}watch(e,i={recursive:!1,excludes:[]}){const r=new lt;let s=!1,n=()=>{s=!0};r.add(ye(()=>n())),(async()=>{try{const a=await this.doWatch(e,i);s?_t(a):n=()=>_t(a)}catch(a){this.logService.error(a)}})();const o=i.correlationId;if(typeof o=="number"){const a=r.add(new O);return r.add(this.internalOnDidFilesChange.event(c=>{c.correlates(o)&&a.fire(c)})),{onDidChange:a.event,dispose:()=>r.dispose()}}return r}async doWatch(e,i){const r=await this.withProvider(e),s=dr([this.getExtUri(r).providerExtUri.getComparisonKey(e),i]);let n=this.activeWatchers.get(s);return n||(n={count:0,disposable:r.watch(e,i)},this.activeWatchers.set(s,n)),n.count+=1,ye(()=>{n&&(n.count--,n.count===0&&(_t(n.disposable),this.activeWatchers.delete(s)))})}dispose(){super.dispose();for(const[,e]of this.activeWatchers)_t(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,i,r,s){return this.writeQueue.queueFor(i,async()=>{const n=await e.open(i,{create:!0,unlock:r?.unlock??!1});try{Qs(s)||Po(s)?await this.doWriteStreamBufferedQueued(e,n,s):await this.doWriteReadableBufferedQueued(e,n,s)}catch(o){throw ji(o)}finally{await e.close(n)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,i,r){let s=0,n;if(Po(r)){if(r.buffer.length>0){const o=W.concat(r.buffer);await this.doWriteBuffer(e,i,o,o.byteLength,s,0),s+=o.byteLength}if(r.ended)return;n=r.stream}else n=r;return new Promise((o,a)=>{Io(n,{onData:async l=>{n.pause();try{await this.doWriteBuffer(e,i,l,l.byteLength,s,0)}catch(c){return a(c)}s+=l.byteLength,setTimeout(()=>n.resume())},onError:l=>a(l),onEnd:()=>o()})})}async doWriteReadableBufferedQueued(e,i,r){let s=0,n;for(;(n=r.read())!==null;)await this.doWriteBuffer(e,i,n,n.byteLength,s,0),s+=n.byteLength}async doWriteBuffer(e,i,r,s,n,o){let a=0;for(;athis.doWriteUnbufferedQueued(e,i,r,s),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,i,r,s){let n;s instanceof W?n=s:Qs(s)?n=await Ni(s):Po(s)?n=await ig(s):n=eg(s),await e.writeFile(i,n.buffer,{create:!0,overwrite:!0,unlock:r?.unlock??!1,atomic:r?.atomic??!1})}async doPipeBuffered(e,i,r,s){return this.writeQueue.queueFor(s,()=>this.doPipeBufferedQueued(e,i,r,s),this.getExtUri(r).providerExtUri)}async doPipeBufferedQueued(e,i,r,s){let n,o;try{n=await e.open(i,{create:!1}),o=await r.open(s,{create:!0,unlock:!1});const a=W.alloc(this.BUFFER_SIZE);let l=0,c=0,h=0;do h=await e.read(n,l,a.buffer,c,a.byteLength-c),await this.doWriteBuffer(r,o,a,h,l,c),l+=h,c+=h,c===a.byteLength&&(c=0);while(h>0)}catch(a){throw ji(a)}finally{await ht.settled([typeof n=="number"?e.close(n):Promise.resolve(),typeof o=="number"?r.close(o):Promise.resolve()])}}async doPipeUnbuffered(e,i,r,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedQueued(e,i,r,s),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedQueued(e,i,r,s){return r.writeFile(s,await e.readFile(i),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,i,r,s){return this.writeQueue.queueFor(s,()=>this.doPipeUnbufferedToBufferedQueued(e,i,r,s),this.getExtUri(r).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,i,r,s){const n=await r.open(s,{create:!0,unlock:!1});try{const o=await e.readFile(i);await this.doWriteBuffer(r,n,W.wrap(o),o.byteLength,0,0)}catch(o){throw ji(o)}finally{await r.close(n)}}async doPipeBufferedToUnbuffered(e,i,r,s){const n=await Ni(this.readFileBuffered(e,i,de.None));await this.doWriteUnbuffered(r,s,void 0,n)}throwIfFileSystemIsReadonly(e,i){if(e.capabilities&2048)throw new rt(g(2049,null,this.resourceForError(i)),6);return e}throwIfFileIsReadonly(e,i){if((i.permissions??0)&vr.Readonly)throw new rt(g(2050,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===ie.file?e.fsPath:e.toString(!0)}async realpath(e){try{const i=await this.withProvider(e);return"realpath"in i&&typeof i.realpath=="function"?i.realpath(e):e}catch{return e}}};pl=dl=__decorate([__param(0,he)],pl);import{promises as _i}from"fs";import*as $f from"fs";async function qf(t){try{return await pe.realpath(t)}catch{const i=k4(t);return await $f.promises.access(i,$f.constants.R_OK),i}}function k4(t){return bo(di(t),tt)}var ys="**",jf="/",qn="[/\\\\]",jn="[^/\\\\]",D4=/\//g;function Bf(t,e){switch(t){case 0:return"";case 1:return`${jn}*?`;default:return`(?:${qn}|${jn}+${qn}${e?`|${qn}${jn}+`:""})*?`}}function zf(t,e){if(!t)return[];const i=[];let r=!1,s=!1,n="";for(const o of t){switch(o){case e:if(!r&&!s){i.push(n),n="";continue}break;case"{":r=!0;break;case"}":r=!1;break;case"[":s=!0;break;case"]":s=!1;break}n+=o}return n&&i.push(n),i}function Hf(t){if(!t)return"";let e="";const i=zf(t,jf);if(i.every(r=>r===ys))e=".*";else{let r=!1;i.forEach((s,n)=>{if(s===ys){if(r)return;e+=Bf(2,n===i.length-1)}else{let o=!1,a="",l=!1,c="";for(const h of s){if(h!=="}"&&o){a+=h;continue}if(l&&(h!=="]"||!c)){let f;h==="-"?f=h:(h==="^"||h==="!")&&!c?f="^":h===jf?f="":f=ar(h),c+=f;continue}switch(h){case"{":o=!0;continue;case"[":l=!0;continue;case"}":{const d=`(?:${zf(a,",").map(p=>Hf(p)).join("|")})`;e+=d,o=!1,a="";break}case"]":{e+="["+c+"]",l=!1,c="";break}case"?":e+=jn;continue;case"*":e+=Bf(1);continue;default:e+=ar(h)}}ngl(a,e)).filter(a=>a!==Ht),t),r=i.length;if(!r)return Ht;if(r===1)return i[0];const s=function(a,l){for(let c=0,h=i.length;c!!a.allBasenames);n&&(s.allBasenames=n.allBasenames);const o=i.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(s.allPaths=o),s}function Jf(t,e,i){const r=tt===se.sep,s=r?t:t.replace(D4,tt),n=tt+s,o=se.sep+t;let a;return i?a=function(l,c){return typeof l=="string"&&(l===s||l.endsWith(n)||!r&&(l===t||l.endsWith(o)))?e:null}:a=function(l,c){return typeof l=="string"&&(l===s||!r&&l===t)?e:null},a.allPaths=[(i?"*/":"./")+t],a}function U4(t){try{const e=new RegExp(`^${Hf(t)}$`);return function(i){return e.lastIndex=0,typeof i=="string"&&e.test(i)?t:null}}catch{return Ht}}function V4(t,e={}){if(!t)return Gf;if(typeof t=="string"||W4(t)){const i=gl(t,e);if(i===Ht)return Gf;const r=function(s,n){return!!i(s,n)};return i.allBasenames&&(r.allBasenames=i.allBasenames),i.allPaths&&(r.allPaths=i.allPaths),r}return $4(t,e)}function W4(t){const e=t;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function $4(t,e){const i=Xf(Object.getOwnPropertyNames(t).map(a=>q4(a,t[a],e)).filter(a=>a!==Ht)),r=i.length;if(!r)return Ht;if(!i.some(a=>!!a.requiresSiblings)){if(r===1)return i[0];const a=function(h,f){let d;for(let p=0,v=i.length;p{for(const p of d){const v=await p;if(typeof v=="string")return v}return null})():null},l=i.find(h=>!!h.allBasenames);l&&(a.allBasenames=l.allBasenames);const c=i.reduce((h,f)=>f.allPaths?h.concat(f.allPaths):h,[]);return c.length&&(a.allPaths=c),a}const s=function(a,l,c){let h,f;for(let d=0,p=i.length;d{for(const d of f){const p=await d;if(typeof p=="string")return p}return null})():null},n=i.find(a=>!!a.allBasenames);n&&(s.allBasenames=n.allBasenames);const o=i.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(s.allPaths=o),s}function q4(t,e,i){if(e===!1)return Ht;const r=gl(t,i);if(r===Ht)return Ht;if(typeof e=="boolean")return r;if(e){const s=e.when;if(typeof s=="string"){const n=(o,a,l,c)=>{if(!c||!r(o,a))return null;const h=s.replace("$(basename)",()=>l),f=c(h);return Lo(f)?f.then(d=>d?t:null):f?t:null};return n.requiresSiblings=!0,n}}return r}function Xf(t,e){const i=t.filter(a=>!!a.basenames);if(i.length<2)return t;const r=i.reduce((a,l)=>{const c=l.basenames;return c?a.concat(c):a},[]);let s;if(e){s=[];for(let a=0,l=r.length;a{const c=l.patterns;return c?a.concat(c):a},[]);const n=function(a,l){if(typeof a!="string")return null;if(!l){let h;for(h=a.length;h>0;h--){const f=a.charCodeAt(h-1);if(f===47||f===92)break}l=a.substr(h)}const c=r.indexOf(l);return c!==-1?s[c]:null};n.basenames=r,n.patterns=s,n.allBasenames=r;const o=t.filter(a=>!a.basenames);return o.push(n),o}function Yf(t,e){return tr(t,e,(i,r)=>typeof i=="string"&&typeof r=="string"?i===r:typeof i!="string"&&typeof r!="string"?i.base===r.base&&i.pattern===r.pattern:!1)}function Zf(t){return typeof t.correlationId=="number"}function j4(t){return t.recursive===!0}var ed=class i1 extends K{static{this.MAX_RESTARTS=5}constructor(e,i,r,s){super(),this.onFileChanges=e,this.onLogMessage=i,this.verboseLogging=r,this.options=s,this.watcherDisposables=this._register(new Ur),this.requests=void 0,this.restartCounter=0}init(){const e=new lt;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(i=>this.onFileChanges(i))),e.add(this.watcher.onDidLogMessage(i=>this.onLogMessage(i))),e.add(this.watcher.onDidError(i=>this.onError(i.error,i.request)))}onError(e,i){this.canRestart(e,i)?this.restartCounter({type:e.type,resource:I.revive(e.resource),cId:e.cId}))}function H4(t){const e=new G4;for(const i of t)e.processEvent(i);return e.coalesce()}function K4(t,e){return typeof e=="string"&&!e.startsWith(ys)&&!Vc(e)?{base:t,pattern:e}:e}function id(t,e){const i=[];for(const r of e)i.push(V4(K4(t,r)));return i}var G4=class{constructor(){this.coalesced=new Set,this.mapPathToChange=new Map}toKey(t){return et?t.resource.fsPath:t.resource.fsPath.toLowerCase()}processEvent(t){const e=this.mapPathToChange.get(this.toKey(t));let i=!1;if(e){const r=e.type,s=t.type;e.resource.fsPath!==t.resource.fsPath&&(t.type===2||t.type===1)?i=!0:r===1&&s===2?(this.mapPathToChange.delete(this.toKey(t)),this.coalesced.delete(e)):r===2&&s===1?e.type=0:r===1&&s===0||(e.type=s)}else i=!0;i&&(this.coalesced.add(t),this.mapPathToChange.set(this.toKey(t),t))}coalesce(){const t=[],e=[];return Array.from(this.coalesced).filter(i=>i.type!==2?(t.push(i),!1):!0).sort((i,r)=>i.resource.fsPath.length-r.resource.fsPath.length).filter(i=>e.some(r=>W0(i.resource.fsPath,r,!et))?!1:(e.push(i.resource.fsPath),!0)).concat(t)}};function Q4(t,e){if(typeof e=="number")switch(t.type){case 1:return(e&4)===0;case 2:return(e&8)===0;case 0:return(e&2)===0}return!1}function J4(t){if(typeof t=="number"){const e=[];return t&4&&e.push("Added"),t&8&&e.push("Deleted"),t&2&&e.push("Updated"),e.length===0?"":`[${e.join(", ")}]`}return""}var X4=class extends K{constructor(t,e){super(),this.logService=t,this.options=e,this._onDidChangeFile=this._register(new O),this.onDidChangeFile=this._onDidChangeFile.event,this._onDidWatchError=this._register(new O),this.onDidWatchError=this._onDidWatchError.event,this.universalWatchRequests=[],this.universalWatchRequestDelayer=this._register(new Mi(this.getRefreshWatchersDelay(this.universalWatchRequests.length))),this.nonRecursiveWatchRequests=[],this.nonRecursiveWatchRequestDelayer=this._register(new Mi(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(t,e){return e.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(t,e):this.watchNonRecursive(t,e)}getRefreshWatchersDelay(t){return t>200?500:0}watchUniversal(t,e){const i=this.toWatchRequest(t,e),r=nc(this.universalWatchRequests,i);return this.refreshUniversalWatchers(),ye(()=>{r(),this.refreshUniversalWatchers()})}toWatchRequest(t,e){const i={path:this.toWatchPath(t),excludes:e.excludes,includes:e.includes,recursive:e.recursive,filter:e.filter,correlationId:e.correlationId};if(j4(i)){const r=this.options?.watcher?.recursive?.usePolling;r===!0?i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(r)&&r.includes(i.path)&&(i.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return i}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(t=>Nt(t))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(t=>this._onDidChangeFile.fire(td(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===T.Trace)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===T.Trace)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(t,e){const i={path:this.toWatchPath(t),excludes:e.excludes,includes:e.includes,recursive:!1,filter:e.filter,correlationId:e.correlationId},r=nc(this.nonRecursiveWatchRequests,i);return this.refreshNonRecursiveWatchers(),ye(()=>{r(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(t=>Nt(t))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(t=>this._onDidChangeFile.fire(td(t)),t=>this.onWatcherLogMessage(t),this.logService.getLevel()===T.Trace)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===T.Trace)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(t){t.type==="error"&&this._onDidWatchError.fire(t.message),this.logWatcherMessage(t)}logWatcherMessage(t){this.logService[t.type](t.message)}toFilePath(t){return di(t.fsPath)}toWatchPath(t){const e=this.toFilePath(t);return Tp(e)}},rd;(function(t){t[t.Promise=100]="Promise",t[t.PromiseCancel=101]="PromiseCancel",t[t.EventListen=102]="EventListen",t[t.EventDispose=103]="EventDispose"})(rd||(rd={}));function sd(t){switch(t){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}var nd;(function(t){t[t.Initialize=200]="Initialize",t[t.PromiseSuccess=201]="PromiseSuccess",t[t.PromiseError=202]="PromiseError",t[t.PromiseErrorObj=203]="PromiseErrorObj",t[t.EventFire=204]="EventFire"})(nd||(nd={}));function od(t){switch(t){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}var Gi;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Idle=1]="Idle"})(Gi||(Gi={}));function Pr(t){let e=0;for(let i=0;;i+=7){const r=t.read(1);if(e|=(r.buffer[0]&127)<>>7)i++;const r=W.alloc(i);for(let s=0;e!==0;s++)r.buffer[s]=e&127,e=e>>>7,e>0&&(r.buffer[s]|=128);t.write(r)}var Z4=class{constructor(t){this.buffer=t,this.pos=0}read(t){const e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=e.byteLength,e}},e5=class{constructor(){this.buffers=[]}get buffer(){return W.concat(this.buffers)}write(t){this.buffers.push(t)}},Xe;(function(t){t[t.Undefined=0]="Undefined",t[t.String=1]="String",t[t.Buffer=2]="Buffer",t[t.VSBuffer=3]="VSBuffer",t[t.Array=4]="Array",t[t.Object=5]="Object",t[t.Int=6]="Int"})(Xe||(Xe={}));function xi(t){const e=W.alloc(1);return e.writeUInt8(t,0),e}var Qi={Undefined:xi(Xe.Undefined),String:xi(Xe.String),Buffer:xi(Xe.Buffer),VSBuffer:xi(Xe.VSBuffer),Array:xi(Xe.Array),Object:xi(Xe.Object),Uint:xi(Xe.Int)},t5=typeof Buffer<"u";function vl(t,e){if(typeof e>"u")t.write(Qi.Undefined);else if(typeof e=="string"){const i=W.fromString(e);t.write(Qi.String),Ir(t,i.byteLength),t.write(i)}else if(t5&&Buffer.isBuffer(e)){const i=W.wrap(e);t.write(Qi.Buffer),Ir(t,i.byteLength),t.write(i)}else if(e instanceof W)t.write(Qi.VSBuffer),Ir(t,e.byteLength),t.write(e);else if(Array.isArray(e)){t.write(Qi.Array),Ir(t,e.length);for(const i of e)vl(t,i)}else if(typeof e=="number"&&(e|0)===e)t.write(Qi.Uint),Ir(t,e);else{const i=W.fromString(JSON.stringify(e));t.write(Qi.Object),Ir(t,i.byteLength),t.write(i)}}function yl(t){switch(t.read(1).readUInt8(0)){case Xe.Undefined:return;case Xe.String:return t.read(Pr(t)).toString();case Xe.Buffer:return t.read(Pr(t)).buffer;case Xe.VSBuffer:return t.read(Pr(t));case Xe.Array:{const i=Pr(t),r=[];for(let s=0;sthis.onBuffer(i)),this.logger=e}getChannel(t){const e=this;return{call(i,r,s){return e.isDisposed?Promise.reject(new Te):e.requestPromise(t,i,r,s)},listen(i,r){return e.isDisposed?ae.None:e.requestEvent(t,i,r)}}}requestPromise(t,e,i,r=de.None){const s=this.lastRequestId++,o={id:s,type:100,channelName:t,name:e,arg:i};if(r.isCancellationRequested)return Promise.reject(new Te);let a,l;return new Promise((h,f)=>{if(r.isCancellationRequested)return f(new Te);const d=()=>{const m=w=>{switch(w.type){case 201:this.handlers.delete(s),h(w.data);break;case 202:{this.handlers.delete(s);const S=new Error(w.data.message);S.stack=Array.isArray(w.data.stack)?w.data.stack.join(` `):w.data.stack,S.name=w.data.name,f(S);break}case 203:this.handlers.delete(s),f(w.data);break}};this.handlers.set(s,m),this.sendRequest(o)};let p=null;this.state===Gi.Idle?d():(p=si(m=>this.whenInitialized()),p.then(()=>{p=null,d()}));const v=()=>{p?(p.cancel(),p=null):this.sendRequest({id:s,type:101}),f(new Te)};a=r.onCancellationRequested(v),l={dispose:rc(()=>{v(),a.dispose()})},this.activeRequests.add(l)}).finally(()=>{a?.dispose(),this.activeRequests.delete(l)})}requestEvent(t,e,i){const r=this.lastRequestId++,n={id:r,type:102,channelName:t,name:e,arg:i};let o=null;const a=new O({onWillAddFirstListener:()=>{const c=()=>{this.activeRequests.add(a),this.sendRequest(n)};this.state===Gi.Idle?c():(o=si(h=>this.whenInitialized()),o.then(()=>{o=null,c()}))},onDidRemoveLastListener:()=>{o?(o.cancel(),o=null):(this.activeRequests.delete(a),this.sendRequest({id:r,type:103}))}}),l=c=>a.fire(c.data);return this.handlers.set(r,l),a.event}sendRequest(t){switch(t.type){case 100:case 102:{const e=this.send([t.type,t.id,t.channelName,t.name],t.arg);this.logger?.logOutgoing(e,t.id,0,`${sd(t.type)}: ${t.channelName}.${t.name}`,t.arg);return}case 101:case 103:{const e=this.send([t.type,t.id]);this.logger?.logOutgoing(e,t.id,0,sd(t.type));return}}}send(t,e=void 0){const i=new e5;return vl(i,t),vl(i,e),this.sendBuffer(i.buffer)}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onBuffer(t){const e=new Z4(t),i=yl(e),r=yl(e),s=i[0];switch(s){case 200:return this.logger?.logIncoming(t.byteLength,0,0,od(s)),this.onResponse({type:i[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(t.byteLength,i[1],0,od(s),r),this.onResponse({type:i[0],id:i[1],data:r})}}onResponse(t){if(t.type===200){this.state=Gi.Idle,this._onDidInitialize.fire();return}this.handlers.get(t.id)?.(t)}get onDidInitializePromise(){return ae.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===Gi.Idle?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),_t(this.activeRequests.values()),this.activeRequests.clear()}};__decorate([ce],ld.prototype,"onDidInitializePromise",null);function i5(t){let e=!1;return{call(i,r,s){return e?t.call(i,r,s):zr(0).then(()=>e=!0).then(()=>t.call(i,r,s))},listen(i,r){if(e)return t.listen(i,r);const s=new X1;return zr(0).then(()=>e=!0).then(()=>s.input=t.listen(i,r)),s.event}}}var wl;(function(t){function e(n,o,a){const l=n,c=a&&a.disableMarshalling,h=new Map;for(const f in l)r(f)&&h.set(f,ae.buffer(l[f],!0,void 0,o));return new class{listen(f,d,p){const v=h.get(d);if(v)return v;const m=l[d];if(typeof m=="function"){if(s(d))return m.call(l,p);if(r(d))return h.set(d,ae.buffer(l[d],!0,void 0,o)),h.get(d)}throw new er(`Event not found: ${d}`)}call(f,d,p){const v=l[d];if(typeof v=="function"){if(!c&&Array.isArray(p))for(let w=0;w{if(o&&console.error(o),i=!1,e.length>0){const a=e.slice(0);e=[],a.forEach(l=>r(l))}})||_e)&&(i=!0)};return{send:r}}var h5=class{constructor(t,e){this.modulePath=t,this.options=e,this.activeRequests=new Set,this.channels=new Map,this._onDidProcessExit=new O,this.onDidProcessExit=this._onDidProcessExit.event;const i=e&&e.timeout?e.timeout:6e4;this.disposeDelayer=new cu(i),this.child=null,this._client=null}getChannel(t){const e=this;return{call(i,r,s){return e.requestPromise(t,i,r,s)},listen(i,r){return e.requestEvent(t,i,r)}}}requestPromise(t,e,i,r=de.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(r.isCancellationRequested)return Promise.reject(tc());this.disposeDelayer.cancel();const s=this.getCachedChannel(t),n=si(l=>s.call(e,i,l)),o=r.onCancellationRequested(()=>n.cancel()),a=ye(()=>n.cancel());return this.activeRequests.add(a),n.finally(()=>{o.dispose(),this.activeRequests.delete(a),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),n}requestEvent(t,e,i){if(!this.disposeDelayer)return ae.None;this.disposeDelayer.cancel();let r;const s=new O({onWillAddFirstListener:()=>{r=this.getCachedChannel(t).listen(e,i)(s.fire,s),this.activeRequests.add(r)},onDidRemoveLastListener:()=>{this.activeRequests.delete(r),r.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return s.event}get client(){if(!this._client){const t=this.options&&this.options.args?this.options.args:[],e=Object.create(null);e.env={...oi(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options&&this.options.env&&(e.env={...e.env,...this.options.env}),this.options&&this.options.freshExecArgv&&(e.execArgv=[]),this.options&&typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),this.options&&typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(h=>!/^--inspect(-brk)?=/.test(h)).filter(h=>!h.startsWith("--vscode-"))),l5(e.env),this.child=r5(this.modulePath,t,e);const i=new O,s=ae.fromNodeEventEmitter(this.child,"message",h=>h)(h=>{if(s5(h)){a5(h,`IPC Library: ${this.options.serverName}`);return}i.fire(W.wrap(Buffer.from(h,"base64")))}),n=this.options.useQueue?u5(this.child):this.child,o=h=>this.child&&this.child.connected&&n.send(h.buffer.toString("base64")),a=i.event,l={send:o,onMessage:a};this._client=new ld(l);const c=()=>this.disposeClient();process.once("exit",c),this.child.on("error",h=>console.warn('IPC "'+this.options.serverName+'" errored with '+h)),this.child.on("exit",(h,f)=>{process.removeListener("exit",c),s.dispose(),this.activeRequests.forEach(d=>_t(d)),this.activeRequests.clear(),h!==0&&f!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+h+" and signal "+f),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:h,signal:f})})}return this._client}getCachedChannel(t){let e=this.channels.get(t);return e||(e=this.client.getChannel(t),this.channels.set(t,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}},f5=class extends z4{constructor(t,e,i){super(t,e,i),this.init()}createWatcher(t){const e=t.add(new h5(en.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return t.add(e.onDidProcessExit(({code:i,signal:r})=>this.onError(`terminated by itself with code ${i}, signal: ${r} (ETERM)`))),wl.toService(i5(e.getChannel("watcher")))}};import{watchFile as d5,unwatchFile as p5}from"fs";var g5=class extends K{constructor(){super(),this._onDidChangeFile=this._register(new O),this.onDidChangeFile=this._onDidChangeFile.event,this._onDidLogMessage=this._register(new O),this.onDidLogMessage=this._onDidLogMessage.event,this._onDidWatchFail=this._register(new O),this.onDidWatchFail=this._onDidWatchFail.event,this.correlatedWatchRequests=new Map,this.nonCorrelatedWatchRequests=new Map,this.suspendedWatchRequests=this._register(new po),this.suspendedWatchRequestsWithPolling=new Set,this.updateWatchersDelayer=this._register(new Mi(this.getUpdateWatchersDelay())),this.suspendedWatchRequestPollingInterval=5007,this.joinWatch=new Ao,this.verboseLogging=!1,this._register(this.onDidWatchFail(t=>this.suspendWatchRequest({id:this.computeId(t),correlationId:this.isCorrelated(t)?t.correlationId:void 0,path:t.path})))}isCorrelated(t){return Zf(t)}computeId(t){return this.isCorrelated(t)?t.correlationId:dr(t)}async watch(t){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Ao;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(const e of t)this.isCorrelated(e)?this.correlatedWatchRequests.set(e.correlationId,e):this.nonCorrelatedWatchRequests.set(this.computeId(e),e);for(const[e]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(e)&&!this.correlatedWatchRequests.has(e)&&(this.suspendedWatchRequests.deleteAndDispose(e),this.suspendedWatchRequestsWithPolling.delete(e));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(t){const e=[];for(const[i,r]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(i)||e.push(r);return this.updateWatchersDelayer.trigger(()=>this.doWatch(e),t?this.getUpdateWatchersDelay():0).catch(i=>Nt(i))}getUpdateWatchersDelay(){return 800}isSuspended(t){const e=this.computeId(t);return this.suspendedWatchRequestsWithPolling.has(e)?"polling":this.suspendedWatchRequests.has(e)}async suspendWatchRequest(t){if(this.suspendedWatchRequests.has(t.id))return;const e=new lt;this.suspendedWatchRequests.set(t.id,e),await this.joinWatch.p,!e.isDisposed&&(this.monitorSuspendedWatchRequest(t,e),this.updateWatchers(!0))}resumeWatchRequest(t){this.suspendedWatchRequests.deleteAndDispose(t.id),this.suspendedWatchRequestsWithPolling.delete(t.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(t,e){this.doMonitorWithExistingWatcher(t,e)?(this.trace(`reusing an existing recursive watcher to monitor ${t.path}`),this.suspendedWatchRequestsWithPolling.delete(t.id)):(this.doMonitorWithNodeJS(t,e),this.suspendedWatchRequestsWithPolling.add(t.id))}doMonitorWithExistingWatcher(t,e){const i=this.recursiveWatcher?.subscribe(t.path,(r,s)=>{e.isDisposed||(r?this.monitorSuspendedWatchRequest(t,e):s?.type===1&&this.onMonitoredPathAdded(t))});return i?(e.add(i),!0):!1}doMonitorWithNodeJS(t,e){let i=!1;const r=(s,n)=>{if(e.isDisposed)return;const o=this.isPathNotFound(s),a=this.isPathNotFound(n),l=i;i=o,!o&&(a||l)&&this.onMonitoredPathAdded(t)};this.trace(`starting fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{d5(t.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},r)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${t.path} (correlationId: ${t.correlationId})`)}e.add(ye(()=>{this.trace(`stopping fs.watchFile() on ${t.path} (correlationId: ${t.correlationId})`);try{p5(t.path,r)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${t.path} (correlationId: ${t.correlationId})`)}}))}onMonitoredPathAdded(t){this.trace(`detected ${t.path} exists again, resuming watcher (correlationId: ${t.correlationId})`);const e={resource:I.file(t.path),type:1,cId:t.correlationId};this._onDidChangeFile.fire([e]),this.traceEvent(e,t),this.resumeWatchRequest(t)}isPathNotFound(t){return t.ctimeMs===0&&t.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(t,e){if(this.verboseLogging){const i=` >> normalized ${t.type===1?"[ADDED]":t.type===2?"[DELETED]":"[CHANGED]"} ${t.resource.fsPath}`;this.traceWithCorrelation(i,e)}}traceWithCorrelation(t,e){this.verboseLogging&&this.trace(`${t}${typeof e.correlationId=="number"?` <${e.correlationId}> `:""}`)}requestToString(t){return`${t.path} (excludes: ${t.excludes.length>0?t.excludes:""}, includes: ${t.includes&&t.includes.length>0?JSON.stringify(t.includes):""}, filter: ${J4(t.filter)}, correlationId: ${typeof t.correlationId=="number"?t.correlationId:""})`}async setVerboseLogging(t){this.verboseLogging=t}};import{watch as m5,promises as v5}from"fs";var y5=class so extends K{static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}constructor(e,i,r,s,n,o){super(),this.request=e,this.recursiveWatcher=i,this.onDidFilesChange=r,this.onDidWatchFail=s,this.onLogMessage=n,this.verboseLogging=o,this.throttledFileChangesEmitter=this._register(new du({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},a=>this.onDidFilesChange(a))),this.fileChangesAggregator=this._register(new Dg(a=>this.handleFileChanges(a),so.FILE_CHANGES_HANDLER_DELAY)),this.cts=new sr,this.realPath=new Fi(async()=>{let a=this.request.path;try{a=await qf(this.request.path),this.request.path!==a&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${a})`)}catch{}return a}),this._isReusingRecursiveWatcher=!1,this.didFail=!1,this.excludes=id(this.request.path,this.request.excludes),this.includes=this.request.includes?id(this.request.path,this.request.includes):void 0,this.filter=Zf(this.request)?this.request.filter:void 0,this.ready=this.watch()}async watch(){try{const e=await v5.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){const i=new lt;return this.doWatchWithExistingWatcher(e,i)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,i)),i}doWatchWithExistingWatcher(e,i){if(e)return!1;const r=I.file(this.request.path),s=this.recursiveWatcher?.subscribe(this.request.path,async(n,o)=>{if(!i.isDisposed)if(n){const a=await this.doWatch(e);i.isDisposed?a.dispose():i.add(a)}else o&&(typeof o.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:o.type,cId:this.request.correlationId},!0)});return s?(i.add(s),!0):!1}async doWatchWithNodeJS(e,i){const r=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(Mt&&Br(r,"/Volumes/",!0)){this.error(`Refusing to watch ${r} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}const s=new sr(this.cts.token);i.add(ye(()=>s.dispose(!0)));const n=new lt;i.add(n);try{const o=I.file(this.request.path),a=Ct(r),l=m5(r);n.add(ye(()=>{l.removeAllListeners(),l.close()})),this.trace(`Started watching: '${r}'`);const c=new Set;if(e)try{for(const f of await pe.readdir(r))c.add(f)}catch(f){this.error(f)}if(s.token.isCancellationRequested)return;const h=new Map;n.add(ye(()=>{for(const[,f]of h)f.dispose();h.clear()})),l.on("error",(f,d)=>{s.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${f}, ${d})`),this.notifyWatchFailed())}),l.on("change",(f,d)=>{if(s.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${f}"] ${d}`);let p="";if(d&&(p=d.toString(),Mt&&(p=Ba(p))),!(!p||f!=="change"&&f!=="rename"))if(e)if(f==="rename"){h.get(p)?.dispose();const v=setTimeout(async()=>{if(h.delete(p),Gs(p,a,!et)&&!await pe.exists(r)){this.onWatchedPathDeleted(o);return}if(s.token.isCancellationRequested)return;const m=await this.existsChildStrictCase(G(r,p));if(s.token.isCancellationRequested)return;let w;m?c.has(p)?w=0:(w=1,c.add(p)):(c.delete(p),w=2),this.onFileChange({resource:j(o,p),type:w,cId:this.request.correlationId})},so.FILE_DELETE_HANDLER_DELAY);h.set(p,ye(()=>clearTimeout(v)))}else{let v;c.has(p)?v=0:(v=1,c.add(p)),this.onFileChange({resource:j(o,p),type:v,cId:this.request.correlationId})}else if(f==="rename"||!Gs(p,a,!et)){const v=setTimeout(async()=>{const m=await pe.exists(r);s.token.isCancellationRequested||(m?(this.onFileChange({resource:o,type:0,cId:this.request.correlationId},!0),n.add(await this.doWatch(!1))):this.onWatchedPathDeleted(o))},so.FILE_DELETE_HANDLER_DELAY);n.clear(),n.add(ye(()=>clearTimeout(v)))}else this.onFileChange({resource:o,type:0,cId:this.request.correlationId},!0)})}catch(o){if(s.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${o.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,i=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!i&&this.excludes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!i&&this.includes&&this.includes.length>0&&!this.includes.some(r=>r(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){const i=H4(e),r=[];for(const n of i){if(Q4(n,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${n.resource.fsPath}`);continue}r.push(n)}if(r.length===0)return;if(this.verboseLogging)for(const n of r)this.traceWithCorrelation(` >> normalized ${n.type===1?"[ADDED]":n.type===2?"[DELETED]":"[CHANGED]"} ${n.resource.fsPath}`);this.throttledFileChangesEmitter.work(r)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${r.length}, most recent change: ${r[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(et)return pe.exists(e);try{const i=Ct(e);return(await pe.readdir(pi(e))).some(s=>s===i)}catch(i){return this.trace(i),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}},w5=class extends g5{get watchers(){return this._watchers.values()}constructor(t){super(),this.recursiveWatcher=t,this.onDidError=ae.None,this._watchers=new Map,this.worker=this._register(new Ur)}async doWatch(t){t=this.removeDuplicateRequests(t);const e=[],i=new Set(Array.from(this.watchers));for(const r of t){const s=this._watchers.get(this.requestToWatcherKey(r));s&&Yf(s.request.excludes,r.excludes)&&Yf(s.request.includes,r.includes)?i.delete(s):e.push(r)}e.length&&this.trace(`Request to start watching: ${e.map(r=>this.requestToString(r)).join(",")}`),i.size&&this.trace(`Request to stop watching: ${Array.from(i).map(r=>this.requestToString(r.request)).join(",")}`),this.worker.clear();for(const r of i)this.stopWatching(r);this.createWatchWorker().work(e)}createWatchWorker(){return this.worker.value=new du({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},t=>{for(const e of t)this.startWatching(e)}),this.worker.value}requestToWatcherKey(t){return typeof t.correlationId=="number"?t.correlationId:this.pathToWatcherKey(t.path)}pathToWatcherKey(t){return et?t:t.toLowerCase()}startWatching(t){const e=new y5(t,this.recursiveWatcher,r=>this._onDidChangeFile.fire(r),()=>this._onDidWatchFail.fire(t),r=>this._onDidLogMessage.fire(r),this.verboseLogging),i={request:t,instance:e};this._watchers.set(this.requestToWatcherKey(t),i)}async stop(){await super.stop();for(const t of this.watchers)this.stopWatching(t)}stopWatching(t){this.trace("stopping file watcher",t),this._watchers.delete(this.requestToWatcherKey(t.request)),t.instance.dispose()}removeDuplicateRequests(t){const e=new Map;for(const i of t){let r=e.get(i.correlationId);r||(r=new Map,e.set(i.correlationId,r));const s=this.pathToWatcherKey(i.path);r.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(i)}`),r.set(s,i)}return Array.from(e.values()).map(i=>Array.from(i.values())).flat()}async setVerboseLogging(t){super.setVerboseLogging(t);for(const e of this.watchers)e.instance.setVerboseLogging(t)}trace(t,e){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(t,e)})}warn(t){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(t)})}toMessage(t,e){return e?`[File Watcher (node.js)] ${t} (${this.requestToString(e.request)})`:`[File Watcher (node.js)] ${t}`}},S5=class extends B4{constructor(t,e,i){super(t,e,i),this.init()}createWatcher(t){return t.add(new w5(void 0))}},b5=class Cs extends X4{static{this.TRACE_LOG_RESOURCE_LOCKS=!1}constructor(e,i){super(e,i),this.onDidChangeCapabilities=ae.None,this.resourceLocks=new Ge(r=>Ro.getComparisonKey(r)),this.mapHandleToPos=new Map,this.mapHandleToLock=new Map,this.writeHandles=new Map}get capabilities(){return this._capabilities||(this._capabilities=253982,et&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{const{stat:i,symbolicLink:r}=await yt.stat(this.toFilePath(e));return{type:this.toType(i,r),ctime:i.birthtime.getTime(),mtime:i.mtime.getTime(),size:i.size,permissions:(i.mode&128)===0?vr.Locked:void 0}}catch(i){throw this.toFileSystemProviderError(i)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){try{const i=this.toFilePath(e),r=await qf(i);return I.file(r)}catch(i){throw this.toFileSystemProviderError(i)}}async readdir(e){try{const i=await pe.readdir(this.toFilePath(e),{withFileTypes:!0}),r=[];return await Promise.all(i.map(async s=>{try{let n;s.isSymbolicLink()?n=(await this.stat(j(e,s.name))).type:n=this.toType(s),r.push([s.name,n])}catch(n){this.logService.trace(n)}})),r}catch(i){throw this.toFileSystemProviderError(i)}}toType(e,i){let r;return i?.dangling?r=dt.Unknown:e.isFile()?r=dt.File:e.isDirectory()?r=dt.Directory:r=dt.Unknown,i&&(r|=dt.SymbolicLink),r}async createResourceLock(e){const i=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${i})`);let r;for(;r=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${i})`),await r.wait();const s=new uu;return this.resourceLocks.set(e,s),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${i})`),ye(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${i})`),this.resourceLocks.get(e)===s&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${i})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${i})`),s.open()})}async readFile(e,i){let r;try{i?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),r=await this.createResourceLock(e));const s=this.toFilePath(e);return await _i.readFile(s)}catch(s){throw this.toFileSystemProviderError(s)}finally{r?.dispose()}}traceLock(e){Cs.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,i,r){const s=Js(n=>W.concat(n.map(o=>W.wrap(o))).buffer);return Wf(this,e,s,n=>n.buffer,{...i,bufferSize:256*1024},r),s}async writeFile(e,i,r){return r?.atomic!==!1&&r?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,j(Sg(e),`${cr(e)}${r.atomic.postfix}`),i,r):this.doWriteFile(e,i,r)}async canWriteFileAtomic(e){try{const i=this.toFilePath(e),{symbolicLink:r}=await yt.stat(i);if(r)return!1}catch{}return!0}async doWriteFileAtomic(e,i,r,s){const n=new lt;try{n.add(await this.createResourceLock(e)),n.add(await this.createResourceLock(i)),await this.doWriteFile(i,r,s,!0);try{await this.rename(i,e,{overwrite:!0})}catch(o){try{await this.delete(i,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw o}}finally{n.dispose()}}async doWriteFile(e,i,r,s){let n;try{const o=this.toFilePath(e);if(!r.create||!r.overwrite){if(await pe.exists(o)){if(!r.overwrite)throw ci(g(2054,null),$.FileExists)}else if(!r.create)throw ci(g(2055,null),$.FileNotFound)}if(n=await this.open(e,{create:!0,unlock:r.unlock},s),await this.write(n,0,i,0,i.byteLength),o.endsWith(".cursor/mcp.json")&&!_e)try{await _i.chmod(o,384),this.logService.trace(`Set secure permissions on MCP config file: ${o}`)}catch(a){this.logService.error(`Failed to set secure permissions on MCP config file: ${o}`,a)}}catch(o){throw await this.toFileSystemProviderWriteError(e,o)}finally{typeof n=="number"&&await this.close(n)}}static{this.canFlush=!0}static configureFlushOnWrite(e){Cs.canFlush=e}async open(e,i,r){const s=this.toFilePath(e);let n;mr(i)&&!r&&(n=await this.createResourceLock(e));let o;try{if(mr(i)&&i.unlock)try{const{stat:a}=await yt.stat(s);a.mode&128||await _i.chmod(s,a.mode|128)}catch(a){a.code!=="ENOENT"&&this.logService.trace(a)}if(_e&&mr(i))try{o=await pe.open(s,"r+"),await pe.ftruncate(o,0)}catch(a){if(a.code!=="ENOENT"&&this.logService.trace(a),typeof o=="number"){try{await pe.close(o)}catch(l){this.logService.trace(l)}o=void 0}}typeof o!="number"&&(o=await pe.open(s,mr(i)?"w":"r"))}catch(a){throw n?.dispose(),mr(i)?await this.toFileSystemProviderWriteError(e,a):this.toFileSystemProviderError(a)}if(this.mapHandleToPos.set(o,0),mr(i)&&this.writeHandles.set(o,e),n){const a=this.mapHandleToLock.get(o);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${o} (${s})`),this.mapHandleToLock.set(o,n),a&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${o} (${s})`),a.dispose())}return o}async close(e){const i=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&Cs.canFlush)try{await pe.fdatasync(e)}catch(r){Cs.configureFlushOnWrite(!1),this.logService.error(r)}return await pe.close(e)}catch(r){throw this.toFileSystemProviderError(r)}finally{i&&(this.mapHandleToLock.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),i.dispose())}}async read(e,i,r,s,n){const o=this.normalizePos(e,i);let a=null;try{a=(await pe.read(e,r,s,n,o)).bytesRead}catch(l){throw this.toFileSystemProviderError(l)}finally{this.updatePos(e,o,a)}return a}normalizePos(e,i){return i===this.mapHandleToPos.get(e)?null:i}updatePos(e,i,r){const s=this.mapHandleToPos.get(e);typeof s=="number"&&(typeof i=="number"||(typeof r=="number"?this.mapHandleToPos.set(e,s+r):this.mapHandleToPos.delete(e)))}async write(e,i,r,s,n){return Lg(()=>this.doWrite(e,i,r,s,n),100,3)}async doWrite(e,i,r,s,n){const o=this.normalizePos(e,i);let a=null;try{a=(await pe.write(e,r,s,n,o)).bytesWritten}catch(l){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),l)}finally{this.updatePos(e,o,a)}return a}async mkdir(e){try{await _i.mkdir(this.toFilePath(e))}catch(i){throw this.toFileSystemProviderError(i)}}async delete(e,i){try{const r=this.toFilePath(e);if(i.recursive){let s;i?.atomic!==!1&&i.atomic.postfix&&(s=G(pi(r),`${Ct(r)}${i.atomic.postfix}`)),await pe.rm(r,xr.MOVE,s)}else try{await _i.unlink(r)}catch(s){if(s.code==="EPERM"||s.code==="EISDIR"){let n=!1;try{const{stat:o,symbolicLink:a}=await yt.stat(r);n=o.isDirectory()&&!a}catch{}if(n)await _i.rmdir(r);else throw s}else throw s}}catch(r){throw this.toFileSystemProviderError(r)}}async rename(e,i,r){const s=this.toFilePath(e),n=this.toFilePath(i);if(s!==n)try{await this.validateMoveCopy(e,i,"move",r.overwrite),await pe.rename(s,n)}catch(o){throw(o.code==="EINVAL"||o.code==="EBUSY"||o.code==="ENAMETOOLONG")&&(o=new Error(g(2056,null,Ct(s),Ct(pi(n)),o.toString()))),this.toFileSystemProviderError(o)}}async copy(e,i,r){const s=this.toFilePath(e),n=this.toFilePath(i);if(s!==n)try{await this.validateMoveCopy(e,i,"copy",r.overwrite),await pe.copy(s,n,{preserveSymlinks:!0})}catch(o){throw(o.code==="EINVAL"||o.code==="EBUSY"||o.code==="ENAMETOOLONG")&&(o=new Error(g(2057,null,Ct(s),Ct(pi(n)),o.toString()))),this.toFileSystemProviderError(o)}}async validateMoveCopy(e,i,r,s){const n=this.toFilePath(e),o=this.toFilePath(i);let a=!1;if(!!(this.capabilities&1024)||(a=Gs(n,o,!0)),a){if(r==="copy")throw ci(g(2058,null),$.FileExists);if(r==="move")return}const c=await this.statIgnoreError(e);if(!c)throw ci(g(2059,null),$.FileNotFound);const h=await this.statIgnoreError(i);if(h){if(!s)throw ci(g(2060,null),$.FileExists);(c.type&dt.File)!==0&&(h.type&dt.File)!==0||await this.delete(i,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,i){return this.doCloneFile(e,i,!1)}async doCloneFile(e,i,r){const s=this.toFilePath(e),n=this.toFilePath(i),o=!!(this.capabilities&1024);if(Gs(s,n,!o))return;const a=new lt;try{a.add(await this.createResourceLock(e)),a.add(await this.createResourceLock(i)),r&&await _i.mkdir(pi(n),{recursive:!0}),await _i.copyFile(s,n)}catch(l){if(l.code==="ENOENT"&&!r)return this.doCloneFile(e,i,!0);throw this.toFileSystemProviderError(l)}finally{a.dispose()}}createUniversalWatcher(e,i,r){return new f5(s=>e(s),s=>i(s),r)}createNonRecursiveWatcher(e,i,r){return new S5(s=>e(s),s=>i(s),r)}toFileSystemProviderError(e){if(e instanceof na)return e;let i=e,r;switch(e.code){case"ENOENT":r=$.FileNotFound;break;case"EISDIR":r=$.FileIsADirectory;break;case"ENOTDIR":r=$.FileNotADirectory;break;case"EEXIST":r=$.FileExists;break;case"EPERM":case"EACCES":r=$.NoPermissions;break;case"ERR_UNC_HOST_NOT_ALLOWED":i=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,r=$.Unknown;break;default:r=$.Unknown}return ci(i,r)}async toFileSystemProviderWriteError(e,i){let r=this.toFileSystemProviderError(i);if(e&&r.code===$.NoPermissions)try{const{stat:s}=await yt.stat(this.toFilePath(e));s.mode&128||(r=ci(i,$.FileWriteLocked))}catch(s){this.logService.trace(s)}return r}},je=class{constructor(t,e=[],i=!1){this.ctor=t,this.staticArguments=e,this.supportsDelayedInstantiation=i}},E5=class{constructor(t,e){this.key=t,this.data=e,this.incoming=new Map,this.outgoing=new Map}},hd=class{constructor(t){this._hashFn=t,this._nodes=new Map}roots(){const t=[];for(const e of this._nodes.values())e.outgoing.size===0&&t.push(e);return t}insertEdge(t,e){const i=this.lookupOrInsertNode(t),r=this.lookupOrInsertNode(e);i.outgoing.set(r.key,r),r.incoming.set(i.key,i)}removeNode(t){const e=this._hashFn(t);this._nodes.delete(e);for(const i of this._nodes.values())i.outgoing.delete(e),i.incoming.delete(e)}lookupOrInsertNode(t){const e=this._hashFn(t);let i=this._nodes.get(e);return i||(i=new E5(e,t),this._nodes.set(e,i)),i}lookup(t){return this._nodes.get(this._hashFn(t))}isEmpty(){return this._nodes.size===0}toString(){const t=[];for(const[e,i]of this._nodes)t.push(`${e} (-> incoming)[${[...i.incoming.keys()].join(", ")}] (outgoing ->)[${[...i.outgoing.keys()].join(",")}] `);return t.join(` `)}findCycleSlow(){for(const[t,e]of this._nodes){const i=new Set([t]),r=this._findCycle(e,i);if(r)return r}}_findCycle(t,e){for(const[i,r]of t.outgoing){if(e.has(i))return[...e,i].join(" -> ");e.add(i);const s=this._findCycle(r,e);if(s)return s;e.delete(i)}}},fd=class{constructor(...t){this._entries=new Map;for(const[e,i]of t)this.set(e,i)}set(t,e){const i=this._entries.get(t);return this._entries.set(t,e),i}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},_5=!1,dd=class extends Error{constructor(t,e){super("cyclic dependency between services"),this.message=`REASON: ${e} `+(t.findCycleSlow()??`UNABLE to detect cycle, dumping graph: ${t.toString()}`)}},x5=class zl{constructor(e=new fd,i=!1,r,s=_5){this._services=e,this._strict=i,this._parent=r,this._enableTracing=s,this._isDisposed=!1,this._servicesToMaybeDispose=new Set,this._children=new Set,this._activeInstantiations=new Set,this._services.set(nn,this),this._globalGraph=s?r?._globalGraph??new hd(n=>n):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,_t(this._children),this._children.clear();for(const e of this._servicesToMaybeDispose)gc(e)&&e.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(e,i){this._throwIfDisposed();const r=this,s=new class extends zl{dispose(){r._children.delete(s),super.dispose()}}(e,this._strict,this,this._enableTracing);return this._children.add(s),i?.add(s),s}invokeFunction(e,...i){this._throwIfDisposed();const r=Sl.traceInvocation(this._enableTracing,e);let s=!1;try{return e({get:o=>{if(s)throw ic("service accessor is only valid during the invocation of its target method");const a=this._getOrCreateServiceInstance(o,r);if(!a)throw new Error(`[invokeFunction] unknown service '${o}'`);return a}},...i)}finally{s=!0,r.stop()}}createInstance(e,...i){this._throwIfDisposed();let r,s;return e instanceof je?(r=Sl.traceCreation(this._enableTracing,e.ctor),s=this._createInstance(e.ctor,e.staticArguments.concat(i),r)):(r=Sl.traceCreation(this._enableTracing,e),s=this._createInstance(e,i,r)),r.stop(),s}_createInstance(e,i=[],r){const s=Lt.getServiceDependencies(e).sort((a,l)=>a.index-l.index),n=[];for(const a of s){const l=this._getOrCreateServiceInstance(a.id,r);l||this._throwIfStrict(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id}.`,!1),n.push(l)}const o=s.length>0?s[0].index:i.length;if(i.length!==o){console.trace(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${i.length} static arguments`);const a=o-i.length;a>0?i=i.concat(new Array(a)):i=i.slice(0,o)}return Reflect.construct(e,i.concat(n))}_setCreatedServiceInstance(e,i){if(this._services.get(e)instanceof je)this._services.set(e,i);else if(this._parent)this._parent._setCreatedServiceInstance(e,i);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(e){const i=this._services.get(e);return!i&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):i}_getOrCreateServiceInstance(e,i){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(e));const r=this._getServiceInstanceOrDescriptor(e);return r instanceof je?this._safeCreateAndCacheServiceInstance(e,r,i.branch(e,!0)):(i.branch(e,!1),r)}_safeCreateAndCacheServiceInstance(e,i,r){if(this._activeInstantiations.has(e))throw new Error(`illegal state - RECURSIVELY instantiating service '${e}'`);this._activeInstantiations.add(e);try{return this._createAndCacheServiceInstance(e,i,r)}finally{this._activeInstantiations.delete(e)}}_createAndCacheServiceInstance(e,i,r){const s=new hd(l=>l.id.toString());let n=0;const o=[{id:e,desc:i,_trace:r}],a=new Set;for(;o.length;){const l=o.pop();if(!a.has(String(l.id))){if(a.add(String(l.id)),s.lookupOrInsertNode(l),n++>1e4)throw new dd(s,"cycle count more than 1000");for(const c of Lt.getServiceDependencies(l.desc.ctor)){const h=this._getServiceInstanceOrDescriptor(c.id);if(h||this._throwIfStrict(`[createInstance] ${e} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),h instanceof je){const f={id:c.id,desc:h,_trace:l._trace.branch(c.id,!0)};s.insertEdge(l,f),o.push(f)}}}}for(;;){const l=s.roots();if(l.length===0){if(!s.isEmpty())throw new dd(s,"no more roots but still nodes in the graph");break}for(const{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof je){const f=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,f)}s.removeNode(c)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,i,r=[],s,n){if(this._services.get(e)instanceof je)return this._createServiceInstance(e,i,r,s,n,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,i,r,s,n);throw new Error(`illegalState - creating UNKNOWN service instance ${i.name}`)}_createServiceInstance(e,i,r=[],s,n,o){if(s){const a=new zl(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(e);const l=new Map,c=new Rg(()=>{const h=a._createInstance(i,r,n);for(const[f,d]of l){const p=h[f];if(typeof p=="function")for(const v of d)v.disposable=p.apply(h,v.listener)}return l.clear(),o.add(h),h});return new Proxy(Object.create(null),{get(h,f){if(!c.isInitialized&&typeof f=="string"&&(f.startsWith("onDid")||f.startsWith("onWill"))){let v=l.get(f);return v||(v=new vc,l.set(f,v)),(w,S,_)=>{if(c.isInitialized)return c.value[f](w,S,_);{const P={listener:[w,S,_],disposable:void 0},N=v.push(P);return ye(()=>{N(),P.disposable?.dispose()})}}}if(f in h)return h[f];const d=c.value;let p=d[f];return typeof p!="function"||(p=p.bind(d),h[f]=p),p},set(h,f,d){return c.value[f]=d,!0},getPrototypeOf(h){return i.prototype}})}else{const a=this._createInstance(i,r,n);return o.add(a),a}}_throwIfStrict(e,i){if(i&&console.warn(e),this._strict)throw new Error(e)}},pd;(function(t){t[t.None=0]="None",t[t.Creation=1]="Creation",t[t.Invocation=2]="Invocation",t[t.Branch=3]="Branch"})(pd||(pd={}));var Sl=class Kt{static{this.all=new Set}static{this._None=new class extends Kt{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(e,i){return e?new Kt(2,i.name||new Error().stack.split(` `).slice(3,4).join(` `)):Kt._None}static traceCreation(e,i){return e?new Kt(1,i.name):Kt._None}static{this._totals=0}constructor(e,i){this.type=e,this.name=i,this._start=Date.now(),this._dep=[]}branch(e,i){const r=new Kt(3,e.toString());return this._dep.push([e,i,r]),r}stop(){const e=Date.now()-this._start;Kt._totals+=e;let i=!1;function r(n,o){const a=[],l=new Array(n+1).join(" ");for(const[c,h,f]of o._dep)if(h&&f){i=!0,a.push(`${l}CREATES -> ${c}`);const d=r(n+1,f);d&&a.push(d)}else a.push(`${l}uses -> ${c}`);return a.join(` `)}const s=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${r(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${Kt._totals.toFixed(2)}ms)`];(e>2||i)&&Kt.all.add(s.join(` `))}};function P5(t){return t.tags.find(e=>e.startsWith("lp-"))?.split("lp-")[1]}var I5=le("languagePackService"),bl=class extends K{constructor(e){super(),this.extensionGalleryService=e}async getAvailableLanguages(){const e=new sr;setTimeout(()=>e.cancel(),1e3);let i;try{i=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}const s=i.firstPage.filter(n=>n.properties.localizedLanguages?.length&&n.tags.some(o=>o.startsWith("lp-"))).map(n=>{const o=n.properties.localizedLanguages?.[0],a=P5(n);return{...this.createQuickPickItem(a,o,n),extensionId:n.identifier.id,galleryExtension:n}});return s.push(this.createQuickPickItem("en","English")),s}createQuickPickItem(e,i,r){const s=i??e;let n;if(s!==e&&(n=`(${e})`),e.toLowerCase()===Vt.toLowerCase()&&(n??="",n+=g(2069,null)),r?.installCount){n??="";const o=r.installCount;let a;o>1e6?a=`${Math.floor(o/1e5)/10}M`:o>1e3?a=`${Math.floor(o/1e3)}K`:a=String(o),n+=` $(cloud-download) ${a}`}return{id:e,label:s,description:n}}};bl=__decorate([__param(0,bi)],bl);import*as k5 from"fs";import{createHash as D5}from"crypto";var El=class extends bl{constructor(e,i,r,s){super(r),this.extensionManagementService=e,this.logService=s,this.cache=this._register(new _l(i,s)),this.extensionManagementService.registerParticipant({postInstall:async n=>this.postInstallExtension(n),postUninstall:async n=>this.postUninstallExtension(n)})}async getBuiltInExtensionTranslationsUri(e,i){const s=(await this.cache.getLanguagePacks())[i];if(!s){this.logService.warn(`No language pack found for ${i}`);return}const n=s.translations[e];return n?I.file(n):void 0}async getInstalledLanguages(){const e=await this.cache.getLanguagePacks(),i=Object.keys(e).map(r=>{const s=e[r];return{...this.createQuickPickItem(r,s.label),extensionId:s.extensions[0].extensionIdentifier.id}});return i.push(this.createQuickPickItem("en","English")),i.sort((r,s)=>r.label.localeCompare(s.label)),i}async postInstallExtension(e){e&&e.manifest&&e.manifest.contributes&&e.manifest.contributes.localizations&&e.manifest.contributes.localizations.length&&(this.logService.info("Adding language packs from the extension",e.identifier.id),await this.update())}async postUninstallExtension(e){const i=await this.cache.getLanguagePacks();Object.keys(i).some(r=>i[r]&&i[r].extensions.some(s=>J(s.extensionIdentifier,e.identifier)))&&(this.logService.info("Removing language packs from the extension",e.identifier.id),await this.update())}async update(){const[e,i]=await Promise.all([this.cache.getLanguagePacks(),this.extensionManagementService.getInstalled()]),r=await this.cache.update(i);return!tr(Object.keys(e),Object.keys(r))}};El=__decorate([__param(0,ma),__param(1,Pt),__param(2,bi),__param(3,he)],El);var _l=class extends K{constructor(e,i){super(),this.logService=i,this.languagePacks={},this.languagePacksFilePath=G(e.userDataPath,"languagepacks.json"),this.languagePacksFileLimiter=new Hr}getLanguagePacks(){return this.languagePacksFileLimiter.size||!this.initializedCache?this.withLanguagePacks().then(()=>this.languagePacks):Promise.resolve(this.languagePacks)}update(e){return this.withLanguagePacks(i=>{Object.keys(i).forEach(r=>delete i[r]),this.createLanguagePacksFromExtensions(i,...e)}).then(()=>this.languagePacks)}createLanguagePacksFromExtensions(e,...i){for(const r of i)r&&r.manifest&&r.manifest.contributes&&r.manifest.contributes.localizations&&r.manifest.contributes.localizations.length&&this.createLanguagePacksFromExtension(e,r);Object.keys(e).forEach(r=>this.updateHash(e[r]))}createLanguagePacksFromExtension(e,i){const r=i.identifier,s=i.manifest.contributes&&i.manifest.contributes.localizations?i.manifest.contributes.localizations:[];for(const n of s)if(i.location.scheme===ie.file&&C5(n)){let o=e[n.languageId];o||(o={hash:"",extensions:[],translations:{},label:n.localizedLanguageName??n.languageName},e[n.languageId]=o);const a=o.extensions.filter(l=>J(l.extensionIdentifier,r))[0];a?a.version=i.manifest.version:o.extensions.push({extensionIdentifier:r,version:i.manifest.version});for(const l of n.translations)o.translations[l.id]=G(i.location.fsPath,l.path)}}updateHash(e){if(e){const i=D5("md5");for(const r of e.extensions)i.update(r.extensionIdentifier.uuid||r.extensionIdentifier.id).update(r.version);e.hash=i.digest("hex")}}withLanguagePacks(e=()=>null){return this.languagePacksFileLimiter.queue(()=>{let i=null;return k5.promises.readFile(this.languagePacksFilePath,"utf8").then(void 0,r=>r.code==="ENOENT"?Promise.resolve("{}"):Promise.reject(r)).then(r=>{try{return JSON.parse(r)}catch{return{}}}).then(r=>(i=e(r),r)).then(r=>{for(const n of Object.keys(r))r[n]||delete r[n];this.languagePacks=r,this.initializedCache=!0;const s=JSON.stringify(this.languagePacks);return this.logService.debug("Writing language packs",s),pe.writeFile(this.languagePacksFilePath,s)}).then(()=>i,r=>this.logService.error(r))})}};_l=__decorate([__param(0,Pt),__param(1,he)],_l);function C5(t){if(typeof t.languageId!="string"||!Array.isArray(t.translations)||t.translations.length===0)return!1;for(const e of t.translations)if(typeof e.id!="string"||typeof e.path!="string")return!1;return!(t.languageName&&typeof t.languageName!="string"||t.localizedLanguageName&&typeof t.localizedLanguageName!="string")}function R5(t,e){const i=[];for(const r of new Set(Ri.concat(t.keys(),e.keys())))t.get(r)!==e.get(r)&&i.push(r);return i}var xl=class extends Qu{constructor(e,i,r){super(),this.file=e,this.fileService=i,this.logService=r,this.throttledDelayer=this._register(new Mi(500));const s=ae.filter(i.onDidFilesChange,n=>n.affects(e));this._register(i.watch(e)),this._register(s(()=>this.throttledDelayer.trigger(()=>this.refresh())))}async _updatePolicyDefinitions(){await this.refresh()}async read(){const e=new Map;try{const i=await this.fileService.readFile(this.file),r=JSON.parse(i.value.toString());if(!Ne(r))throw new Error("Policy file isn't a JSON object");for(const s of Object.keys(r))this.policyDefinitions[s]&&e.set(s,r[s])}catch(i){i.fileOperationResult!==1&&this.logService.error("[FilePolicyService] Failed to read policies",i)}return e}async refresh(){const e=await this.read(),i=R5(this.policies,e);this.policies=e,i.length>0&&this._onDidChange.fire(i)}};xl=__decorate([__param(1,Pe),__param(2,he)],xl);var Bn=class extends Qu{constructor(e,i){super(),this.logService=e,this.productName=i,this.throttler=new lu,this.watcher=this._register(new Ur)}async _updatePolicyDefinitions(e){this.logService.trace(`NativePolicyService#_updatePolicyDefinitions - Found ${Object.keys(e).length} policy definitions`);const{createWatcher:i}=await import("@vscode/policy-watcher");await this.throttler.queue(()=>new Promise((r,s)=>{try{this.watcher.value=i(this.productName,e,n=>{this._onDidPolicyChange(n),r()})}catch(n){this.logService.error("NativePolicyService#_updatePolicyDefinitions - Error creating watcher:",n),s(n)}}))}_onDidPolicyChange(e){this.logService.trace(`NativePolicyService#_onDidPolicyChange - Updated policy values: ${JSON.stringify(e)}`);for(const i in e){const r=e[i];r===void 0?this.policies.delete(i):this.policies.set(i,r)}this._onDidChange.fire(Object.keys(e))}};Bn=__decorate([__param(0,he)],Bn);import{parse as gd}from"url";import{spawn as L5}from"child_process";import{userInfo as A5}from"os";import*as md from"os";var vd=/^\d+$/,O5=/^Microsoft.PowerShell_.*/,F5=/^Microsoft.PowerShellPreview_.*/,yd;(function(t){t[t.x64=0]="x64",t[t.x86=1]="x86",t[t.ARM=2]="ARM"})(yd||(yd={}));var ws;switch(process.arch){case"ia32":ws=1;break;case"arm":case"arm64":ws=2;break;default:ws=0;break}var Dr;process.env.PROCESSOR_ARCHITEW6432?Dr=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Dr=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Dr=1:Dr=0;var Ss=class{constructor(t,e,i){this.exePath=t,this.displayName=e,this.knownToExist=i}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await yt.existsFile(this.exePath)),this.knownToExist}};function T5({useAlternateBitness:t=!1}={}){return t?ws===0?process.env["ProgramFiles(x86)"]||null:Dr===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function zn({useAlternateBitness:t=!1,findPreview:e=!1}={}){const i=T5({useAlternateBitness:t});if(!i)return null;const r=G(i,"PowerShell");if(!await yt.existsDirectory(r))return null;let s=-1,n=null;for(const l of await pe.readdir(r)){let c=-1;if(e){const f=l.indexOf("-");if(f<0)continue;const d=l.substring(0,f);if(!vd.test(d)||l.substring(f+1)!=="preview")continue;c=parseInt(d,10)}else{if(!vd.test(l))continue;c=parseInt(l,10)}if(c<=s)continue;const h=G(r,l,"pwsh.exe");await yt.existsFile(h)&&(n=h,s=c)}if(!n)return null;const o=i.includes("x86")?" (x86)":"",a=e?" Preview":"";return new Ss(n,`PowerShell${a}${o}`,!0)}async function wd({findPreview:t}={}){if(!process.env.LOCALAPPDATA)return null;const e=G(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await yt.existsDirectory(e))return null;const{pwshMsixDirRegex:i,pwshMsixName:r}=t?{pwshMsixDirRegex:F5,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:O5,pwshMsixName:"PowerShell (Store)"};for(const s of await pe.readdir(e))if(i.test(s)){const n=G(e,s,"pwsh.exe");return new Ss(n,r)}return null}function N5(){const t=G(md.homedir(),".dotnet","tools","pwsh.exe");return new Ss(t,".NET Core PowerShell Global Tool")}function M5(){const t=G(md.homedir(),"scoop","apps"),e=G(t,"pwsh","current","pwsh.exe");return new Ss(e,"PowerShell (Scoop)")}function U5(){const t=G(process.env.windir,ws===1&&Dr!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new Ss(t,"Windows PowerShell",!0)}async function*V5(){let t=await zn();t&&(yield t),t=await zn({useAlternateBitness:!0}),t&&(yield t),t=await wd(),t&&(yield t),t=N5(),t&&(yield t),t=await zn({findPreview:!0}),t&&(yield t),t=await wd({findPreview:!0}),t&&(yield t),t=await zn({useAlternateBitness:!0,findPreview:!0}),t&&(yield t),t=await M5(),t&&(yield t),t=U5(),t&&(yield t)}async function*W5(){for await(const t of V5())await t.exists()&&(yield t)}async function $5(){for await(const t of W5())return t;return null}async function q5(t,e){return t===1?_e?B5():c5(e):j5(t,e)}var Pl=null;function j5(t,e){if(et&&t===2||Mt&&t===3)return"/bin/bash";if(!Pl){let i;if(_e)i="/bin/bash";else{if(i=e.SHELL,!i)try{i=A5().shell}catch{}i||(i="sh"),i==="/bin/false"&&(i="/bin/bash")}Pl=i}return Pl}var Il=null;async function B5(){return Il||(Il=(await $5()).exePath),Il}import"assert";var Lw=d1(p1(),1),Aw={o:g(1852,null),e:g(1853,null),t:g(1854,null)},Ow={tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1855,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:g(1856,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:g(1857,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:g(1858,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:g(1859,null)},remove:{type:"boolean",cat:"o",args:"folder",description:g(1860,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:g(1861,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:g(1862,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:g(1863,null)},wait:{type:"boolean",cat:"o",alias:"w",description:g(1864,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:g(1865,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:g(1866,null)},profile:{type:"string",cat:"o",args:"profileName",description:g(1867,null)},help:{type:"boolean",cat:"o",alias:"h",description:g(1868,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:g(1869,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:g(1870,null)},"show-versions":{type:"boolean",cat:"e",description:g(1871,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:g(1872,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:g(1873,null)},"pre-release":{type:"boolean",cat:"e",description:g(1874,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:g(1875,null)},"update-extensions":{type:"boolean",cat:"e",description:g(1876,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:g(1877,null)},"add-mcp":{type:"string[]",cat:"o",args:"json",description:g(1878,null)},version:{type:"boolean",cat:"t",alias:"v",description:g(1879,null)},verbose:{type:"boolean",cat:"t",global:!0,description:g(1880,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:g(1881,null)},status:{type:"boolean",alias:"s",cat:"t",description:g(1882,null)},"prof-startup":{type:"boolean",cat:"t",description:g(1883,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:g(1884,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:g(1885,null)},sync:{type:"string",cat:"t",description:g(1886,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:g(1887,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:g(1888,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:g(1889,null)},"disable-gpu":{type:"boolean",cat:"t",description:g(1890,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:g(1891,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:g(1892,null)},telemetry:{type:"boolean",cat:"t",description:g(1893,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"skip-onboarding":{type:"boolean"},"override-cursor-auth-token":{type:"string"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"shadow-window-for-workspace-id":{type:"string"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},hmr:{type:"boolean"},_:{type:"string[]"}};function Sd(t){return t.VSCODE_CLI==="1"}function z5(t,e,i){return Math.min(Math.max(t,e),i)}var kl=void 0;async function H5(t,e,i,r){return i["force-disable-user-env"]?(e.trace("resolveShellEnv(): skipped (--force-disable-user-env)"),{}):_e?(e.trace("resolveShellEnv(): skipped (Windows)"),{}):Sd(r)&&!i["force-user-env"]?(e.trace("resolveShellEnv(): skipped (VSCODE_CLI is set)"),{}):(Sd(r)?e.trace("resolveShellEnv(): running (--force-user-env)"):e.trace("resolveShellEnv(): running (macOS/Linux)"),kl||(kl=ht.withAsyncBody(async(s,n)=>{const o=new sr;let a=1e4;const l=t.getValue("application.shellEnvironmentResolutionTimeout");typeof l=="number"&&(a=z5(l,1,120)*1e3);const c=setTimeout(()=>{o.dispose(!0),n(new Error(g(2227,null)))},a);try{s(await K5(e,o.token))}catch(h){!Ci(h)&&!o.token.isCancellationRequested?n(new Error(g(2228,null,Ui(h)))):s({})}finally{clearTimeout(c),o.dispose()}})),kl)}async function K5(t,e){const i=process.env.ELECTRON_RUN_AS_NODE;t.trace("getUnixShellEnvironment#runAsNode",i);const r=process.env.ELECTRON_NO_ATTACH_CONSOLE;t.trace("getUnixShellEnvironment#noAttach",r);const s=pt().replace(/-/g,"").substr(0,12),n=new RegExp(s+"({.*})"+s),o={...process.env,ELECTRON_RUN_AS_NODE:"1",ELECTRON_NO_ATTACH_CONSOLE:"1",VSCODE_RESOLVING_ENVIRONMENT:"1"};t.trace("getUnixShellEnvironment#env",o);const a=await q5(yo,o);return t.trace("getUnixShellEnvironment#shell",a),new Promise((l,c)=>{if(e.isCancellationRequested)return c(new Te);const h=Ct(a);let f,d;const p="";/^(?:pwsh|powershell)(?:-preview)?$/.test(h)?(f=`& '${process.execPath}' ${p} -p '''${s}'' + JSON.stringify(process.env) + ''${s}'''`,d=["-Login","-Command"]):h==="nu"?(f=`^'${process.execPath}' ${p} -p '"${s}" + JSON.stringify(process.env) + "${s}"'`,d=["-i","-l","-c"]):h==="xonsh"?(f=`import os, json; print("${s}", json.dumps(dict(os.environ)), "${s}")`,d=["-i","-l","-c"]):(f=`'${process.execPath}' ${p} -p '"${s}" + JSON.stringify(process.env) + "${s}"'`,h==="tcsh"||h==="csh"?d=["-ic"]:d=["-i","-l","-c"]),t.trace("getUnixShellEnvironment#spawn",JSON.stringify(d),f);const v=L5(a,[...d,f],{detached:!0,stdio:["ignore","pipe","pipe"],env:o});e.onCancellationRequested(()=>(v.kill(),c(new Te))),v.on("error",S=>{t.error("getUnixShellEnvironment#errorChildProcess",Ui(S)),c(S)});const m=[];v.stdout.on("data",S=>m.push(S));const w=[];v.stderr.on("data",S=>w.push(S)),v.on("close",(S,_)=>{const P=Buffer.concat(m).toString("utf8");t.trace("getUnixShellEnvironment#raw",P);const N=Buffer.concat(w).toString("utf8");if(N.trim()&&t.trace("getUnixShellEnvironment#stderr",N),S||_)return c(new Error(g(2229,null,S,_)));const x=n.exec(P),A=x?x[1]:"{}";try{const M=JSON.parse(A);i?M.ELECTRON_RUN_AS_NODE=i:delete M.ELECTRON_RUN_AS_NODE,r?M.ELECTRON_NO_ATTACH_CONSOLE=r:delete M.ELECTRON_NO_ATTACH_CONSOLE,delete M.VSCODE_RESOLVING_ENVIRONMENT,delete M.XDG_RUNTIME_DIR,t.trace("getUnixShellEnvironment#result",M),l(M)}catch(M){t.error("getUnixShellEnvironment#errorCaught",Ui(M)),c(M)}})})}import{parse as bd}from"url";function G5(t,e){return t.protocol==="http:"?e.HTTP_PROXY||e.http_proxy||null:t.protocol==="https:"&&(e.HTTPS_PROXY||e.https_proxy||e.HTTP_PROXY||e.http_proxy)||null}async function Q5(t,e,i={}){const r=bd(t),s=i.proxyUrl||G5(r,e);if(!s)return null;const n=bd(s);if(!/^https?:$/.test(n.protocol||""))return null;const o={host:n.hostname||"",port:(n.port?+n.port:0)||(n.protocol==="https"?443:80),auth:n.auth,rejectUnauthorized:Dt(i.strictSSL)?i.strictSSL:!0};if(r.protocol==="http:"){const{default:a}=await import("http-proxy-agent");return new a.HttpProxyAgent(s,o)}else{const{default:a}=await import("https-proxy-agent");return new a.HttpsProxyAgent(s,o)}}import{createGunzip as J5}from"zlib";var Dl=class extends j0{constructor(e,i,r,s){super(s),this.machine=e,this.configurationService=i,this.environmentService=r,this.configure(),this._register(i.onDidChangeConfiguration(n=>{n.affectsConfiguration("http")&&this.configure()}))}configure(){this.proxyUrl=this.getConfigValue("http.proxy"),this.strictSSL=!!this.getConfigValue("http.proxyStrictSSL"),this.authorization=this.getConfigValue("http.proxyAuthorization")}async request(e,i){const{proxyUrl:r,strictSSL:s}=this;let n;try{n=await H5(this.configurationService,this.logService,this.environmentService.args,process.env)}catch(l){this.shellEnvErrorLogged||(this.shellEnvErrorLogged=!0,this.logService.error("resolving shell environment failed",H(l)))}const o={...process.env,...n},a=e.agent?e.agent:await Q5(e.url||"",o,{proxyUrl:r,strictSSL:s});return e.agent=a,e.strictSSL=s,this.authorization&&(e.headers={...e.headers||{},"Proxy-Authorization":this.authorization}),this.logAndRequest(e,()=>Cl(e,i))}async resolveProxy(e){}async lookupAuthorization(e){}async lookupKerberosAuthorization(e){try{const i=this.getConfigValue("http.proxyKerberosServicePrincipal");return"Negotiate "+await X5(e,i,this.logService,"RequestService#lookupKerberosAuthorization")}catch(i){this.logService.debug("RequestService#lookupKerberosAuthorization Kerberos authentication failed",i);return}}async loadCertificates(){return(await import("@vscode/proxy-agent")).loadSystemCertificates({log:this.logService})}getConfigValue(e){if(this.machine==="remote")return this.configurationService.getValue(e);const i=this.configurationService.inspect(e);return i.userLocalValue||i.defaultValue}};Dl=__decorate([__param(1,ni),__param(2,Pt),__param(3,he)],Dl);async function X5(t,e,i,r){const s=await import("kerberos"),n=s.default||s,o=new URL(t),a=e||(process.platform==="win32"?`HTTP/${o.hostname}`:`HTTP@${o.hostname}`);return i.debug(`${r} Kerberos authentication lookup`,`proxyURL:${o}`,`spn:${a}`),(await n.initializeClient(a)).step("")}async function Y5(t){return(gd(t.url).protocol==="https:"?await import("https"):await import("http")).request}async function Cl(t,e){return ht.withAsyncBody(async(i,r)=>{const s=gd(t.url),n=t.getRawRequest?t.getRawRequest(t):await Y5(t),o={hostname:s.hostname,port:s.port?parseInt(s.port):s.protocol==="https:"?443:80,protocol:s.protocol,path:s.path,method:t.type||"GET",headers:t.headers,agent:t.agent,rejectUnauthorized:Dt(t.strictSSL)?t.strictSSL:!0};t.user&&t.password&&(o.auth=t.user+":"+t.password),t.disableCache&&(o.cache="no-store");const a=n(o,l=>{const c=hc(t.followRedirects)?t.followRedirects:3;if(l.statusCode&&l.statusCode>=300&&l.statusCode<400&&c>0&&l.headers.location)l.statusCode===303?Cl({...t,url:l.headers.location,type:"GET",followRedirects:c-1},e).then(i,r):Cl({...t,url:l.headers.location,followRedirects:c-1},e).then(i,r);else{let h=l;!t.isChromiumNetwork&&l.headers["content-encoding"]==="gzip"&&(h=l.pipe(J5())),i({res:l,stream:rg(h)})}});if(a.on("error",r),t.timeout)if(t.isChromiumNetwork){const l=setTimeout(()=>{a.abort(),r(new Error(`Request timeout after ${t.timeout}ms`))},t.timeout);a.on("response",()=>clearTimeout(l)),a.on("error",()=>clearTimeout(l)),a.on("abort",()=>clearTimeout(l))}else a.setTimeout(t.timeout);t.isChromiumNetwork&&a.removeHeader("Content-Length"),t.data&&typeof t.data=="string"&&a.write(t.data),a.end(),e.onCancellationRequested(()=>{a.abort(),r(new Te)})})}var Ed;(function(t){t[t.IMMEDIATE=0]="IMMEDIATE",t[t.DELAYED=1]="DELAYED"})(Ed||(Ed={}));var Z5=class extends K{constructor(t,e,i,r){super(),this.storagePath=t,this.logService=i,this.fileService=r,this.storage=Object.create(null),this.lastSavedStorageContents="",this.initializing=void 0,this.closing=void 0,this.flushDelayer=this._register(new Mi(e===0?0:100))}init(){return this.initializing||(this.initializing=this.doInit()),this.initializing}async doInit(){try{this.lastSavedStorageContents=(await this.fileService.readFile(this.storagePath)).value.toString(),this.storage=JSON.parse(this.lastSavedStorageContents)}catch(t){t.fileOperationResult!==1&&this.logService.error(t)}}getItem(t,e){const i=this.storage[t];return Qe(i)?e:i}setItem(t,e){this.setItems([{key:t,data:e}])}setItems(t){let e=!1;for(const{key:i,data:r}of t)this.storage[i]!==r&&(Qe(r)?Et(this.storage[i])||(this.storage[i]=void 0,e=!0):(this.storage[i]=r,e=!0));e&&this.save()}removeItem(t){Et(this.storage[t])||(this.storage[t]=void 0,this.save())}async save(){if(!this.closing)return this.flushDelayer.trigger(()=>this.doSave())}async doSave(){if(!this.initializing)return;await this.initializing;const t=JSON.stringify(this.storage,null,4);if(t!==this.lastSavedStorageContents)try{await this.fileService.writeFile(this.storagePath,W.fromString(t),{atomic:{postfix:".vsctmp"}}),this.lastSavedStorageContents=t}catch(e){this.logService.error(e)}}async close(){return this.closing||(this.closing=this.flushDelayer.trigger(()=>this.doSave(),0)),this.closing}},Hn=class extends K{constructor(e,i,r,s){super(),this.fileStorage=this._register(new Z5(i.stateResource,e,r,s))}async init(){await this.fileStorage.init()}getItem(e,i){return this.fileStorage.getItem(e,i)}};Hn=__decorate([__param(1,ui),__param(2,he),__param(3,Pe)],Hn);var ey=class extends Hn{setItem(t,e){this.fileStorage.setItem(t,e)}setItems(t){this.fileStorage.setItems(t)}removeItem(t){this.fileStorage.removeItem(t)}close(){return this.fileStorage.close()}},Rl=class{static{this.IDLE_START_EVENT_NAME="UserIdleStart"}static{this.IDLE_STOP_EVENT_NAME="UserIdleStop"}constructor(e,i,r){this._configurationService=i,this._productService=r,this._experimentProperties={},this._disposables=new lt,this._cleanupPatterns=[],this._appenders=e.appenders,this._commonProperties=e.commonProperties??Object.create(null),this.sessionId=this._commonProperties.sessionID,this.machineId=this._commonProperties["common.machineId"],this.macMachineId=this._commonProperties["common.macMachineId"],this.sqmId=this._commonProperties["common.sqmId"],this.devDeviceId=this._commonProperties["common.devDeviceId"],this.firstSessionDate=this._commonProperties["common.firstSessionDate"],this.msftInternal=this._commonProperties["common.msftInternal"],this._piiPaths=e.piiPaths||[],this._telemetryLevel=3,this._sendErrorTelemetry=!!e.sendErrorTelemetry,this._cleanupPatterns=[/(vscode-)?file:\/\/\/.*?\/resources\/app\//gi];for(const s of this._piiPaths)this._cleanupPatterns.push(new RegExp(ar(s),"gi")),s.indexOf("\\")>=0&&this._cleanupPatterns.push(new RegExp(ar(s.replace(/\\/g,"/")),"gi"));this._updateTelemetryLevel(),this._disposables.add(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration(xn)||s.affectsConfiguration(wa)||s.affectsConfiguration(Ah))&&this._updateTelemetryLevel()}))}setExperimentProperty(e,i){this._experimentProperties[e]=i}_updateTelemetryLevel(){let e=Nh(this._configurationService);const i=this._productService.enabledTelemetryLevels;if(i){this._sendErrorTelemetry=this.sendErrorTelemetry?i.error:!1;const r=i.usage?3:i.error?2:0;e=Math.min(e,r)}this._telemetryLevel=e}get sendErrorTelemetry(){return this._sendErrorTelemetry}get telemetryLevel(){return this._telemetryLevel}dispose(){this._disposables.dispose()}_log(e,i,r){this._telemetryLevels.log(e,r)))}_capture(e,i,r){this._telemetryLevel{s.capture(e,r)}))}registerAuthId(e){this._appenders.forEach(i=>i.registerAuthId(e))}publicLog(e,i){this._log(e,3,i)}publicLog2(e,i){this.publicLog(e,i)}publicLogError(e,i){this._sendErrorTelemetry&&this._log(e,2,i)}publicLogError2(e,i){this.publicLogError(e,i)}publicLogCapture(e,i){this._capture(e,3,i)}};Rl=__decorate([__param(1,ni),__param(2,mt)],Rl);function ty(){const t=g(2231,null,Bt.nameLong),e=g(2232,null,"https://cursor.com/privacy","https://cursor.com/security"),i=ei?"":g(2233,null);return` ${t} ${e} ${i} `}var iy=qt.as(mi.Configuration);iy.registerConfiguration({id:Im,order:1,type:"object",title:"Crash Reporting",properties:{[xn]:{type:"string",enum:["all","off"],enumDescriptions:["Send OS-level crash reports.","Disable crash reporting."],markdownDescription:ty(),default:"all",restricted:!0,scope:1,tags:["usesOnlineServices","telemetry"]},"telemetry.feedback.enabled":{type:"boolean",default:!1,description:g(2234,null)},[wa]:{type:"boolean",markdownDescription:Bt.privacyStatementUrl?g(2236,null,Bt.nameLong,Bt.privacyStatementUrl):g(2235,null,Bt.nameLong),default:!0,restricted:!0,markdownDeprecationMessage:g(2237,null,`\`#${xn}#\``),scope:1,tags:["usesOnlineServices","telemetry"]}}});import*as ry from"https";import sy from"node-fetch";var ny=class{constructor(t,e,i,r,s){this._isInternalTelemetry=t,this._eventPrefix=e,this._defaultData=i,this._xhrOverride=s,this._defaultData||(this._defaultData={}),typeof r=="function"?this._faroCoreOrKey=r():this._faroCoreOrKey=r,this._asyncFaroCore=null}registerAuthId(t){this._authId=t}_withAIClient(t){}log(t,e){}capture(t,e){}flush(){return this._faroCoreOrKey?new Promise(t=>{this._withAIClient(e=>{e.unload(!0,()=>{this._faroCoreOrKey=void 0,t(void 0)})})}):Promise.resolve(void 0)}};async function oy(t,e){const i=await e.request(t,de.None),r=(await Ni(i.stream)).toString(),s=i.res.statusCode??200;return{headers:i.res.headers,statusCode:s,responseData:r}}async function ay(t){const e={method:t.type,headers:t.headers};return new Promise((r,s)=>{const n=ry.request(t.url??"",e,o=>{o.on("data",function(a){r({headers:o.headers,statusCode:o.statusCode??200,responseData:a.toString()})}),o.on("error",function(a){s(a)})});n.write(t.data,o=>{o&&s(o)}),n.end()})}async function ly(t,e,i){const r=typeof e.data=="string"?e.data:new TextDecoder().decode(e.data),s={type:"POST",headers:{...e.headers,"Content-Type":"application/json","Content-Length":Buffer.byteLength(e.data).toString()},url:e.urlString,data:r};try{const n=t?await oy(s,t):await ay(s);i(n.statusCode,n.headers,n.responseData)}catch{i(0,{})}}var cy=class extends ny{constructor(t,e,i,r,s){const n={sendPOST:(o,a)=>{ly(t,o,a)}};super(e,i,r,s,n)}fetch(t,e){return sy(t,e)}};import*as Kn from"fs";async function uy(t,e){const i=Object.create(null),r=(n,o)=>{const a=JSON.parse(n);i[o]=a};if(e){const n=[],o=await pe.readdir(e);for(const l of o)try{(await Kn.promises.stat(G(e,l))).isDirectory()&&n.push(l)}catch{}const a=[];for(const l of n)(await pe.readdir(G(e,l))).filter(h=>h==="telemetry.json").length===1&&a.push(l);for(const l of a){const c=(await Kn.promises.readFile(G(e,l,"telemetry.json"))).toString();r(c,l)}}let s=(await Kn.promises.readFile(G(t,"telemetry-core.json"))).toString();return r(s,"vscode-core"),s=(await Kn.promises.readFile(G(t,"telemetry-extensions.json"))).toString(),r(s,"vscode-extensions"),JSON.stringify(i,null,4)}var hy=[],_d;(function(t){t[t.Eager=0]="Eager",t[t.Delayed=1]="Delayed"})(_d||(_d={}));function fy(t,e,i){e instanceof je||(e=new je(e,[],!!i)),hy.push([t,e])}var xd,Ll=class{constructor(t,e,i){this.level=t,this.key=e,this.value=i,this.forward=[]}},bs=void 0,dy=class Lr{constructor(e,i=2**16){this.comparator=e,this[xd]="SkipList",this._level=0,this._size=0,this._maxLevel=Math.max(1,Math.log2(i)|0),this._header=new Ll(this._maxLevel,bs,bs)}get size(){return this._size}clear(){this._header=new Ll(this._maxLevel,bs,bs),this._size=0}has(e){return!!Lr._search(this,e,this.comparator)}get(e){return Lr._search(this,e,this.comparator)?.value}set(e,i){return Lr._insert(this,e,i,this.comparator)&&(this._size+=1),this}delete(e){const i=Lr._delete(this,e,this.comparator);return i&&(this._size-=1),i}forEach(e,i){let r=this._header.forward[0];for(;r;)e.call(i,r.value,r.key,this),r=r.forward[0]}[(xd=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*entries(){let e=this._header.forward[0];for(;e;)yield[e.key,e.value],e=e.forward[0]}*keys(){let e=this._header.forward[0];for(;e;)yield e.key,e=e.forward[0]}*values(){let e=this._header.forward[0];for(;e;)yield e.value,e=e.forward[0]}toString(){let e="[SkipList]:",i=this._header.forward[0];for(;i;)e+=`node(${i.key}, ${i.value}, lvl:${i.level})`,i=i.forward[0];return e}static _search(e,i,r){let s=e._header;for(let n=e._level-1;n>=0;n--)for(;s.forward[n]&&r(s.forward[n].key,i)<0;)s=s.forward[n];if(s=s.forward[0],s&&r(s.key,i)===0)return s}static _insert(e,i,r,s){const n=[];let o=e._header;for(let a=e._level-1;a>=0;a--){for(;o.forward[a]&&s(o.forward[a].key,i)<0;)o=o.forward[a];n[a]=o}if(o=o.forward[0],o&&s(o.key,i)===0)return o.value=r,!1;{const a=Lr._randomLevel(e);if(a>e._level){for(let l=e._level;l=0;o--){for(;n.forward[o]&&r(n.forward[o].key,i)<0;)n=n.forward[o];s[o]=n}if(n=n.forward[0],!n||r(n.key,i)!==0)return!1;for(let o=0;o0&&e._header.forward[e._level-1]===bs;)e._level-=1;return!0}},Pd=class Hl{static{this._clock=0}constructor(e){this.uri=e,this.time=Hl._clock++}touch(){return this.time=Hl._clock++,this}},Es=class{constructor(e){this._fileService=e,this._dispooables=new lt,this._limit=2**16;const i=new Map,r=s=>{let n=i.get(s.scheme);return n===void 0&&(n=e.hasProvider(s)&&!this._fileService.hasCapability(s,1024),i.set(s.scheme,n)),n};this._dispooables.add(ae.any(e.onDidChangeFileSystemProviderRegistrations,e.onDidChangeFileSystemProviderCapabilities)(s=>{i.delete(s.scheme)})),this.extUri=new tn(r),this._canonicalUris=new dy((s,n)=>this.extUri.compare(s,n,!0),this._limit)}dispose(){this._dispooables.dispose(),this._canonicalUris.clear()}asCanonicalUri(e){this._fileService.hasProvider(e)&&(e=bg(e));const i=this._canonicalUris.get(e);return i?i.touch().uri.with({fragment:e.fragment}):(this._canonicalUris.set(e,new Pd(e)),this._checkTrim(),e)}_checkTrim(){if(this._canonicalUris.sizer[1].times[1].time?-1:0);Pd._clock=0,this._canonicalUris.clear();const i=this._limit*.5;for(let r=0;r({...i,location:Re(i.location)?this.uriIdentityService.extUri.joinPath(this.profilesHome,i.location):I.revive(i.location)}))}getStoredProfileAssociations(){return this.stateReadonlyService.getItem(Gn.PROFILE_ASSOCIATIONS_KEY,{})}getDefaultProfileExtensionsLocation(){return this.uriIdentityService.extUri.joinPath(I.file(this.nativeEnvironmentService.extensionsPath).with({scheme:this.profilesHome.scheme}),"extensions.json")}};Qn=Gn=__decorate([__param(0,py),__param(1,qe),__param(2,Pt),__param(3,Pe),__param(4,he)],Qn);var Al=Cr=class extends Qn{constructor(e,i,r,s,n){super(e,i,r,s,n),this.stateService=e}saveStoredProfiles(e){e.length?this.stateService.setItem(Cr.PROFILES_KEY,e.map(i=>({...i,location:this.uriIdentityService.extUri.basename(i.location)}))):this.stateService.removeItem(Cr.PROFILES_KEY)}saveStoredProfileAssociations(e){e.emptyWindows||e.workspaces?this.stateService.setItem(Cr.PROFILE_ASSOCIATIONS_KEY,e):this.stateService.removeItem(Cr.PROFILE_ASSOCIATIONS_KEY)}};Al=Cr=__decorate([__param(0,gy),__param(1,qe),__param(2,Pt),__param(3,Pe),__param(4,he)],Al);var Id=class extends Al{constructor(e,i,r,s){super(new ey(0,i,s,r),e,i,r,s)}async init(){return await this.stateService.init(),super.init()}};Id=__decorate([__param(0,qe),__param(1,Pt),__param(2,Pe),__param(3,he)],Id);import{networkInterfaces as my}from"os";import{networkInterfaces as vy}from"os";var yy=new Set(["00:00:00:00:00:00","ff:ff:ff:ff:ff:ff","ac:de:48:00:11:22"]);function wy(t){const e=t.replace(/\-/g,":").toLowerCase();return!yy.has(e)}function Sy(){const t=vy();for(const e in t){const i=t[e];if(i){for(const{mac:r}of i)if(wy(r))return r}}throw new Error("Unable to retrieve mac address (unexpected format)")}import{platform as Ol}from"process";import{execSync as by}from"child_process";var Gw=new class{_isVirtualMachineMacAddress(t){return this._virtualMachineOUIs||(this._virtualMachineOUIs=gr.forStrings(),this._virtualMachineOUIs.set("00-50-56",!0),this._virtualMachineOUIs.set("00-0C-29",!0),this._virtualMachineOUIs.set("00-05-69",!0),this._virtualMachineOUIs.set("00-03-FF",!0),this._virtualMachineOUIs.set("00-1C-42",!0),this._virtualMachineOUIs.set("00-16-3E",!0),this._virtualMachineOUIs.set("08-00-27",!0),this._virtualMachineOUIs.set("00:50:56",!0),this._virtualMachineOUIs.set("00:0C:29",!0),this._virtualMachineOUIs.set("00:05:69",!0),this._virtualMachineOUIs.set("00:03:FF",!0),this._virtualMachineOUIs.set("00:1C:42",!0),this._virtualMachineOUIs.set("00:16:3E",!0),this._virtualMachineOUIs.set("08:00:27",!0)),!!this._virtualMachineOUIs.findSubstr(t)}value(){if(this._value===void 0){let t=0,e=0;const i=my();for(const r in i){const s=i[r];if(s)for(const{mac:n,internal:o}of s)o||(e+=1,this._isVirtualMachineMacAddress(n.toUpperCase())&&(t+=1))}this._value=e>0?t/e:0}return this._value}},Fl;async function Ey(t){return Fl||(Fl=(async()=>{let e;try{e=await Dy(!1)}catch(i){t(i)}return e||pt()})()),Fl}async function _y(t){try{const e=await import("crypto"),i=Sy();return e.createHash("sha256").update(i,"utf8").digest("hex")}catch(e){t(e);return}}var xy={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32",notdefined:""},Py={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:`${xy[Iy()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"};function Iy(){return Ol!=="win32"?"notdefined":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function ky(t){switch(Ol){case"darwin":return t.split("IOPlatformUUID")[1].split(` `)[0].replace(/\=|\s+|\"/ig,"").toLowerCase();case"win32":return t.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/ig,"").toLowerCase();case"linux":return t.toString().replace(/\r+|\n+|\s+/ig,"").toLowerCase();case"freebsd":return t.toString().replace(/\r+|\n+|\s+/ig,"").toLowerCase();default:throw new Error(`Unsupported platform: ${process.platform}`)}}async function Dy(t){let e=ky(by(Py[Ol],{timeout:5e3}).toString()),i;try{i=(await import("crypto")).createHash("sha256").update(e,"utf8").digest("hex")}catch{i=pt()}return t?e:i}var Cy="Software\\Microsoft\\SQMClient";async function Ry(t){if(_e){const e=await import("@vscode/windows-registry");try{return e.GetStringRegKey("HKEY_LOCAL_MACHINE",Cy,"MachineId")||""}catch(i){return t(i),""}}return""}async function Ly(t){try{return await(await import("@vscode/deviceid")).getDeviceId()}catch(e){return t(e),pt()}}async function Ay(t,e){let i=t.getItem(Em);return(typeof i!="string"||Mt&&i==="6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead")&&(i=await Ey(e.error.bind(e))),i}async function Oy(t,e){let i=t.getItem(_m);return typeof i!="string"&&(i=await _y(e.error.bind(e))),i}async function Fy(t,e){let i=t.getItem(xm);return typeof i!="string"&&(i=await Ry(e.error.bind(e))),i}async function Ty(t,e){let i=t.getItem(Pm);return typeof i!="string"&&(i=await Ly(e.error.bind(e))),i}var Tl=class extends Wa{constructor(e,i,r,s,n){super(I.file(e.extensionsPath),i,r,s,n)}};Tl=__decorate([__param(0,Pt),__param(1,Pe),__param(2,Ot),__param(3,qe),__param(4,he)],Tl);var Ny=class extends K{constructor(t,e=[]){super(),this.logger=new _0([t,...e]),this._register(t.onDidChangeLogLevel(i=>this.setLevel(i)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(t){this.logger.setLevel(t)}getLevel(){return this.logger.getLevel()}trace(t,...e){this.logger.trace(t,...e)}debug(t,...e){this.logger.debug(t,...e)}info(t,...e){this.logger.info(t,...e)}warn(t,...e){this.logger.warn(t,...e)}error(t,...e){this.logger.error(t,...e)}flush(){this.logger.flush()}},fi;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.Off=6]="Off"})(fi||(fi={}));async function My(t,e,i,r,s){try{const n=await import("@vscode/spdlog");n.setFlushOn(fi.Trace);const o=await n.createAsyncRotatingLogger(t,e,i,r);return s?o.clearFormatters():o.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),o}catch(n){console.error(n)}return null}function kd(t,e,i){switch(e){case T.Trace:t.trace(i);break;case T.Debug:t.debug(i);break;case T.Info:t.info(i);break;case T.Warning:t.warn(i);break;case T.Error:t.error(i);break;case T.Off:break;default:throw new Error(`Invalid log level ${e}`)}}function Dd(t,e){switch(e){case T.Trace:t.setLevel(fi.Trace);break;case T.Debug:t.setLevel(fi.Debug);break;case T.Info:t.setLevel(fi.Info);break;case T.Warning:t.setLevel(fi.Warning);break;case T.Error:t.setLevel(fi.Error);break;case T.Off:t.setLevel(fi.Off);break;default:throw new Error(`Invalid log level ${e}`)}}var Uy=class extends E0{constructor(t,e,i,r,s){super(),this.buffer=[],this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(t,e,i,r),this._register(this.onDidChangeLogLevel(n=>{this._logger&&Dd(this._logger,n)}))}async _createSpdLogLogger(t,e,i,r){const s=i?6:1,n=30/s*$0.MB,o=await My(t,e,n,s,r);if(o){this._logger=o,Dd(this._logger,this.getLevel());for(const{level:a,message:l}of this.buffer)kd(this._logger,a,l);this.buffer=[]}}log(t,e){this._logger?kd(this._logger,t,e):this.getLevel()<=t&&this.buffer.push({level:t,message:e})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}},Vy=class extends x0{doCreateLogger(t,e,i){return new Uy(pt(),t.fsPath,!i?.donotRotate,!!i?.donotUseFormatters,e)}},Wy=class extends K{constructor(t,e,i,r,s,n){super(),this.fileSystemScheme=t,this.fileSystemProvider=e,this.userDataScheme=i,this.userDataProfilesService=r,this.uriIdentityService=s,this.logService=n,this.capabilities=this.fileSystemProvider.capabilities,this.onDidChangeCapabilities=this.fileSystemProvider.onDidChangeCapabilities,this._onDidChangeFile=this._register(new O),this.onDidChangeFile=this._onDidChangeFile.event,this.watchResources=gr.forUris(()=>!(this.capabilities&1024)),this.atomicReadWriteResources=new ho(o=>this.uriIdentityService.extUri.getComparisonKey(this.toFileSystemResource(o))),this.updateAtomicReadWritesResources(),this._register(r.onDidChangeProfiles(()=>this.updateAtomicReadWritesResources())),this._register(this.fileSystemProvider.onDidChangeFile(o=>this.handleFileChanges(o)))}updateAtomicReadWritesResources(){this.atomicReadWriteResources.clear();for(const t of this.userDataProfilesService.profiles)this.atomicReadWriteResources.add(t.settingsResource),this.atomicReadWriteResources.add(t.keybindingsResource),this.atomicReadWriteResources.add(t.tasksResource),this.atomicReadWriteResources.add(t.extensionsResource)}open(t,e){return this.fileSystemProvider.open(this.toFileSystemResource(t),e)}close(t){return this.fileSystemProvider.close(t)}read(t,e,i,r,s){return this.fileSystemProvider.read(t,e,i,r,s)}write(t,e,i,r,s){return this.fileSystemProvider.write(t,e,i,r,s)}watch(t,e){this.watchResources.set(t,t);const i=this.fileSystemProvider.watch(this.toFileSystemResource(t),e);return ye(()=>{this.watchResources.delete(t),i.dispose()})}stat(t){return this.fileSystemProvider.stat(this.toFileSystemResource(t))}mkdir(t){return this.fileSystemProvider.mkdir(this.toFileSystemResource(t))}rename(t,e,i){return this.fileSystemProvider.rename(this.toFileSystemResource(t),this.toFileSystemResource(e),i)}readFile(t,e){return this.fileSystemProvider.readFile(this.toFileSystemResource(t),e)}readFileStream(t,e,i){return this.fileSystemProvider.readFileStream(this.toFileSystemResource(t),e,i)}readdir(t){return this.fileSystemProvider.readdir(this.toFileSystemResource(t))}enforceAtomicReadFile(t){return this.atomicReadWriteResources.has(t)}writeFile(t,e,i){return this.fileSystemProvider.writeFile(this.toFileSystemResource(t),e,i)}enforceAtomicWriteFile(t){return this.atomicReadWriteResources.has(t)?{postfix:".vsctmp"}:!1}delete(t,e){return this.fileSystemProvider.delete(this.toFileSystemResource(t),e)}copy(t,e,i){if(ia(this.fileSystemProvider))return this.fileSystemProvider.copy(this.toFileSystemResource(t),this.toFileSystemResource(e),i);throw new Error("copy not supported")}cloneFile(t,e){if(rh(this.fileSystemProvider))return this.fileSystemProvider.cloneFile(this.toFileSystemResource(t),this.toFileSystemResource(e));throw new Error("clone not supported")}handleFileChanges(t){const e=[];for(const i of t){if(i.resource.scheme!==this.fileSystemScheme)continue;const r=this.toUserDataResource(i.resource);this.watchResources.findSubstr(r)&&e.push({resource:r,type:i.type,cId:i.cId})}e.length&&(this.logService.debug("User data changed"),this._onDidChangeFile.fire(e))}toFileSystemResource(t){return t.with({scheme:this.fileSystemScheme})}toUserDataResource(t){return t.with({scheme:this.userDataScheme})}};function $y(){return process.uncHostAllowlist}function Cd(t){if(process.platform!=="win32")return;const e=$y();if(e)if(typeof t=="string")e.add(t.toLowerCase());else for(const i of qy(t))Cd(i)}function qy(t){const e=new Set;if(Array.isArray(t))for(const i of t)typeof i=="string"&&e.add(i);return Array.from(e)}function jy(t){if(typeof t!="string")return;const e=["\\\\.\\UNC\\","\\\\?\\UNC\\","\\\\"];let i;for(const r of e){if(t.indexOf(r)!==0)continue;const n=t.indexOf("\\",r.length);if(n===-1)continue;const o=t.substring(r.length,n);if(o){i=o;break}}return i}function By(t){return t.type==="gallery"}function zy(t){return t.type===1||t.type===0}var Hy=/^(?\d+\.\d+\.\d+(-.*)?)(@(?.+))?$/,Nl=class extends K{get allowedExtensionsConfigValue(){return this._allowedExtensionsConfigValue}constructor(e,i){super(),this.configurationService=i,this._onDidChangeAllowedExtensions=this._register(new O),this.onDidChangeAllowedExtensionsConfigValue=this._onDidChangeAllowedExtensions.event,this.publisherOrgs=e.extensionPublisherOrgs?.map(r=>r.toLowerCase())??[],this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(ya)&&(this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._onDidChangeAllowedExtensions.fire())}))}getAllowedExtensionsValue(){const e=this.configurationService.getValue(ya);if(!Ne(e)||Array.isArray(e))return;const i=Object.entries(e).map(([r,s])=>[r.toLowerCase(),s]);if(!(i.length===1&&i[0][0]==="*"&&i[0][1]===!0))return Object.fromEntries(i)}isAllowed(e){if(!this._allowedExtensionsConfigValue)return!0;let i,r,s,n,o,a;By(e)?(i=e.identifier.id.toLowerCase(),r=e.version,n=e.properties.isPreReleaseVersion,o=e.publisher.toLowerCase(),a=e.publisherDisplayName.toLowerCase(),s=e.properties.targetPlatform):zy(e)?(i=e.identifier.id.toLowerCase(),r=e.manifest.version,n=e.preRelease,o=e.manifest.publisher.toLowerCase(),a=e.publisherDisplayName?.toLowerCase(),s=e.targetPlatform):(i=e.id.toLowerCase(),r=e.version??"*",s=e.targetPlatform??"universal",n=e.prerelease??!1,o=e.id.substring(0,e.id.indexOf(".")).toLowerCase(),a=e.publisherDisplayName?.toLowerCase());const l=I.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify({query:`@id:${ya}`}))}`).toString(),c=this._allowedExtensionsConfigValue[i],h=new Ki(g(1925,null,l));if(!Et(c))return Dt(c)?c?!0:h:c==="stable"&&n?new Ki(g(1926,null,l)):r!=="*"&&Array.isArray(c)&&!c.some(p=>{const v=Hy.exec(p);if(v&&v.groups){const{platform:m,version:w}=v.groups;return!(w!==r||s!=="universal"&&m&&s!==m)}return!1})?new Ki(g(1927,null,r,l)):!0;const f=a&&this.publisherOrgs.includes(a)?a:o,d=this._allowedExtensionsConfigValue[f];return Et(d)?this._allowedExtensionsConfigValue["*"]===!0?!0:h:Dt(d)?d?!0:new Ki(g(1928,null,f,l)):d==="stable"&&n?new Ki(g(1929,null,f,l)):!0}};Nl=__decorate([__param(0,mt),__param(1,ni)],Nl);var Ml=class{constructor(e,i){this._logger=e,this._userConfigurationService=i}async addMcpDefinitions(e){const i=e.map(r=>this.validateConfiguration(r));await this.updateMcpInConfig(this._userConfigurationService,i),this._logger.info(`Added MCP servers: ${i.map(r=>r.name).join(", ")}`)}async updateMcpInConfig(e,i){const r=e.getValue("mcp")||{servers:{}};r.servers??={};for(const s of i)r.servers[s.name]=s.config;await e.updateValue("mcp",r)}validateConfiguration(e){let i;try{i=JSON.parse(e)}catch(n){throw new Ul(`Invalid JSON '${e}': ${n}`)}if(!i.name)throw new Ul(`Missing name property in ${e}`);if(!("command"in i)&&!("url"in i))throw new Ul(`Missing command or URL property in ${e}`);const{name:r,...s}=i;return{name:r,config:s}}};Ml=__decorate([__param(1,ni)],Ml);var Ul=class extends Error{constructor(t){super(t),this.stack=t}};function Ky(t){if(!t?.serviceUrl)return null;const e=[{id:`${t.serviceUrl}/extensionquery`,type:"ExtensionQueryService"},{id:`${t.serviceUrl}/vscode/{publisher}/{name}/latest`,type:"ExtensionLatestVersionUriTemplate"},{id:`${t.serviceUrl}/publishers/{publisher}/extensions/{name}/{version}/stats?statType={statTypeName}`,type:"ExtensionStatisticsUriTemplate"},{id:`${t.serviceUrl}/itemName/{publisher}.{name}/version/{version}/statType/{statTypeValue}/vscodewebextension`,type:"WebExtensionStatisticsUriTemplate"}];return t.publisherUrl&&e.push({id:`${t.publisherUrl}/{publisher}`,type:"PublisherViewUriTemplate"}),t.itemUrl&&(e.push({id:`${t.itemUrl}/?itemName={publisher}.{name}`,type:"ExtensionDetailsViewUriTemplate"}),e.push({id:`${t.itemUrl}/?itemName={publisher}.{name}&ssr=false#review-details`,type:"ExtensionRatingViewUriTemplate"})),t.resourceUrlTemplate&&e.push({id:t.resourceUrlTemplate,type:"ExtensionResourceUriTemplate"}),{version:"",resources:e,capabilities:{extensionQuery:{filtering:[{name:"Tag",value:1},{name:"ExtensionId",value:4},{name:"Category",value:5},{name:"ExtensionName",value:7},{name:"Target",value:8},{name:"Featured",value:9},{name:"SearchText",value:10},{name:"ExcludeWithFlags",value:12}],sorting:[{name:"NoneOrRelevance",value:0},{name:"LastUpdatedDate",value:1},{name:"Title",value:2},{name:"PublisherName",value:3},{name:"InstallCount",value:4},{name:"AverageRating",value:6},{name:"PublishedDate",value:10},{name:"WeightedRating",value:12}],flags:[{name:"None",value:0},{name:"IncludeVersions",value:1},{name:"IncludeFiles",value:2},{name:"IncludeCategoryAndTags",value:4},{name:"IncludeSharedAccounts",value:8},{name:"IncludeVersionProperties",value:16},{name:"ExcludeNonValidated",value:32},{name:"IncludeInstallationTargets",value:64},{name:"IncludeAssetUri",value:128},{name:"IncludeStatistics",value:256},{name:"IncludeLatestVersionOnly",value:512},{name:"Unpublished",value:4096},{name:"IncludeNameConflictInfo",value:32768},{name:"IncludeLatestPrereleaseAndStableVersionOnly",value:65536}]},signing:{allRepositorySigned:!0,allPublicRepositorySigned:!0}}}}var Vl=class extends K{constructor(e){super(),this.productService=e,this.onDidChangeExtensionGalleryManifest=ae.None}isEnabled(){return!!this.productService.extensionsGallery?.serviceUrl}async getExtensionGalleryManifest(){return Ky(this.productService.extensionsGallery)}};Vl=__decorate([__param(0,mt)],Vl);var Gy=class extends K{constructor(t){super(),this.argv=t,this.registerListeners()}registerListeners(){process.once("exit",()=>this.dispose())}async run(){const[t,e]=await this.initServices();return t.invokeFunction(async i=>{const r=i.get(he),s=i.get(Pe),n=i.get(Pt),o=i.get(Ot);r.info("CLI main",this.argv),this.registerErrorHandler(r),await this.doRun(n,s,o,t),await Promise.all(e.map(a=>{xg(a.flush(),1e3)}))})}async initServices(){const t=new fd,e={_serviceBrand:void 0,...Bt};t.set(mt,e);const i=new im(this.argv,e);t.set(Pt,i),await Promise.all([this.allowWindowsUNCPath(i.appSettingsHome.with({scheme:ie.file}).fsPath),this.allowWindowsUNCPath(i.extensionsPath)].map(x=>x?g1.promises.mkdir(x,{recursive:!0}):void 0));const r=new Vy(k0(i),i.logsHome);t.set(S0,r);const s=this._register(r.createLogger("cli",{name:g(179,null)})),n=[];r.getLogLevel()===T.Trace&&n.push(new $i(r.getLogLevel()));const o=this._register(new Ny(s,n));t.set(he,o);const a=this._register(new pl(o));t.set(Pe,a);const l=this._register(new b5(o));a.registerProvider(ie.file,l);const c=new Es(a);t.set(qe,c);const h=new Hn(1,i,o,a),f=new Qn(h,c,i,a,o);t.set(Ot,f),a.registerProvider(ie.vscodeUserData,new Wy(ie.file,l,ie.vscodeUserData,f,c,o));let d;_e&&e.win32RegValueName?d=this._register(new Bn(o,e.win32RegValueName)):Mt&&e.darwinBundleIdentifier?d=this._register(new Bn(o,e.darwinBundleIdentifier)):i.policyFile?d=this._register(new xl(i.policyFile,a,o)):d=new Ju,t.set(Gu,d);const p=this._register(new A0(f.defaultProfile.settingsResource,a,d,o));t.set(ni,p),await Promise.all([h.init(),p.initialize()]);let v;try{v=await Ay(h,o)}catch(x){x.code!=="ENOENT"&&o.error(x)}const m=await Oy(h,o),w=await Fy(h,o),S=await Ty(h,o);f.init(),t.set(qe,new Es(a));const _=new Dl("local",p,i,o);t.set(os,_),t.set(Xu,new je(ha,void 0,!0)),t.set(Ei,new je(Tl,void 0,!0)),t.set(Fn,new je(hl,void 0,!0)),t.set(af,new je(Va,void 0,!0)),t.set(Bi,new je(Nl,void 0,!0)),t.set(b4,new je(ll,void 0,!0)),t.set(us,new je(Vl)),t.set(bi,new je(Ua,void 0,!0)),t.set(I5,new je(El,void 0,!1));const P=[],N=Rm(e,p);if(Th(e,i)){e.aiConfig&&e.aiConfig.ariaKey&&P.push(new cy(_,N,"monacoworkbench",null,e.aiConfig.ariaKey));const x={appenders:P,sendErrorTelemetry:!1,commonProperties:Sm(v1(),m1(),process.arch,e.commit,e.version,v,m,w,S,N),piiPaths:Lm(i)};t.set(jt,new je(Rl,[x],!1))}else t.set(jt,Dm);return[new x5(t),P]}allowWindowsUNCPath(t){if(_e){const e=jy(t);e&&Cd(e)}return t}registerErrorHandler(t){S1(e=>{const i=Ui(e,!0);i&&t.error(`[uncaught exception in CLI]: ${i}`)}),process.on("uncaughtException",e=>{b1(e)||Nt(e)}),process.on("unhandledRejection",e=>Nt(e))}async doRun(t,e,i,r){let s;if(t.args.profile&&(s=i.profiles.find(o=>o.name===t.args.profile),!s))throw new Error(`Profile '${t.args.profile}' not found.`);const n=(s??i.defaultProfile).extensionsResource;if(this.argv["list-extensions"])return r.createInstance(Hi,new $i(T.Info,!1)).listExtensions(!!this.argv["show-versions"],this.argv.category,n);if(this.argv["install-extension"]||this.argv["install-builtin-extension"]){const o={isMachineScoped:!!this.argv["do-not-sync"],installPreReleaseVersion:!!this.argv["pre-release"],donotIncludePackAndDependencies:!!this.argv["do-not-include-pack-dependencies"],profileLocation:n};return r.createInstance(Hi,new $i(T.Info,!1)).installExtensions(this.asExtensionIdOrVSIX(this.argv["install-extension"]||[]),this.asExtensionIdOrVSIX(this.argv["install-builtin-extension"]||[]),o,!!this.argv.force)}else{if(this.argv["uninstall-extension"])return r.createInstance(Hi,new $i(T.Info,!1)).uninstallExtensions(this.asExtensionIdOrVSIX(this.argv["uninstall-extension"]),!!this.argv.force,n);if(this.argv["update-extensions"])return r.createInstance(Hi,new $i(T.Info,!1)).updateExtensions(n);if(this.argv["locate-extension"])return r.createInstance(Hi,new $i(T.Info,!1)).locateExtension(this.argv["locate-extension"]);if(this.argv["add-mcp"])return r.createInstance(Ml,new $i(T.Info,!1)).addMcpDefinitions(this.argv["add-mcp"]);this.argv.telemetry&&console.log(await uy(t.appRoot,t.extensionsPath))}}asExtensionIdOrVSIX(t){return t.map(e=>/\.vsix$/i.test(e)?I.file(Vc(e)?e:G(qr(),e)):e)}};async function Qy(t){const e=new Gy(t);try{await e.run()}finally{e.dispose()}}export{Qy as main}; //# sourceMappingURL=http://go/sourcemap/sourcemaps/0cc5b2dcee887155094cc3d879718855ac5414a0/core/vs/code/node/cliProcessMain.js.map //# debugId=432ab60b-03fd-5b94-a706-559aecaf9176