/*!--------------------------------------------------------
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *--------------------------------------------------------*/
/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */

var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return extendStatics(d, b);
};

export function __extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

export var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    }
    return __assign.apply(this, arguments);
}

export function __rest(s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
}

export function __decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}

export function __param(paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
}

export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};

export function __runInitializers(thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};

export function __propKey(x) {
    return typeof x === "symbol" ? x : "".concat(x);
};

export function __setFunctionName(f, name, prefix) {
    if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
    return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};

export function __metadata(metadataKey, metadataValue) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}

export function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}

export function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
    return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}

export var __createBinding = Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
});

export function __exportStar(m, o) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}

export function __values(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}

export function __read(o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
}

/** @deprecated */
export function __spread() {
    for (var ar = [], i = 0; i < arguments.length; i++)
        ar = ar.concat(__read(arguments[i]));
    return ar;
}

/** @deprecated */
export function __spreadArrays() {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
}

export function __spreadArray(to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
}

export function __await(v) {
    return this instanceof __await ? (this.v = v, this) : new __await(v);
}

export function __asyncGenerator(thisArg, _arguments, generator) {
    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
    var g = generator.apply(thisArg, _arguments || []), i, q = [];
    return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
    function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
    function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
    function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
    function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
    function fulfill(value) { resume("next", value); }
    function reject(value) { resume("throw", value); }
    function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}

export function __asyncDelegator(o) {
    var i, p;
    return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
    function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}

export function __asyncValues(o) {
    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
    var m = o[Symbol.asyncIterator], i;
    return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
    function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
    function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}

export function __makeTemplateObject(cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};

var __setModuleDefault = Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
};

var ownKeys = function(o) {
    ownKeys = Object.getOwnPropertyNames || function (o) {
        var ar = [];
        for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
        return ar;
    };
    return ownKeys(o);
};

export function __importStar(mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
    __setModuleDefault(result, mod);
    return result;
}

export function __importDefault(mod) {
    return (mod && mod.__esModule) ? mod : { default: mod };
}

export function __classPrivateFieldGet(receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}

export function __classPrivateFieldSet(receiver, state, value, kind, f) {
    if (kind === "m") throw new TypeError("Private method is not writable");
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}

export function __classPrivateFieldIn(state, receiver) {
    if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
    return typeof state === "function" ? receiver === state : state.has(receiver);
}

export function __addDisposableResource(env, value, async) {
    if (value !== null && value !== void 0) {
        if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
        var dispose, inner;
        if (async) {
            if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
            dispose = value[Symbol.asyncDispose];
        }
        if (dispose === void 0) {
            if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
            dispose = value[Symbol.dispose];
            if (async) inner = dispose;
        }
        if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
        if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
        env.stack.push({ value: value, dispose: dispose, async: async });
    }
    else if (async) {
        env.stack.push({ async: true });
    }
    return value;

}

var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
    var e = new Error(message);
    return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

export function __disposeResources(env) {
    function fail(e) {
        env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
        env.hasError = true;
    }
    var r, s = 0;
    function next() {
        while (r = env.stack.pop()) {
            try {
                if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
                if (r.dispose) {
                    var result = r.dispose.call(r.value);
                    if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
                }
                else s |= 1;
            }
            catch (e) {
                fail(e);
            }
        }
        if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
        if (env.hasError) throw env.error;
    }
    return next();
}

export function __rewriteRelativeImportExtension(path, preserveJsx) {
    if (typeof path === "string" && /^\.\.?\//.test(path)) {
        return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
            return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
        });
    }
    return path;
}

export default {
    __extends: __extends,
    __assign: __assign,
    __rest: __rest,
    __decorate: __decorate,
    __param: __param,
    __esDecorate: __esDecorate,
    __runInitializers: __runInitializers,
    __propKey: __propKey,
    __setFunctionName: __setFunctionName,
    __metadata: __metadata,
    __awaiter: __awaiter,
    __generator: __generator,
    __createBinding: __createBinding,
    __exportStar: __exportStar,
    __values: __values,
    __read: __read,
    __spread: __spread,
    __spreadArrays: __spreadArrays,
    __spreadArray: __spreadArray,
    __await: __await,
    __asyncGenerator: __asyncGenerator,
    __asyncDelegator: __asyncDelegator,
    __asyncValues: __asyncValues,
    __makeTemplateObject: __makeTemplateObject,
    __importStar: __importStar,
    __importDefault: __importDefault,
    __classPrivateFieldGet: __classPrivateFieldGet,
    __classPrivateFieldSet: __classPrivateFieldSet,
    __classPrivateFieldIn: __classPrivateFieldIn,
    __addDisposableResource: __addDisposableResource,
    __disposeResources: __disposeResources,
    __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
};

var iH=Object.defineProperty;var n7=Object.getOwnPropertyDescriptor;var sH=i=>{throw TypeError(i)};var o7=(i,t)=>{for(var e in t)iH(i,e,{get:t[e],enumerable:!0})};var _=(i,t,e,n)=>{for(var o=n>1?void 0:n?n7(t,e):t,r=i.length-1,s;r>=0;r--)(s=i[r])&&(o=(n?s(t,e,o):s(o))||o);return n&&o&&iH(t,e,o),o},S=(i,t)=>(e,n)=>t(e,n,i);var lR=(i,t,e)=>t.has(i)||sH("Cannot "+e);var yn=(i,t,e)=>(lR(i,t,"read from private field"),e?e.call(i):t.get(i)),Rp=(i,t,e)=>t.has(i)?sH("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),nv=(i,t,e,n)=>(lR(i,t,"write to private field"),n?n.call(i,e):t.set(i,e),e),ov=(i,t,e)=>(lR(i,t,"access private method"),e);import gne from"minimist";import*as J8 from"net";function Dp(i,t){let e=Object.create(null);for(let n of i){let o=t(n),r=e[o];r||(r=e[o]=[]),r.push(n)}return e}function dR(i,t){let e=[],n=[];for(let o of i)t.has(o)||e.push(o);for(let o of t)i.has(o)||n.push(o);return{removed:e,added:n}}var lH,dH,aH=class{constructor(t,e){this.toKey=e;this._map=new Map;this[lH]="SetWithKey";for(let n of t)this.add(n)}get size(){return this._map.size}add(t){let e=this.toKey(t);return this._map.set(e,t),this}delete(t){return this._map.delete(this.toKey(t))}has(t){return this._map.has(this.toKey(t))}*entries(){for(let t of this._map.values())yield[t,t]}keys(){return this.values()}*values(){for(let t of this._map.values())yield t}clear(){this._map.clear()}forEach(t,e){this._map.forEach(n=>t.call(e,n,n,this))}[(dH=Symbol.iterator,lH=Symbol.toStringTag,dH)](){return this.values()}};var cR=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ln.isErrorNoTelemetry(t)?new Ln(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)}},Ml=new cR;function rv(i){Ml.setUnexpectedErrorHandler(i)}function cH(i){if(!i||typeof i!="object")return!1;let t=i;return t.code==="EPIPE"&&t.syscall?.toUpperCase()==="WRITE"}function Ll(i){Ml.onUnexpectedError(i)}function Ge(i){Yt(i)||Ml.onUnexpectedError(i)}function ba(i){Yt(i)||Ml.onUnexpectedExternalError(i)}function ls(i){if(i instanceof Error){let{name:t,message:e,cause:n}=i,o=i.stacktrace||i.stack;return{$isError:!0,name:t,message:e,stack:o,noTelemetry:Ln.isErrorNoTelemetry(i),cause:n?ls(n):void 0,code:i.code}}return i}function uR(i){let t;return i.noTelemetry?t=new Ln:(t=new Error,t.name=i.name),t.message=i.message,t.stack=i.stack,i.code&&(t.code=i.code),i.cause&&(t.cause=uR(i.cause)),t}var QI="Canceled";function Yt(i){return i instanceof Oe?!0:i instanceof Error&&i.name===QI&&i.message===QI}var Oe=class extends Error{constructor(){super(QI),this.name=this.message}},ya=class i extends Error{static{this._name="PendingMigrationError"}static is(t){return t instanceof i||t instanceof Error&&t.name===i._name}constructor(t){super(t),this.name=i._name}};function Ia(){let i=new Error(QI);return i.name=i.message,i}function $e(i){return i?new Error(`Illegal argument: ${i}`):new Error("Illegal argument")}function Ap(i){return i?new Error(`Illegal state: ${i}`):new Error("Illegal state")}var wi=class extends TypeError{constructor(t){super(t?`${t} is read-only and cannot be changed`:"Cannot change read-only property")}};function ds(i){return i?i.message?i.message:i.stack?i.stack.split(`
`)[0]:String(i):"Error"}var JI=class extends Error{constructor(t){super("NotImplemented"),t&&(this.message=t)}},Tc=class extends Error{constructor(t){super("NotSupported"),t&&(this.message=t)}};var Ln=class i extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof i)return t;let e=new i;return e.message=t.message,e.stack=t.stack,e}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},At=class i extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,i.prototype)}};function Nl(i,t){let e=this,n=!1,o;return function(){if(n)return o;if(n=!0,t)try{o=i.apply(e,arguments)}finally{t()}else o=i.apply(e,arguments);return o}}function pH(i,t,e=i.length-1){let n=i7(i,t,e);if(n!==-1)return i[n]}function i7(i,t,e=i.length-1){for(let n=e;n>=0;n--){let o=i[n];if(t(o,n))return n}return-1}function s7(i,t,e=0,n=i.length){let o=e,r=n;for(;o<r;){let s=Math.floor((o+r)/2);t(i[s])?o=s+1:r=s}return o-1}function mH(i,t,e=0,n=i.length){let o=e,r=n;for(;o<r;){let s=Math.floor((o+r)/2);t(i[s])?r=s:o=s+1}return o}var uH=class i{constructor(t){this._array=t;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(t){if(i.assertInvariants){if(this._prevFindLastPredicate){for(let n of this._array)if(this._prevFindLastPredicate(n)&&!t(n))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let e=s7(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function dn(i,t,e=(n,o)=>n===o){if(i===t)return!0;if(!i||!t||i.length!==t.length)return!1;for(let n=0,o=i.length;n<o;n++)if(!e(i[n],t[n]))return!1;return!0}function fH(i,t,e){return a7(i.length,n=>e(i[n],t))}function a7(i,t){let e=0,n=i-1;for(;e<=n;){let o=(e+n)/2|0,r=t(o);if(r<0)e=o+1;else if(r>0)n=o-1;else return o}return-(e+1)}function hH(i,t){let e=[],n;for(let o of i.slice(0).sort(t))!n||t(n[0],o)!==0?(n=[o],e.push(n)):n.push(o);return e}function pR(i,t,e){let n=[];function o(a,l,d){if(l===0&&d.length===0)return;let c=n[n.length-1];c&&c.start+c.deleteCount===a?(c.deleteCount+=l,c.toInsert.push(...d)):n.push({start:a,deleteCount:l,toInsert:d})}let r=0,s=0;for(;;){if(r===i.length){o(r,0,t.slice(s));break}if(s===t.length){o(r,i.length-r,[]);break}let a=i[r],l=t[s],d=e(a,l);d===0?(r+=1,s+=1):d<0?(o(r,1,[]),r+=1):d>0&&(o(r,0,[l]),s+=1)}return n}function vH(i,t,e){let n=pR(i,t,e),o=[],r=[];for(let s of n)o.push(...i.slice(s.start,s.start+s.deleteCount)),r.push(...s.toInsert);return{removed:o,added:r}}function yH(i,t,e,n,o){return e===0?Promise.resolve([]):new Promise((r,s)=>{(async()=>{let a=i.length,l=i.slice(0,e).sort(t);for(let d=e,c=Math.min(e+n,a);d<a;d=c,c=Math.min(c+n,a)){if(d>e&&await new Promise(u=>setTimeout(u)),o&&o.isCancellationRequested)throw new Oe;l7(i,t,l,d,c)}return l})().then(r,s)})}function l7(i,t,e,n,o){for(let r=e.length;n<o;n++){let s=i[n];if(t(s,e[r-1])<0){e.pop();let a=mH(e,l=>t(s,l)<0);e.splice(a,0,s)}}}function nt(i){return i.filter(t=>!!t)}function bH(i){let t=0;for(let e=0;e<i.length;e++)i[e]&&(i[t]=i[e],t+=1);i.length=t}function iv(i){return!Array.isArray(i)||i.length===0}function Ul(i){return Array.isArray(i)&&i.length>0}function er(i,t=e=>e){let e=new Set;return i.filter(n=>{let o=t(n);return e.has(o)?!1:(e.add(o),!0)})}function mR(i,t){return i.push(t),()=>d7(i,t)}function d7(i,t){let e=i.indexOf(t);if(e>-1)return i.splice(e,1),t}function gR(i,t){let e;if(typeof t=="number"){let n=t;e=()=>{let o=Math.sin(n++)*179426549;return o-Math.floor(o)}}else e=Math.random;for(let n=i.length-1;n>0;n-=1){let o=Math.floor(e()*(n+1)),r=i[n];i[n]=i[o],i[o]=r}}function Ec(i,t){return Array.isArray(i)?i.map(t):t(i)}function On(i){return Array.isArray(i)?i:[i]}var IH;(a=>{function i(l){return l<0}a.isLessThan=i;function t(l){return l<=0}a.isLessThanOrEqual=t;function e(l){return l>0}a.isGreaterThan=e;function n(l){return l===0}a.isNeitherLessOrGreaterThan=n,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(IH||={});function xH(i,t){return(e,n)=>t(i(e),i(n))}var SH=(i,t)=>i-t;var gH=class i{constructor(t){this.iterate=t}static{this.empty=new i(t=>{})}forEach(t){this.iterate(e=>(t(e),!0))}toArray(){let t=[];return this.iterate(e=>(t.push(e),!0)),t}filter(t){return new i(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new i(e=>this.iterate(n=>e(t(n))))}some(t){let e=!1;return this.iterate(n=>(e=t(n),!e)),e}findFirst(t){let e;return this.iterate(n=>t(n)?(e=n,!1):!0),e}findLast(t){let e;return this.iterate(n=>(t(n)&&(e=n),!0)),e}findLastMaxBy(t){let e,n=!0;return this.iterate(o=>((n||IH.isGreaterThan(t(o,e)))&&(n=!1,e=o),!0)),e}};function yR(i,t,e){let n=i.get(t);return n===void 0&&(n=e,i.set(t,n)),n}var fR=class{constructor(t,e){this.uri=t;this.value=e}};function c7(i){return Array.isArray(i)}var CH,Ve=class i{constructor(t,e){this[CH]="ResourceMap";if(t instanceof i)this.map=new Map(t.map),this.toKey=e??i.defaultToKey;else if(c7(t)){this.map=new Map,this.toKey=e??i.defaultToKey;for(let[n,o]of t)this.set(n,o)}else this.map=new Map,this.toKey=t??i.defaultToKey}static{this.defaultToKey=t=>t.toString()}set(t,e){return this.map.set(this.toKey(t),new fR(t,e)),this}get(t){return this.map.get(this.toKey(t))?.value}has(t){return this.map.has(this.toKey(t))}get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(this.toKey(t))}forEach(t,e){typeof e<"u"&&(t=t.bind(e));for(let[n,o]of this.map)t(o.value,o.uri,this)}*values(){for(let t of this.map.values())yield t.value}*keys(){for(let t of this.map.values())yield t.uri}*entries(){for(let t of this.map.values())yield[t.uri,t.value]}*[(CH=Symbol.toStringTag,Symbol.iterator)](){for(let[,t]of this.map)yield[t.uri,t.value]}},TH,Lr=class{constructor(t,e){this[TH]="ResourceSet";!t||typeof t=="function"?this._map=new Ve(t):(this._map=new Ve(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((n,o)=>t.call(e,o,o,this))}has(t){return this._map.has(t)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(TH=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var EH,hR=class{constructor(){this[EH]="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){let n=this._map.get(t);if(n)return e!==0&&this.touch(n,e),n.value}set(t,e,n=0){let o=this._map.get(t);if(o)o.value=e,n!==0&&this.touch(o,n);else{switch(o={key:t,value:e,next:void 0,previous:void 0},n){case 0:this.addItemLast(o);break;case 1:this.addItemFirst(o);break;case 2:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let 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");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,e){let n=this._state,o=this._head;for(;o;){if(e?t.bind(e)(o.value,o.key,this):t(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},[Symbol.dispose](){},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let r={value:n.key,done:!1};return n=n.next,r}else return{value:void 0,done:!0}}};return o}values(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},[Symbol.dispose](){},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let r={value:n.value,done:!1};return n=n.next,r}else return{value:void 0,done:!0}}};return o}entries(){let t=this,e=this._state,n=this._head,o={[Symbol.iterator](){return o},[Symbol.dispose](){},next(){if(t._state!==e)throw new Error("LinkedMap got modified during iteration.");if(n){let r={value:[n.key,n.value],done:!1};return n=n.next,r}else return{value:void 0,done:!0}}};return o}[(EH=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._head,n=this.size;for(;e&&n>t;)this._map.delete(e.key),e=e.next,n--;this._head=e,this._size=n,e&&(e.previous=void 0),this._state++}trimNew(t){if(t>=this.size)return;if(t===0){this.clear();return}let e=this._tail,n=this.size;for(;e&&n>t;)this._map.delete(e.key),e=e.previous,n--;this._tail=e,this._size=n,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{let e=t.next,n=t.previous;if(!e||!n)throw new Error("Invalid list");e.previous=n,n.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;let n=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),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;let n=t.next,o=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((e,n)=>{t.push([n,e])}),t}fromJSON(t){this.clear();for(let[e,n]of t)this.set(e,n)}},vR=class extends hR{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))}},Xr=class extends vR{constructor(t,e=1){super(t,e)}trim(t){this.trimOld(t)}set(t,e){return super.set(t,e),this.checkTrim(),this}};var YI=class{constructor(t){this._m1=new Map;this._m2=new Map;if(t)for(let[e,n]of t)this.set(e,n)}clear(){this._m1.clear(),this._m2.clear()}set(t,e){let n=this._m1.get(t);n!==void 0&&this._m2.delete(n),this._m1.set(t,e),this._m2.set(e,t)}get(t){return this._m1.get(t)}getKey(t){return this._m2.get(t)}delete(t){let e=this._m1.get(t);return e===void 0?!1:(this._m1.delete(t),this._m2.delete(e),!0)}forEach(t,e){this._m1.forEach((n,o)=>{t.call(e,n,o,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},Mp=class{constructor(){this.map=new Map}add(t,e){let n=this.map.get(t);n||(n=new Set,this.map.set(t,n)),n.add(e)}delete(t,e){let n=this.map.get(t);n&&(n.delete(e),n.size===0&&this.map.delete(t))}forEach(t,e){let n=this.map.get(t);n&&n.forEach(e)}get(t){let e=this.map.get(t);return e||new Set}};function Xn(i,t){if(!i)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}function Hl(i,t="Unreachable"){throw new Error(t)}function wc(i,t="unexpected state"){if(!i)throw typeof t=="string"?new At(`Assertion Failed: ${t}`):t}function sv(i){if(!i()){debugger;i(),Ge(new At("Assertion Failed"))}}function Pe(i){return typeof i=="string"}function kH(i){return u7(i,Pe)}function u7(i,t){return Array.isArray(i)&&i.every(t)}function st(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&!(i instanceof RegExp)&&!(i instanceof Date)}function PH(i){let t=Object.getPrototypeOf(Uint8Array);return typeof i=="object"&&i instanceof t}function jn(i){return typeof i=="number"&&!isNaN(i)}function _H(i){return!!i&&typeof i[Symbol.iterator]=="function"}function XI(i){return i===!0||i===!1}function cs(i){return typeof i>"u"}function Uo(i){return!Wt(i)}function Wt(i){return cs(i)||i===null}function Lp(i,t){if(!i)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}function ki(i){return wc(i!=null,"Argument is `undefined` or `null`."),i}var p7=Object.prototype.hasOwnProperty;function Wl(i){if(!st(i))return!1;for(let t in i)if(p7.call(i,t))return!1;return!0}function ZI(i){return typeof i=="function"}function RH(i,t){let e=Math.min(i.length,t.length);for(let n=0;n<e;n++)bR(i[n],t[n])}function bR(i,t){if(Pe(t)){if(typeof i!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ZI(t)){try{if(i instanceof t)return}catch{}if(!Wt(i)&&i.constructor===t||t.length===1&&t.call(void 0,i)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function Gn(i,t){for(let e in t)if(!(e in i))return!1;return!0}var Mt;(U=>{function i(z){return!!z&&typeof z=="object"&&typeof z[Symbol.iterator]=="function"}U.is=i;let t=Object.freeze([]);function e(){return t}U.empty=e;function*n(z){yield z}U.single=n;function o(z){return i(z)?z:n(z)}U.wrap=o;function r(z){return z??t}U.from=r;function*s(z){for(let Y=z.length-1;Y>=0;Y--)yield z[Y]}U.reverse=s;function a(z){return!z||z[Symbol.iterator]().next().done===!0}U.isEmpty=a;function l(z){return z[Symbol.iterator]().next().value}U.first=l;function d(z,Y){let j=0;for(let Q of z)if(Y(Q,j++))return!0;return!1}U.some=d;function c(z,Y){let j=0;for(let Q of z)if(!Y(Q,j++))return!1;return!0}U.every=c;function u(z,Y){for(let j of z)if(Y(j))return j}U.find=u;function*m(z,Y){for(let j of z)Y(j)&&(yield j)}U.filter=m;function*g(z,Y){let j=0;for(let Q of z)yield Y(Q,j++)}U.map=g;function*h(z,Y){let j=0;for(let Q of z)yield*Y(Q,j++)}U.flatMap=h;function*f(...z){for(let Y of z)_H(Y)?yield*Y:yield Y}U.concat=f;function I(z,Y,j){let Q=j;for(let Z of z)Q=Y(Q,Z);return Q}U.reduce=I;function x(z){let Y=0;for(let j of z)Y++;return Y}U.length=x;function*E(z,Y,j=z.length){for(Y<-z.length&&(Y=0),Y<0&&(Y+=z.length),j<0?j+=z.length:j>z.length&&(j=z.length);Y<j;Y++)yield z[Y]}U.slice=E;function w(z,Y=Number.POSITIVE_INFINITY){let j=[];if(Y===0)return[j,z];let Q=z[Symbol.iterator]();for(let Z=0;Z<Y;Z++){let me=Q.next();if(me.done)return[j,U.empty()];j.push(me.value)}return[j,{[Symbol.iterator](){return Q}}]}U.consume=w;async function R(z){let Y=[];for await(let j of z)Y.push(j);return Y}U.asyncToArray=R;async function L(z){let Y=[];for await(let j of z)Y=Y.concat(j);return Y}U.asyncToArrayFlat=L})(Mt||={});var m7=!1,kc=null;var DH=class i{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(t){let e=this.livingDisposables.get(t);return e||(e={parent:null,source:null,isSingleton:!1,value:t,idx:i.idx++},this.livingDisposables.set(t,e)),e}trackDisposable(t){let e=this.getDisposableData(t);e.source||(e.source=new Error().stack)}setParent(t,e){let n=this.getDisposableData(t);n.parent=e}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,e){let n=e.get(t);if(n)return n;let o=t.parent?this.getRootParent(this.getDisposableData(t.parent),e):t;return e.set(t,o),o}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,n])=>n.source!==null&&!this.getRootParent(n,t).isSingleton).flatMap(([n])=>n)}computeLeakingDisposables(t=10,e){let n;if(e)n=e;else{let l=new Map,d=[...this.livingDisposables.values()].filter(u=>u.source!==null&&!this.getRootParent(u,l).isSingleton);if(d.length===0)return;let c=new Set(d.map(u=>u.value));if(n=d.filter(u=>!(u.parent&&c.has(u.parent))),n.length===0)throw new Error("There are cyclic diposable chains!")}if(!n)return;function o(l){function d(u,m){for(;u.length>0&&m.some(g=>typeof g=="string"?g===u[0]:u[0].match(g));)u.shift()}let c=l.source.split(`
`).map(u=>u.trim().replace("at ","")).filter(u=>u!=="");return d(c,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),c.reverse()}let r=new Mp;for(let l of n){let d=o(l);for(let c=0;c<=d.length;c++)r.add(d.slice(0,c).join(`
`),l)}n.sort(xH(l=>l.idx,SH));let s="",a=0;for(let l of n.slice(0,t)){a++;let d=o(l),c=[];for(let u=0;u<d.length;u++){let m=d[u];m=`(shared with ${r.get(d.slice(0,u+1).join(`
`)).size}/${n.length} leaks) at ${m}`;let h=r.get(d.slice(0,u).join(`
`)),f=Dp([...h].map(I=>o(I)[u]),I=>I);delete f[d[u]];for(let[I,x]of Object.entries(f))x&&c.unshift(`    - stacktraces of ${x.length} other leaks continue with ${I}`);c.unshift(m)}s+=`


==================== Leaking disposable ${a}/${n.length}: ${l.value.constructor.name} ====================
${c.join(`
`)}
============================================================

`}return n.length>t&&(s+=`


... and ${n.length-t} more leaking disposables

`),{leaks:n,details:s}}};function g7(i){kc=i}if(m7){let i="__is_disposable_tracked__";g7(new class{trackDisposable(t){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[i]||console.log(e)},3e3)}setParent(t,e){if(t&&t!==N.None)try{t[i]=!0}catch{}}markAsDisposed(t){if(t&&t!==N.None)try{t[i]=!0}catch{}}markAsSingleton(t){}})}function Vl(i){return kc?.trackDisposable(i),i}function Bl(i){kc?.markAsDisposed(i)}function Pc(i,t){kc?.setParent(i,t)}function f7(i,t){if(kc)for(let e of i)kc.setParent(e,t)}function av(i){return kc?.markAsSingleton(i),i}function tx(i){return typeof i=="object"&&i!==null&&typeof i.dispose=="function"&&i.dispose.length===0}function In(i){if(Mt.is(i)){let t=[];for(let e of i)if(e)try{e.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Op(...i){let t=q(()=>In(i));return f7(i,t),t}var IR=class{constructor(t){this._isDisposed=!1,this._fn=t,Vl(this)}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,Bl(this),this._fn()}}};function q(i){return new IR(i)}var $=class i{constructor(){this._toDispose=new Set;this._isDisposed=!1;Vl(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(Bl(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{In(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t||t===N.None)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return Pc(t,this),this._isDisposed?i.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(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.delete(t)&&Pc(t,null)}assertNotDisposed(){this._isDisposed&&Ge(new At("Object disposed"))}},N=class{constructor(){this._store=new $;Vl(this),Pc(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){Bl(this),this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}},tn=class{constructor(){this._isDisposed=!1;Vl(this)}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),t&&Pc(t,this),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Bl(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t&&Pc(t,null),t}};var bn=class{constructor(t=new Map){this._isDisposed=!1;this._store=t,Vl(this)}dispose(){Bl(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{In(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,n=!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),n||this._store.get(t)?.dispose(),this._store.set(t,e),Pc(e,this)}deleteAndDispose(t){this._store.get(t)?.dispose(),this._store.delete(t)}deleteAndLeak(t){let e=this._store.get(t);return e&&Pc(e,null),this._store.delete(t),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function AH(i,t){return i.then(e=>(t.isDisposed?e.dispose():t.add(e),e))}var ex=class extends bn{constructor(){super(new Ve)}};var mn=class i{static{this.Undefined=new i(void 0)}constructor(t){this.element=t,this.next=i.Undefined,this.prev=i.Undefined}},mo=class{constructor(){this._first=mn.Undefined;this._last=mn.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===mn.Undefined}clear(){let t=this._first;for(;t!==mn.Undefined;){let e=t.next;t.prev=mn.Undefined,t.next=mn.Undefined,t=e}this._first=mn.Undefined,this._last=mn.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let n=new mn(t);if(this._first===mn.Undefined)this._first=n,this._last=n;else if(e){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(n))}}shift(){if(this._first!==mn.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==mn.Undefined){let t=this._last.element;return this._remove(this._last),t}}peek(){if(this._last!==mn.Undefined)return this._last.element}_remove(t){if(t.prev!==mn.Undefined&&t.next!==mn.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===mn.Undefined&&t.next===mn.Undefined?(this._first=mn.Undefined,this._last=mn.Undefined):t.next===mn.Undefined?(this._last=this._last.prev,this._last.next=mn.Undefined):t.prev===mn.Undefined&&(this._first=this._first.next,this._first.prev=mn.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==mn.Undefined;)yield t.element,t=t.next}};function h7(){return globalThis._VSCODE_NLS_MESSAGES}function xR(){return globalThis._VSCODE_NLS_LANGUAGE}var v7=xR()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function nx(i,t){let e;return t.length===0?e=i:e=i.replace(/\{(\d+)\}/g,(n,o)=>{let r=parseInt(o,10),s=t[r],a=n;return typeof s=="string"?a=s:(typeof s=="number"||typeof s=="boolean"||s===void 0||s===null)&&(a=String(s)),a}),v7&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function p(i,t,...e){return nx(typeof i=="number"?MH(i,t):t,e)}function MH(i,t){let e=h7()?.[i];if(typeof e!="string"){if(typeof t=="string")return t;throw new Error(`!!! NLS MISSING: ${i} !!!`)}return e}function xa(i,t,...e){let n;typeof i=="number"?n=MH(i,t):n=t;let o=nx(n,e);return{value:o,original:t===n?o:nx(t,e)}}var ps="en",dv=!1,cv=!1,lv=!1,y7=!1,UH=!1,SR=!1,FH=!1,CR=!1,HH=!1,WH=!1,ox,rx=ps,LH=ps,b7,Sa,Ta=globalThis,mr;typeof Ta.vscode<"u"&&typeof Ta.vscode.process<"u"?mr=Ta.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(mr=process);var VH=typeof mr?.versions?.electron=="string",I7=VH&&mr?.type==="renderer";if(typeof mr=="object"){dv=mr.platform==="win32",cv=mr.platform==="darwin",lv=mr.platform==="linux",y7=lv&&!!mr.env.SNAP&&!!mr.env.SNAP_REVISION,FH=VH,HH=!!mr.env.CI||!!mr.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!mr.env.GITHUB_WORKSPACE,ox=ps,rx=ps;let i=mr.env.VSCODE_NLS_CONFIG;if(i)try{let t=JSON.parse(i);ox=t.userLocale,LH=t.osLocale,rx=t.resolvedLanguage||ps,b7=t.languagePack?.translationsConfigFile}catch{}UH=!0}else typeof navigator=="object"&&!I7?(Sa=navigator.userAgent,dv=Sa.indexOf("Windows")>=0,cv=Sa.indexOf("Macintosh")>=0,CR=(Sa.indexOf("Macintosh")>=0||Sa.indexOf("iPad")>=0||Sa.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,lv=Sa.indexOf("Linux")>=0,WH=Sa?.indexOf("Mobi")>=0,SR=!0,rx=xR()||ps,ox=navigator.language.toLowerCase(),LH=ox):console.error("Unable to resolve platform.");function sx(i){switch(i){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var ix=0;cv?ix=1:dv?ix=3:lv&&(ix=2);var Te=dv,St=cv,Xe=lv;var uv=UH,BH=FH,ei=SR,TR=SR&&typeof Ta.importScripts=="function",$H=TR?Ta.origin:void 0,zH=CR,qH=WH,$l=HH,pv=ix,Zr=Sa,Ca=rx,x7;(n=>{function i(){return Ca}n.value=i;function t(){return Ca.length===2?Ca==="en":Ca.length>=3?Ca[0]==="e"&&Ca[1]==="n"&&Ca[2]==="-":!1}n.isDefaultVariant=t;function e(){return Ca==="en"}n.isDefault=e})(x7||={});var S7=typeof Ta.postMessage=="function"&&!Ta.importScripts,ax=(()=>{if(S7){let i=[];Ta.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let n=0,o=i.length;n<o;n++){let r=i[n];if(r.id===e.data.vscodeScheduleAsyncWork){i.splice(n,1),r.callback();return}}});let t=0;return e=>{let n=++t;i.push({id:n,callback:e}),Ta.postMessage({vscodeScheduleAsyncWork:n},"*")}}return i=>setTimeout(i)})();var gr=cv||CR?2:dv?1:3,OH=!0,NH=!1;function lx(){if(!NH){NH=!0;let i=new Uint8Array(2);i[0]=1,i[1]=2,OH=new Uint16Array(i.buffer)[0]===513}return OH}var mv=!!(Zr&&Zr.indexOf("Chrome")>=0),KH=!!(Zr&&Zr.indexOf("Firefox")>=0),jH=!!(!mv&&Zr&&Zr.indexOf("Safari")>=0),dx=!!(Zr&&Zr.indexOf("Edg/")>=0),Bne=!!(Zr&&Zr.indexOf("Android")>=0),GH=!!(Zr&&Zr.indexOf("Electron")>=0);var _c,ER=globalThis.vscode;if(typeof ER<"u"&&typeof ER.process<"u"){let i=ER.process;_c={get platform(){return i.platform},get arch(){return i.arch},get env(){return i.env},cwd(){return i.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?_c={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:_c={get platform(){return Te?"win32":St?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var Pi=_c.cwd,Fo=_c.env,wR=_c.platform,C7=_c.arch;var T7=globalThis.performance.now.bind(globalThis.performance),Xt=class i{static create(t){return new i(t)}constructor(t){this._now=t===!1?Date.now:T7,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var QH=!1,E7=!1,w7=100,JH=6e4;function YH(){return!!Fo.VSCODE_DEV}var ye;(ut=>{ut.None=()=>N.None;function t(ie){if(E7){let{onDidAddListener:ee}=ie,ne=Up.create(),se=0;ie.onDidAddListener=()=>{++se===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),ne.print()),ee?.()}}}function e(ie,ee,ne){return g(ie,()=>{},0,void 0,ee??!0,void 0,ne)}ut.defer=e;function n(ie){return(ee,ne=null,se)=>{let X=!1,ae;return ae=ie(be=>{if(!X)return ae?ae.dispose():X=!0,ee.call(ne,be)},null,se),X&&ae.dispose(),ae}}ut.once=n;function o(ie,ee){return ut.once(ut.filter(ie,ee))}ut.onceIf=o;function r(ie,ee,ne){return u((se,X=null,ae)=>ie(be=>se.call(X,ee(be)),null,ae),ne)}ut.map=r;function s(ie,ee,ne){return u((se,X=null,ae)=>ie(be=>{ee(be),se.call(X,be)},null,ae),ne)}ut.forEach=s;function a(ie,ee,ne){return u((se,X=null,ae)=>ie(be=>ee(be)&&se.call(X,be),null,ae),ne)}ut.filter=a;function l(ie){return ie}ut.signal=l;function d(...ie){return(ee,ne=null,se)=>{let X=Op(...ie.map(ae=>ae(be=>ee.call(ne,be))));return m(X,se)}}ut.any=d;function c(ie,ee,ne,se){let X=ne;return r(ie,ae=>(X=ee(X,ae),X),se)}ut.reduce=c;function u(ie,ee){let ne,se={onWillAddFirstListener(){ne=ie(X.fire,X)},onDidRemoveLastListener(){ne?.dispose()}};ee||t(se);let X=new T(se);return ee?.add(X),X.event}function m(ie,ee){return ee instanceof Array?ee.push(ie):ee&&ee.add(ie),ie}function g(ie,ee,ne=100,se=!1,X=!1,ae,be){let yt=N.None,Qe,He,qt=0,Gt,It={leakWarningThreshold:ae,onWillAddFirstListener(){yt=ie(ga=>{qt++,Qe=ee(Qe,ga),se&&!He&&(Lo.fire(Qe),Qe=void 0),Gt=()=>{let ss=Qe;Qe=void 0,He=void 0,(!se||qt>1)&&Lo.fire(ss),qt=0},typeof ne=="number"?(He&&clearTimeout(He),He=setTimeout(Gt,ne)):He===void 0&&(He=null,queueMicrotask(Gt))})},onWillRemoveListener(){X&&qt>0&&Gt?.()},onDidRemoveLastListener(){Gt=void 0,yt.dispose()}};be||t(It);let Lo=new T(It);return be?.add(Lo),Lo.event}ut.debounce=g;function h(ie,ee=0,ne,se){return ut.debounce(ie,(X,ae)=>X?(X.push(ae),X):[ae],ee,void 0,ne??!0,void 0,se)}ut.accumulate=h;function f(ie,ee,ne=100,se=!0,X=!0,ae,be){let yt,Qe,He,qt=0,Gt={leakWarningThreshold:ae,onWillAddFirstListener(){yt=ie(Lo=>{qt++,Qe=ee(Qe,Lo),He===void 0&&(se&&(It.fire(Qe),Qe=void 0,qt=0),typeof ne=="number"?He=setTimeout(()=>{X&&qt>0&&It.fire(Qe),Qe=void 0,He=void 0,qt=0},ne):(He=0,queueMicrotask(()=>{X&&qt>0&&It.fire(Qe),Qe=void 0,He=void 0,qt=0})))})},onDidRemoveLastListener(){yt.dispose()}};be||t(Gt);let It=new T(Gt);return be?.add(It),It.event}ut.throttle=f;function I(ie,ee=(se,X)=>se===X,ne){let se=!0,X;return a(ie,ae=>{let be=se||!ee(ae,X);return se=!1,X=ae,be},ne)}ut.latch=I;function x(ie,ee,ne){return[ut.filter(ie,ee,ne),ut.filter(ie,se=>!ee(se),ne)]}ut.split=x;function E(ie,ee,ne=!1,se=[],X){let ae=se.slice(),be;YH()&&(be={stack:Up.create(),timerId:setTimeout(()=>{ae&&ae.length>0&&be&&!be.warned&&(be.warned=!0,console.warn(`[Event.buffer][${ee}] potential LEAK detected: ${ae.length} events buffered for ${JH/1e3}s without being consumed. Buffered here:`),be.stack.print())},JH),warned:!1},X&&X.add(q(()=>clearTimeout(be.timerId))));let yt=()=>{be&&clearTimeout(be.timerId)},Qe=ie(Gt=>{ae?(ae.push(Gt),YH()&&be&&!be.warned&&ae.length>=w7&&(be.warned=!0,console.warn(`[Event.buffer][${ee}] potential LEAK detected: ${ae.length} events buffered without being consumed. Buffered here:`),be.stack.print())):qt.fire(Gt)});X&&X.add(Qe);let He=()=>{ae?.forEach(Gt=>qt.fire(Gt)),ae=null,yt()},qt=new T({onWillAddFirstListener(){Qe||(Qe=ie(Gt=>qt.fire(Gt)),X&&X.add(Qe))},onDidAddFirstListener(){ae&&(ne?setTimeout(He):He())},onDidRemoveLastListener(){Qe&&Qe.dispose(),Qe=null,yt()}});return X&&X.add(qt),qt.event}ut.buffer=E;function w(ie,ee){return(se,X,ae)=>{let be=ee(new L);return ie(function(yt){let Qe=be.evaluate(yt);Qe!==R&&se.call(X,Qe)},void 0,ae)}}ut.chain=w;let R=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(ee){return this.steps.push(ee),this}forEach(ee){return this.steps.push(ne=>(ee(ne),ne)),this}filter(ee){return this.steps.push(ne=>ee(ne)?ne:R),this}reduce(ee,ne){let se=ne;return this.steps.push(X=>(se=ee(se,X),se)),this}latch(ee=(ne,se)=>ne===se){let ne=!0,se;return this.steps.push(X=>{let ae=ne||!ee(X,se);return ne=!1,se=X,ae?X:R}),this}evaluate(ee){for(let ne of this.steps)if(ee=ne(ee),ee===R)break;return ee}}function U(ie,ee,ne=se=>se){let se=(...yt)=>be.fire(ne(...yt)),X=()=>ie.on(ee,se),ae=()=>ie.removeListener(ee,se),be=new T({onWillAddFirstListener:X,onDidRemoveLastListener:ae});return be.event}ut.fromNodeEventEmitter=U;function z(ie,ee,ne=se=>se){let se=(...yt)=>be.fire(ne(...yt)),X=()=>ie.addEventListener(ee,se),ae=()=>ie.removeEventListener(ee,se),be=new T({onWillAddFirstListener:X,onDidRemoveLastListener:ae});return be.event}ut.fromDOMEventEmitter=z;function Y(ie,ee){let ne,se,X=new Promise(ae=>{se=n(ie)(ae),DR(se,ee),ne=()=>{ZH(se,ee)}});return X.cancel=ne,ee&&X.finally(()=>ZH(se,ee)),X}ut.toPromise=Y;function j(ie,ee){return ie(ne=>ee.fire(ne))}ut.forward=j;function Q(ie,ee,ne){return ee(ne),ie(se=>ee(se))}ut.runAndSubscribe=Q;class Z{constructor(ee,ne){this._observable=ee;this._counter=0;this._hasChanged=!1;let se={onWillAddFirstListener:()=>{ee.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{ee.removeObserver(this)}};ne||t(se),this.emitter=new T(se),ne&&ne.add(this.emitter)}beginUpdate(ee){this._counter++}handlePossibleChange(ee){}handleChange(ee,ne){this._hasChanged=!0}endUpdate(ee){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function me(ie,ee){return new Z(ie,ee).emitter.event}ut.fromObservable=me;function vt(ie){return(ee,ne,se)=>{let X=0,ae=!1,be={beginUpdate(){X++},endUpdate(){X--,X===0&&(ie.reportChanges(),ae&&(ae=!1,ee.call(ne)))},handlePossibleChange(){},handleChange(){ae=!0}};ie.addObserver(be),ie.reportChanges();let yt={dispose(){ie.removeObserver(be)}};return DR(yt,se),yt}}ut.fromObservableLight=vt})(ye||={});var kR=class i{constructor(t){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${t}_${i._idPool++}`,i.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(t){this._stopWatch=new Xt,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}},XH=-1;var k7=1;function e2(){return(k7++).toString(16).padStart(3,"0")}var PR=class{constructor(t,e,n=e2()){this._errorHandler=t;this.threshold=e;this.name=n;this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,e){let n=this.threshold;if(n<=0||e<n)return;this._stacks||(this._stacks=new Map);let o=t.value,r=this._stacks.get(o)||0;if(this._stacks.set(o,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[s,a]=this.getMostFrequentStack(),l=/^[0-9a-f]+$/i.test(this.name)?void 0:this.name,d=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${a}):`;console.warn(d),console.warn(s);let c=a/e>.3?"dominated":"popular",u=new Fp(c,d,s,e,l);this._errorHandler(u)}return()=>{let s=this._stacks.get(o)||0;s<=1?this._stacks.delete(o):this._stacks.set(o,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,e=0;for(let[n,o]of this._stacks)(!t||e<o)&&(t=[n,o],e=o);return t}},Up=class i{constructor(t){this.value=t}static create(){let t=new Error;return new i(t.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},Fp=class i extends Error{constructor(t,e,n,o,r){super(r?`[${r}] potential listener LEAK detected, ${t}`:`potential listener LEAK detected, ${t}`),this.name="ListenerLeakError",this.kind=t,this.listenerCount=o,this.details=e,this.stack=n}static is(t){return t instanceof i||t instanceof Error&&typeof t.kind=="string"&&typeof t.listenerCount=="number"}},_R=class extends Fp{constructor(t,e,n,o,r){super(t,e,n,o,r),this.name="ListenerRefusalError"}},P7=0,Np=class{constructor(t){this.value=t;this.id=P7++}},_7=2,t2=(i,t)=>{if(i instanceof Np)t(i);else for(let e=0;e<i.length;e++){let n=i[e];n&&t(n)}},T=class{constructor(t){this._size=0;this._options=t,(XH>0||this._options?.leakWarningThreshold)&&(this._leakWarningThreshold=this._options?.leakWarningThreshold??XH,this._leakWarningName=this._options?.leakWarningName??e2(),this._leakWarningErrorHandler=this._options?.onListenerError??Ge),this._perfMon=this._options?._profName?new kR(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}_getLeakageMonitor(){if(!(this._leakWarningThreshold===void 0||this._leakWarningName===void 0||this._leakWarningErrorHandler===void 0))return this._leakageMon??=new PR(this._leakWarningErrorHandler,this._leakWarningThreshold,this._leakWarningName)}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(QH){let t=this._listeners;queueMicrotask(()=>{t2(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,n)=>{if(this._leakWarningThreshold!==void 0&&this._size>this._leakWarningThreshold**2){let l=this._getLeakageMonitor();if(l){let d=`[${l.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${l.threshold})`;console.warn(d);let c=l.getMostFrequentStack()??["UNKNOWN stack",-1],u=c[1]/this._size>.3?"dominated":"popular",m=new _R(u,`${d}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0],this._size,this._options?.leakWarningName);return(this._options?.onListenerError||Ge)(m),N.None}}if(this._disposed)return N.None;e&&(t=t.bind(e));let o=new Np(t),r,s;if(this._leakWarningThreshold!==void 0&&this._size>=Math.ceil(this._leakWarningThreshold*.2)){let l=this._getLeakageMonitor();l&&(o.stack=Up.create(),r=l.check(o.stack,this._size+1))}QH&&(o.stack=s??Up.create()),this._listeners?this._listeners instanceof Np?(this._deliveryQueue??=new RR,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=q(()=>{r?.(),this._removeListener(o)});return DR(a,n),a},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}let e=this._listeners,n=e.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[n]=void 0;let o=this._deliveryQueue.current===this;if(this._size*_7<=e.length){let r=0;for(let s=0;s<e.length;s++)e[s]?e[r++]=e[s]:o&&r<this._deliveryQueue.end&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=r}}_deliver(t,e){if(!t)return;let n=this._options?.onListenerError||Ge;if(!n){t.value(e);return}try{t.value(e)}catch(o){n(o)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Np)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}};var RR=class{constructor(){this.i=-1;this.end=0}enqueue(t,e,n){this.i=0,this.end=n,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ms=class extends T{async fireAsync(t,e,n){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new mo),t2(this._listeners,o=>this._asyncDeliveryQueue.push([o.value,t]));this._asyncDeliveryQueue.size>0&&!e.isCancellationRequested;){let[o,r]=this._asyncDeliveryQueue.shift(),s=[],a={...r,token:e,waitUntil:l=>{if(Object.isFrozen(s))throw new Error("waitUntil can NOT be called asynchronous");n&&(l=n(l,o)),s.push(l)}};try{o(a)}catch(l){Ge(l);continue}Object.freeze(s),await Promise.allSettled(s).then(l=>{for(let d of l)d.status==="rejected"&&Ge(d.reason)})}}},gs=class extends T{constructor(e){super(e);this._isPaused=0;this._eventQueue=new mo;this._mergeFn=e?.merge}get isPaused(){return this._isPaused!==0}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){let e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}},ux=class extends gs{constructor(t){super(t),this._delay=t.delay??100}fire(t){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(t)}},px=class extends T{constructor(e){super(e);this._queuedEvents=[];this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(n=>super.fire(n)),this._queuedEvents=[]}))}};var mx=class{constructor(){this.listening=!1;this.inputEvent=ye.None;this.inputEventListener=N.None;this.emitter=new T({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()}};function DR(i,t){t instanceof $?t.add(i):Array.isArray(t)&&t.push(i)}function ZH(i,t){if(t instanceof $)t.delete(i);else if(Array.isArray(t)){let e=t.indexOf(i);e!==-1&&t.splice(e,1)}i.dispose()}var n2=Object.freeze(function(i,t){let e=setTimeout(i.bind(t),0);return{dispose(){clearTimeout(e)}}}),pe;(n=>{function i(o){return o===n.None||o===n.Cancelled||o instanceof Hp?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}n.isCancellationToken=i,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ye.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n2})})(pe||={});var Hp=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?n2:(this._emitter||(this._emitter=new T),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ee=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 Hp),this._token}cancel(){this._token?this._token instanceof Hp&&this._token.cancel():this._token=pe.Cancelled}dispose(t=!1){t&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Hp&&this._token.dispose():this._token=pe.None}};var R7=65,D7=97,A7=90,M7=122,Rc=46,go=47,fr=92,Ea=58,L7=63,gx=class extends Error{constructor(t,e,n){let o;typeof e=="string"&&e.indexOf("not ")===0?(o="must not be",e=e.replace(/^not /,"")):o="must be";let r=t.indexOf(".")!==-1?"property":"argument",s=`The "${t}" ${r} ${o} of type ${e}`;s+=`. Received type ${typeof n}`,super(s),this.code="ERR_INVALID_ARG_TYPE"}};function O7(i,t){if(i===null||typeof i!="object")throw new gx(t,"Object",i)}function Nn(i,t){if(typeof i!="string")throw new gx(t,"string",i)}var hr=wR==="win32";function pt(i){return i===go||i===fr}function AR(i){return i===go}function wa(i){return i>=R7&&i<=A7||i>=D7&&i<=M7}function fx(i,t,e,n){let o="",r=0,s=-1,a=0,l=0;for(let d=0;d<=i.length;++d){if(d<i.length)l=i.charCodeAt(d);else{if(n(l))break;l=go}if(n(l)){if(!(s===d-1||a===1))if(a===2){if(o.length<2||r!==2||o.charCodeAt(o.length-1)!==Rc||o.charCodeAt(o.length-2)!==Rc){if(o.length>2){let c=o.lastIndexOf(e);c===-1?(o="",r=0):(o=o.slice(0,c),r=o.length-1-o.lastIndexOf(e)),s=d,a=0;continue}else if(o.length!==0){o="",r=0,s=d,a=0;continue}}t&&(o+=o.length>0?`${e}..`:"..",r=2)}else o.length>0?o+=`${e}${i.slice(s+1,d)}`:o=i.slice(s+1,d),r=d-s-1;s=d,a=0}else l===Rc&&a!==-1?++a:a=-1}return o}function N7(i){return i?`${i[0]==="."?"":"."}${i}`:""}function o2(i,t){O7(t,"pathObject");let e=t.dir||t.root,n=t.base||`${t.name||""}${N7(t.ext)}`;return e?e===t.root?`${e}${n}`:`${e}${i}${n}`:n}var xn={resolve(...i){let t="",e="",n=!1;for(let o=i.length-1;o>=-1;o--){let r;if(o>=0){if(r=i[o],Nn(r,`paths[${o}]`),r.length===0)continue}else t.length===0?r=Pi():(r=Fo[`=${t}`]||Pi(),(r===void 0||r.slice(0,2).toLowerCase()!==t.toLowerCase()&&r.charCodeAt(2)===fr)&&(r=`${t}\\`));let s=r.length,a=0,l="",d=!1,c=r.charCodeAt(0);if(s===1)pt(c)&&(a=1,d=!0);else if(pt(c))if(d=!0,pt(r.charCodeAt(1))){let u=2,m=u;for(;u<s&&!pt(r.charCodeAt(u));)u++;if(u<s&&u!==m){let g=r.slice(m,u);for(m=u;u<s&&pt(r.charCodeAt(u));)u++;if(u<s&&u!==m){for(m=u;u<s&&!pt(r.charCodeAt(u));)u++;(u===s||u!==m)&&(l=`\\\\${g}\\${r.slice(m,u)}`,a=u)}}}else a=1;else wa(c)&&r.charCodeAt(1)===Ea&&(l=r.slice(0,2),a=2,s>2&&pt(r.charCodeAt(2))&&(d=!0,a=3));if(l.length>0)if(t.length>0){if(l.toLowerCase()!==t.toLowerCase())continue}else t=l;if(n){if(t.length>0)break}else if(e=`${r.slice(a)}\\${e}`,n=d,d&&t.length>0)break}return e=fx(e,!n,"\\",pt),n?`${t}\\${e}`:`${t}${e}`||"."},normalize(i){Nn(i,"path");let t=i.length;if(t===0)return".";let e=0,n,o=!1,r=i.charCodeAt(0);if(t===1)return AR(r)?"\\":i;if(pt(r))if(o=!0,pt(i.charCodeAt(1))){let a=2,l=a;for(;a<t&&!pt(i.charCodeAt(a));)a++;if(a<t&&a!==l){let d=i.slice(l,a);for(l=a;a<t&&pt(i.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&!pt(i.charCodeAt(a));)a++;if(a===t)return`\\\\${d}\\${i.slice(l)}\\`;a!==l&&(n=`\\\\${d}\\${i.slice(l,a)}`,e=a)}}}else e=1;else wa(r)&&i.charCodeAt(1)===Ea&&(n=i.slice(0,2),e=2,t>2&&pt(i.charCodeAt(2))&&(o=!0,e=3));let s=e<t?fx(i.slice(e),!o,"\\",pt):"";if(s.length===0&&!o&&(s="."),s.length>0&&pt(i.charCodeAt(t-1))&&(s+="\\"),!o&&n===void 0&&i.includes(":")){if(s.length>=2&&wa(s.charCodeAt(0))&&s.charCodeAt(1)===Ea)return`.\\${s}`;let a=i.indexOf(":");do if(a===t-1||pt(i.charCodeAt(a+1)))return`.\\${s}`;while((a=i.indexOf(":",a+1))!==-1)}return n===void 0?o?`\\${s}`:s:o?`${n}\\${s}`:`${n}${s}`},isAbsolute(i){Nn(i,"path");let t=i.length;if(t===0)return!1;let e=i.charCodeAt(0);return pt(e)||t>2&&wa(e)&&i.charCodeAt(1)===Ea&&pt(i.charCodeAt(2))},join(...i){if(i.length===0)return".";let t,e;for(let r=0;r<i.length;++r){let s=i[r];Nn(s,"path"),s.length>0&&(t===void 0?t=e=s:t+=`\\${s}`)}if(t===void 0)return".";let n=!0,o=0;if(typeof e=="string"&&pt(e.charCodeAt(0))){++o;let r=e.length;r>1&&pt(e.charCodeAt(1))&&(++o,r>2&&(pt(e.charCodeAt(2))?++o:n=!1))}if(n){for(;o<t.length&&pt(t.charCodeAt(o));)o++;o>=2&&(t=`\\${t.slice(o)}`)}return xn.normalize(t)},relative(i,t){if(Nn(i,"from"),Nn(t,"to"),i===t)return"";let e=xn.resolve(i),n=xn.resolve(t);if(e===n||(i=e.toLowerCase(),t=n.toLowerCase(),i===t))return"";if(e.length!==i.length||n.length!==t.length){let h=e.split("\\"),f=n.split("\\");h[h.length-1]===""&&h.pop(),f[f.length-1]===""&&f.pop();let I=h.length,x=f.length,E=I<x?I:x,w;for(w=0;w<E&&h[w].toLowerCase()===f[w].toLowerCase();w++);return w===0?n:w===E?x>E?f.slice(w).join("\\"):I>E?"..\\".repeat(I-1-w)+"..":"":"..\\".repeat(I-w)+f.slice(w).join("\\")}let o=0;for(;o<i.length&&i.charCodeAt(o)===fr;)o++;let r=i.length;for(;r-1>o&&i.charCodeAt(r-1)===fr;)r--;let s=r-o,a=0;for(;a<t.length&&t.charCodeAt(a)===fr;)a++;let l=t.length;for(;l-1>a&&t.charCodeAt(l-1)===fr;)l--;let d=l-a,c=s<d?s:d,u=-1,m=0;for(;m<c;m++){let h=i.charCodeAt(o+m);if(h!==t.charCodeAt(a+m))break;h===fr&&(u=m)}if(m!==c){if(u===-1)return n}else{if(d>c){if(t.charCodeAt(a+m)===fr)return n.slice(a+m+1);if(m===2)return n.slice(a+m)}s>c&&(i.charCodeAt(o+m)===fr?u=m:m===2&&(u=3)),u===-1&&(u=0)}let g="";for(m=o+u+1;m<=r;++m)(m===r||i.charCodeAt(m)===fr)&&(g+=g.length===0?"..":"\\..");return a+=u,g.length>0?`${g}${n.slice(a,l)}`:(n.charCodeAt(a)===fr&&++a,n.slice(a,l))},toNamespacedPath(i){if(typeof i!="string"||i.length===0)return i;let t=xn.resolve(i);if(t.length<=2)return i;if(t.charCodeAt(0)===fr){if(t.charCodeAt(1)===fr){let e=t.charCodeAt(2);if(e!==L7&&e!==Rc)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(wa(t.charCodeAt(0))&&t.charCodeAt(1)===Ea&&t.charCodeAt(2)===fr)return`\\\\?\\${t}`;return t},dirname(i){Nn(i,"path");let t=i.length;if(t===0)return".";let e=-1,n=0,o=i.charCodeAt(0);if(t===1)return pt(o)?i:".";if(pt(o)){if(e=n=1,pt(i.charCodeAt(1))){let a=2,l=a;for(;a<t&&!pt(i.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&pt(i.charCodeAt(a));)a++;if(a<t&&a!==l){for(l=a;a<t&&!pt(i.charCodeAt(a));)a++;if(a===t)return i;a!==l&&(e=n=a+1)}}}}else wa(o)&&i.charCodeAt(1)===Ea&&(e=t>2&&pt(i.charCodeAt(2))?3:2,n=e);let r=-1,s=!0;for(let a=t-1;a>=n;--a)if(pt(i.charCodeAt(a))){if(!s){r=a;break}}else s=!1;if(r===-1){if(e===-1)return".";r=e}return i.slice(0,r)},basename(i,t){t!==void 0&&Nn(t,"suffix"),Nn(i,"path");let e=0,n=-1,o=!0,r;if(i.length>=2&&wa(i.charCodeAt(0))&&i.charCodeAt(1)===Ea&&(e=2),t!==void 0&&t.length>0&&t.length<=i.length){if(t===i)return"";let s=t.length-1,a=-1;for(r=i.length-1;r>=e;--r){let l=i.charCodeAt(r);if(pt(l)){if(!o){e=r+1;break}}else a===-1&&(o=!1,a=r+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(n=r):(s=-1,n=a))}return e===n?n=a:n===-1&&(n=i.length),i.slice(e,n)}for(r=i.length-1;r>=e;--r)if(pt(i.charCodeAt(r))){if(!o){e=r+1;break}}else n===-1&&(o=!1,n=r+1);return n===-1?"":i.slice(e,n)},extname(i){Nn(i,"path");let t=0,e=-1,n=0,o=-1,r=!0,s=0;i.length>=2&&i.charCodeAt(1)===Ea&&wa(i.charCodeAt(0))&&(t=n=2);for(let a=i.length-1;a>=t;--a){let l=i.charCodeAt(a);if(pt(l)){if(!r){n=a+1;break}continue}o===-1&&(r=!1,o=a+1),l===Rc?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||o===-1||s===0||s===1&&e===o-1&&e===n+1?"":i.slice(e,o)},format:o2.bind(null,"\\"),parse(i){Nn(i,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;let e=i.length,n=0,o=i.charCodeAt(0);if(e===1)return pt(o)?(t.root=t.dir=i,t):(t.base=t.name=i,t);if(pt(o)){if(n=1,pt(i.charCodeAt(1))){let u=2,m=u;for(;u<e&&!pt(i.charCodeAt(u));)u++;if(u<e&&u!==m){for(m=u;u<e&&pt(i.charCodeAt(u));)u++;if(u<e&&u!==m){for(m=u;u<e&&!pt(i.charCodeAt(u));)u++;u===e?n=u:u!==m&&(n=u+1)}}}}else if(wa(o)&&i.charCodeAt(1)===Ea){if(e<=2)return t.root=t.dir=i,t;if(n=2,pt(i.charCodeAt(2))){if(e===3)return t.root=t.dir=i,t;n=3}}n>0&&(t.root=i.slice(0,n));let r=-1,s=n,a=-1,l=!0,d=i.length-1,c=0;for(;d>=n;--d){if(o=i.charCodeAt(d),pt(o)){if(!l){s=d+1;break}continue}a===-1&&(l=!1,a=d+1),o===Rc?r===-1?r=d:c!==1&&(c=1):r!==-1&&(c=-1)}return a!==-1&&(r===-1||c===0||c===1&&r===a-1&&r===s+1?t.base=t.name=i.slice(s,a):(t.name=i.slice(s,r),t.base=i.slice(s,a),t.ext=i.slice(r,a))),s>0&&s!==n?t.dir=i.slice(0,s-1):t.dir=t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},U7=(()=>{if(hr){let i=/\\/g;return()=>{let t=Pi().replace(i,"/");return t.slice(t.indexOf("/"))}}return()=>Pi()})(),qe={resolve(...i){let t="",e=!1;for(let n=i.length-1;n>=0&&!e;n--){let o=i[n];Nn(o,`paths[${n}]`),o.length!==0&&(t=`${o}/${t}`,e=o.charCodeAt(0)===go)}if(!e){let n=U7();t=`${n}/${t}`,e=n.charCodeAt(0)===go}return t=fx(t,!e,"/",AR),e?`/${t}`:t.length>0?t:"."},normalize(i){if(Nn(i,"path"),i.length===0)return".";let t=i.charCodeAt(0)===go,e=i.charCodeAt(i.length-1)===go;return i=fx(i,!t,"/",AR),i.length===0?t?"/":e?"./":".":(e&&(i+="/"),t?`/${i}`:i)},isAbsolute(i){return Nn(i,"path"),i.length>0&&i.charCodeAt(0)===go},join(...i){if(i.length===0)return".";let t=[];for(let e=0;e<i.length;++e){let n=i[e];Nn(n,"path"),n.length>0&&t.push(n)}return t.length===0?".":qe.normalize(t.join("/"))},relative(i,t){if(Nn(i,"from"),Nn(t,"to"),i===t||(i=qe.resolve(i),t=qe.resolve(t),i===t))return"";let e=1,n=i.length,o=n-e,r=1,s=t.length-r,a=o<s?o:s,l=-1,d=0;for(;d<a;d++){let u=i.charCodeAt(e+d);if(u!==t.charCodeAt(r+d))break;u===go&&(l=d)}if(d===a)if(s>a){if(t.charCodeAt(r+d)===go)return t.slice(r+d+1);if(d===0)return t.slice(r+d)}else o>a&&(i.charCodeAt(e+d)===go?l=d:d===0&&(l=0));let c="";for(d=e+l+1;d<=n;++d)(d===n||i.charCodeAt(d)===go)&&(c+=c.length===0?"..":"/..");return`${c}${t.slice(r+l)}`},toNamespacedPath(i){return i},dirname(i){if(Nn(i,"path"),i.length===0)return".";let t=i.charCodeAt(0)===go,e=-1,n=!0;for(let o=i.length-1;o>=1;--o)if(i.charCodeAt(o)===go){if(!n){e=o;break}}else n=!1;return e===-1?t?"/":".":t&&e===1?"//":i.slice(0,e)},basename(i,t){t!==void 0&&Nn(t,"suffix"),Nn(i,"path");let e=0,n=-1,o=!0,r;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t===i)return"";let s=t.length-1,a=-1;for(r=i.length-1;r>=0;--r){let l=i.charCodeAt(r);if(l===go){if(!o){e=r+1;break}}else a===-1&&(o=!1,a=r+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(n=r):(s=-1,n=a))}return e===n?n=a:n===-1&&(n=i.length),i.slice(e,n)}for(r=i.length-1;r>=0;--r)if(i.charCodeAt(r)===go){if(!o){e=r+1;break}}else n===-1&&(o=!1,n=r+1);return n===-1?"":i.slice(e,n)},extname(i){Nn(i,"path");let t=-1,e=0,n=-1,o=!0,r=0;for(let s=i.length-1;s>=0;--s){let a=i[s];if(a==="/"){if(!o){e=s+1;break}continue}n===-1&&(o=!1,n=s+1),a==="."?t===-1?t=s:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||n===-1||r===0||r===1&&t===n-1&&t===e+1?"":i.slice(t,n)},format:o2.bind(null,"/"),parse(i){Nn(i,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;let e=i.charCodeAt(0)===go,n;e?(t.root="/",n=1):n=0;let o=-1,r=0,s=-1,a=!0,l=i.length-1,d=0;for(;l>=n;--l){let c=i.charCodeAt(l);if(c===go){if(!a){r=l+1;break}continue}s===-1&&(a=!1,s=l+1),c===Rc?o===-1?o=l:d!==1&&(d=1):o!==-1&&(d=-1)}if(s!==-1){let c=r===0&&e?1:r;o===-1||d===0||d===1&&o===s-1&&o===r+1?t.base=t.name=i.slice(c,s):(t.name=i.slice(c,o),t.base=i.slice(c,s),t.ext=i.slice(o,s))}return r>0?t.dir=i.slice(0,r-1):e&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};qe.win32=xn.win32=xn;qe.posix=xn.posix=qe;var so=hr?xn.normalize:qe.normalize,cn=hr?xn.isAbsolute:qe.isAbsolute,Be=hr?xn.join:qe.join,MR=hr?xn.resolve:qe.resolve,_i=hr?xn.relative:qe.relative,gn=hr?xn.dirname:qe.dirname,ot=hr?xn.basename:qe.basename,zl=hr?xn.extname:qe.extname,soe=hr?xn.format:qe.format,aoe=hr?xn.parse:qe.parse,loe=hr?xn.toNamespacedPath:qe.toNamespacedPath,Dt=hr?xn.sep:qe.sep,Wp=hr?xn.delimiter:qe.delimiter;function F7(i){return i}var hx=class{constructor(t,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof t=="function"?(this._fn=t,this._computeKey=F7):(this._fn=e,this._computeKey=t.getCacheKey)}get(t){let e=this._computeKey(t);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(t)),this.lastCache}};var mt=class{constructor(t){this.executor=t;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(t){this._error=t}finally{this._state=2}}else if(this._state===1)throw new Error("Cannot read the value of a lazy that is being initialized");if(this._error)throw this._error;return this._value}get rawValue(){return this._value}};function LR(i){return i<0?0:i>255?255:i|0}function Dc(i){return i<0?0:i>4294967295?4294967295:i|0}function fs(i){return!i||typeof i!="string"?!0:i.trim().length===0}var W7=/{(\d+)}/g;function l2(i,...t){return t.length===0?i:i.replace(W7,function(e,n){let o=parseInt(n,10);return isNaN(o)||o<0||o>=t.length?e:t[o]})}var V7=/{([^}]+)}/g;function FR(i,t){return Object.keys(t).length===0?i:i.replace(V7,(e,n)=>t[n]??e)}function yx(i){return i.replace(/[<>"'&]/g,t=>{switch(t){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;"}return t})}function ti(i){return i.replace(/[<>&]/g,function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return t}})}function nr(i){return i.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function d2(i,t){let e=0,n=i.indexOf(t);for(;n!==-1;)e++,n=i.indexOf(t,n+t.length);return e}function HR(i,t){if(!i||!t)return i;let e=t.length,n=0;if(e===1){let o=t.charCodeAt(0);for(;n<i.length&&i.charCodeAt(n)===o;)n++}else for(;i.startsWith(t,n);)n+=e;return i.substring(n)}function vr(i,t){if(!i||!t)return i;let e=t.length,n=i.length;if(e===1){let r=n,s=t.charCodeAt(0);for(;r>0&&i.charCodeAt(r-1)===s;)r--;return i.substring(0,r)}let o=n;for(;o>0&&i.endsWith(t,o);)o-=e;return i.substring(0,o)}function bx(i,t,e={}){if(!i)throw new Error("Cannot create regex from empty string");t||(i=nr(i)),e.wholeWord&&(/\B/.test(i.charAt(0))||(i="\\b"+i),/\B/.test(i.charAt(i.length-1))||(i=i+"\\b"));let n="";return e.global&&(n+="g"),e.matchCase||(n+="i"),e.multiline&&(n+="m"),e.unicode&&(n+="u"),new RegExp(i,n)}function Ix(i){return i.source==="^"||i.source==="^$"||i.source==="$"||i.source==="^\\s*$"?!1:!!(i.exec("")&&i.lastIndex===0)}function xx(i){return i.split(/\r\n|\r|\n/)}function Sx(i){for(let t=0,e=i.length;t<e;t++){let n=i.charCodeAt(t);if(n!==32&&n!==9)return t}return-1}function c2(i,t=i.length-1){for(let e=t;e>=0;e--){let n=i.charCodeAt(e);if(n!==32&&n!==9)return e}return-1}function Ri(i,t){return i<t?-1:i>t?1:0}function Cx(i,t,e=0,n=i.length,o=0,r=t.length){for(;e<n&&o<r;e++,o++){let l=i.charCodeAt(e),d=t.charCodeAt(o);if(l<d)return-1;if(l>d)return 1}let s=n-e,a=r-o;return s<a?-1:s>a?1:0}function Ac(i,t){return Mc(i,t,0,i.length,0,t.length)}function Mc(i,t,e=0,n=i.length,o=0,r=t.length){for(;e<n&&o<r;e++,o++){let l=i.charCodeAt(e),d=t.charCodeAt(o);if(l===d)continue;if(l>=128||d>=128)return Cx(i.toLowerCase(),t.toLowerCase(),e,n,o,r);r2(l)&&(l-=32),r2(d)&&(d-=32);let c=l-d;if(c!==0)return c}let s=n-e,a=r-o;return s<a?-1:s>a?1:0}function r2(i){return i>=97&&i<=122}function WR(i){return i>=65&&i<=90}function wn(i,t){return i.length===t.length&&Mc(i,t)===0}function hs(i,t,e){return i===t||!!e&&i!==void 0&&t!==void 0&&wn(i,t)}function ka(i,t){let e=t.length;return e<=i.length&&Mc(i,t,0,e)===0}function u2(i,t){let e=i.length,n=e-t.length;return n>=0&&Mc(i,t,n,e)===0}function p2(i,t){let e=Math.min(i.length,t.length),n;for(n=0;n<e;n++)if(i.charCodeAt(n)!==t.charCodeAt(n))return n;return e}function Lc(i){return 55296<=i&&i<=56319}function gv(i){return 56320<=i&&i<=57343}function Tx(i,t){return(i-55296<<10)+(t-56320)+65536}function VR(i,t,e){let n=i.charCodeAt(e);if(Lc(n)&&e+1<t){let o=i.charCodeAt(e+1);if(gv(o))return Tx(n,o)}return n}function B7(i,t){let e=i.charCodeAt(t-1);if(gv(e)&&t>1){let n=i.charCodeAt(t-2);if(Lc(n))return Tx(n,e)}return e}var NR=class{get offset(){return this._offset}constructor(t,e=0){this._str=t,this._len=t.length,this._offset=e}setOffset(t){this._offset=t}prevCodePoint(){let t=B7(this._str,this._offset);return this._offset-=t>=65536?2:1,t}nextCodePoint(){let t=VR(this._str,this._len,this._offset);return this._offset+=t>=65536?2:1,t}eol(){return this._offset>=this._len}},UR=class{get offset(){return this._iterator.offset}constructor(t,e=0){this._iterator=new NR(t,e)}nextGraphemeLength(){let t=vx.getInstance(),e=this._iterator,n=e.offset,o=t.getGraphemeBreakType(e.nextCodePoint());for(;!e.eol();){let r=e.offset,s=t.getGraphemeBreakType(e.nextCodePoint());if(i2(o,s)){e.setOffset(r);break}o=s}return e.offset-n}prevGraphemeLength(){let t=vx.getInstance(),e=this._iterator,n=e.offset,o=t.getGraphemeBreakType(e.prevCodePoint());for(;e.offset>0;){let r=e.offset,s=t.getGraphemeBreakType(e.prevCodePoint());if(i2(s,o)){e.setOffset(r);break}o=s}return n-e.offset}eol(){return this._iterator.eol()}};function BR(i,t){return new UR(i,t).nextGraphemeLength()}var OR;function $7(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function Ex(i){return OR||(OR=$7()),OR.test(i)}var z7=/^[\t\n\r\x20-\x7E]*$/;function m2(i){return z7.test(i)}var q7=/[\u2028\u2029]/;function wx(i){return q7.test(i)}var K7=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,j7=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,G7=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,yoe=new RegExp("(?:"+[K7.source,j7.source,G7.source].join("|")+")","g");var g2=String.fromCharCode(65279);function f2(i){return!!(i&&i.length>0&&i.charCodeAt(0)===65279)}function h2(i,t){if(!i||!t||i.length<t.length)return!1;let e=i.toLowerCase(),n=t.toLowerCase(),o=n.length,r=0,s=-1;for(;r<o;){let a=e.indexOf(n[r],s+1);if(a<0)return!1;s=a,r++}return!0}function $R(i,t=!1){return i?(t&&(i=i.replace(/\\./g,"")),i.toLowerCase()!==i):!1}function v2(i){return i.charAt(0).toUpperCase()+i.slice(1)}function y2(i,t=1){if(t===0)return"";let e=-1;do e=i.indexOf(`
`,e+1),t--;while(t>0&&e>=0);return e===-1?i:(i[e-1]==="\r"&&e--,i.substr(0,e))}function i2(i,t){return i===0?t!==5&&t!==7:i===2&&t===3?!1:i===4||i===2||i===3||t===4||t===2||t===3?!0:!(i===8&&(t===8||t===9||t===11||t===12)||(i===11||i===9)&&(t===9||t===10)||(i===12||i===10)&&t===10||t===5||t===13||t===7||i===1||i===13&&t===14||i===6&&t===6)}var vx=class i{static{this._INSTANCE=null}static getInstance(){return i._INSTANCE||(i._INSTANCE=new i),i._INSTANCE}constructor(){this._data=Q7()}getGraphemeBreakType(t){if(t<32)return t===10?3:t===13?2:4;if(t<127)return 0;let e=this._data,n=e.length/3,o=1;for(;o<=n;)if(t<e[3*o])o=2*o;else if(t>e[3*o+1])o=2*o+1;else return e[3*o+2];return 0}};function Q7(){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 s2=class i{constructor(t){this.confusableDictionary=t}static{this.ambiguousCharacterData=new mt(()=>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 hx(t=>{let e=t.split(",");function n(u){let m=new Map;for(let g=0;g<u.length;g+=2)m.set(u[g],u[g+1]);return m}function o(u,m){let g=new Map(u);for(let[h,f]of m)g.set(h,f);return g}function r(u,m){if(!u)return m;let g=new Map;for(let[h,f]of u)m.has(h)&&g.set(h,f);return g}let s=this.ambiguousCharacterData.value,a=e.filter(u=>!u.startsWith("_")&&Object.hasOwn(s,u));a.length===0&&(a=["_default"]);let l;for(let u of a){let m=n(s[u]);l=r(l,m)}let d=n(s._common),c=o(d,l);return new i(c)})}static getInstance(t){return i.cache.get(Array.from(t).join(","))}static{this._locales=new mt(()=>Object.keys(i.ambiguousCharacterData.value).filter(t=>!t.startsWith("_")))}static getLocales(){return i._locales.value}isAmbiguous(t){return this.confusableDictionary.has(t)}containsAmbiguousCharacter(t){for(let e=0;e<t.length;e++){let n=t.codePointAt(e);if(typeof n=="number"&&this.isAmbiguous(n))return!0}return!1}getPrimaryConfusable(t){return this.confusableDictionary.get(t)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},a2=class i{static getRawData(){return JSON.parse('{"_common":[11,12,13,127,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999],"cs":[173,8203,12288],"de":[173,8203,12288],"es":[8203,12288],"fr":[173,8203,12288],"it":[160,173,12288],"ja":[173],"ko":[173,12288],"pl":[173,8203,12288],"pt-BR":[173,8203,12288],"qps-ploc":[160,173,8203,12288],"ru":[173,12288],"tr":[160,173,8203,12288],"zh-hans":[160,173,8203,12288],"zh-hant":[173,12288]}')}static{this._data=void 0}static getData(){return this._data||(this._data=new Set([...Object.values(i.getRawData())].flat())),this._data}static isInvisibleCharacter(t){return i.getData().has(t)}static containsInvisibleCharacter(t){for(let e=0;e<t.length;e++){let n=t.codePointAt(e);if(typeof n=="number"&&(i.isInvisibleCharacter(n)||n===32))return!0}return!1}static get codePoints(){return i.getData()}};function ql(i){return i===47||i===92}function kx(i){return i.replace(/[\\/]/g,qe.sep)}function b2(i){return i.indexOf("/")===-1&&(i=kx(i)),/^[a-zA-Z]:(\/|$)/.test(i)&&(i="/"+i),i}function fv(i,t=qe.sep){if(!i)return"";let e=i.length,n=i.charCodeAt(0);if(ql(n)){if(ql(i.charCodeAt(1))&&!ql(i.charCodeAt(2))){let r=3,s=r;for(;r<e&&!ql(i.charCodeAt(r));r++);if(s!==r&&!ql(i.charCodeAt(r+1))){for(r+=1;r<e;r++)if(ql(i.charCodeAt(r)))return i.slice(0,r+1).replace(/[\\/]/g,t)}}return t}else if(x2(n)&&i.charCodeAt(1)===58)return ql(i.charCodeAt(2))?i.slice(0,2)+t:i.slice(0,2);let o=i.indexOf("://");if(o!==-1){for(o+=3;o<e;o++)if(ql(i.charCodeAt(o)))return i.slice(0,o+1)}return""}var J7=/[\\/:\*\?"<>\|]/g,Y7=/[/]/g,X7=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function I2(i,t=Te){let e=t?J7:Y7;return!(!i||i.length===0||/^\s+$/.test(i)||(e.lastIndex=0,e.test(i))||t&&X7.test(i)||i==="."||i===".."||t&&i[i.length-1]==="."||t&&i.length!==i.trim().length||i.length>255)}function Oc(i,t,e){let n=i===t;return!e||n?n:!i||!t?!1:wn(i,t)}function Or(i,t,e,n=!1){let o=n?qe.sep:Dt;if(i===t)return!0;if(!i||!t||((i.indexOf("..")>=0||t.indexOf("..")>=0)&&(i=n?qe.normalize(i):so(i),t=n?qe.normalize(t):so(t)),t.length>i.length))return!1;if(e){if(!ka(i,t))return!1;if(t.length===i.length)return!0;let s=t.length;return t.charAt(t.length-1)===o&&s--,i.charAt(s)===o}return t.charAt(t.length-1)!==o&&(t+=o),i.indexOf(t)===0}function x2(i){return i>=65&&i<=90||i>=97&&i<=122}function S2(i){return Te?(i=vr(i,Dt),i.endsWith(":")&&(i+=Dt)):(i=vr(i,Dt),i||(i=Dt)),i}function zR(i){let t=so(i);return Te?i.length>3?!1:Px(t)&&(i.length===2||t.charCodeAt(2)===92):t===qe.sep}function Px(i,t=Te){return t?x2(i.charCodeAt(0))&&i.charCodeAt(1)===58:!1}function qR(i,t=Te){return Px(i,t)?i[0]:void 0}var Z7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",eq="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function C2(i,t,e=8){let n="";for(let r=0;r<e;r++){let s;r===0&&Te&&!t&&(e===3||e===4)?s=eq:s=Z7,n+=s.charAt(Math.floor(Math.random()*s.length))}let o;return t?o=`${t}-${n}`:o=n,i?Be(i,o):o}var tq=/^\w[\w\d+.-]*$/,nq=/^\//,oq=/^\/\//;function rq(i,t){if(!i.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${i.authority}", path: "${i.path}", query: "${i.query}", fragment: "${i.fragment}"}`);if(i.scheme&&!tq.test(i.scheme)){let e=[...i.scheme.matchAll(/[^\w\d+.-]/gu)],n=e.length>0?` Found '${e[0][0]}' at index ${e[0].index} (${e.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${n} (len:${i.scheme.length})`)}if(i.path){if(i.authority){if(!nq.test(i.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(oq.test(i.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function iq(i,t){return!i&&!t?"file":i}function sq(i,t){switch(i){case"https":case"http":case"file":t?t[0]!==Di&&(t=Di+t):t=Di;break}return t}var un="",Di="/",aq=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,y=class i{static isUri(t){return t instanceof i?!0:!t||typeof t!="object"?!1:typeof t.authority=="string"&&typeof t.fragment=="string"&&typeof t.path=="string"&&typeof t.query=="string"&&typeof t.scheme=="string"&&typeof t.fsPath=="string"&&typeof t.with=="function"&&typeof t.toString=="function"}constructor(t,e,n,o,r,s=!1){typeof t=="object"?(this.scheme=t.scheme||un,this.authority=t.authority||un,this.path=t.path||un,this.query=t.query||un,this.fragment=t.fragment||un):(this.scheme=iq(t,s),this.authority=e||un,this.path=sq(this.scheme,n||un),this.query=o||un,this.fragment=r||un,rq(this,s))}get fsPath(){return hv(this,!1)}with(t){if(!t)return this;let{scheme:e,authority:n,path:o,query:r,fragment:s}=t;return e===void 0?e=this.scheme:e===null&&(e=un),n===void 0?n=this.authority:n===null&&(n=un),o===void 0?o=this.path:o===null&&(o=un),r===void 0?r=this.query:r===null&&(r=un),s===void 0?s=this.fragment:s===null&&(s=un),e===this.scheme&&n===this.authority&&o===this.path&&r===this.query&&s===this.fragment?this:new Kl(e,n,o,r,s)}static parse(t,e=!1){let n=aq.exec(t);return n?new Kl(n[2]||un,_x(n[4]||un),_x(n[5]||un),_x(n[7]||un),_x(n[9]||un),e):new Kl(un,un,un,un,un)}static file(t){let e=un;if(Te&&(t=t.replace(/\\/g,Di)),t[0]===Di&&t[1]===Di){let n=t.indexOf(Di,2);n===-1?(e=t.substring(2),t=Di):(e=t.substring(2,n),t=t.substring(n)||Di)}return new Kl("file",e,t,un,un)}static from(t,e){return new Kl(t.scheme,t.authority,t.path,t.query,t.fragment,e)}static joinPath(t,...e){if(!t.path)throw new Error(`[UriError]: cannot call joinPath on URI without path: ${t.toString()}`);let n;return Te&&t.scheme==="file"?n=i.file(xn.join(hv(t,!0),...e)).path:n=qe.join(t.path,...e),t.with({path:n})}toString(t=!1){return jR(this,t)}toJSON(){return this}static revive(t){if(t){if(t instanceof i)return t;{let e=new Kl(t);return e._formatted=t.external??null,e._fsPath=t._sep===w2?t.fsPath??null:null,e}}else return t}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function jl(i){return!i||typeof i!="object"?!1:typeof i.scheme=="string"&&(typeof i.authority=="string"||typeof i.authority>"u")&&(typeof i.path=="string"||typeof i.path>"u")&&(typeof i.query=="string"||typeof i.query>"u")&&(typeof i.fragment=="string"||typeof i.fragment>"u")}var w2=Te?1:void 0,Kl=class extends y{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=hv(this,!1)),this._fsPath}toString(e=!1){return e?jR(this,!0):(this._formatted||(this._formatted=jR(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=w2),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}},k2={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 T2(i,t,e){let n,o=-1;for(let r=0;r<i.length;r++){let s=i.charCodeAt(r);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||t&&s===47||e&&s===91||e&&s===93||e&&s===58)o!==-1&&(n+=encodeURIComponent(i.substring(o,r)),o=-1),n!==void 0&&(n+=i.charAt(r));else{n===void 0&&(n=i.substr(0,r));let a=k2[s];a!==void 0?(o!==-1&&(n+=encodeURIComponent(i.substring(o,r)),o=-1),n+=a):o===-1&&(o=r)}}return o!==-1&&(n+=encodeURIComponent(i.substring(o))),n!==void 0?n:i}function lq(i){let t;for(let e=0;e<i.length;e++){let n=i.charCodeAt(e);n===35||n===63?(t===void 0&&(t=i.substr(0,e)),t+=k2[n]):t!==void 0&&(t+=i[e])}return t!==void 0?t:i}function hv(i,t){let e;return i.authority&&i.path.length>1&&i.scheme==="file"?e=`//${i.authority}${i.path}`:i.path.charCodeAt(0)===47&&(i.path.charCodeAt(1)>=65&&i.path.charCodeAt(1)<=90||i.path.charCodeAt(1)>=97&&i.path.charCodeAt(1)<=122)&&i.path.charCodeAt(2)===58?t?e=i.path.substr(1):e=i.path[1].toLowerCase()+i.path.substr(2):e=i.path,Te&&(e=e.replace(/\//g,"\\")),e}function jR(i,t){let e=t?lq:T2,n="",{scheme:o,authority:r,path:s,query:a,fragment:l}=i;if(o&&(n+=o,n+=":"),(r||o==="file")&&(n+=Di,n+=Di),r){let d=r.indexOf("@");if(d!==-1){let c=r.substr(0,d);r=r.substr(d+1),d=c.lastIndexOf(":"),d===-1?n+=e(c,!1,!1):(n+=e(c.substr(0,d),!1,!1),n+=":",n+=e(c.substr(d+1),!1,!0)),n+="@"}r=r.toLowerCase(),d=r.lastIndexOf(":"),d===-1?n+=e(r,!1,!0):(n+=e(r.substr(0,d),!1,!0),n+=r.substr(d))}if(s){if(s.length>=3&&s.charCodeAt(0)===47&&s.charCodeAt(2)===58){let d=s.charCodeAt(1);d>=65&&d<=90&&(s=`/${String.fromCharCode(d+32)}:${s.substr(3)}`)}else if(s.length>=2&&s.charCodeAt(1)===58){let d=s.charCodeAt(0);d>=65&&d<=90&&(s=`${String.fromCharCode(d+32)}:${s.substr(2)}`)}n+=e(s,!0,!1)}return a&&(n+="?",n+=e(a,!1,!1)),l&&(n+="#",n+=t?l:T2(l,!1,!1)),n}function P2(i){try{return decodeURIComponent(i)}catch{return i.length>3?i.substr(0,3)+P2(i.substr(3)):i}}var E2=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function _x(i){return i.match(E2)?i.replace(E2,t=>P2(t)):i}var B;(We=>(We.inMemory="inmemory",We.vscode="vscode",We.internal="private",We.walkThrough="walkThrough",We.walkThroughSnippet="walkThroughSnippet",We.http="http",We.https="https",We.file="file",We.mailto="mailto",We.untitled="untitled",We.data="data",We.command="command",We.vscodeRemote="vscode-remote",We.vscodeRemoteResource="vscode-remote-resource",We.vscodeManagedRemoteResource="vscode-managed-remote-resource",We.vscodeUserData="vscode-userdata",We.vscodeCustomEditor="vscode-custom-editor",We.vscodeNotebookCell="vscode-notebook-cell",We.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",We.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",We.vscodeNotebookCellOutput="vscode-notebook-cell-output",We.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",We.vscodeNotebookMetadata="vscode-notebook-metadata",We.vscodeInteractiveInput="vscode-interactive-input",We.vscodeSettings="vscode-settings",We.vscodeWorkspaceTrust="vscode-workspace-trust",We.vscodeTerminal="vscode-terminal",We.vscodeImageCarousel="vscode-image-carousel",We.vscodeChatCodeBlock="vscode-chat-code-block",We.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",We.vscodeChatEditor="vscode-chat-editor",We.vscodeChatInput="chatSessionInput",We.sessionsChatInput="sessions-chat",We.vscodeLocalChatSession="vscode-chat-session",We.vscodeChatResponseResource="vscode-chat-response-resource",We.webviewPanel="webview-panel",We.vscodeWebview="vscode-webview",We.vscodeBrowser="vscode-browser",We.extension="extension",We.vscodeFileResource="vscode-file",We.tmp="tmp",We.vsls="vsls",We.vscodeSourceControl="vscode-scm",We.commentsInput="comment",We.codeSetting="code-setting",We.outputChannel="output",We.accessibleView="accessible-view",We.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",We.chatEditingModel="chat-editing-text-model",We.copilotPr="copilot-pr"))(B||={});function Rx(i,t){return y.isUri(i)?wn(i.scheme,t):ka(i,t+":")}function JR(i,...t){return t.some(e=>Rx(i,e))}var dq="tkn",GR=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=qe.join(e??"/",cq(t))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return qe.join(this._serverRootPath,B.vscodeRemoteResource)}set(t,e,n){this._hosts[t]=e,this._ports[t]=n}setConnectionToken(t,e){this._connectionTokens[t]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(t){if(this._delegate)try{return this._delegate(t)}catch(a){return ba(a),t}let e=t.authority,n=this._hosts[e];n&&n.indexOf(":")!==-1&&n.indexOf("[")===-1&&(n=`[${n}]`);let o=this._ports[e],r=this._connectionTokens[e],s=`path=${encodeURIComponent(t.path)}`;return typeof r=="string"&&(s+=`&${dq}=${encodeURIComponent(r)}`),y.from({scheme:ei?this._preferredWebSchema:B.vscodeRemoteResource,authority:`${n}:${o}`,path:this._remoteResourcesPath,query:s})}},YR=new GR;function cq(i){return`${i.quality??"oss"}-${i.commit??"dev"}`}var _2="vs/../../node_modules",R2="vs/../../node_modules.asar";var XR="vscode-app",QR=class i{static{this.FALLBACK_AUTHORITY=XR}asBrowserUri(t){let e=this.toUri(t);return this.uriToBrowserUri(e)}uriToBrowserUri(t){return t.scheme===B.vscodeRemote?YR.rewrite(t):t.scheme===B.file&&(uv||$H===`${B.vscodeFileResource}://${i.FALLBACK_AUTHORITY}`)?t.with({scheme:B.vscodeFileResource,authority:t.authority||i.FALLBACK_AUTHORITY,query:null,fragment:null}):t}asFileUri(t){let e=this.toUri(t);return this.uriToFileUri(e)}uriToFileUri(t){return t.scheme===B.vscodeFileResource?t.with({scheme:B.file,authority:t.authority!==i.FALLBACK_AUTHORITY?t.authority:null,query:null,fragment:null}):t}toUri(t){if(y.isUri(t))return t;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return y.joinPath(y.parse(e,!0),t);let n=Be(e,t);return y.file(n)}throw new Error("Cannot determine URI for module id!")}},Gl=new QR,Doe=Object.freeze({"Cache-Control":"no-cache, no-store"}),Aoe=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),uq;(r=>{let i=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"}]]);r.CoopAndCoep=Object.freeze(i.get("3"));let e="vscode-coi";function n(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:y.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(e);if(l)return i.get(l)}r.getHeadersFromQuery=n;function o(s,a,l){if(!globalThis.crossOriginIsolated)return;let d=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(e,d):s[e]=d}r.addSearchParam=o})(uq||={});function ni(i){return hv(i,!0)}var vs=class{constructor(t){this._ignorePathCasing=t}compare(t,e,n=!1){return t===e?0:Ri(this.getComparisonKey(t,n),this.getComparisonKey(e,n))}isEqual(t,e,n=!1){return t===e?!0:!t||!e?!1:this.getComparisonKey(t,n)===this.getComparisonKey(e,n)}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,n=!1){if(t.scheme===e.scheme){if(t.scheme===B.file)return Or(ni(t),ni(e),this._ignorePathCasing(t))&&t.query===e.query&&(n||t.fragment===e.fragment);if(D2(t.authority,e.authority))return Or(t.path,e.path,this._ignorePathCasing(t),!0)&&t.query===e.query&&(n||t.fragment===e.fragment)}return!1}joinPath(t,...e){return y.joinPath(t,...e)}basenameOrAuthority(t){return Ze(t)||t.authority}basename(t,e){return qe.basename(t.path,e)}extname(t){return qe.extname(t.path)}dirname(t){if(t.path.length===0)return t;let e;return t.scheme===B.file?e=y.file(gn(ni(t))).path:(e=qe.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===B.file?e=y.file(so(ni(t))).path:e=qe.normalize(t.path),t.with({path:e})}relativePath(t,e){if(t.scheme!==e.scheme||!D2(t.authority,e.authority))return;if(t.scheme===B.file){let r=_i(ni(t),ni(e));return Te?kx(r):r}let n=t.path||"/",o=e.path||"/";if(this._ignorePathCasing(t)){let r=0;for(let s=Math.min(n.length,o.length);r<s&&!(n.charCodeAt(r)!==o.charCodeAt(r)&&n.charAt(r).toLowerCase()!==o.charAt(r).toLowerCase());r++);n=o.substr(0,r)+n.substr(r)}return qe.relative(n,o)}resolvePath(t,e){if(t.scheme===B.file){let n=y.file(MR(ni(t),e));return t.with({authority:n.authority,path:n.path})}return e=b2(e),t.with({path:qe.resolve(t.path,e)})}isAbsolutePath(t){return!!t.path&&t.path[0]==="/"}isEqualAuthority(t,e){return t===e||t!==void 0&&e!==void 0&&wn(t,e)}hasTrailingPathSeparator(t,e=Dt){if(t.scheme===B.file){let n=ni(t);return n.length>fv(n).length&&n[n.length-1]===e}else{let n=t.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(t.fsPath)}}removeTrailingPathSeparator(t,e=Dt){return A2(t,e)?t.with({path:t.path.substr(0,t.path.length-1)}):t}addTrailingPathSeparator(t,e=Dt){let n=!1;if(t.scheme===B.file){let o=ni(t);n=o!==void 0&&o.length===fv(o).length&&o[o.length-1]===e}else{e="/";let o=t.path;n=o.length===1&&o.charCodeAt(o.length-1)===47}return!n&&!A2(t,e)?t.with({path:t.path+"/"}):t}},Ct=new vs(()=>!1),Nc=new vs(i=>i.scheme===B.file?!Xe:!0),ZR=new vs(i=>!0),Sn=Ct.isEqual.bind(Ct),M2=Ct.isEqualOrParent.bind(Ct),Hoe=Ct.getComparisonKey.bind(Ct),vv=Ct.basenameOrAuthority.bind(Ct),Ze=Ct.basename.bind(Ct),yv=Ct.extname.bind(Ct),Ho=Ct.dirname.bind(Ct),gt=Ct.joinPath.bind(Ct),pq=Ct.normalizePath.bind(Ct),bv=Ct.relativePath.bind(Ct),Woe=Ct.resolvePath.bind(Ct),L2=Ct.isAbsolutePath.bind(Ct),D2=Ct.isEqualAuthority.bind(Ct),A2=Ct.hasTrailingPathSeparator.bind(Ct),Voe=Ct.removeTrailingPathSeparator.bind(Ct),Boe=Ct.addTrailingPathSeparator.bind(Ct);var mq;(r=>{r.META_DATA_LABEL="label",r.META_DATA_DESCRIPTION="description",r.META_DATA_SIZE="size",r.META_DATA_MIME="mime";function o(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(c=>{let[u,m]=c.split(":");u&&m&&a.set(u,m)});let d=s.path.substring(0,s.path.indexOf(";"));return d&&a.set(r.META_DATA_MIME,d),a}r.parseMetaData=o})(mq||={});var O2=Symbol("MicrotaskDelay");function oi(i){return!!i&&typeof i.then=="function"}function br(i){let t=new Ee,e=i(t.token),n=!1,o=new Promise((r,s)=>{let a=t.token.onCancellationRequested(()=>{n=!0,a.dispose(),s(new Oe)});Promise.resolve(e).then(l=>{a.dispose(),t.dispose(),n?tx(l)&&l.dispose():r(l)},l=>{a.dispose(),t.dispose(),s(l)})});return new class{cancel(){t.cancel(),t.dispose()}then(r,s){return o.then(r,s)}catch(r){return this.then(void 0,r)}finally(r){return o.finally(r)}}}function Jl(i,t,e){return new Promise((n,o)=>{let r=t.onCancellationRequested(()=>{r.dispose(),n(e)});i.then(n,o).finally(()=>r.dispose())})}function ri(i,t){return new Promise((e,n)=>{let o=t.onCancellationRequested(()=>{o.dispose(),n(new Oe)});i.then(e,n).finally(()=>o.dispose())})}function Cn(i){return new Promise((t,e)=>{let n=i();oi(n)?n.then(t,e):t(n)})}function Ev(){let i,t;return{promise:new Promise((n,o)=>{i=n,t=o}),resolve:i,reject:t}}var eD=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new Ee}queue(t){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=t,!this.queuedPromise){let e=()=>{if(this.queuedPromise=null,this.cancellationTokenSource.token.isCancellationRequested)return;let n=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,n};this.queuedPromise=new Promise(n=>{this.activePromise.then(e,e).then(n)})}return new Promise((e,n)=>{this.queuedPromise.then(e,n)})}return this.activePromise=t(this.cancellationTokenSource.token),new Promise((e,n)=>{this.activePromise.then(o=>{this.activePromise=null,e(o)},o=>{this.activePromise=null,n(o)})})}dispose(){this.cancellationTokenSource.cancel()}},Ax=class{constructor(){this.current=Promise.resolve(null)}queue(t){return this.current=this.current.then(()=>t(),()=>t())}};var Ql=class{constructor(){this.promiseMap=new Map}queue(t,e){let o=(this.promiseMap.get(t)??Promise.resolve()).catch(()=>{}).then(e).finally(()=>{this.promiseMap.get(t)===o&&this.promiseMap.delete(t)});return this.promiseMap.set(t,o),o}peek(t){return this.promiseMap.get(t)||void 0}keys(){return this.promiseMap.keys()}},gq=(i,t)=>{let e=!0,n=setTimeout(()=>{e=!1,t()},i);return{isTriggered:()=>e,dispose:()=>{clearTimeout(n),e=!1}}},fq=i=>{let t=!0;return queueMicrotask(()=>{t&&(t=!1,i())}),{isTriggered:()=>t,dispose:()=>{t=!1}}},Iv=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((o,r)=>{this.doResolve=o,this.doReject=r}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let n=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===O2?fq(n):gq(e,n),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new Oe),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},Pa=class{constructor(t){this.delayer=new Iv(t),this.throttler=new eD}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()}},kn=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 Vt(i,t){return t?new Promise((e,n)=>{let o=setTimeout(()=>{r.dispose(),e()},i),r=t.onCancellationRequested(()=>{clearTimeout(o),r.dispose(),n(new Oe)})}):br(e=>Vt(i,e))}function wv(i,t=0,e){let n=setTimeout(()=>{i(),e&&o.dispose()},t),o=q(()=>{clearTimeout(n),e?.delete(o)});return e?.add(o),o}var nre=2**31-1;function N2(i,t=n=>!!n,e=null){if(i.length===0)return Promise.resolve(e);let n=i.length,o=()=>{n=-1;for(let r of i)r.cancel?.()};return new Promise((r,s)=>{for(let a of i)a.then(l=>{--n>=0&&t(l)?(o(),r(l)):n===0&&r(e)}).catch(l=>{--n>=0&&(o(),s(l))})})}var xv=class{constructor(t){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=t,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new T}whenIdle(){return this.size>0?ye.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,n)=>{this.outstandingPromises.push({factory:t,c:e,e:n}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let t=this.outstandingPromises.shift();this.runningPromises++;let e=t.factory();e.then(t.c,t.e),e.then(()=>this.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()}},Sv=class extends xv{constructor(){super(1)}};var Bp=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let t=new jt;return this.drainers.add(t),t.p}isDrained(){for(let[,t]of this.queues)if(t.size>0)return!1;return!0}queueSize(t,e=Ct){let n=e.getComparisonKey(t);return this.queues.get(n)?.size??0}queueFor(t,e,n=Ct){let o=n.getComparisonKey(t),r=this.queues.get(o);if(!r){r=new Sv;let s=this.drainListenerCount++,a=ye.once(r.onDrained)(()=>{r?.dispose(),this.queues.delete(o),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new bn),this.drainListeners.set(s,a),this.queues.set(o,r)}return r.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let t of this.drainers)t.complete();this.drainers.clear()}dispose(){for(let[,t]of this.queues)t.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}};var Cv=class{constructor(t,e){this._isDisposed=!1;this._token=void 0,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(t,e){if(this._isDisposed)throw new At("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new At("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,t()},e))}},$p=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,n=globalThis){if(this.isDisposed)throw new At("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let o=n.setInterval(()=>{t()},e);this.disposable=q(()=>{n.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Pn=class{constructor(t,e){this.timeoutToken=void 0,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=void 0)}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!==void 0}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}},Tv=class{constructor(t,e){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.runner=t,this.timeout=e,this.counter=0,this.intervalToken=void 0,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=void 0)}schedule(t=this.timeout){t%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(t/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return this.intervalToken!==void 0}onInterval(){this.counter--,!(this.counter>0)&&(clearInterval(this.intervalToken),this.intervalToken=void 0,this.runner?.())}},Mx=class extends Pn{constructor(e,n){super(e,n);this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){let e=this.units;this.units=[],this.runner?.(e)}dispose(){this.units=[],super.dispose()}},zp=class extends N{constructor(e,n){super();this.options=e;this.handler=n;this.pendingWork=[];this.throttler=this._register(new tn);this.disposed=!1;this.lastExecutionTime=0}get pending(){return this.pendingWork.length}work(e){if(this.disposed)return!1;if(typeof this.options.maxBufferedWork=="number"){if(this.throttler.value){if(this.pending+e.length>this.options.maxBufferedWork)return!1}else if(this.pending+e.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1}for(let o of e)this.pendingWork.push(o);let n=Date.now()-this.lastExecutionTime;return!this.throttler.value&&(!this.options.waitThrottleDelayBetweenWorkUnits||n>=this.options.throttleDelay)?this.doWork():!this.throttler.value&&this.options.waitThrottleDelayBetweenWorkUnits&&this.scheduleThrottler(Math.max(this.options.throttleDelay-n,0)),!0}doWork(){this.lastExecutionTime=Date.now(),this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&this.scheduleThrottler()}scheduleThrottler(e=this.options.throttleDelay){this.throttler.value=new Pn(()=>{this.throttler.clear(),this.doWork()},e),this.throttler.value.schedule()}dispose(){super.dispose(),this.pendingWork.length=0,this.disposed=!0}},oD,Dx;(function(){let i=globalThis;typeof i.requestIdleCallback!="function"||typeof i.cancelIdleCallback!="function"?Dx=(t,e,n)=>{ax(()=>{if(o)return;let r=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,r-Date.now())}}))});let o=!1;return{dispose(){o||(o=!0)}}}:Dx=(t,e,n)=>{let o=t.requestIdleCallback(e,typeof n=="number"?{timeout:n}:void 0),r=!1;return{dispose(){r||(r=!0,t.cancelIdleCallback(o))}}},oD=(t,e)=>Dx(globalThis,t,e)})();var tD=class{constructor(t,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(n){this._error=n}finally{this._didRun=!0}},this._handle=Dx(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}},Lx=class extends tD{constructor(t){super(globalThis,t)}};async function U2(i,t,e){let n;for(let o=0;o<e;o++)try{return await i()}catch(r){n=r,await Vt(t)}throw n}var jt=class i{static fromPromise(t){let e=new i;return e.settleWith(t),e}get isRejected(){return this.outcome?.outcome===1}get isResolved(){return this.outcome?.outcome===0}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===0?this.outcome?.value:void 0}constructor(){this.p=new Promise((t,e)=>{this.completeCallback=t,this.errorCallback=e})}complete(t){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(t),this.outcome={outcome:0,value:t},e()})}error(t){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(t),this.outcome={outcome:1,value:t},e()})}settleWith(t){return t.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new Oe)}},ii;(e=>{async function i(n){let o,r=await Promise.all(n.map(s=>s.then(a=>a,a=>{o||(o=a)})));if(typeof o<"u")throw o;return r}e.settled=i;function t(n){return new Promise(async(o,r)=>{try{await n(o,r)}catch(s){r(s)}})}e.withAsyncBody=t})(ii||={});var _a=class i{static fromArray(t){return new i(e=>{e.emitMany(t)})}static fromPromise(t){return new i(async e=>{e.emitMany(await t)})}static fromPromisesResolveOrder(t){return new i(async e=>{await Promise.all(t.map(async n=>e.emitOne(await n)))})}static merge(t){return new i(async e=>{await Promise.all(t.map(async n=>{for await(let o of n)e.emitOne(o)}))})}static{this.EMPTY=i.fromArray([])}constructor(t,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new T,queueMicrotask(async()=>{let n={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(n)),this.resolve()}catch(o){this.reject(o)}finally{n.emitOne=()=>{},n.emitMany=()=>{},n.reject=()=>{}}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ye.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,e){return new i(async n=>{for await(let o of t)n.emitOne(e(o))})}map(t){return i.map(this,t)}static filter(t,e){return new i(async n=>{for await(let o of t)e(o)&&n.emitOne(o)})}filter(t){return i.filter(this,t)}static coalesce(t){return i.filter(t,e=>!!e)}coalesce(){return i.coalesce(this)}static async toPromise(t){let e=[];for await(let n of t)e.push(n);return e}toPromise(){return i.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};var Ox=class{constructor(t){this._deferred=new jt;this._asyncIterable=new _a(o=>{if(e){o.reject(e);return}return n&&o.emitMany(n),this._errorFn=r=>o.reject(r),this._emitOneFn=r=>o.emitOne(r),this._emitManyFn=r=>o.emitMany(r),this._deferred.p},t);let e,n;this._errorFn=o=>{e||(e=o)},this._emitOneFn=o=>{n||(n=[]),n.push(o)},this._emitManyFn=o=>{n?o.forEach(r=>n.push(r)):n=o.slice()}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(t){this._errorFn(t),this._deferred.complete()}emitOne(t){this._emitOneFn(t)}emitMany(t){this._emitManyFn(t)}};var nD=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(t){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,t)}else this._unconsumedValues.push(t)}produceFinal(t){this._ensureNoFinalValue(),this._finalValue=t;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,t);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new At("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(t,e){e.ok?t.complete(e.value):t.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let t=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return t.ok?Promise.resolve(t.value):Promise.reject(t.error)}else{let t=new jt;return this._unsatisfiedConsumers.push(t),t.p}}},qp=class i{constructor(t,e){this._onReturn=e;this._producerConsumer=new nD;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async t=>(this._finishError(t),{done:!0,value:void 0})};queueMicrotask(async()=>{let n=t({emitOne:o=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}}),emitMany:o=>{for(let r of o)this._producerConsumer.produce({ok:!0,value:{done:!1,value:r}})},reject:o=>this._finishError(o)});if(!this._producerConsumer.hasFinalValue)try{await n,this._finishOk()}catch(o){this._finishError(o)}})}static fromArray(t){return new i(e=>{e.emitMany(t)})}static fromPromise(t){return new i(async e=>{e.emitMany(await t)})}static fromPromisesResolveOrder(t){return new i(async e=>{await Promise.all(t.map(async n=>e.emitOne(await n)))})}static merge(t){return new i(async e=>{await Promise.all(t.map(async n=>{for await(let o of n)e.emitOne(o)}))})}static{this.EMPTY=i.fromArray([])}static map(t,e){return new i(async n=>{for await(let o of t)n.emitOne(e(o))})}static tee(t){let e,n,o=new jt,r=async()=>{if(!(!e||!n))try{for await(let l of t)e.emitOne(l),n.emitOne(l)}catch(l){e.reject(l),n.reject(l)}finally{o.complete()}},s=new i(async l=>(e=l,r(),o.p)),a=new i(async l=>(n=l,r(),o.p));return[s,a]}map(t){return i.map(this,t)}static coalesce(t){return i.filter(t,e=>!!e)}coalesce(){return i.coalesce(this)}static filter(t,e){return new i(async n=>{for await(let o of t)e(o)&&n.emitOne(o)})}filter(t){return i.filter(this,t)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(t){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:t})}[Symbol.asyncIterator](){return this._iterator}};function Uc(i,t){return new rD(i,t)}var rD=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?Ge(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 n;switch(t){case"data":n=this.listeners.data;break;case"end":n=this.listeners.end;break;case"error":n=this.listeners.error;break}if(n){let o=n.indexOf(e);o>=0&&n.splice(o,1)}}flowData(){if(this.buffer.data.length===0)return;if(typeof this.reducer=="function"){let e=this.reducer(this.buffer.data);this.emitData(e)}else for(let e of this.buffer.data)this.emitData(e);this.buffer.data.length=0;let t=[...this.pendingWritePromises];this.pendingWritePromises.length=0,t.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let 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 F2(i,t){let e=[],n;for(;(n=i.read())!==null;)e.push(n);return t(e)}function Nx(i,t){return new Promise((e,n)=>{let o=[];Ux(i,{onData:r=>{t&&o.push(r)},onError:r=>{t?n(r):e(void 0)},onEnd:()=>{e(t?t(o):void 0)}})})}function Ux(i,t,e){i.on("error",n=>{e?.isCancellationRequested||t.onError(n)}),i.on("end",()=>{e?.isCancellationRequested||t.onEnd()}),i.on("data",n=>{e?.isCancellationRequested||t.onData(n)})}function H2(i,t){let e=Uc(t);return e.end(i),e}function W2(i,t,e){let n=Uc(e);return Ux(i,{onData:o=>n.write(t.data(o)),onError:o=>n.error(t.error?t.error(o):o),onEnd:()=>n.end()}),n}var kv=typeof Buffer<"u",vq=new mt(()=>new Uint8Array(256)),iD,sD,H=class i{static alloc(t){return kv?new i(Buffer.allocUnsafe(t)):new i(new Uint8Array(t))}static wrap(t){return kv&&!Buffer.isBuffer(t)&&(t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)),new i(t)}static fromString(t,e){return!(e?.dontUseNodeBuffer||!1)&&kv?new i(Buffer.from(t)):(iD||(iD=new TextEncoder),new i(iD.encode(t)))}static fromByteArray(t){let e=i.alloc(t.length);for(let n=0,o=t.length;n<o;n++)e.buffer[n]=t[n];return e}static concat(t,e){if(typeof e>"u"){e=0;for(let r=0,s=t.length;r<s;r++)e+=t[r].byteLength}let n=i.alloc(e),o=0;for(let r=0,s=t.length;r<s;r++){let a=t[r];n.set(a,o),o+=a.byteLength}return n}static isNativeBuffer(t){return kv&&Buffer.isBuffer(t)}constructor(t){this.buffer=t,this.byteLength=this.buffer.byteLength}clone(){let t=i.alloc(this.byteLength);return t.set(this),t}toString(){return kv?this.buffer.toString():(sD||(sD=new TextDecoder(void 0,{ignoreBOM:!0})),sD.decode(this.buffer))}slice(t,e){return new i(this.buffer.subarray(t,e))}set(t,e){if(t instanceof i)this.buffer.set(t.buffer,e);else if(t instanceof Uint8Array)this.buffer.set(t,e);else if(t instanceof ArrayBuffer)this.buffer.set(new Uint8Array(t),e);else if(ArrayBuffer.isView(t))this.buffer.set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(t){return Pv(this.buffer,t)}writeUInt32BE(t,e){_v(this.buffer,t,e)}readUInt32LE(t){return yq(this.buffer,t)}writeUInt32LE(t,e){bq(this.buffer,t,e)}readUInt8(t){return Iq(this.buffer,t)}writeUInt8(t,e){xq(this.buffer,t,e)}indexOf(t,e=0){return aD(this.buffer,t instanceof i?t.buffer:t,e)}equals(t){return this===t?!0:this.byteLength!==t.byteLength?!1:this.buffer.every((e,n)=>e===t.buffer[n])}};function aD(i,t,e=0){let n=t.byteLength,o=i.byteLength;if(n===0)return 0;if(n===1)return i.indexOf(t[0],e);if(n>o-e)return-1;let r=vq.value;r.fill(t.length);for(let d=0;d<t.length;d++)r[t[d]]=t.length-d-1;let s=e+t.length-1,a=s,l=-1;for(;s<o;)if(i[s]===t[a]){if(a===0){l=s;break}s--,a--}else s+=Math.max(t.length-a,r[i[s]]),a=t.length-1;return l}function $2(i,t){return i[t+0]<<0>>>0|i[t+1]<<8>>>0}function z2(i,t,e){i[e+0]=t&255,t=t>>>8,i[e+1]=t&255}function Pv(i,t){return i[t]*2**24+i[t+1]*2**16+i[t+2]*2**8+i[t+3]}function _v(i,t,e){i[e+3]=t,t=t>>>8,i[e+2]=t,t=t>>>8,i[e+1]=t,t=t>>>8,i[e]=t}function yq(i,t){return i[t+0]<<0>>>0|i[t+1]<<8>>>0|i[t+2]<<16>>>0|i[t+3]<<24>>>0}function bq(i,t,e){i[e+0]=t&255,t=t>>>8,i[e+1]=t&255,t=t>>>8,i[e+2]=t&255,t=t>>>8,i[e+3]=t&255}function Iq(i,t){return i[t]}function xq(i,t,e){i[e]=t}function q2(i){return F2(i,t=>H.concat(t))}function lD(i){return Nx(i,t=>H.concat(t))}function K2(i){return H2(i,t=>H.concat(t))}function j2(i){return W2(i,{data:t=>typeof t=="string"?H.fromString(t):H.wrap(t)},t=>H.concat(t))}function fo(i){let t=0,e=0,n=0,o=new Uint8Array(Math.floor(i.length/4*3)),r=a=>{switch(e){case 3:o[n++]=t|a,e=0;break;case 2:o[n++]=t|a>>>2,t=a<<6,e=3;break;case 1:o[n++]=t|a>>>4,t=a<<4,e=2;break;default:t=a<<2,e=1}};for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);if(l>=65&&l<=90)r(l-65);else if(l>=97&&l<=122)r(l-97+26);else if(l>=48&&l<=57)r(l-48+52);else if(l===43||l===45)r(62);else if(l===47||l===95)r(63);else{if(l===61)break;throw new SyntaxError(`Unexpected base64 character ${i[a]}`)}}let s=n;for(;e>0;)r(0);return H.wrap(o).slice(0,s)}var Sq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function eo({buffer:i},t=!0,e=!1){let n=e?Cq:Sq,o="",r=i.byteLength%3,s=0;for(;s<i.byteLength-r;s+=3){let a=i[s+0],l=i[s+1],d=i[s+2];o+=n[a>>>2],o+=n[(a<<4|l>>>4)&63],o+=n[(l<<2|d>>>6)&63],o+=n[d&63]}if(r===1){let a=i[s+0];o+=n[a>>>2],o+=n[a<<4&63],t&&(o+="==")}else if(r===2){let a=i[s+0],l=i[s+1];o+=n[a>>>2],o+=n[(a<<4|l>>>4)&63],o+=n[l<<2&63],t&&(o+="=")}return o}var V2="0123456789abcdef";function Yl({buffer:i}){let t="";for(let e=0;e<i.length;e++){let n=i[e];t+=V2[n>>>4],t+=V2[n&15]}return t}function Rv(i){if(i.length%2!==0)throw new SyntaxError("Hex string must have an even length");let t=new Uint8Array(i.length>>1);for(let e=0;e<i.length;)t[e>>1]=B2(i,e++)<<4|B2(i,e++);return H.wrap(t)}function B2(i,t){let e=i.charCodeAt(t);if(e>=48&&e<=57)return e-48;if(e>=97&&e<=102)return e-87;if(e>=65&&e<=70)return e-55;throw new SyntaxError(`Invalid hex character at position ${t}`)}function dD(i){let t=[];typeof i=="number"&&t.push("code/timeOrigin",i);function e(r,s){t.push(r,s?.startTime??Date.now())}function n(){let r=[];for(let s=0;s<t.length;s+=2)r.push({name:t[s],startTime:t[s+1]});return r}function o(r){if(typeof r>"u"){let s=t.length>=2&&t[0]==="code/timeOrigin",a=s?t[1]:void 0;t.length=0,s&&t.push("code/timeOrigin",a)}else for(let s=t.length-2;s>=0;s-=2)t[s]===r&&t.splice(s,2)}return{mark:e,getMarks:n,clearMarks:o}}function Tq(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?dD():{mark(i,t){performance.mark(i,t)},clearMarks(i){performance.clearMarks(i)},getMarks(){let i=performance.timeOrigin;typeof i!="number"&&(i=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let t=[{name:"code/timeOrigin",startTime:Math.round(i)}];for(let e of performance.getEntriesByType("mark"))t.push({name:e.name,startTime:Math.round(i+e.startTime)});return t}};if(typeof process=="object"){let i=performance?.timeOrigin;return dD(i)}else return console.trace("perf-util loaded in UNKNOWN environment"),dD()}function Eq(i){return i.MonacoPerformanceMarks||(i.MonacoPerformanceMarks=Tq()),i.MonacoPerformanceMarks}var cD=Eq(globalThis),Bt=cD.mark,wq=cD.clearMarks,Q2=cD.getMarks;var Ai={};o7(Ai,{Promises:()=>at,RimRafMode:()=>mD,SymlinkSupport:()=>Wo,configureFlushOnWrite:()=>fD,realcase:()=>pD,realpathSync:()=>hD,whenDeleted:()=>Uq,writeFileSync:()=>Vq});import*as Ne from"fs";import{tmpdir as Aq}from"os";import{promisify as Dv}from"util";var kq=new Xr(1e4);function Fc(i){return J2(i,"NFC",kq)}var Pq=new Xr(1e4);function Fx(i){return J2(i,"NFD",Pq)}var _q=/[^\u0000-\u0080]/;function J2(i,t,e){if(!i)return i;let n=e.get(i);if(n)return n;let o;return _q.test(i)?o=i.normalize(t):o=i,e.set(i,o),o}var Rq=(function(){let i=new Xr(1e4),t=/[\u0300-\u036f]/g;return function(e){let n=i.get(e);if(n)return n;let o=Fx(e).replace(t,""),r=(o.length===e.length?o:e).toLowerCase();return i.set(e,r),r}})();var mD=(e=>(e[e.UNLINK=0]="UNLINK",e[e.MOVE=1]="MOVE",e))(mD||{});async function Z2(i,t=0,e){if(zR(i))throw new Error("rimraf - will refuse to recursively delete root");return t===0?uD(i):Mq(i,e)}async function Mq(i,t=C2(Aq())){try{try{await Ne.promises.rename(i,t)}catch(e){return e.code==="ENOENT"?void 0:uD(i)}uD(t).catch(()=>{})}catch(e){if(e.code!=="ENOENT")throw e}}async function uD(i){return Ne.promises.rm(i,{recursive:!0,force:!0,maxRetries:3})}async function Hx(i,t){try{return await Y2(i,t)}catch(e){if(e.code==="ENOENT"&&Te&&zR(i))try{return await Y2(`${i}.`,t)}catch{}throw e}}async function Y2(i,t){return Oq(await(t?Lq(i):Ne.promises.readdir(i)))}async function Lq(i){try{return await Ne.promises.readdir(i,{withFileTypes:!0})}catch(n){n.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",n)}let t=[],e=await Hx(i);for(let n of e){let o=!1,r=!1,s=!1;try{let a=await Ne.promises.lstat(Be(i,n));o=a.isFile(),r=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}t.push({name:n,isFile:()=>o,isDirectory:()=>r,isSymbolicLink:()=>s})}return t}function Oq(i){return i.map(t=>typeof t=="string"?St?Fc(t):t:(t.name=St?Fc(t.name):t.name,t))}async function Nq(i){let t=await Hx(i),e=[];for(let n of t)await Wo.existsDirectory(Be(i,n))&&e.push(n);return e}function Uq(i,t=1e3){return new Promise(e=>{let n=!1,o=setInterval(()=>{n||(n=!0,Ne.access(i,r=>{n=!1,r&&(clearInterval(o),e(void 0))}))},t)})}var Wo;(n=>{async function i(o){let r;try{if(r=await Ne.promises.lstat(o),!r.isSymbolicLink())return{stat:r}}catch{}try{return{stat:await Ne.promises.stat(o),symbolicLink:r?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&r)return{stat:r,symbolicLink:{dangling:!0}};if(Te&&s.code==="EACCES")try{return{stat:await Ne.promises.stat(await Ne.promises.readlink(o)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&r)return{stat:r,symbolicLink:{dangling:!0}};throw a}throw s}}n.stat=i;async function t(o){try{let{stat:r,symbolicLink:s}=await n.stat(o);return r.isFile()&&s?.dangling!==!0}catch{}return!1}n.existsFile=t;async function e(o){try{let{stat:r,symbolicLink:s}=await n.stat(o);return r.isDirectory()&&s?.dangling!==!0}catch{}return!1}n.existsDirectory=e})(Wo||={});var Fq=new Bp;function Hq(i,t,e){return Fq.queueFor(y.file(i),()=>{let n=eW(e);return new Promise((o,r)=>Wq(i,t,n,s=>s?r(s):o()))},Nc)}var gD=!0;function fD(i){gD=i}function Wq(i,t,e,n){if(!gD)return Ne.writeFile(i,t,{mode:e.mode,flag:e.flag},n);Ne.open(i,e.flag,e.mode,(o,r)=>{if(o)return n(o);Ne.writeFile(r,t,s=>{if(s)return Ne.close(r,()=>n(s));Ne.fdatasync(r,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),fD(!1)),Ne.close(r,l=>n(l))))})})}function Vq(i,t,e){let n=eW(e);if(!gD)return Ne.writeFileSync(i,t,{mode:n.mode,flag:n.flag});let o=Ne.openSync(i,n.flag,n.mode);try{Ne.writeFileSync(o,t);try{Ne.fdatasyncSync(o)}catch(r){console.warn("[node.js fs] fdatasyncSync is now disabled for this session because it failed: ",r),fD(!1)}}finally{Ne.closeSync(o)}}function eW(i){return i?{mode:typeof i.mode=="number"?i.mode:438,flag:typeof i.flag=="string"?i.flag:"w"}:{mode:438,flag:"w"}}async function Bq(i,t,e=6e4){if(i!==t)try{Te&&typeof e=="number"?await tW(i,t,Date.now(),e):await Ne.promises.rename(i,t)}catch(n){if(i.toLowerCase()!==t.toLowerCase()&&n.code==="EXDEV"||i.endsWith("."))await nW(i,t,{preserveSymlinks:!1}),await Z2(i,1);else throw n}}async function tW(i,t,e,n,o=0){try{return await Ne.promises.rename(i,t)}catch(r){if(r.code!=="EACCES"&&r.code!=="EPERM"&&r.code!=="EBUSY")throw r;if(Date.now()-e>=n)throw console.error(`[node.js fs] rename failed after ${o} retries with error: ${r}`),r;if(o===0){let s=!1;try{let{stat:a}=await Wo.stat(t);a.isFile()||(s=!0)}catch{}if(s)throw r}return await Vt(Math.min(100,o*10)),tW(i,t,e,n,o+1)}}async function nW(i,t,e){return oW(i,t,{root:{source:i,target:t},options:e,handledSourcePaths:new Set})}var X2=511;async function oW(i,t,e){if(e.handledSourcePaths.has(i))return;e.handledSourcePaths.add(i);let{stat:n,symbolicLink:o}=await Wo.stat(i);if(o){if(e.options.preserveSymlinks)try{return await qq(i,t,e)}catch{}if(o.dangling)return}return n.isDirectory()?$q(i,t,n.mode&X2,e):zq(i,t,n.mode&X2)}async function $q(i,t,e,n){await Ne.promises.mkdir(t,{recursive:!0,mode:e});let o=await Hx(i);for(let r of o)await oW(Be(i,r),Be(t,r),n)}async function zq(i,t,e){await Ne.promises.copyFile(i,t),await Ne.promises.chmod(t,e)}async function qq(i,t,e){let n=await Ne.promises.readlink(i);Or(n,e.root.source,!Xe)&&(n=Be(e.root.target,n.substr(e.root.source.length+1))),await Ne.promises.symlink(n,t)}async function pD(i,t){if(Xe)return i;let e=gn(i);if(i===e)return i;let n=(ot(i)||i).toLowerCase();try{if(t?.isCancellationRequested)return null;let r=(await at.readdir(e)).filter(s=>s.toLowerCase()===n);if(r.length===1){let s=await pD(e,t);if(s)return Be(s,r[0])}else if(r.length>1){let s=r.indexOf(n);if(s>=0){let a=await pD(e,t);if(a)return Be(a,r[s])}}}catch{}return null}async function Kq(i){try{return await Dv(Ne.realpath)(i)}catch{let t=rW(i);return await Ne.promises.access(t,Ne.constants.R_OK),t}}function hD(i){try{return Ne.realpathSync(i)}catch{let t=rW(i);return Ne.accessSync(t,Ne.constants.R_OK),t}}function rW(i){return vr(so(i),Dt)}var at=new class{get read(){return(i,t,e,n,o)=>new Promise((r,s)=>{Ne.read(i,t,e,n,o,(a,l,d)=>a?s(a):r({bytesRead:l,buffer:d}))})}get write(){return(i,t,e,n,o)=>new Promise((r,s)=>{Ne.write(i,t,e,n,o,(a,l,d)=>a?s(a):r({bytesWritten:l,buffer:d}))})}get fdatasync(){return Dv(Ne.fdatasync)}get open(){return Dv(Ne.open)}get close(){return Dv(Ne.close)}get ftruncate(){return Dv(Ne.ftruncate)}async exists(i){try{return await Ne.promises.access(i),!0}catch{return!1}}get readdir(){return Hx}get readDirsInDir(){return Nq}get writeFile(){return Hq}get rm(){return Z2}get rename(){return Bq}get copy(){return nW}get realpath(){return Kq}};function iW(i){return(t,e,n)=>{let o=null,r=null;if(typeof n.value=="function"?(o="value",r=n.value):typeof n.get=="function"&&(o="get",r=n.get),!r||typeof e=="symbol")throw new Error("not supported");n[o]=i(r,e)}}function Wx(i,t,e){let n=null,o=null;if(typeof e.value=="function"?(n="value",o=e.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(n="get",o=e.get),!o)throw new Error("not supported");let r=`$memoize$${t}`;e[n]=function(...s){return this.hasOwnProperty(r)||Object.defineProperty(this,r,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,s)}),this[r]}}function Hc(i,t,e){return iW((n,o)=>{let r=`$debounce$${o}`,s=`$debounce$result$${o}`;return function(...a){this[s]||(this[s]=e?e():void 0),clearTimeout(this[r]),t&&(this[s]=t(this[s],...a),a=[this[s]]),this[r]=setTimeout(()=>{n.apply(this,a),this[s]=e?e():void 0},i)}})}function sW(i,t,e){return iW((n,o)=>{let r=`$throttle$timer$${o}`,s=`$throttle$result$${o}`,a=`$throttle$lastRun$${o}`,l=`$throttle$pending$${o}`;return function(...d){if(this[s]||(this[s]=e?e():void 0),(this[a]===null||this[a]===void 0)&&(this[a]=-Number.MAX_VALUE),t&&(this[s]=t(this[s],...d)),this[l])return;let c=this[a]+i;c<=Date.now()?(this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=e?e():void 0):(this[l]=!0,this[r]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),n.apply(this,[this[s]]),this[s]=e?e():void 0},c-Date.now()))}})}function aW(i){return JSON.stringify(i,jq)}function Vx(i){let t=JSON.parse(i);return t=Tt(t),t}function jq(i,t){return t instanceof RegExp?{$mid:2,source:t.source,flags:t.flags}:t}function Tt(i,t=0){if(!i||t>200)return i;if(typeof i=="object"){switch(i.$mid){case 1:return y.revive(i);case 2:return new RegExp(i.source,i.flags);case 17:return new Date(i.source)}if(i instanceof H||i instanceof Uint8Array)return i;if(Array.isArray(i))for(let e=0;e<i.length;++e)i[e]=Tt(i[e],t+1);else for(let e in i)Object.hasOwnProperty.call(i,e)&&(i[e]=Tt(i[e],t+1))}return i}function lW(i){switch(i){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function dW(i){switch(i){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function jp(i){let t=0;for(let e=0;;e+=7){let n=i.read(1);if(t|=(n.buffer[0]&127)<<e,!(n.buffer[0]&128))return t}}var Gq=Xl(0);function Gp(i,t){if(t===0){i.write(Gq);return}let e=0;for(let o=t;o!==0;o=o>>>7)e++;let n=H.alloc(e);for(let o=0;t!==0;o++)n.buffer[o]=t&127,t=t>>>7,t>0&&(n.buffer[o]|=128);i.write(n)}var vD=class{constructor(t){this.buffer=t;this.pos=0}read(t){let e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=e.byteLength,e}},yD=class{constructor(){this.buffers=[]}get buffer(){return H.concat(this.buffers)}write(t){this.buffers.push(t)}dispose(){this.buffers.length=0}};function Xl(i){let t=H.alloc(1);return t.writeUInt8(i,0),t}var Wc={Undefined:Xl(0),String:Xl(1),Buffer:Xl(2),VSBuffer:Xl(3),Array:Xl(4),Object:Xl(5),Uint:Xl(6)};function bD(i,t){if(typeof t>"u")i.write(Wc.Undefined);else if(typeof t=="string"){let e=H.fromString(t);i.write(Wc.String),Gp(i,e.byteLength),i.write(e)}else if(H.isNativeBuffer(t)){let e=H.wrap(t);i.write(Wc.Buffer),Gp(i,e.byteLength),i.write(e)}else if(t instanceof H)i.write(Wc.VSBuffer),Gp(i,t.byteLength),i.write(t);else if(Array.isArray(t)){i.write(Wc.Array),Gp(i,t.length);for(let e of t)bD(i,e)}else if(typeof t=="number"&&(t|0)===t)i.write(Wc.Uint),Gp(i,t);else{let e=H.fromString(JSON.stringify(t));i.write(Wc.Object),Gp(i,e.byteLength),i.write(e)}}function ID(i){switch(i.read(1).readUInt8(0)){case 0:return;case 1:return i.read(jp(i)).toString();case 2:return i.read(jp(i)).buffer;case 3:return i.read(jp(i));case 4:{let e=jp(i),n=[];for(let o=0;o<e;o++)n.push(ID(i));return n}case 5:return JSON.parse(i.read(jp(i)).toString());case 6:return jp(i)}}var Av=class{constructor(t,e=null){this.protocol=t;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new T;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(n=>this.onBuffer(n)),this.logger=e}getChannel(t){let e=this;return{call(n,o,r){return e.isDisposed?Promise.reject(new Oe):e.requestPromise(t,n,o,r)},listen(n,o){return e.isDisposed?ye.None:e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=pe.None){let r=this.lastRequestId++,a={id:r,type:100,channelName:t,name:e,arg:n};if(o.isCancellationRequested)return Promise.reject(new Oe);let l,d;return new Promise((u,m)=>{if(o.isCancellationRequested)return m(new Oe);let g=()=>{let I=x=>{switch(x.type){case 201:this.handlers.delete(r),u(x.data);break;case 202:{this.handlers.delete(r);let E=new Error(x.data.message);E.stack=Array.isArray(x.data.stack)?x.data.stack.join(`
`):x.data.stack,E.name=x.data.name,m(E);break}case 203:this.handlers.delete(r),m(x.data);break}};this.handlers.set(r,I);try{this.sendRequest(a)}catch(x){this.handlers.delete(r),m(x)}},h=null;this.state===1?g():(h=br(I=>this.whenInitialized()),h.then(()=>{h=null,g()},()=>{}));let f=()=>{h?(h.cancel(),h=null):this.sendRequest({id:r,type:101}),m(new Oe)};l=o.onCancellationRequested(f),d={dispose:Nl(()=>{f(),l.dispose()})},this.activeRequests.add(d)}).finally(()=>{l?.dispose(),this.activeRequests.delete(d)})}requestEvent(t,e,n){let o=this.lastRequestId++,s={id:o,type:102,channelName:t,name:e,arg:n},a=null,l=new T({onWillAddFirstListener:()=>{let d=u=>l.fire(u.data);this.handlers.set(o,d);let c=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?c():(a=br(u=>this.whenInitialized()),a.then(()=>{a=null,c()},()=>{}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:o,type:103})),this.handlers.delete(o)}});return l.event}sendRequest(t){switch(t.type){case 100:case 102:{let e=this.send([t.type,t.id,t.channelName,t.name],t.arg);this.logger?.logOutgoing(e,t.id,0,`${lW(t.type)}: ${t.channelName}.${t.name}`,t.arg);return}case 101:case 103:{let e=this.send([t.type,t.id]);this.logger?.logOutgoing(e,t.id,0,lW(t.type));return}}}send(t,e=void 0){let n=new yD;try{return bD(n,t),bD(n,e),this.sendBuffer(n.buffer)}finally{n.dispose()}}sendBuffer(t){try{return this.protocol.send(t),t.byteLength}catch{return 0}}onBuffer(t){let e=new vD(t),n=ID(e),o=ID(e),r=n[0];switch(r){case 200:return this.logger?.logIncoming(t.byteLength,0,0,dW(r)),this.onResponse({type:n[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(t.byteLength,n[1],0,dW(r),o),this.onResponse({type:n[0],id:n[1],data:o})}}onResponse(t){if(t.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(t.id)?.(t)}get onDidInitializePromise(){return ye.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),In(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};_([Wx],Av.prototype,"onDidInitializePromise",1);function cW(i){let t=!1;return{call(e,n,o){return t?i.call(e,n,o):Vt(0).then(()=>t=!0).then(()=>i.call(e,n,o))},listen(e,n){if(t)return i.listen(e,n);let o=new mx;return Vt(0).then(()=>t=!0).then(()=>o.input=i.listen(e,n)),o.event}}}var xD;(o=>{function i(r,s,a){let l=r,d=a?.disableMarshalling,c=a?.unbufferedEvents?new Set(a.unbufferedEvents):void 0,u=new Map;for(let m in l)e(m)&&!c?.has(m)&&u.set(m,ye.buffer(l[m],m,!0,void 0,s));return new class{listen(m,g,h){let f=u.get(g);if(f)return f;let I=l[g];if(typeof I=="function"){if(n(g))return I.call(l,h);if(e(g))return c?.has(g)?l[g]:(u.set(g,ye.buffer(l[g],g,!0,void 0,s)),u.get(g))}throw new Ln(`Event not found: ${g}`)}call(m,g,h){let f=l[g];if(typeof f=="function"){if(!d&&Array.isArray(h))for(let x=0;x<h.length;x++)h[x]=Tt(h[x]);let I=f.apply(l,h);return I instanceof Promise||(I=Promise.resolve(I)),I}throw new Ln(`Method not found: ${g}`)}}}o.fromService=i;function t(r,s){let a=s?.disableMarshalling;return new Proxy({},{get(l,d){if(typeof d=="string")return s?.properties?.has(d)?s.properties.get(d):d==="then"?void 0:n(d)?function(c){return r.listen(d,c)}:e(d)?r.listen(d):async function(...c){let u;s&&!Wt(s.context)?u=[s.context,...c]:u=c;let m=await r.call(d,u);return a?m:Tt(m)};throw new Ln(`Property not found: ${String(d)}`)}})}o.toService=t;function e(r){return r[0]==="o"&&r[1]==="n"&&WR(r.charCodeAt(2))}function n(r){return/^onDynamic/.test(r)&&WR(r.charCodeAt(9))}})(xD||={});var Lv;(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,n=0;function o(a,l){if(!e.has(a)){let d=String(++n);e.set(a,d)}return e.get(a)}function r(a,l,d,c){}s.traceSocketEvent=r})(Lv||={});var SD=null;function Zl(){return SD||(SD=H.alloc(0)),SD}var Mv=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(t){this._chunks.push(t),this._totalLength+=t.byteLength}read(t){return this._read(t,!0)}peek(t){return this._read(t,!1)}_read(t,e){if(t===0)return Zl();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=t),s}if(this._chunks[0].byteLength>t){let s=this._chunks[0].slice(0,t);return e&&(this._chunks[0]=this._chunks[0].slice(t),this._totalLength-=t),s}let n=H.alloc(t),o=0,r=0;for(;t>0;){let s=this._chunks[r];if(s.byteLength>t){let a=s.slice(0,t);n.set(a,o),o+=t,e&&(this._chunks[r]=s.slice(t),this._totalLength-=t),t-=t}else n.set(s,o),o+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):r++,t-=s.byteLength}return n}};function uW(i){switch(i){case 0:return"None";case 1:return"Regular";case 2:return"Control";case 3:return"Ack";case 5:return"Disconnect";case 6:return"ReplayRequest";case 7:return"PauseWriting";case 8:return"ResumeWriting";case 9:return"KeepAlive"}}var si=class{constructor(t,e,n,o){this.type=t;this.id=e;this.ack=n;this.data=o;this.writtenTime=0}get size(){return this.data.byteLength}},Bx=class extends N{constructor(e){super();this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._state={readHead:!0,readLen:13,messageType:0,id:0,ack:0};this._socket=e,this._isDisposed=!1,this._incomingData=new Mv,this._register(this._socket.onData(n=>this.acceptChunk(n))),this.lastReadTime=Date.now()}acceptChunk(e){if(!(!e||e.byteLength===0))for(this.lastReadTime=Date.now(),this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;){let n=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=n.readUInt32BE(9),this._state.messageType=n.readUInt8(0),this._state.id=n.readUInt32BE(1),this._state.ack=n.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:uW(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let o=this._state.messageType,r=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",n),this._onMessage.fire(new si(o,r,s,n)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},$x=class{constructor(t){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=t,this._data=[],this._totalLength=0,this.lastWriteTime=0}dispose(){try{this.flush()}catch{}this._isDisposed=!0}drain(){return this.flush(),this._socket.drain()}flush(){this._writeNow()}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this._scheduleWriting()}write(t){if(this._isDisposed)return;t.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=H.alloc(13);e.writeUInt8(t.type,0),e.writeUInt32BE(t.id,1),e.writeUInt32BE(t.ack,5),e.writeUInt32BE(t.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:uW(t.type),id:t.id,ack:t.ack,messageSize:t.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",t.data),this._writeSoon(e,t.data)}_bufferAdd(t,e){let n=this._totalLength===0;return this._data.push(t,e),this._totalLength+=t.byteLength+e.byteLength,n}_bufferTake(){let t=H.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,t}_writeSoon(t,e){this._bufferAdd(t,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let t=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:t.byteLength}),this._socket.write(t)}};var ys=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new T({onWillAddFirstListener:()=>{this._hasListeners=!0,queueMicrotask(()=>this._deliverMessages())},onDidRemoveLastListener:()=>{this._hasListeners=!1}}),this.event=this._emitter.event}_deliverMessages(){if(!this._isDeliveringMessages){for(this._isDeliveringMessages=!0;this._hasListeners&&this._bufferedMessages.length>0;)this._emitter.fire(this._bufferedMessages.shift());this._isDeliveringMessages=!1}}fire(t){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(t):this._emitter.fire(t):this._bufferedMessages.push(t)}flushBuffer(){this._bufferedMessages=[]}},CD=class{constructor(t){this.data=t,this.next=null}},TD=class{constructor(){this._first=null,this._last=null}length(){let t=0,e=this._first;for(;e;)e=e.next,t++;return t}peek(){return this._first?this._first.data:null}toArray(){let t=[],e=0,n=this._first;for(;n;)t[e++]=n.data,n=n.next;return t}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(t){let e=new CD(t);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},ED=class i{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return i._INSTANCE||(i._INSTANCE=new i),i._INSTANCE}constructor(){this.lastRuns=[];let t=Date.now();for(let e=0;e<i._HISTORY_LENGTH;e++)this.lastRuns[e]=t-1e3*e;setInterval(()=>{for(let e=i._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let t=Date.now(),e=(1+i._HISTORY_LENGTH)*1e3,n=0;for(let o=0;o<i._HISTORY_LENGTH;o++)t-this.lastRuns[o]<=e&&n++;return 1-n/i._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},Vc=class{constructor(t){this._onControlMessage=new ys;this.onControlMessage=this._onControlMessage.event;this._onMessage=new ys;this.onMessage=this._onMessage.event;this._onDidDispose=new ys;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new ys;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new ys;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=t.loadEstimator??ED.getInstance(),this._shouldSendKeepAlive=t.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new TD,this._outgoingMsgId=0,this._outgoingAckId=0,this._outgoingAckTimeout=null,this._incomingMsgId=0,this._incomingAckId=0,this._incomingMsgLastTime=0,this._incomingAckTimeout=null,this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socketDisposables=new $,this._socket=t.socket,this._socketWriter=this._socketDisposables.add(new $x(this._socket)),this._socketReader=this._socketDisposables.add(new Bx(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),t.initialChunk&&this._socketReader.acceptChunk(t.initialChunk),this._shouldSendKeepAlive?this._keepAliveInterval=setInterval(()=>{this._sendKeepAlive()},5e3):this._keepAliveInterval=null}get unacknowledgedCount(){return this._outgoingMsgId-this._outgoingAckId}dispose(){this._outgoingAckTimeout&&(clearTimeout(this._outgoingAckTimeout),this._outgoingAckTimeout=null),this._incomingAckTimeout&&(clearTimeout(this._incomingAckTimeout),this._incomingAckTimeout=null),this._keepAliveInterval&&(clearInterval(this._keepAliveInterval),this._keepAliveInterval=null),this._socketDisposables.dispose()}drain(){return this._socketWriter.drain()}sendDisconnect(){if(!this._didSendDisconnect){this._didSendDisconnect=!0;let t=new si(5,0,0,Zl());this._socketWriter.write(t),this._socketWriter.flush()}}sendPause(){let t=new si(7,0,0,Zl());this._socketWriter.write(t)}sendResume(){let t=new si(8,0,0,Zl());this._socketWriter.write(t)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(t,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new $,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=t,this._socketWriter=this._socketDisposables.add(new $x(this._socket)),this._socketReader=this._socketDisposables.add(new Bx(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(n=>this._receiveMessage(n))),this._socketDisposables.add(this._socket.onClose(n=>this._onSocketClose.fire(n))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let t=new si(3,0,this._incomingAckId,Zl());this._socketWriter.write(t);let e=this._outgoingUnackMsg.toArray();for(let n=0,o=e.length;n<o;n++)this._socketWriter.write(e[n]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(t){if(t.ack>this._outgoingAckId){this._outgoingAckId=t.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=t.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(t.type){case 0:break;case 1:{if(t.id>this._incomingMsgId)if(t.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new si(6,0,0,Zl())))}else this._incomingMsgId=t.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(t.data);break}case 2:{this._onControlMessage.fire(t.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let n=0,o=e.length;n<o;n++)this._socketWriter.write(e[n]);this._recvAckCheck();break}case 7:{this._socketWriter.pause();break}case 8:{this._socketWriter.resume();break}case 9:break}}readEntireBuffer(){return this._socketReader.readEntireBuffer()}flush(){this._socketWriter.flush()}send(t){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let n=new si(1,e,this._incomingAckId,t);this._outgoingUnackMsg.push(n),this._isReconnecting||(this._socketWriter.write(n),this._recvAckCheck())}sendControl(t){let e=new si(2,0,0,t);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let t=Date.now()-this._incomingMsgLastTime;if(t>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-t+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let t=this._outgoingUnackMsg.peek(),e=Date.now()-t.writtenTime,n=Date.now()-this._socketReader.lastReadTime,o=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&o>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({reason:"unacknowledgedMessage",unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:n});return}let r=Math.max(2e4-e,2e4-n,2e4-o,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},r)}_keepAliveTimeoutCheck(){if(this._isReconnecting)return;let t=Date.now(),e=t-this._socketReader.lastReadTime,n=t-this._lastSocketTimeoutTime;if(e>=2e4&&n>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=t;let o=this._outgoingUnackMsg.length(),r=this._outgoingUnackMsg.peek();this._onSocketTimeout.fire({reason:"keepAlive",unacknowledgedMsgCount:o,timeSinceOldestUnacknowledgedMsg:r?t-r.writtenTime:void 0,timeSinceLastReceivedSomeData:e})}}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let t=new si(3,0,this._incomingAckId,Zl());this._socketWriter.write(t)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let t=new si(9,0,this._incomingAckId,Zl());this._socketWriter.write(t),this._keepAliveTimeoutCheck()}};import{createHash as Iie}from"crypto";import{createConnection as Tie,createServer as Eie}from"net";import{tmpdir as t3}from"os";import{createDeflateRaw as n3,createInflateRaw as o3}from"zlib";var _e=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let i=new Uint8Array(16),t=[];for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(i),i[6]=i[6]&15|64,i[8]=i[8]&63|128;let n=0,o="";return o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o+="-",o+=t[i[n++]],o+=t[i[n++]],o+="-",o+=t[i[n++]],o+=t[i[n++]],o+="-",o+=t[i[n++]],o+=t[i[n++]],o+="-",o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o+=t[i[n++]],o}})();var qx=128,Kx=64,Qq=48,zx=128,Jq=127,Qp=126,pW=127,jx=4294967295;var wD=class extends Error{constructor(e,n){super(`WebSocket frame payload length ${e} exceeds the configured limit of ${n}.`);this.payloadLength=e;this.maxPayloadLength=n}},Gx=class{constructor(t={}){this._incomingData=new Mv;if(this._maxPayloadLength=t.maxPayloadLength??jx,this._unmaskInPlace=t.unmaskInPlace??!1,!Number.isInteger(this._maxPayloadLength)||this._maxPayloadLength<0||this._maxPayloadLength>jx)throw new Error("WebSocket frame payload limits must be unsigned 32-bit integers.")}acceptChunk(t){if(t.byteLength===0)return[];this._incomingData.acceptChunk(t);let e=[];for(;this._incomingData.byteLength>=2;){let n=this._incomingData.peek(2),o=n.readUInt8(0),r=n.readUInt8(1),s=r&Jq,a=s===Qp?2:s===pW?8:0,l=(r&zx)!==0,d=2+a+(l?4:0);if(this._incomingData.byteLength<d)break;let c=this._incomingData.peek(d),u=Xq(c,s);if(u>this._maxPayloadLength)throw new wD(u,this._maxPayloadLength);fW(o,u);let m=o&15;if(kD(m),this._incomingData.byteLength<d+u)break;this._incomingData.read(d);let g=this._incomingData.read(u),h=l?c.readUInt32BE(d-4):void 0,f=g;h!==void 0&&(this._unmaskInPlace?gW(f,h):f=vW(g,h)),e.push({final:(o&qx)!==0,compressed:(o&Kx)!==0,opcode:m,payload:f,mask:h})}return e}};function mW(i,t){let e=t.final??!0,n=t.compressed??!1;kD(t.opcode),hW(t.mask),fW((e?qx:0)|(n?Kx:0)|t.opcode,i.byteLength);let o=Yq(i.byteLength,t.mask!==void 0),r=H.alloc(o);r.writeUInt8((e?qx:0)|(n?Kx:0)|t.opcode,0);let s=2;return i.byteLength<Qp?r.writeUInt8((t.mask===void 0?0:zx)|i.byteLength,1):i.byteLength<2**16?(r.writeUInt8((t.mask===void 0?0:zx)|Qp,1),r.writeUInt8(i.byteLength>>>8,s++),r.writeUInt8(i.byteLength,s++)):(r.writeUInt8((t.mask===void 0?0:zx)|pW,1),r.writeUInt32BE(0,s),s+=4,r.writeUInt32BE(i.byteLength,s),s+=4),t.mask===void 0?H.concat([r,i]):(r.writeUInt32BE(t.mask,s),H.concat([r,vW(i,t.mask)]))}function gW(i,t){if(hW(t),t===0)return;let e=i.byteLength>>>2;for(let r=0;r<e;r++){let s=r*4;i.writeUInt32BE(i.readUInt32BE(s)^t,s)}let n=e*4,o=i.byteLength-n;o>=1&&i.writeUInt8(i.readUInt8(n)^t>>>24&255,n),o>=2&&i.writeUInt8(i.readUInt8(n+1)^t>>>16&255,n+1),o>=3&&i.writeUInt8(i.readUInt8(n+2)^t>>>8&255,n+2)}function Yq(i,t){if(i>jx)throw new Error("WebSocket payload lengths greater than 2^32 - 1 are not supported.");return i<Qp?2+(t?4:0):i<2**16?4+(t?4:0):10+(t?4:0)}function Xq(i,t){if(t<Qp)return t;if(t===Qp)return i.readUInt8(2)*2**8+i.readUInt8(3);if(i.readUInt32BE(2)!==0)throw new Error("WebSocket payload lengths greater than 2^32 - 1 are not supported.");return i.readUInt32BE(6)}function fW(i,t){if((i&Qq)!==0)throw new Error("WebSocket frames must not set RSV2 or RSV3.");let e=i&15;if(kD(e),Zq(e)){if((i&qx)===0)throw new Error("WebSocket control frames must be final.");if(t>125)throw new Error("WebSocket control frames must not exceed 125 bytes.");if((i&Kx)!==0)throw new Error("WebSocket control frames must not set RSV1.")}}function kD(i){if(i!==0&&i!==1&&i!==2&&i!==8&&i!==9&&i!==10)throw new Error(`WebSocket frame has reserved opcode ${i}.`)}function hW(i){if(i!==void 0&&(!Number.isInteger(i)||i<0||i>jx))throw new Error("WebSocket masks must be unsigned 32-bit integers.")}function Zq(i){return(i&8)!==0}function vW(i,t){let e=H.alloc(i.byteLength);return e.set(i),gW(e,t),e}var r3=3e4,Ur=class{constructor(t,e=""){this._canWrite=!0;this.debugLabel=e,this.socket=t,this.traceSocketEvent("created",{type:"NodeSocket"}),this._errorListener=n=>{if(this.traceSocketEvent("error",{code:n?.code,message:n?.message}),n){if(n.code==="EPIPE")return;Ge(n)}},this.socket.on("error",this._errorListener),this._closeListener=n=>{this.traceSocketEvent("close",{hadError:n}),this._canWrite=!1,this._endTimeoutHandle&&clearTimeout(this._endTimeoutHandle)},this.socket.on("close",this._closeListener),this._endListener=()=>{this.traceSocketEvent("nodeEndReceived"),this._canWrite=!1,this._endTimeoutHandle=setTimeout(()=>t.destroy(),r3)},this.socket.on("end",this._endListener)}traceSocketEvent(t,e){Lv.traceSocketEvent(this.socket,this.debugLabel,t,e)}dispose(t=!0){this._endTimeoutHandle&&(clearTimeout(this._endTimeoutHandle),this._endTimeoutHandle=void 0),this.socket.off("error",this._errorListener),this.socket.off("close",this._closeListener),this.socket.off("end",this._endListener),t&&this.socket.destroy()}onData(t){let e=n=>{this.traceSocketEvent("read",n),t(H.wrap(n))};return this.socket.on("data",e),{dispose:()=>this.socket.off("data",e)}}onClose(t){let e=n=>{t({type:0,hadError:n,error:void 0})};return this.socket.on("close",e),{dispose:()=>this.socket.off("close",e)}}onEnd(t){let e=()=>{t()};return this.socket.on("end",e),{dispose:()=>this.socket.off("end",e)}}write(t){if(!(this.socket.destroyed||!this._canWrite))try{this.traceSocketEvent("write",t),this.socket.write(t.buffer,e=>{if(e){if(e.code==="EPIPE")return;Ge(e)}})}catch(e){if(e.code==="EPIPE")return;Ge(e)}}end(){this.traceSocketEvent("nodeEndSent"),this.socket.end()}drain(){return this.traceSocketEvent("nodeDrainBegin"),new Promise((t,e)=>{if(this.socket.bufferSize===0){this.traceSocketEvent("nodeDrainEnd"),t();return}let n=()=>{this.socket.off("close",n),this.socket.off("end",n),this.socket.off("error",n),this.socket.off("timeout",n),this.socket.off("drain",n),this.traceSocketEvent("nodeDrainEnd"),t()};this.socket.on("close",n),this.socket.on("end",n),this.socket.on("error",n),this.socket.on("timeout",n),this.socket.on("drain",n)})}};var Qx=class extends N{constructor(e,n,o,r,s=!0){super();this._frameParser=new Gx({unmaskInPlace:!0});this._onData=this._register(new T);this._onClose=this._register(new T);this._isEnded=!1;this._compressedMessage=!1;this.socket=e,this._maxSocketMessageLength=s?262144:1/0,this.traceSocketEvent("created",{type:"WebSocketNodeSocket",permessageDeflate:n,inflateBytesLength:o?.byteLength||0,recordInflateBytes:r}),this._flowManager=this._register(new PD(this,n,o,r,this._onData,(a,l)=>this._write(a,l))),this._register(this._flowManager.onError(a=>{console.error(a),Ge(a),this._onClose.fire({type:0,hadError:!0,error:a})})),this._register(this.socket.onData(a=>this._acceptChunk(a))),this._register(this.socket.onClose(async a=>{this._flowManager.isProcessingReadQueue()&&await ye.toPromise(this._flowManager.onDidFinishProcessingReadQueue),this._onClose.fire(a)}))}get permessageDeflate(){return this._flowManager.permessageDeflate}get recordedInflateBytes(){return this._flowManager.recordedInflateBytes}setRecordInflateBytes(e){this._flowManager.setRecordInflateBytes(e)}traceSocketEvent(e,n){this.socket.traceSocketEvent(e,n)}dispose(){this._flowManager.isProcessingWriteQueue()?this._register(this._flowManager.onDidFinishProcessingWriteQueue(()=>{this.dispose()})):(this.socket.dispose(),super.dispose())}onData(e){return this._onData.event(e)}onClose(e){return this._onClose.event(e)}onEnd(e){return this.socket.onEnd(e)}write(e){let n=0;for(;n<e.byteLength;)this._flowManager.writeMessage(e.slice(n,Math.min(n+this._maxSocketMessageLength,e.byteLength)),{compressed:!0,opcode:2}),n+=this._maxSocketMessageLength}_write(e,{compressed:n,opcode:o}){this._isEnded||(this.traceSocketEvent("webSocketNodeSocketWrite",e),this.socket.write(mW(e,{compressed:n,opcode:o})))}end(){this._isEnded=!0,this.socket.end()}_acceptChunk(e){for(let n of this._frameParser.acceptChunk(e)){let o=n.opcode===0?this._compressedMessage:n.compressed;(n.opcode===1||n.opcode===2)&&(this._compressedMessage=n.compressed),this.traceSocketEvent("webSocketNodeSocketPeekedHeader",{bodySize:n.payload.byteLength,compressed:o,fin:Number(n.final),mask:n.mask,opcode:n.opcode}),this.traceSocketEvent("webSocketNodeSocketReadData",n.payload),n.mask!==void 0&&this.traceSocketEvent("webSocketNodeSocketUnmaskedData",n.payload),n.opcode===0||n.opcode===1||n.opcode===2?(this._flowManager.acceptFrame(n.payload,o,n.final),n.final&&(this._compressedMessage=!1)):n.opcode===9&&this._flowManager.writeMessage(n.payload,{compressed:!1,opcode:10})}}async drain(){this.traceSocketEvent("webSocketNodeSocketDrainBegin"),this._flowManager.isProcessingWriteQueue()&&await ye.toPromise(this._flowManager.onDidFinishProcessingWriteQueue),await this.socket.drain(),this.traceSocketEvent("webSocketNodeSocketDrainEnd")}},PD=class extends N{constructor(e,n,o,r,s,a){super();this._tracer=e;this._onData=s;this._writeFn=a;this._onError=this._register(new T);this.onError=this._onError.event;this._writeQueue=[];this._readQueue=[];this._onDidFinishProcessingReadQueue=this._register(new T);this.onDidFinishProcessingReadQueue=this._onDidFinishProcessingReadQueue.event;this._onDidFinishProcessingWriteQueue=this._register(new T);this.onDidFinishProcessingWriteQueue=this._onDidFinishProcessingWriteQueue.event;this._isProcessingWriteQueue=!1;this._isProcessingReadQueue=!1;n?(this._zlibInflateStream=this._register(new _D(this._tracer,r,o,{windowBits:15})),this._zlibDeflateStream=this._register(new RD(this._tracer,{windowBits:15})),this._register(this._zlibInflateStream.onError(l=>this._onError.fire(l))),this._register(this._zlibDeflateStream.onError(l=>this._onError.fire(l)))):(this._zlibInflateStream=null,this._zlibDeflateStream=null)}get permessageDeflate(){return!!(this._zlibInflateStream&&this._zlibDeflateStream)}get recordedInflateBytes(){return this._zlibInflateStream?this._zlibInflateStream.recordedInflateBytes:H.alloc(0)}setRecordInflateBytes(e){this._zlibInflateStream?.setRecordInflateBytes(e)}writeMessage(e,n){this._writeQueue.push({data:e,options:n}),this._processWriteQueue()}async _processWriteQueue(){if(!this._isProcessingWriteQueue){for(this._isProcessingWriteQueue=!0;this._writeQueue.length>0;){let{data:e,options:n}=this._writeQueue.shift();if(this._zlibDeflateStream&&n.compressed){let o=await this._deflateMessage(this._zlibDeflateStream,e);this._writeFn(o,n)}else this._writeFn(e,{...n,compressed:!1})}this._isProcessingWriteQueue=!1,this._onDidFinishProcessingWriteQueue.fire()}}isProcessingWriteQueue(){return this._isProcessingWriteQueue}_deflateMessage(e,n){return new Promise((o,r)=>{e.write(n),e.flush(s=>o(s))})}acceptFrame(e,n,o){this._readQueue.push({data:e,isCompressed:n,isLastFrameOfMessage:o}),this._processReadQueue()}async _processReadQueue(){if(!this._isProcessingReadQueue){for(this._isProcessingReadQueue=!0;this._readQueue.length>0;){let e=this._readQueue.shift();if(this._zlibInflateStream&&e.isCompressed){let n=await this._inflateFrame(this._zlibInflateStream,e.data,e.isLastFrameOfMessage);this._onData.fire(n)}else this._onData.fire(e.data)}this._isProcessingReadQueue=!1,this._onDidFinishProcessingReadQueue.fire()}}isProcessingReadQueue(){return this._isProcessingReadQueue}_inflateFrame(e,n,o){return new Promise((r,s)=>{e.write(n),o&&e.write(H.fromByteArray([0,0,255,255])),e.flush(a=>r(a))})}},_D=class extends N{constructor(e,n,o,r){super();this._tracer=e;this._onError=this._register(new T);this.onError=this._onError.event;this._recordedInflateBytes=[];this._pendingInflateData=[];this._recordInflateBytes=n,this._zlibInflate=o3(r),this._zlibInflate.on("error",s=>{this._tracer.traceSocketEvent("zlibInflateError",{message:s?.message,code:s?.code}),this._onError.fire(s)}),this._zlibInflate.on("data",s=>{this._tracer.traceSocketEvent("zlibInflateData",s),this._pendingInflateData.push(H.wrap(s))}),o&&(this._tracer.traceSocketEvent("zlibInflateInitialWrite",o.buffer),this._zlibInflate.write(o.buffer),this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateInitialFlushFired"),this._pendingInflateData.length=0}))}get recordedInflateBytes(){return this._recordInflateBytes?H.concat(this._recordedInflateBytes):H.alloc(0)}write(e){this._recordInflateBytes&&this._recordedInflateBytes.push(e.clone()),this._tracer.traceSocketEvent("zlibInflateWrite",e),this._zlibInflate.write(e.buffer)}setRecordInflateBytes(e){this._recordInflateBytes=e,e||(this._recordedInflateBytes.length=0)}flush(e){this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateFlushFired");let n=H.concat(this._pendingInflateData);this._pendingInflateData.length=0,e(n)})}dispose(){this._recordedInflateBytes.length=0,this._pendingInflateData.length=0;try{this._zlibInflate.close()}catch{}super.dispose()}},RD=class extends N{constructor(e,n){super();this._tracer=e;this._onError=this._register(new T);this.onError=this._onError.event;this._pendingDeflateData=[];this._zlibDeflate=n3({windowBits:15}),this._zlibDeflate.on("error",o=>{this._tracer.traceSocketEvent("zlibDeflateError",{message:o?.message,code:o?.code}),this._onError.fire(o)}),this._zlibDeflate.on("data",o=>{this._tracer.traceSocketEvent("zlibDeflateData",o),this._pendingDeflateData.push(H.wrap(o))})}write(e){this._tracer.traceSocketEvent("zlibDeflateWrite",e.buffer),this._zlibDeflate.write(e.buffer)}flush(e){this._zlibDeflate.flush(2,()=>{this._tracer.traceSocketEvent("zlibDeflateFlushFired");let n=H.concat(this._pendingDeflateData);this._pendingDeflateData.length=0,n=n.slice(0,n.byteLength-4),e(n)})}dispose(){this._pendingDeflateData.length=0;try{this._zlibDeflate.close()}catch{}super.dispose()}},yW=process.env.XDG_RUNTIME_DIR,i3={2:107,1:103};function bW(){let i=_e();if(process.platform==="win32")return`\\\\.\\pipe\\vscode-ipc-${i}-sock`;let t=process.platform!=="darwin"&&yW?yW:t3(),e=i3[pv],n=i;if(typeof e=="number"){let o=Math.max(0,e-1-Be(t,"vscode-ipc-.sock").length);o<n.length&&(n=n.slice(0,o))}return Be(t,`vscode-ipc-${n}.sock`)}function ft(i){if(!i||typeof i!="object"||i instanceof RegExp)return i;let t=Array.isArray(i)?[]:{};return Object.entries(i).forEach(([e,n])=>{t[e]=n&&typeof n=="object"?ft(n):n}),t}function Ov(i){if(!i||typeof i!="object")return i;let t=[i];for(;t.length>0;){let e=t.shift();Object.freeze(e);for(let n in e)if(IW.call(e,n)){let o=e[n];typeof o=="object"&&!Object.isFrozen(o)&&!PH(o)&&t.push(o)}}return i}var IW=Object.prototype.hasOwnProperty;function Mi(i,t){return MD(i,t,new Set)}function MD(i,t,e){if(Wt(i))return i;let n=t(i);if(typeof n<"u")return n;if(Array.isArray(i)){let o=[];for(let r of i)o.push(MD(r,t,e));return o}if(st(i)){if(e.has(i))throw new Error("Cannot clone recursive data-structure");e.add(i);let o={};for(let r in i)IW.call(i,r)&&(o[r]=MD(i[r],t,e));return e.delete(i),o}return i}function or(i,t,e=!0){return st(i)?(st(t)&&Object.keys(t).forEach(n=>{n in i?e&&(st(i[n])&&st(t[n])?or(i[n],t[n],e):i[n]=t[n]):i[n]=t[n]}),i):t}function Et(i,t){if(i===t)return!0;if(i==null||t===null||t===void 0||typeof i!=typeof t||typeof i!="object"||Array.isArray(i)!==Array.isArray(t))return!1;let e,n;if(Array.isArray(i)){if(i.length!==t.length)return!1;for(e=0;e<i.length;e++)if(!Et(i[e],t[e]))return!1}else{let o=[];for(n in i)o.push(n);o.sort();let r=[];for(n in t)r.push(n);if(r.sort(),!Et(o,r))return!1;for(e=0;e<o.length;e++)if(!Et(i[o[e]],t[o[e]]))return!1}return!0}function Jp(i){let t=new Set;return JSON.stringify(i,(e,n)=>{if(st(n)||Array.isArray(n)){if(t.has(n))return"[Circular]";t.add(n)}return typeof n=="bigint"?`[BigInt ${n.toString()}]`:n})}function LD(i,t){let e=t.toLowerCase(),n=Object.keys(i).find(o=>o.toLowerCase()===e);return n?i[n]:i[t]}function OD(i,t){let e=Object.create(null);for(let[n,o]of Object.entries(i))t(n,o)&&(e[n]=o);return e}var xW=new class{constructor(){this._zoomLevel=0;this._onDidChangeZoomLevel=new T;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(i){i=Math.min(Math.max(-5,i),20),this._zoomLevel!==i&&(this._zoomLevel=i,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var s3=St?1.5:1.35,ND=8,UD=class i{constructor(t){this._bareFontInfoBrand=void 0;this.pixelRatio=t.pixelRatio,this.fontFamily=String(t.fontFamily),this.fontWeight=String(t.fontWeight),this.fontSize=t.fontSize,this.fontFeatureSettings=t.fontFeatureSettings,this.fontVariationSettings=t.fontVariationSettings,this.lineHeight=t.lineHeight|0,this.letterSpacing=t.letterSpacing}static _create(t,e,n,o,r,s,a,l,d){s===0?s=s3*n:s<ND&&(s=s*n),s=Math.round(s),s<ND&&(s=ND);let c=1+(d?0:xW.getZoomLevel()*.1);return n*=c,s*=c,r===HD&&(e==="normal"||e==="bold"?r=FD:(r=`'wght' ${parseInt(e,10)}`,e="normal")),new i({pixelRatio:l,fontFamily:t,fontWeight:e,fontSize:n,fontFeatureSettings:o,fontVariationSettings:r,lineHeight:s,letterSpacing:a})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){let t=Li.fontFamily,e=i._wrapInQuotes(this.fontFamily);return t&&this.fontFamily!==t?`${e}, ${t}`:e}static _wrapInQuotes(t){return/[,"']/.test(t)?t:/[+ ]/.test(t)?`"${t}"`:t}},a3=2,Jx=class extends UD{constructor(e,n){super(e);this._editorStylingBrand=void 0;this.version=a3;this.isTrusted=n,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.fontVariationSettings===e.fontVariationSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}},FD="normal",HD="translate",l3="Consolas, 'Courier New', monospace",d3="Menlo, Monaco, 'Courier New', monospace",c3="'Droid Sans Mono', monospace",Li={fontFamily:St?d3:Te?l3:c3,fontWeight:"normal",fontSize:St?12:14,lineHeight:0,letterSpacing:0};var WD={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var VD="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function u3(i=""){let t="(-?\\d*\\.\\d\\w*)|([^";for(let e of VD)i.indexOf(e)>=0||(t+="\\"+e);return t+="\\s]+)",new RegExp(t,"g")}var p3=u3();function BD(i){let t=p3;if(i&&i instanceof RegExp)if(i.global)t=i;else{let e="g";i.ignoreCase&&(e+="i"),i.multiline&&(e+="m"),i.unicode&&(e+="u"),t=new RegExp(i.source,e)}return t.lastIndex=0,t}var SW=new mo;SW.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function $D(i,t,e,n,o){if(t=BD(t),o||(o=Mt.first(SW)),e.length>o.maxLen){let d=i-o.maxLen/2;return d<0?d=0:n+=d,e=e.substring(d,i+o.maxLen/2),$D(i,t,e,n,o)}let r=Date.now(),s=i-1-n,a=-1,l=null;for(let d=1;!(Date.now()-r>=o.timeBudget);d++){let c=s-o.windowSize*d;t.lastIndex=Math.max(0,c);let u=m3(t,e,s,a);if(!u&&l||(l=u,c<=0))break;a=c}if(l){let d={word:l[0],startColumn:n+1+l.index,endColumn:n+1+l.index+l[0].length};return t.lastIndex=0,d}return null}function m3(i,t,e,n){let o;for(;o=i.exec(t);){let r=o.index||0;if(r<=e&&i.lastIndex>=e)return o;if(n>0&&r>n)return null}return null}function zD(...i){switch(i.length){case 1:return p(2818,null,i[0]);case 2:return p(2819,null,i[0],i[1]);case 3:return p(2820,null,i[0],i[1],i[2]);default:return}}var g3=p(2817,null),f3=p(2816,null),td=class i{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(t){switch(t.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return t.isTripleEq?"===":"==";case 4:return t.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">";case 8:return">=";case 9:return"=~";case 10:return t.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 t.lexeme;case 18:return t.lexeme;case 19:return t.lexeme;case 20:return"EOF";default:throw Ap(`unhandled token type: ${JSON.stringify(t)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(t=>t.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(t){return this._input=t,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)){let e=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:e})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){let e=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:e})}else this._match(126)?this._addToken(9):this._error(zD("==","=~"));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(zD("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(zD("||"));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(t){return this._isAtEnd()||this._input.charCodeAt(this._current)!==t?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(t){this._tokens.push({type:t,offset:this._start})}_error(t){let e=this._start,n=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:n};this._errors.push({offset:e,lexeme:n,additionalInfo:t}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let t=this.stringRe.exec(this._input);if(t){this._current=this._start+t[0].length;let e=this._input.substring(this._start,this._current),n=i._keywords.get(e);n?this._addToken(n):this._tokens.push({type:17,lexeme:e,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(g3);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let t=this._current,e=!1,n=!1;for(;;){if(t>=this._input.length){this._current=t,this._error(f3);return}let r=this._input.charCodeAt(t);if(e)e=!1;else if(r===47&&!n){t++;break}else r===91?n=!0:r===92?e=!0:r===93&&(n=!1);t++}for(;t<this._input.length&&i._regexFlags.has(this._input.charCodeAt(t));)t++;this._current=t;let o=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:o,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}};var Oi;(o=>{o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function n(r){return r[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=n})(Oi||={});var Dn=A("instantiationService");function h3(i,t,e){t[Oi.DI_TARGET]===t?t[Oi.DI_DEPENDENCIES].push({id:i,index:e}):(t[Oi.DI_DEPENDENCIES]=[{id:i,index:e}],t[Oi.DI_TARGET]=t)}function A(i){if(Oi.serviceIds.has(i))return Oi.serviceIds.get(i);let t=function(e,n,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h3(t,e,o)};return t.toString=()=>i,Oi.serviceIds.set(i,t),t}var lo=new Map;lo.set("false",!1);lo.set("true",!0);lo.set("isMac",St);lo.set("isLinux",Xe);lo.set("isWindows",Te);lo.set("isWeb",ei);lo.set("isMacNative",St&&!ei);lo.set("isEdge",dx);lo.set("isFirefox",KH);lo.set("isChrome",mv);lo.set("isSafari",jH);var v3=Object.prototype.hasOwnProperty;var y3={regexParsingWithErrorRecovery:!0},b3=p(2797,null),I3=p(2798,null),x3=p(2800,null),CW=p(2796,null),S3=p(2803,null),C3=p(2804,null),T3=p(2801,null),E3=p(2802,null),Yx=class i{constructor(t=y3){this._config=t;this._scanner=new td;this._tokens=[];this._current=0;this._parsingErrors=[];this._flagsGYRe=/g|y/g}static{this._parseError=new Error}get lexingErrors(){return this._scanner.errors}get parsingErrors(){return this._parsingErrors}parse(t){if(t===""){this._parsingErrors.push({message:b3,offset:0,lexeme:"",additionalInfo:I3});return}this._tokens=this._scanner.reset(t).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let n=this._peek(),o=n.type===17?C3:void 0;throw this._parsingErrors.push({message:S3,offset:n.offset,lexeme:td.getLexeme(n),additionalInfo:o}),i._parseError}return e}catch(e){if(e!==i._parseError)throw e;return}}_expr(){return this._or()}_or(){let t=[this._and()];for(;this._matchOne(16);){let e=this._and();t.push(e)}return t.length===1?t[0]:lt.or(...t)}_and(){let t=[this._term()];for(;this._matchOne(15);){let e=this._term();t.push(e)}return t.length===1?t[0]:lt.and(...t)}_term(){if(this._matchOne(2)){let t=this._peek();switch(t.type){case 11:return this._advance(),Co.INSTANCE;case 12:return this._advance(),Vo.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,CW),e?.negate()}case 17:return this._advance(),$c.create(t.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",t)}}return this._primary()}_primary(){let t=this._peek();switch(t.type){case 11:return this._advance(),lt.true();case 12:return this._advance(),lt.false();case 0:{this._advance();let e=this._expr();return this._consume(1,CW),e}case 17:{let e=t.lexeme;if(this._advance(),this._matchOne(9)){let o=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),o.type!==10)throw this._errExpectedButGot("REGEX",o);let r=o.lexeme,s=r.lastIndexOf("/"),a=s===r.length-1?void 0:this._removeFlagsGY(r.substring(s+1)),l;try{l=new RegExp(r.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",o)}return Bv.create(e,l)}switch(o.type){case 10:case 19:{let r=[o.lexeme];this._advance();let s=this._peek(),a=0;for(let m=0;m<o.lexeme.length;m++)o.lexeme.charCodeAt(m)===40?a++:o.lexeme.charCodeAt(m)===41&&a--;for(;!this._isAtEnd()&&s.type!==15&&s.type!==16;){switch(s.type){case 0:a++;break;case 1:a--;break;case 10:case 18:for(let m=0;m<s.lexeme.length;m++)s.lexeme.charCodeAt(m)===40?a++:o.lexeme.charCodeAt(m)===41&&a--}if(a<0)break;r.push(td.getLexeme(s)),this._advance(),s=this._peek()}let l=r.join(""),d=l.lastIndexOf("/"),c=d===l.length-1?void 0:this._removeFlagsGY(l.substring(d+1)),u;try{u=new RegExp(l.substring(1,d),c)}catch{throw this._errExpectedButGot("REGEX",o)}return lt.regex(e,u)}case 18:{let r=o.lexeme;this._advance();let s=null;if(!fs(r)){let a=r.indexOf("/"),l=r.lastIndexOf("/");if(a!==l&&a>=0){let d=r.slice(a+1,l),c=r[l+1]==="i"?"i":"";try{s=new RegExp(d,c)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(s===null)throw this._errExpectedButGot("REGEX",o);return Bv.create(e,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,x3);let o=this._value();return lt.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return lt.equals(e,o);switch(o){case"true":return lt.has(e);case"false":return lt.not(e);default:return lt.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return lt.notEquals(e,o);switch(o){case"true":return lt.not(e);case"false":return lt.has(e);default:return lt.notEquals(e,o)}}case 5:return this._advance(),Wv.create(e,this._value());case 6:return this._advance(),Vv.create(e,this._value());case 7:return this._advance(),Yp.create(e,this._value());case 8:return this._advance(),Hv.create(e,this._value());case 13:return this._advance(),lt.in(e,this._value());default:return lt.has(e)}}case 20:throw this._parsingErrors.push({message:T3,offset:t.offset,lexeme:"",additionalInfo:E3}),i._parseError;default:throw this._errExpectedButGot(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let t=this._peek();switch(t.type){case 17:case 18:return this._advance(),t.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(t){return t.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(t){return this._check(t)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(t,e){if(this._check(t))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(t,e,n){let o=p(2799,null,t,td.getLexeme(e)),r=e.offset,s=td.getLexeme(e);return this._parsingErrors.push({message:o,offset:r,lexeme:s,additionalInfo:n}),i._parseError}_check(t){return this._peek().type===t}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},lt=class{static false(){return Co.INSTANCE}static true(){return Vo.INSTANCE}static has(t){return Bc.create(t)}static equals(t,e){return Uv.create(t,e)}static notEquals(t,e){return Fv.create(t,e)}static regex(t,e){return Bv.create(t,e)}static in(t,e){return Xx.create(t,e)}static notIn(t,e){return Zx.create(t,e)}static not(t){return $c.create(t)}static and(...t){return eS.create(t,null,!0)}static or(...t){return $v.create(t,null,!0)}static greater(t,e){return Yp.create(t,e)}static greaterEquals(t,e){return Hv.create(t,e)}static smaller(t,e){return Wv.create(t,e)}static smallerEquals(t,e){return Vv.create(t,e)}static{this._parser=new Yx({regexParsingWithErrorRecovery:!1})}static deserialize(t){return t==null?void 0:this._parser.parse(t)}};function EW(i){let t=new Yx({regexParsingWithErrorRecovery:!1});return i.map(e=>(t.parse(e),t.lexingErrors.length>0?t.lexingErrors.map(n=>({errorMessage:n.additionalInfo?p(2806,null,n.additionalInfo):p(2805,null),offset:n.offset,length:n.lexeme.length})):t.parsingErrors.length>0?t.parsingErrors.map(n=>({errorMessage:n.additionalInfo?`${n.message}. ${n.additionalInfo}`:n.message,offset:n.offset,length:n.lexeme.length})):[]))}function Nv(i,t){return i.cmp(t)}var Co=class i{constructor(){this.type=0}static{this.INSTANCE=new i}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!1}serialize(){return"false"}keys(){return[]}map(t){return this}negate(){return Vo.INSTANCE}},Vo=class i{constructor(){this.type=1}static{this.INSTANCE=new i}cmp(t){return this.type-t.type}equals(t){return t.type===this.type}substituteConstants(){return this}evaluate(t){return!0}serialize(){return"true"}keys(){return[]}map(t){return this}negate(){return Co.INSTANCE}},Bc=class i{constructor(t,e){this.key=t;this.negated=e;this.type=2}static create(t,e=null){let n=lo.get(t);return typeof n=="boolean"?n?Vo.INSTANCE:Co.INSTANCE:new i(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:kW(this.key,t.key)}equals(t){return t.type===this.type?this.key===t.key:!1}substituteConstants(){let t=lo.get(this.key);return typeof t=="boolean"?t?Vo.INSTANCE:Co.INSTANCE:this}evaluate(t){return!!t.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(t){return t.mapDefined(this.key)}negate(){return this.negated||(this.negated=$c.create(this.key,this)),this.negated}},Uv=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=4}static create(t,e,n=null){if(typeof e=="boolean")return e?Bc.create(t,n):$c.create(t,n);let o=lo.get(t);return typeof o=="boolean"?e===(o?"true":"false")?Vo.INSTANCE:Co.INSTANCE:new i(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){let t=lo.get(this.key);if(typeof t=="boolean"){let e=t?"true":"false";return this.value===e?Vo.INSTANCE:Co.INSTANCE}return this}evaluate(t){return t.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(t){return t.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Fv.create(this.key,this.value,this)),this.negated}},Xx=class i{constructor(t,e){this.key=t;this.valueKey=e;this.type=10;this.negated=null}static create(t,e){return new i(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.valueKey,t.key,t.valueKey)}equals(t){return t.type===this.type?this.key===t.key&&this.valueKey===t.valueKey:!1}substituteConstants(){return this}evaluate(t){let e=t.getValue(this.valueKey),n=t.getValue(this.key);if(Array.isArray(e)){if(e.includes(n))return!0;if(Te&&typeof n=="string"&&n.startsWith("file:///")){let o=n.toLowerCase();return e.some(r=>typeof r=="string"&&r.toLowerCase()===o)}return!1}if(typeof n=="string"&&typeof e=="object"&&e!==null){if(v3.call(e,n))return!0;if(Te&&n.startsWith("file:///")){let o=n.toLowerCase();return Object.keys(e).some(r=>r.toLowerCase()===o)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(t){return t.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Zx.create(this.key,this.valueKey)),this.negated}},Zx=class i{constructor(t,e){this.key=t;this.valueKey=e;this.type=11;this._negated=Xx.create(t,e)}static create(t,e){return new i(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:this._negated.cmp(t._negated)}equals(t){return t.type===this.type?this._negated.equals(t._negated):!1}substituteConstants(){return this}evaluate(t){return!this._negated.evaluate(t)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(t){return t.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Fv=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=5}static create(t,e,n=null){if(typeof e=="boolean")return e?$c.create(t,n):Bc.create(t,n);let o=lo.get(t);return typeof o=="boolean"?e===(o?"true":"false")?Co.INSTANCE:Vo.INSTANCE:new i(t,e,n)}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){let t=lo.get(this.key);if(typeof t=="boolean"){let e=t?"true":"false";return this.value===e?Co.INSTANCE:Vo.INSTANCE}return this}evaluate(t){return t.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(t){return t.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Uv.create(this.key,this.value,this)),this.negated}},$c=class i{constructor(t,e){this.key=t;this.negated=e;this.type=3}static create(t,e=null){let n=lo.get(t);return typeof n=="boolean"?n?Co.INSTANCE:Vo.INSTANCE:new i(t,e)}cmp(t){return t.type!==this.type?this.type-t.type:kW(this.key,t.key)}equals(t){return t.type===this.type?this.key===t.key:!1}substituteConstants(){let t=lo.get(this.key);return typeof t=="boolean"?t?Co.INSTANCE:Vo.INSTANCE:this}evaluate(t){return!t.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(t){return t.mapNot(this.key)}negate(){return this.negated||(this.negated=Bc.create(this.key,this)),this.negated}};function tS(i,t){if(typeof i=="string"){let e=parseFloat(i);isNaN(e)||(i=e)}return typeof i=="string"||typeof i=="number"?t(i):Co.INSTANCE}var Yp=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=12}static create(t,e,n=null){return tS(e,o=>new i(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(t){return t.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Vv.create(this.key,this.value,this)),this.negated}},Hv=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=13}static create(t,e,n=null){return tS(e,o=>new i(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(t){return t.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Wv.create(this.key,this.value,this)),this.negated}},Wv=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=14}static create(t,e,n=null){return tS(e,o=>new i(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(t){return t.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=Hv.create(this.key,this.value,this)),this.negated}},Vv=class i{constructor(t,e,n){this.key=t;this.value=e;this.negated=n;this.type=15}static create(t,e,n=null){return tS(e,o=>new i(t,o,n))}cmp(t){return t.type!==this.type?this.type-t.type:zc(this.key,this.value,t.key,t.value)}equals(t){return t.type===this.type?this.key===t.key&&this.value===t.value:!1}substituteConstants(){return this}evaluate(t){return typeof this.value=="string"?!1:parseFloat(t.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(t){return t.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Yp.create(this.key,this.value,this)),this.negated}},Bv=class i{constructor(t,e){this.key=t;this.regexp=e;this.type=7;this.negated=null}static create(t,e){return new i(t,e)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.key<t.key)return-1;if(this.key>t.key)return 1;let e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return e<n?-1:e>n?1:0}equals(t){if(t.type===this.type){let e=this.regexp?this.regexp.source:"",n=t.regexp?t.regexp.source:"";return this.key===t.key&&e===n}return!1}substituteConstants(){return this}evaluate(t){let e=t.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let t=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${t}`}keys(){return[this.key]}map(t){return t.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=qD.create(this)),this.negated}},qD=class i{constructor(t){this._actual=t;this.type=8}static create(t){return new i(t)}cmp(t){return t.type!==this.type?this.type-t.type:this._actual.cmp(t._actual)}equals(t){return t.type===this.type?this._actual.equals(t._actual):!1}substituteConstants(){return this}evaluate(t){return!this._actual.evaluate(t)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(t){return new i(this._actual.map(t))}negate(){return this._actual}};function wW(i){let t=null;for(let e=0,n=i.length;e<n;e++){let o=i[e].substituteConstants();if(i[e]!==o&&t===null){t=[];for(let r=0;r<e;r++)t[r]=i[r]}t!==null&&(t[e]=o)}return t===null?i:t}var eS=class i{constructor(t,e){this.expr=t;this.negated=e;this.type=6}static create(t,e,n){return i._normalizeArr(t,e,n)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){let o=Nv(this.expr[e],t.expr[e]);if(o!==0)return o}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){let t=wW(this.expr);return t===this.expr?this:i.create(t,this.negated,!1)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].evaluate(t))return!1;return!0}static _normalizeArr(t,e,n){let o=[],r=!1;for(let s of t)if(s){if(s.type===1){r=!0;continue}if(s.type===0)return Co.INSTANCE;if(s.type===6){o.push(...s.expr);continue}o.push(s)}if(o.length===0&&r)return Vo.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(Nv);for(let s=1;s<o.length;s++)o[s-1].equals(o[s])&&(o.splice(s,1),s--);if(o.length===1)return o[0];for(;o.length>1;){let s=o[o.length-1];if(s.type!==9)break;o.pop();let a=o.pop(),l=o.length===0,d=$v.create(s.expr.map(c=>i.create([c,a],null,n)),null,l);d&&(o.push(d),o.sort(Nv))}if(o.length===1)return o[0];if(n){for(let s=0;s<o.length;s++)for(let a=s+1;a<o.length;a++)if(o[s].negate().equals(o[a]))return Co.INSTANCE;if(o.length===1)return o[0]}return new i(o,e)}}serialize(){return this.expr.map(t=>t.serialize()).join(" && ")}keys(){let t=[];for(let e of this.expr)t.push(...e.keys());return t}map(t){return new i(this.expr.map(e=>e.map(t)),null)}negate(){if(!this.negated){let t=[];for(let e of this.expr)t.push(e.negate());this.negated=$v.create(t,this,!0)}return this.negated}},$v=class i{constructor(t,e){this.expr=t;this.negated=e;this.type=9}static create(t,e,n){return i._normalizeArr(t,e,n)}cmp(t){if(t.type!==this.type)return this.type-t.type;if(this.expr.length<t.expr.length)return-1;if(this.expr.length>t.expr.length)return 1;for(let e=0,n=this.expr.length;e<n;e++){let o=Nv(this.expr[e],t.expr[e]);if(o!==0)return o}return 0}equals(t){if(t.type===this.type){if(this.expr.length!==t.expr.length)return!1;for(let e=0,n=this.expr.length;e<n;e++)if(!this.expr[e].equals(t.expr[e]))return!1;return!0}return!1}substituteConstants(){let t=wW(this.expr);return t===this.expr?this:i.create(t,this.negated,!1)}evaluate(t){for(let e=0,n=this.expr.length;e<n;e++)if(this.expr[e].evaluate(t))return!0;return!1}static _normalizeArr(t,e,n){let o=[],r=!1;if(t){for(let s=0,a=t.length;s<a;s++){let l=t[s];if(l){if(l.type===0){r=!0;continue}if(l.type===1)return Vo.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&r)return Co.INSTANCE;o.sort(Nv)}if(o.length!==0){if(o.length===1)return o[0];for(let s=1;s<o.length;s++)o[s-1].equals(o[s])&&(o.splice(s,1),s--);if(o.length===1)return o[0];if(n){for(let s=0;s<o.length;s++)for(let a=s+1;a<o.length;a++)if(o[s].negate().equals(o[a]))return Vo.INSTANCE;if(o.length===1)return o[0]}return new i(o,e)}}serialize(){return this.expr.map(t=>t.serialize()).join(" || ")}keys(){let t=[];for(let e of this.expr)t.push(...e.keys());return t}map(t){return new i(this.expr.map(e=>e.map(t)),null)}negate(){if(!this.negated){let t=[];for(let e of this.expr)t.push(e.negate());for(;t.length>1;){let e=t.shift(),n=t.shift(),o=[];for(let r of TW(e))for(let s of TW(n))o.push(eS.create([r,s],null,!1));t.unshift(i.create(o,null,!1))}this.negated=i.create(t,this,!0)}return this.negated}},k=class i extends Bc{static{this._info=[]}static all(){return i._info.values()}constructor(t,e,n){super(t,null),this._defaultValue=e,typeof n=="object"?i._info.push({...n,key:t}):n!==!0&&i._info.push({key:t,description:n,type:e!=null?typeof e:void 0})}bindTo(t){return t.createKey(this.key,this._defaultValue)}getValue(t){return t.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(t){return Uv.create(this.key,t)}notEqualsTo(t){return Fv.create(this.key,t)}greater(t){return Yp.create(this.key,t)}},Ir=A("contextKeyService");function kW(i,t){return i<t?-1:i>t?1:0}function zc(i,t,e,n){return i<e?-1:i>e?1:t<n?-1:t>n?1:0}function TW(i){return i.type===9?i.expr:[i]}var kse=A("accessibilityService");var Pse=new k("accessibilityModeEnabled",!1);var w3=8;var KD=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},Ut=class{constructor(t,e,n,o){this.id=t,this.name=e,this.defaultValue=n,this.schema=o}applyUpdate(t,e){return nS(t,e)}compute(t,e,n){return n}},Xp=class{constructor(t,e){this.newValue=t;this.didChange=e}};function nS(i,t){if(typeof i!="object"||typeof t!="object"||!i||!t)return new Xp(t,i!==t);if(Array.isArray(i)||Array.isArray(t)){let n=Array.isArray(i)&&Array.isArray(t)&&dn(i,t);return new Xp(t,!n)}let e=!1;for(let n in t)if(t.hasOwnProperty(n)){let o=nS(i[n],t[n]);o.didChange&&(i[n]=o.newValue,e=!0)}return new Xp(i,e)}var bs=class{constructor(t,e){this.schema=void 0;this.id=t,this.name="_never_",this.defaultValue=e}applyUpdate(t,e){return nS(t,e)}validate(t){return this.defaultValue}},nd=class{constructor(t,e,n,o){this.id=t,this.name=e,this.defaultValue=n,this.schema=o}applyUpdate(t,e){return nS(t,e)}compute(t,e,n){return n}};function ce(i,t){return typeof i>"u"?t:i==="false"?!1:!!i}var Re=class extends nd{constructor(t,e,n,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=n),super(t,e,n,o)}validate(t){return ce(t,this.defaultValue)}};function k3(i,t,e,n){if(typeof i=="string"&&(i=parseInt(i,10)),typeof i!="number"||isNaN(i))return t;let o=i;return o=Math.max(e,o),o=Math.min(n,o),o|0}var dt=class i extends nd{static clampedInt(t,e,n,o){return k3(t,e,n,o)}constructor(t,e,n,o,r,s=void 0){typeof s<"u"&&(s.type="integer",s.default=n,s.minimum=o,s.maximum=r),super(t,e,n,s),this.minimum=o,this.maximum=r}validate(t){return i.clampedInt(t,this.defaultValue,this.minimum,this.maximum)}};var xr=class i extends nd{static clamp(t,e,n){return t<e?e:t>n?n:t}static float(t,e){return typeof t=="string"&&(t=parseFloat(t)),typeof t!="number"||isNaN(t)?e:t}constructor(t,e,n,o,r,s,a){typeof r<"u"&&(r.type="number",r.default=n,r.minimum=s,r.maximum=a),super(t,e,n,r),this.validationFn=o,this.minimum=s,this.maximum=a}validate(t){return this.validationFn(i.float(t,this.defaultValue))}},ho=class i extends nd{static string(t,e){return typeof t!="string"?e:t}constructor(t,e,n,o=void 0){typeof o<"u"&&(o.type="string",o.default=n),super(t,e,n,o)}validate(t){return i.string(t,this.defaultValue)}};function Nt(i,t,e,n){return typeof i!="string"?t:n&&i in n?n[i]:e.indexOf(i)===-1?t:i}var Ot=class extends nd{constructor(t,e,n,o,r=void 0){typeof r<"u"&&(r.type="string",r.enum=o.slice(0),r.default=n),super(t,e,n,r),this._allowedValues=o}validate(t){return Nt(t,this.defaultValue,this._allowedValues)}},Kc=class extends Ut{constructor(t,e,n,o,r,s,a=void 0){typeof a<"u"&&(a.type="string",a.enum=r,a.default=o),super(t,e,n,a),this._allowedValues=r,this._convert=s}validate(t){return typeof t!="string"?this.defaultValue:this._allowedValues.indexOf(t)===-1?this.defaultValue:this._convert(t)}};function P3(i){switch(i){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var jD=class extends Ut{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[p(329,null),p(331,null),p(330,null)],default:"auto",tags:["accessibility"],description:p(328,null)})}validate(t){switch(t){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(t,e,n){return n===0?t.accessibilitySupport:n}},GD=class extends Ut{constructor(){let t={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",t,{"editor.comments.insertSpace":{type:"boolean",default:t.insertSpace,description:p(359,null)},"editor.comments.ignoreEmptyLines":{type:"boolean",default:t.ignoreEmptyLines,description:p(358,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{insertSpace:ce(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:ce(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function _3(i){switch(i){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var NA=(s=>(s[s.Line=1]="Line",s[s.Block=2]="Block",s[s.Underline=3]="Underline",s[s.LineThin=4]="LineThin",s[s.BlockOutline=5]="BlockOutline",s[s.UnderlineThin=6]="UnderlineThin",s))(NA||{});function PW(i){switch(i){case"line":return 1;case"block":return 2;case"underline":return 3;case"line-thin":return 4;case"block-outline":return 5;case"underline-thin":return 6}}var QD=class extends bs{constructor(){super(162,"")}compute(t,e,n){let o=["monaco-editor"];return e.get(48)&&o.push(e.get(48)),t.extraEditorClassName&&o.push(t.extraEditorClassName),e.get(82)==="default"?o.push("mouse-default"):e.get(82)==="copy"&&o.push("mouse-copy"),e.get(127)&&o.push("showUnused"),e.get(157)&&o.push("showDeprecated"),o.join(" ")}},JD=class extends Re{constructor(){super(45,"emptySelectionClipboard",!0,{description:p(482,null)})}compute(t,e,n){return n&&t.emptySelectionClipboard}},YD=class extends Ut{constructor(){let t={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,closeOnResult:!1,history:"workspace",replaceHistory:"workspace"};super(50,"find",t,{"editor.find.cursorMoveOnType":{type:"boolean",default:t.cursorMoveOnType,description:p(495,null)},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:t.seedSearchStringFromSelection,enumDescriptions:[p(418,null),p(417,null),p(419,null)],description:p(501,null)},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:t.autoFindInSelection,enumDescriptions:[p(412,null),p(410,null),p(411,null)],description:p(493,null)},"editor.find.globalFindClipboard":{type:"boolean",default:t.globalFindClipboard,description:p(497,null),included:St},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:t.addExtraSpaceOnTop,description:p(492,null)},"editor.find.loop":{type:"boolean",default:t.loop,description:p(499,null)},"editor.find.closeOnResult":{type:"boolean",default:t.closeOnResult,description:p(494,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(413,null),p(414,null)],description:p(498,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(415,null),p(416,null)],description:p(500,null)},"editor.find.findOnType":{type:"boolean",default:t.findOnType,description:p(496,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{cursorMoveOnType:ce(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:ce(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":Nt(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":Nt(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:ce(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:ce(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:ce(e.loop,this.defaultValue.loop),closeOnResult:ce(e.closeOnResult,this.defaultValue.closeOnResult),history:Nt(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Nt(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},XD=class i extends Ut{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(60,"fontLigatures",i.OFF,{anyOf:[{type:"boolean",description:p(511,null)},{type:"string",description:p(510,null)}],description:p(512,null),default:!1})}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t==="false"||t.length===0?i.OFF:t==="true"?i.ON:t:t?i.ON:i.OFF}},ZD=class i extends Ut{static{this.OFF=FD}static{this.TRANSLATE=HD}constructor(){super(63,"fontVariations",i.OFF,{anyOf:[{type:"boolean",description:p(514,null)},{type:"string",description:p(515,null)}],description:p(516,null),default:!1})}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t==="false"?i.OFF:t==="true"?i.TRANSLATE:t:t?i.TRANSLATE:i.OFF}compute(t,e,n){return t.fontInfo.fontVariationSettings}},eA=class extends bs{constructor(){super(59,new Jx({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(t,e,n){return t.fontInfo}},tA=class extends bs{constructor(){super(161,1)}compute(t,e,n){return t.inputMode==="overtype"?e.get(92):e.get(34)}},nA=class extends bs{constructor(){super(170,!1)}compute(t,e){return t.editContextSupported&&e.get(44)}},oA=class extends bs{constructor(){super(172,!1)}compute(t,e){return t.accessibilitySupport===2?e.get(7):e.get(6)}},rA=class extends nd{constructor(){super(61,"fontSize",Li.fontSize,{type:"number",minimum:6,maximum:100,default:Li.fontSize,description:p(513,null)})}validate(t){let e=xr.float(t,this.defaultValue);return e===0?Li.fontSize:xr.clamp(e,6,100)}compute(t,e,n){return t.fontInfo.fontSize}},iA=class i extends Ut{static{this.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"]}static{this.MINIMUM_VALUE=1}static{this.MAXIMUM_VALUE=1e3}constructor(){super(62,"fontWeight",Li.fontWeight,{anyOf:[{type:"number",minimum:i.MINIMUM_VALUE,maximum:i.MAXIMUM_VALUE,errorMessage:p(518,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:i.SUGGESTION_VALUES}],default:Li.fontWeight,description:p(517,null)})}validate(t){return t==="normal"||t==="bold"?t:String(dt.clampedInt(t,Li.fontWeight,i.MINIMUM_VALUE,i.MAXIMUM_VALUE))}},sA=class extends Ut{constructor(){let t={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},e={type:"string",enum:["peek","gotoAndPeek","goto"],default:t.multiple,enumDescriptions:[p(423,null),p(422,null),p(421,null)]},n=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",t,{"editor.gotoLocation.multiple":{deprecationMessage:p(420,null)},"editor.gotoLocation.multipleDefinitions":{description:p(406,null),...e},"editor.gotoLocation.multipleTypeDefinitions":{description:p(409,null),...e},"editor.gotoLocation.multipleDeclarations":{description:p(405,null),...e},"editor.gotoLocation.multipleImplementations":{description:p(407,null),...e},"editor.gotoLocation.multipleReferences":{description:p(408,null),...e},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:t.alternativeDefinitionCommand,enum:n,description:p(336,null)},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:t.alternativeTypeDefinitionCommand,enum:n,description:p(339,null)},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:t.alternativeDeclarationCommand,enum:n,description:p(335,null)},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:t.alternativeImplementationCommand,enum:n,description:p(337,null)},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:t.alternativeReferenceCommand,enum:n,description:p(338,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{multiple:Nt(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:Nt(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:Nt(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:Nt(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:Nt(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:Nt(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:Nt(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:ho.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:ho.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:ho.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:ho.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:ho.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:ho.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},aA=class extends Ut{constructor(){let t={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",t,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:t.enabled,markdownEnumDescriptions:[p(527,null),p(526,null),p(528,null,St?"Command":"Control")],description:p(525,null),keywords:["hint","info","tooltip"]},"editor.hover.delay":{type:"number",default:t.delay,minimum:0,maximum:1e4,description:p(524,null)},"editor.hover.sticky":{type:"boolean",default:t.sticky,description:p(531,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:t.hidingDelay,markdownDescription:p(529,null)},"editor.hover.above":{type:"boolean",default:t.above,description:p(523,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:t.showLongLineWarning,description:p(530,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:Nt(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:dt.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:ce(e.sticky,this.defaultValue.sticky),hidingDelay:dt.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:ce(e.above,this.defaultValue.above),showLongLineWarning:ce(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var lA=class i extends bs{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(t,e,n){return i.computeLayout(e,{memory:t.memory,outerWidth:t.outerWidth,outerHeight:t.outerHeight,isDominatedByLongLines:t.isDominatedByLongLines,lineHeight:t.fontInfo.lineHeight,viewLineCount:t.viewLineCount,lineNumbersDigitCount:t.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:t.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:t.fontInfo.maxDigitWidth,pixelRatio:t.pixelRatio,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(t){let e=t.height/t.lineHeight,n=Math.floor(t.paddingTop/t.lineHeight),o=Math.floor(t.paddingBottom/t.lineHeight);t.scrollBeyondLastLine&&(o=Math.max(o,e-1));let r=(n+t.viewLineCount+o)/(t.pixelRatio*t.height),s=Math.floor(t.viewLineCount/r);return{typicalViewportLineCount:e,extraLinesBeforeFirstLine:n,extraLinesBeyondLastLine:o,desiredRatio:r,minimapLineCount:s}}static _computeMinimapLayout(t,e){let n=t.outerWidth,o=t.outerHeight,r=t.pixelRatio;if(!t.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(r*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let s=e.stableMinimapLayoutInput,a=s&&t.outerHeight===s.outerHeight&&t.lineHeight===s.lineHeight&&t.typicalHalfwidthCharacterWidth===s.typicalHalfwidthCharacterWidth&&t.pixelRatio===s.pixelRatio&&t.scrollBeyondLastLine===s.scrollBeyondLastLine&&t.paddingTop===s.paddingTop&&t.paddingBottom===s.paddingBottom&&t.minimap.enabled===s.minimap.enabled&&t.minimap.side===s.minimap.side&&t.minimap.size===s.minimap.size&&t.minimap.showSlider===s.minimap.showSlider&&t.minimap.renderCharacters===s.minimap.renderCharacters&&t.minimap.maxColumn===s.minimap.maxColumn&&t.minimap.scale===s.minimap.scale&&t.verticalScrollbarWidth===s.verticalScrollbarWidth&&t.isViewportWrapping===s.isViewportWrapping,l=t.lineHeight,d=t.typicalHalfwidthCharacterWidth,c=t.scrollBeyondLastLine,u=t.minimap.renderCharacters,m=r>=2?Math.round(t.minimap.scale*2):t.minimap.scale,g=t.minimap.maxColumn,h=t.minimap.size,f=t.minimap.side,I=t.verticalScrollbarWidth,x=t.viewLineCount,E=t.remainingWidth,w=t.isViewportWrapping,R=u?2:3,L=Math.floor(r*o),U=L/r,z=!1,Y=!1,j=R*m,Q=m/r,Z=1;if(h==="fill"||h==="fit"){let{typicalViewportLineCount:se,extraLinesBeforeFirstLine:X,extraLinesBeyondLastLine:ae,desiredRatio:be,minimapLineCount:yt}=i.computeContainedMinimapLineCount({viewLineCount:x,scrollBeyondLastLine:c,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,height:o,lineHeight:l,pixelRatio:r});if(x/yt>1)z=!0,Y=!0,m=1,j=1,Q=m/r;else{let He=!1,qt=m+1;if(h==="fit"){let Gt=Math.ceil((X+x+ae)*j);w&&a&&E<=e.stableFitRemainingWidth?(He=!0,qt=e.stableFitMaxMinimapScale):He=Gt>L}if(h==="fill"||He){z=!0;let Gt=m;j=Math.min(l*r,Math.max(1,Math.floor(1/be))),w&&a&&E<=e.stableFitRemainingWidth&&(qt=e.stableFitMaxMinimapScale),m=Math.min(qt,Math.max(1,Math.floor(j/R))),m>Gt&&(Z=Math.min(2,m/Gt)),Q=m/r/Z,L=Math.ceil(Math.max(se,X+x+ae)*j),w?(e.stableMinimapLayoutInput=t,e.stableFitRemainingWidth=E,e.stableFitMaxMinimapScale=m):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let me=Math.floor(g*Q),vt=Math.min(me,Math.max(0,Math.floor((E-I-2)*Q/(d+Q)))+w3),ut=Math.floor(r*vt),ie=ut/r;ut=Math.floor(ut*Z);let ee=u?1:2,ne=f==="left"?0:n-vt-I;return{renderMinimap:ee,minimapLeft:ne,minimapWidth:vt,minimapHeightIsEditorHeight:z,minimapIsSampling:Y,minimapScale:m,minimapLineHeight:j,minimapCanvasInnerWidth:ut,minimapCanvasInnerHeight:L,minimapCanvasOuterWidth:ie,minimapCanvasOuterHeight:U}}static computeLayout(t,e){let n=e.outerWidth|0,o=e.outerHeight|0,r=e.lineHeight|0,s=e.lineNumbersDigitCount|0,a=e.typicalHalfwidthCharacterWidth,l=e.maxDigitWidth,d=e.pixelRatio,c=e.viewLineCount,u=t.get(154),m=u==="inherit"?t.get(153):u,g=m==="inherit"?t.get(149):m,h=t.get(152),f=e.isDominatedByLongLines,I=t.get(66),x=t.get(76).renderType!==0,E=t.get(77),w=t.get(119),R=t.get(96),L=t.get(81),U=t.get(117),z=U.verticalScrollbarSize,Y=U.verticalHasArrows,j=U.arrowSize,Q=U.horizontalScrollbarSize,Z=t.get(52),me=t.get(126)!=="never",vt=t.get(74);Z&&me&&(vt+=16);let ut=0;if(x){let Lo=Math.max(s,E);ut=Math.round(Lo*l)}let ie=0;I&&(ie=r*e.glyphMarginDecorationLaneCount);let ee=0,ne=ee+ie,se=ne+ut,X=se+vt,ae=n-ie-ut-vt,be=!1,yt=!1,Qe=-1;t.get(2)===2&&m==="inherit"&&f?(be=!0,yt=!0):g==="on"||g==="bounded"?yt=!0:g==="wordWrapColumn"&&(Qe=h);let He=i._computeMinimapLayout({outerWidth:n,outerHeight:o,lineHeight:r,typicalHalfwidthCharacterWidth:a,pixelRatio:d,scrollBeyondLastLine:w,paddingTop:R.top,paddingBottom:R.bottom,minimap:L,verticalScrollbarWidth:z,viewLineCount:c,remainingWidth:ae,isViewportWrapping:yt},e.memory||new KD);He.renderMinimap!==0&&He.minimapLeft===0&&(ee+=He.minimapWidth,ne+=He.minimapWidth,se+=He.minimapWidth,X+=He.minimapWidth);let qt=ae-He.minimapWidth,Gt=Math.max(1,Math.floor((qt-z-2)/a)),It=Y?j:0;return yt&&(Qe=Math.max(1,Gt),g==="bounded"&&(Qe=Math.min(Qe,h))),{width:n,height:o,glyphMarginLeft:ee,glyphMarginWidth:ie,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:ne,lineNumbersWidth:ut,decorationsLeft:se,decorationsWidth:vt,contentLeft:X,contentWidth:qt,minimap:He,viewportColumn:Gt,isWordWrapMinified:be,isViewportWrapping:yt,wrappingColumn:Qe,verticalScrollbarWidth:z,horizontalScrollbarHeight:Q,overviewRuler:{top:It,width:z,height:o-2*It,right:0}}}},dA=class extends Ut{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[p(744,null),p(743,null)],type:"string",enum:["simple","advanced"],default:"simple",description:p(742,null)}})}validate(t){return Nt(t,"simple",["simple","advanced"])}compute(t,e,n){return e.get(2)===2?"advanced":n}};var cA=class extends Ut{constructor(){let t={enabled:"onCode"};super(73,"lightbulb",t,{"editor.lightbulb.enabled":{type:"string",enum:["off","onCode","on"],default:t.enabled,enumDescriptions:[p(444,null),p(446,null),p(445,null)],description:p(483,null)}})}validate(t){return!t||typeof t!="object"?this.defaultValue:{enabled:Nt(t.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},uA=class extends Ut{constructor(){let t={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",t,{"editor.stickyScroll.enabled":{type:"boolean",default:t.enabled,description:p(448,null)},"editor.stickyScroll.maxLineCount":{type:"number",default:t.maxLineCount,minimum:1,maximum:20,description:p(449,null)},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:t.defaultModel,description:p(447,null)},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:t.scrollWithEditor,description:p(450,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),maxLineCount:dt.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Nt(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:ce(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},pA=class extends Ut{constructor(){let t={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",t,{"editor.inlayHints.enabled":{type:"string",default:t.enabled,description:p(533,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[p(440,null),p(441,null,St?"Ctrl+Option":"Ctrl+Alt"),p(439,null,St?"Ctrl+Option":"Ctrl+Alt"),p(438,null)]},"editor.inlayHints.fontSize":{type:"number",default:t.fontSize,markdownDescription:p(535,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:t.fontFamily,markdownDescription:p(534,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:t.padding,description:p(537,null)},"editor.inlayHints.maximumLength":{type:"number",default:t.maximumLength,markdownDescription:p(536,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return typeof e.enabled=="boolean"&&(e.enabled=e.enabled?"on":"off"),{enabled:Nt(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:dt.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:ho.string(e.fontFamily,this.defaultValue.fontFamily),padding:ce(e.padding,this.defaultValue.padding),maximumLength:dt.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},mA=class extends Ut{constructor(){super(74,"lineDecorationsWidth",10)}validate(t){return typeof t=="string"&&/^\d+(\.\d+)?ch$/.test(t)?-parseFloat(t.substring(0,t.length-2)):dt.clampedInt(t,this.defaultValue,0,1e3)}compute(t,e,n){return n<0?dt.clampedInt(-n*t.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):n}},gA=class extends xr{constructor(){super(75,"lineHeight",Li.lineHeight,t=>xr.clamp(t,0,150),{markdownDescription:p(560,null)},0,150)}compute(t,e,n){return t.fontInfo.lineHeight}},fA=class extends Ut{constructor(){let t={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?<separator>-?)\\s*(?<label>.*)$",sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(81,"minimap",t,{"editor.minimap.enabled":{type:"boolean",default:t.enabled,description:p(573,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[p(571,null),p(570,null),p(572,null)],default:t.autohide,description:p(569,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[p(587,null),p(585,null),p(586,null)],default:t.size,description:p(584,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:t.side,description:p(583,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:t.showSlider,description:p(582,null)},"editor.minimap.scale":{type:"number",default:t.scale,minimum:1,maximum:3,enum:[1,2,3],description:p(577,null)},"editor.minimap.renderCharacters":{type:"boolean",default:t.renderCharacters,description:p(576,null)},"editor.minimap.maxColumn":{type:"number",default:t.maxColumn,description:p(575,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:t.showRegionSectionHeaders,description:p(581,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:t.showMarkSectionHeaders,description:p(580,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:t.markSectionHeaderRegex,description:p(574,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:t.sectionHeaderFontSize,description:p(578,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:t.sectionHeaderLetterSpacing,description:p(579,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t,n=this.defaultValue.markSectionHeaderRegex,o=e.markSectionHeaderRegex;if(typeof o=="string")try{new RegExp(o,"d"),n=o}catch{}return{enabled:ce(e.enabled,this.defaultValue.enabled),autohide:Nt(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Nt(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:Nt(e.side,this.defaultValue.side,["right","left"]),showSlider:Nt(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:ce(e.renderCharacters,this.defaultValue.renderCharacters),scale:dt.clampedInt(e.scale,1,1,3),maxColumn:dt.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:ce(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:ce(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:n,sectionHeaderFontSize:xr.clamp(xr.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:xr.clamp(xr.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function R3(i){return i==="ctrlCmd"?St?"metaKey":"ctrlKey":"altKey"}var hA=class extends Ut{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:p(612,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:p(611,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{top:dt.clampedInt(e.top,0,0,1e3),bottom:dt.clampedInt(e.bottom,0,0,1e3)}}},vA=class extends Ut{constructor(){let t={enabled:!0,cycle:!0};super(98,"parameterHints",t,{"editor.parameterHints.enabled":{type:"boolean",default:t.enabled,description:p(614,null)},"editor.parameterHints.cycle":{type:"boolean",default:t.cycle,description:p(613,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),cycle:ce(e.cycle,this.defaultValue.cycle)}}},yA=class extends bs{constructor(){super(163,1)}compute(t,e,n){return t.pixelRatio}},bA=class extends Ut{constructor(){super(100,"placeholder",void 0)}validate(t){return typeof t>"u"?this.defaultValue:typeof t=="string"?t:this.defaultValue}},IA=class extends Ut{constructor(){let t={other:"offWhenInlineCompletions",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[p(607,null),p(538,null),p(605,null),p(606,null)]}];super(102,"quickSuggestions",t,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[p(629,null),p(626,null),p(627,null),p(628,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:t.strings,description:p(625,null)},comments:{anyOf:e,default:t.comments,description:p(623,null)},other:{anyOf:e,default:t.other,description:p(624,null)}}}],default:t,markdownDescription:p(622,null,"`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=t}validate(t){if(typeof t=="boolean"){let d=t?"on":"off";return{comments:d,strings:d,other:d}}if(typeof t=="string"){let d=["on","inline","off","offWhenInlineCompletions"],c=Nt(t,this.defaultValue.other,d);return{comments:c,strings:c,other:c}}if(!t||typeof t!="object")return this.defaultValue;let{other:e,comments:n,strings:o}=t,r=["on","inline","off","offWhenInlineCompletions"],s,a,l;return typeof e=="boolean"?s=e?"on":"off":s=Nt(e,this.defaultValue.other,r),typeof n=="boolean"?a=n?"on":"off":a=Nt(n,this.defaultValue.comments,r),typeof o=="boolean"?l=o?"on":"off":l=Nt(o,this.defaultValue.strings,r),{other:s,comments:a,strings:l}}};var xA=class extends Ut{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[p(563,null),p(564,null),p(565,null),p(562,null)],default:"on",description:p(561,null)})}validate(t){let e=this.defaultValue.renderType,n=this.defaultValue.renderFn;return typeof t<"u"&&(typeof t=="function"?(e=4,n=t):t==="interval"?e=3:t==="relative"?e=2:t==="on"?e=1:e=0),{renderType:e,renderFn:n}}};var SA=class extends Ut{constructor(){let t=[],e={type:"number",description:p(646,null)};super(116,"rulers",t,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:p(645,null),format:"color-hex"}}}]},default:t,description:p(644,null)})}validate(t){if(Array.isArray(t)){let e=[];for(let n of t)if(typeof n=="number")e.push({column:dt.clampedInt(n,0,0,1e4),color:null});else if(n&&typeof n=="object"){let o=n;e.push({column:dt.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((n,o)=>n.column-o.column),e}return this.defaultValue}},CA=class extends Ut{constructor(){super(105,"readOnlyMessage",void 0)}validate(t){return!t||typeof t!="object"?this.defaultValue:t}};function _W(i,t){if(typeof i!="string")return t;switch(i){case"hidden":return 2;case"visible":return 3;default:return 1}}var TA=class extends Ut{constructor(){let t={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(117,"scrollbar",t,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(656,null),p(658,null),p(657,null)],default:"auto",description:p(655,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(649,null),p(651,null),p(650,null)],default:"auto",description:p(648,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:t.verticalScrollbarSize,description:p(659,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:t.horizontalScrollbarSize,description:p(652,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:t.scrollByPage,description:p(654,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:t.ignoreHorizontalScrollbarInContentHeight,description:p(653,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t,n=dt.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=dt.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:dt.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:_W(e.vertical,this.defaultValue.vertical),horizontal:_W(e.horizontal,this.defaultValue.horizontal),useShadows:ce(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:ce(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:ce(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:ce(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:ce(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:n,horizontalSliderSize:dt.clampedInt(e.horizontalSliderSize,n,0,1e3),verticalScrollbarSize:o,verticalSliderSize:dt.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:ce(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:ce(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},Ni="inUntrustedWorkspace",qc={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"},EA=class extends Ut{constructor(){let t={nonBasicASCII:Ni,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:Ni,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",t,{[qc.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Ni],default:t.nonBasicASCII,description:p(719,null)},[qc.invisibleCharacters]:{restricted:!0,type:"boolean",default:t.invisibleCharacters,description:p(718,null)},[qc.ambiguousCharacters]:{restricted:!0,type:"boolean",default:t.ambiguousCharacters,description:p(715,null)},[qc.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Ni],default:t.includeComments,description:p(716,null)},[qc.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Ni],default:t.includeStrings,description:p(717,null)},[qc.allowedCharacters]:{restricted:!0,type:"object",default:t.allowedCharacters,description:p(713,null),additionalProperties:{type:"boolean"}},[qc.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:t.allowedLocales,description:p(714,null)}})}applyUpdate(t,e){let n=!1;e.allowedCharacters&&t&&(Et(t.allowedCharacters,e.allowedCharacters)||(t={...t,allowedCharacters:e.allowedCharacters},n=!0)),e.allowedLocales&&t&&(Et(t.allowedLocales,e.allowedLocales)||(t={...t,allowedLocales:e.allowedLocales},n=!0));let o=super.applyUpdate(t,e);return n?new Xp(o.newValue,!0):o}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{nonBasicASCII:Zp(e.nonBasicASCII,Ni,[!0,!1,Ni]),invisibleCharacters:ce(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:ce(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:Zp(e.includeComments,Ni,[!0,!1,Ni]),includeStrings:Zp(e.includeStrings,Ni,[!0,!1,Ni]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(t,e){if(typeof t!="object"||!t)return e;let n={};for(let[o,r]of Object.entries(t))r===!0&&(n[o]=!0);return n}},wA=class extends Ut{constructor(){let t={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default",syntaxHighlightingEnabled:!0,minShowDelay:0,suppressInSnippetMode:!0,edits:{enabled:!0,showCollapsed:!1,renderSideBySide:"auto",allowCodeShifting:"always",showLongDistanceHint:!0,longDistanceHintContextLineCount:0},triggerCommandOnProviderChange:!1,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",t,{"editor.inlineSuggest.enabled":{type:"boolean",default:t.enabled,description:p(546,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:t.showToolbar,enum:["always","onHover","never"],enumDescriptions:[p(551,null),p(553,null),p(552,null)],description:p(550,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:t.syntaxHighlightingEnabled,description:p(557,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:t.suppressSuggestions,description:p(556,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:t.suppressInSnippetMode,description:p(555,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:p(548,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:t.experimental.suppressInlineSuggestions,tags:["experimental"],description:p(554,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:t.experimental.emptyResponseInformation,tags:["experimental"],description:p(545,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:t.triggerCommandOnProviderChange,tags:["experimental"],description:p(558,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:t.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:p(549,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:t.fontFamily,description:p(547,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:t.edits.allowCodeShifting,description:p(540,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:t.edits.showLongDistanceHint,description:p(544,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.longDistanceHintContextLineCount":{type:"number",default:t.edits.longDistanceHintContextLineCount,minimum:0,maximum:10,description:p(541,null),tags:["nextEditSuggestions","experimental"],experiment:{mode:"auto"}},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:t.edits.renderSideBySide,description:p(542,null),enum:["auto","never"],enumDescriptions:[p(442,null),p(443,null)],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:t.edits.showCollapsed,description:p(543,null),tags:["nextEditSuggestions"]}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),mode:Nt(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Nt(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:ce(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:ce(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:ho.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:ce(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:dt.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:ce(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:ce(e.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(e.experimental)}}_validateEdits(t){if(!t||typeof t!="object")return this.defaultValue.edits;let e=t;return{enabled:ce(e.enabled,this.defaultValue.edits.enabled),showCollapsed:ce(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Nt(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:ce(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),longDistanceHintContextLineCount:dt.clampedInt(e.longDistanceHintContextLineCount,this.defaultValue.edits.longDistanceHintContextLineCount,0,10),renderSideBySide:Nt(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(t){if(!t||typeof t!="object")return this.defaultValue.experimental;let e=t;return{suppressInlineSuggestions:ho.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Nt(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:ce(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},kA=class extends Ut{constructor(){let t={enabled:WD.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:WD.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",t,{"editor.bracketPairColorization.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(349,null,"`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:t.independentColorPoolPerBracketType,description:p(350,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:ce(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},PA=class extends Ut{constructor(){let t={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",t,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(427,null),p(425,null),p(426,null)],default:t.bracketPairs,description:p(424,null)},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(431,null),p(429,null),p(430,null)],default:t.bracketPairsHorizontal,description:p(428,null)},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:t.highlightActiveBracketPair,description:p(432,null)},"editor.guides.indentation":{type:"boolean",default:t.indentation,description:p(437,null)},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[p(436,null),p(434,null),p(435,null)],default:t.highlightActiveIndentation,description:p(433,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{bracketPairs:Zp(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:Zp(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:ce(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:ce(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:Zp(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function Zp(i,t,e){let n=e.indexOf(i);return n===-1?t:e[n]}var _A=class extends Ut{constructor(){let t={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,fitWidthToDetails:!1,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(134,"suggest",t,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[p(686,null),p(688,null)],default:t.insertMode,description:p(684,null)},"editor.suggest.filterGraceful":{type:"boolean",default:t.filterGraceful,description:p(683,null)},"editor.suggest.localityBonus":{type:"boolean",default:t.localityBonus,description:p(691,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:t.shareSuggestSelections,markdownDescription:p(694,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[p(685,null),p(687,null),p(690,null),p(689,null)],default:t.selectionMode,markdownDescription:p(693,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:t.snippetsPreventQuickSuggestions,description:p(698,null)},"editor.suggest.showIcons":{type:"boolean",default:t.showIcons,description:p(695,null)},"editor.suggest.showStatusBar":{type:"boolean",default:t.showStatusBar,description:p(697,null)},"editor.suggest.preview":{type:"boolean",default:t.preview,description:p(692,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:t.showInlineDetails,description:p(696,null)},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:p(375,null)},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:p(468,null)},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:p(464,null)},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:p(455,null)},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:p(457,null)},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:p(451,null)},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:p(461,null)},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:p(480,null)},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:p(452,null)},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:p(474,null)},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:p(465,null)},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:p(469,null)},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:p(471,null)},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:p(460,null)},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:p(470,null)},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:p(477,null)},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:p(479,null)},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:p(454,null)},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:p(459,null)},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:p(458,null)},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:p(467,null)},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:p(475,null)},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:p(453,null)},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:p(462,null)},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:p(472,null)},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:p(456,null)},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:p(463,null)},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:p(476,null)},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:p(473,null)},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:p(478,null)},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:p(466,null)}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{insertMode:Nt(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:ce(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:ce(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:ce(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:ce(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Nt(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:ce(e.showIcons,this.defaultValue.showIcons),showStatusBar:ce(e.showStatusBar,this.defaultValue.showStatusBar),preview:ce(e.preview,this.defaultValue.preview),previewMode:Nt(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:ce(e.showInlineDetails,this.defaultValue.showInlineDetails),fitWidthToDetails:ce(e.fitWidthToDetails,this.defaultValue.fitWidthToDetails),showMethods:ce(e.showMethods,this.defaultValue.showMethods),showFunctions:ce(e.showFunctions,this.defaultValue.showFunctions),showConstructors:ce(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:ce(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:ce(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:ce(e.showFields,this.defaultValue.showFields),showVariables:ce(e.showVariables,this.defaultValue.showVariables),showClasses:ce(e.showClasses,this.defaultValue.showClasses),showStructs:ce(e.showStructs,this.defaultValue.showStructs),showInterfaces:ce(e.showInterfaces,this.defaultValue.showInterfaces),showModules:ce(e.showModules,this.defaultValue.showModules),showProperties:ce(e.showProperties,this.defaultValue.showProperties),showEvents:ce(e.showEvents,this.defaultValue.showEvents),showOperators:ce(e.showOperators,this.defaultValue.showOperators),showUnits:ce(e.showUnits,this.defaultValue.showUnits),showValues:ce(e.showValues,this.defaultValue.showValues),showConstants:ce(e.showConstants,this.defaultValue.showConstants),showEnums:ce(e.showEnums,this.defaultValue.showEnums),showEnumMembers:ce(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:ce(e.showKeywords,this.defaultValue.showKeywords),showWords:ce(e.showWords,this.defaultValue.showWords),showColors:ce(e.showColors,this.defaultValue.showColors),showFiles:ce(e.showFiles,this.defaultValue.showFiles),showReferences:ce(e.showReferences,this.defaultValue.showReferences),showFolders:ce(e.showFolders,this.defaultValue.showFolders),showTypeParameters:ce(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:ce(e.showSnippets,this.defaultValue.showSnippets),showUsers:ce(e.showUsers,this.defaultValue.showUsers),showIssues:ce(e.showIssues,this.defaultValue.showIssues)}}},RA=class extends Ut{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:p(668,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:p(669,null),default:!0,type:"boolean"}})}validate(t){return!t||typeof t!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:ce(t.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:ce(t.selectSubwords,this.defaultValue.selectSubwords)}}},DA=class extends Ut{constructor(){let t=[];super(147,"wordSegmenterLocales",t,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:p(728,null),type:"array",items:{type:"string"},default:t})}validate(t){if(typeof t=="string"&&(t=[t]),Array.isArray(t)){let e=[];for(let n of t)if(typeof n=="string")try{Intl.Segmenter.supportedLocalesOf(n).length>0&&e.push(n)}catch{}return e}return this.defaultValue}};var AA=class extends Ut{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[p(740,null),p(741,null),p(739,null),p(738,null)],description:p(737,null),default:"same"}})}validate(t){switch(t){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(t,e,n){return e.get(2)===2?0:n}},MA=class extends bs{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(t,e,n){let o=e.get(165);return{isDominatedByLongLines:t.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},LA=class extends Ut{constructor(){let t={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",t,{"editor.dropIntoEditor.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(378,null)},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:p(379,null),enum:["afterDrop","never"],enumDescriptions:[p(380,null),p(381,null)],default:"afterDrop"}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),showDropSelector:Nt(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},OA=class extends Ut{constructor(){let t={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",t,{"editor.pasteAs.enabled":{type:"boolean",default:t.enabled,markdownDescription:p(615,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:p(616,null),enum:["afterPaste","never"],enumDescriptions:[p(617,null),p(618,null)],default:"afterPaste"}})}validate(t){if(!t||typeof t!="object")return this.defaultValue;let e=t;return{enabled:ce(e.enabled,this.defaultValue.enabled),showPasteSelector:Nt(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},D3=[];function W(i){return D3[i.id]=i,i}var Fse={acceptSuggestionOnCommitCharacter:W(new Re(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:p(324,null)})),acceptSuggestionOnEnter:W(new Ot(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",p(326,null),""],markdownDescription:p(325,null)})),accessibilitySupport:W(new jD),accessibilityPageSize:W(new dt(3,"accessibilityPageSize",500,1,1073741824,{description:p(327,null),tags:["accessibility"]})),allowOverflow:W(new Re(4,"allowOverflow",!0)),allowVariableLineHeights:W(new Re(5,"allowVariableLineHeights",!0,{description:p(334,null)})),allowVariableFonts:W(new Re(6,"allowVariableFonts",!0,{description:p(332,null)})),allowVariableFontsInAccessibilityMode:W(new Re(7,"allowVariableFontsInAccessibilityMode",!1,{description:p(333,null),tags:["accessibility"]})),ariaLabel:W(new ho(8,"ariaLabel",p(481,null))),ariaRequired:W(new Re(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:W(new Re(12,"screenReaderAnnounceInlineSuggestion",!0,{description:p(647,null),tags:["accessibility"]})),autoClosingBrackets:W(new Ot(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(384,null),p(383,null),""],description:p(340,null)})),autoClosingComments:W(new Ot(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(386,null),p(385,null),""],description:p(341,null)})),autoClosingDelete:W(new Ot(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",p(387,null),""],description:p(342,null)})),autoClosingOvertype:W(new Ot(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",p(388,null),""],description:p(343,null)})),autoClosingQuotes:W(new Ot(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(390,null),p(389,null),""],description:p(344,null)})),autoIndent:W(new Kc(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],P3,{enumDescriptions:[p(395,null),p(394,null),p(392,null),p(391,null),p(393,null)],description:p(345,null)})),autoIndentOnPaste:W(new Re(17,"autoIndentOnPaste",!1,{description:p(346,null)})),autoIndentOnPasteWithinString:W(new Re(18,"autoIndentOnPasteWithinString",!0,{description:p(347,null)})),automaticLayout:W(new Re(19,"automaticLayout",!1)),autoSurround:W(new Ot(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[p(397,null),p(398,null),p(396,null),""],description:p(348,null)})),bracketPairColorization:W(new kA),bracketPairGuides:W(new PA),stickyTabStops:W(new Re(132,"stickyTabStops",!1,{description:p(682,null)})),codeLens:W(new Re(23,"codeLens",!0,{description:p(351,null)})),codeLensFontFamily:W(new ho(24,"codeLensFontFamily","",{description:p(352,null)})),codeLensFontSize:W(new dt(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:p(353,null)})),colorDecorators:W(new Re(26,"colorDecorators",!0,{description:p(355,null)})),colorDecoratorActivatedOn:W(new Ot(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[p(400,null),p(401,null),p(399,null)],description:p(354,null)})),colorDecoratorsLimit:W(new dt(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:p(356,null)})),columnSelection:W(new Re(28,"columnSelection",!1,{description:p(357,null)})),comments:W(new GD),contextmenu:W(new Re(30,"contextmenu",!0)),copyWithSyntaxHighlighting:W(new Re(31,"copyWithSyntaxHighlighting",!0,{description:p(360,null)})),cursorBlinking:W(new Kc(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],_3,{description:p(361,null)})),cursorSmoothCaretAnimation:W(new Ot(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[p(365,null),p(364,null),p(366,null)],description:p(363,null)})),cursorStyle:W(new Kc(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],PW,{description:p(367,null)})),overtypeCursorStyle:W(new Kc(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],PW,{description:p(608,null)})),cursorSurroundingLines:W(new dt(35,"cursorSurroundingLines",0,0,1073741824,{description:p(368,null)})),cursorSurroundingLinesStyle:W(new Ot(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[p(371,null),p(370,null)],markdownDescription:p(369,null)})),cursorWidth:W(new dt(37,"cursorWidth",0,0,1073741824,{markdownDescription:p(372,null)})),cursorHeight:W(new dt(38,"cursorHeight",0,0,1073741824,{markdownDescription:p(362,null)})),disableLayerHinting:W(new Re(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:W(new Re(40,"disableMonospaceOptimizations",!1)),domReadOnly:W(new Re(41,"domReadOnly",!1)),doubleClickSelectsBlock:W(new Re(173,"doubleClickSelectsBlock",!0,{description:p(376,null)})),dragAndDrop:W(new Re(42,"dragAndDrop",!0,{description:p(377,null)})),emptySelectionClipboard:W(new JD),dropIntoEditor:W(new LA),editContext:W(new Re(44,"editContext",!0,{description:p(382,null),included:mv||dx||uv})),renderRichScreenReaderContent:W(new Re(107,"renderRichScreenReaderContent",!1,{markdownDescription:p(638,null)})),stickyScroll:W(new uA),experimentalGpuAcceleration:W(new Ot(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[p(485,null),p(486,null)],description:p(484,null)})),experimentalWhitespaceRendering:W(new Ot(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[p(490,null),p(488,null),p(489,null)],description:p(487,null)})),extraEditorClassName:W(new ho(48,"extraEditorClassName","")),fastScrollSensitivity:W(new xr(49,"fastScrollSensitivity",5,i=>i<=0?5:i,{markdownDescription:p(491,null)})),find:W(new YD),fixedOverflowWidgets:W(new Re(51,"fixedOverflowWidgets",!1)),folding:W(new Re(52,"folding",!0,{description:p(502,null)})),foldingStrategy:W(new Ot(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[p(507,null),p(508,null)],description:p(506,null)})),foldingHighlight:W(new Re(54,"foldingHighlight",!0,{description:p(503,null)})),foldingImportsByDefault:W(new Re(55,"foldingImportsByDefault",!1,{description:p(504,null)})),foldingMaximumRegions:W(new dt(56,"foldingMaximumRegions",5e3,10,65e3,{description:p(505,null)})),unfoldOnClickAfterEndOfLine:W(new Re(57,"unfoldOnClickAfterEndOfLine",!1,{description:p(712,null)})),fontFamily:W(new ho(58,"fontFamily",Li.fontFamily,{description:p(509,null)})),fontInfo:W(new eA),fontLigatures2:W(new XD),fontSize:W(new rA),fontWeight:W(new iA),fontVariations:W(new ZD),formatOnPaste:W(new Re(64,"formatOnPaste",!1,{description:p(519,null)})),formatOnType:W(new Re(65,"formatOnType",!1,{description:p(520,null)})),glyphMargin:W(new Re(66,"glyphMargin",!0,{description:p(521,null)})),gotoLocation:W(new sA),hideCursorInOverviewRuler:W(new Re(68,"hideCursorInOverviewRuler",!1,{description:p(522,null)})),hover:W(new aA),inDiffEditor:W(new Re(70,"inDiffEditor",!1)),inertialScroll:W(new Re(158,"inertialScroll",!1,{description:p(532,null)})),letterSpacing:W(new xr(72,"letterSpacing",Li.letterSpacing,i=>xr.clamp(i,-5,20),{description:p(559,null)})),lightbulb:W(new cA),lineDecorationsWidth:W(new mA),lineHeight:W(new gA),lineNumbers:W(new xA),lineNumbersMinChars:W(new dt(77,"lineNumbersMinChars",5,1,300)),linkedEditing:W(new Re(78,"linkedEditing",!1,{description:p(566,null)})),links:W(new Re(79,"links",!0,{description:p(567,null)})),matchBrackets:W(new Ot(80,"matchBrackets","always",["always","near","never"],{description:p(568,null)})),minimap:W(new fA),mouseStyle:W(new Ot(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:W(new xr(83,"mouseWheelScrollSensitivity",1,i=>i===0?1:i,{markdownDescription:p(589,null)})),mouseWheelZoom:W(new Re(84,"mouseWheelZoom",!1,{markdownDescription:St?p(591,null):p(590,null)})),multiCursorMergeOverlapping:W(new Re(85,"multiCursorMergeOverlapping",!0,{description:p(593,null)})),multiCursorModifier:W(new Kc(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],R3,{markdownEnumDescriptions:[p(596,null),p(595,null)],markdownDescription:p(594,null)})),mouseMiddleClickAction:W(new Ot(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:p(588,null)})),multiCursorPaste:W(new Ot(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[p(599,null),p(598,null)],markdownDescription:p(597,null)})),multiCursorLimit:W(new dt(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:p(592,null)})),occurrencesHighlight:W(new Ot(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[p(602,null),p(603,null),p(601,null)],markdownDescription:p(600,null)})),occurrencesHighlightDelay:W(new dt(91,"occurrencesHighlightDelay",0,0,2e3,{description:p(604,null),tags:["preview"]})),overtypeOnPaste:W(new Re(93,"overtypeOnPaste",!0,{description:p(609,null)})),overviewRulerBorder:W(new Re(94,"overviewRulerBorder",!0,{description:p(610,null)})),overviewRulerLanes:W(new dt(95,"overviewRulerLanes",3,0,3)),padding:W(new hA),pasteAs:W(new OA),parameterHints:W(new vA),peekWidgetDefaultFocus:W(new Ot(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[p(621,null),p(620,null)],description:p(619,null)})),placeholder:W(new bA),definitionLinkOpensInPeek:W(new Re(101,"definitionLinkOpensInPeek",!1,{description:p(374,null)})),quickSuggestions:W(new IA),quickSuggestionsDelay:W(new dt(103,"quickSuggestionsDelay",10,0,1073741824,{description:p(630,null),experiment:{mode:"auto"}})),readOnly:W(new Re(104,"readOnly",!1)),readOnlyMessage:W(new CA),renameOnType:W(new Re(106,"renameOnType",!1,{description:p(631,null),markdownDeprecationMessage:p(632,null)})),renderControlCharacters:W(new Re(108,"renderControlCharacters",!0,{description:p(633,null),restricted:!0})),renderFinalNewline:W(new Ot(109,"renderFinalNewline",Xe?"dimmed":"on",["off","on","dimmed"],{description:p(634,null)})),renderLineHighlight:W(new Ot(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",p(636,null)],description:p(635,null)})),renderLineHighlightOnlyWhenFocus:W(new Re(111,"renderLineHighlightOnlyWhenFocus",!1,{description:p(637,null)})),renderValidationDecorations:W(new Ot(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:W(new Ot(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",p(640,null),p(641,null),p(642,null),""],description:p(639,null)})),revealHorizontalRightPadding:W(new dt(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:W(new Re(115,"roundedSelection",!0,{description:p(643,null)})),rulers:W(new SA),scrollbar:W(new TA),scrollBeyondLastColumn:W(new dt(118,"scrollBeyondLastColumn",4,0,1073741824,{description:p(660,null)})),scrollBeyondLastLine:W(new Re(119,"scrollBeyondLastLine",!0,{description:p(661,null)})),scrollOnMiddleClick:W(new Re(171,"scrollOnMiddleClick",!1,{description:p(662,null)})),scrollPredominantAxis:W(new Re(120,"scrollPredominantAxis",!0,{description:p(663,null)})),selectionClipboard:W(new Re(121,"selectionClipboard",!0,{description:p(664,null),included:Xe})),selectionHighlight:W(new Re(122,"selectionHighlight",!0,{description:p(665,null)})),selectionHighlightMaxLength:W(new dt(123,"selectionHighlightMaxLength",200,0,1073741824,{description:p(666,null)})),selectionHighlightMultiline:W(new Re(124,"selectionHighlightMultiline",!1,{description:p(667,null)})),selectOnLineNumbers:W(new Re(125,"selectOnLineNumbers",!0)),showFoldingControls:W(new Ot(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[p(672,null),p(674,null),p(673,null)],description:p(671,null)})),showUnused:W(new Re(127,"showUnused",!0,{description:p(675,null)})),showDeprecated:W(new Re(157,"showDeprecated",!0,{description:p(670,null)})),inlayHints:W(new pA),snippetSuggestions:W(new Ot(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[p(681,null),p(678,null),p(679,null),p(680,null)],description:p(677,null)})),smartSelect:W(new RA),smoothScrolling:W(new Re(130,"smoothScrolling",!1,{description:p(676,null)})),stopRenderingLineAfter:W(new dt(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:W(new _A),inlineSuggest:W(new wA),inlineCompletionsAccessibilityVerbose:W(new Re(169,"inlineCompletionsAccessibilityVerbose",!1,{description:p(539,null)})),suggestFontSize:W(new dt(135,"suggestFontSize",0,0,1e3,{markdownDescription:p(699,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:W(new dt(136,"suggestLineHeight",0,0,1e3,{markdownDescription:p(700,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:W(new Re(137,"suggestOnTriggerCharacters",!0,{description:p(701,null)})),suggestSelection:W(new Ot(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[p(703,null),p(704,null),p(705,null)],description:p(702,null)})),tabCompletion:W(new Ot(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[p(708,null),p(707,null),p(709,null)],description:p(706,null)})),tabIndex:W(new dt(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:W(new Re(141,"trimWhitespaceOnDelete",!1,{description:p(711,null)})),unicodeHighlight:W(new EA),unusualLineTerminators:W(new Ot(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[p(721,null),p(722,null),p(723,null)],description:p(720,null)})),useShadowDOM:W(new Re(144,"useShadowDOM",!0)),useTabStops:W(new Re(145,"useTabStops",!0,{description:p(724,null)})),wordBreak:W(new Ot(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[p(727,null),p(726,null)],description:p(725,null)})),wordSegmenterLocales:W(new DA),wordSeparators:W(new ho(148,"wordSeparators",VD,{description:p(729,null)})),wordWrap:W(new Ot(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[p(732,null),p(733,null),p(734,null),p(731,null)],description:p(730,null)})),wordWrapBreakAfterCharacters:W(new ho(150,"wordWrapBreakAfterCharacters"," 	})]?|/&.,;\xA2\xB0\u2032\u2033\u2030\u2103\u3001\u3002\uFF61\uFF64\uFFE0\uFF0C\uFF0E\uFF1A\uFF1B\uFF1F\uFF01\uFF05\u30FB\uFF65\u309D\u309E\u30FD\u30FE\u30FC\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u3095\u3096\u31F0\u31F1\u31F2\u31F3\u31F4\u31F5\u31F6\u31F7\u31F8\u31F9\u31FA\u31FB\u31FC\u31FD\u31FE\u31FF\u3005\u303B\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF70\u201D\u3009\u300B\u300D\u300F\u3011\u3015\uFF09\uFF3D\uFF5D\uFF63")),wordWrapBreakBeforeCharacters:W(new ho(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:W(new dt(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:p(735,null)})),wordWrapOverride1:W(new Ot(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:W(new Ot(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:W(new Re(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:p(736,null)})),effectiveCursorStyle:W(new tA),editorClassName:W(new QD),defaultColorDecorators:W(new Ot(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[p(403,null),p(402,null),p(404,null)],description:p(373,null)})),pixelRatio:W(new yA),tabFocusMode:W(new Re(164,"tabFocusMode",!1,{markdownDescription:p(710,null)})),layoutInfo:W(new lA),wrappingInfo:W(new MA),wrappingIndent:W(new AA),wrappingStrategy:W(new dA),effectiveEditContextEnabled:W(new nA),effectiveAllowVariableFonts:W(new oA)};function RW(i,t){return i.dependencies?.[t]?.replace(/^[~^]/,"")}var Bo,UA=globalThis.vscode;if(typeof UA<"u"&&typeof UA.context<"u"){let i=UA.context.configuration();if(i)Bo=i.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){Bo=globalThis._VSCODE_PRODUCT_JSON;let i=globalThis._VSCODE_PACKAGE_JSON;if(Fo.VSCODE_DEV&&Object.assign(Bo,{nameShort:`${Bo.nameShort} Dev`,nameLong:`${Bo.nameLong} Dev`,dataFolderName:`${Bo.dataFolderName}-dev`,serverDataFolderName:Bo.serverDataFolderName?`${Bo.serverDataFolderName}-dev`:void 0}),Bo.version||Object.assign(Bo,{version:i.version}),!Bo.copilotVersions){let t=RW(i,"@github/copilot"),e=RW(i,"@github/copilot-sdk");t&&e&&Object.assign(Bo,{copilotVersions:{runtime:t,sdk:e}})}}else Bo={quality:"stable",extensionsGallery:{serviceUrl:"https://open-vsx.org/vscode/gallery",itemUrl:"https://open-vsx.org/vscode/item"},linkProtectionTrustedDomains:["https://open-vsx.org"],documentationUrl:"https://code.visualstudio.com/docs",requestFeatureUrl:"https://github.com/Microsoft/vscode/issues",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",commit:"a44adf7f53e00964ab890f9f8758a334f1fc15bc",date:"2026-09-03T05:06:41Z",nameShort:"Code - OSS",nameLong:"Code - OSS",applicationName:"code-oss",dataFolderName:".vscode-oss",sharedDataFolderName:".vscode-oss-shared",win32MutexName:"vscodeoss",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"code-server-oss",serverDataFolderName:".vscode-server-oss",tunnelApplicationName:"code-tunnel-oss",win32DirName:"Microsoft Code OSS",win32NameVersion:"Microsoft Code OSS",win32RegValueName:"CodeOSS",win32x64AppId:"{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",win32arm64AppId:"{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",win32x64UserAppId:"{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",win32arm64UserAppId:"{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",win32AppUserModelId:"Microsoft.CodeOSS",win32ShellNameShort:"C&ode - OSS",win32TunnelServiceMutex:"vscodeoss-tunnelservice",win32TunnelMutex:"vscodeoss-tunnel",darwinBundleIdentifier:"com.visualstudio.code.oss",darwinProfileUUID:"47827DD9-4734-49A0-AF80-7E19B11495CC",darwinProfilePayloadUUID:"CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",linuxIconName:"code-oss",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",nodejsArtifactFeed:"",electronArtifactFeed:"",urlProtocol:"code-oss",agentsTelemetryAppName:"agents",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",builtInExtensions:[{name:"ms-vscode.js-debug-companion",version:"1.1.3",sha256:"7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",repo:"https://github.com/microsoft/vscode-js-debug-companion",metadata:{id:"99cb0b7f-7354-4278-b8da-6cc79972169d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.js-debug",version:"1.117.0",sha256:"854eeb8a785b1f41ba2bd02d7ccd4fdbe10021b61473293973c7e96d036c7fb8",repo:"https://github.com/microsoft/vscode-js-debug",metadata:{id:"25629058-ddac-4e17-abba-74678e126c5d",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},{name:"ms-vscode.vscode-js-profile-table",version:"1.0.11",sha256:"a962a1e6a3baf74c9354b7f47fa96e6d6f0423a63bff55d7f976b6134a748ae9",repo:"https://github.com/microsoft/vscode-js-profile-visualizer",metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",optimizeUsageDocumentationUrl:"https://aka.ms/token-usage-tips",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"},microsoft:{id:"microsoft",name:"Microsoft"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"https://api.github.com/copilot_internal/user",entitlementSignupLimitedUrl:"https://api.github.com/copilot_internal/subscribe_limited_user",chatQuotaExceededContext:"github.copilot.chat.quotaExceeded",completionsQuotaExceededContext:"github.copilot.completions.quotaExceeded",walkthroughCommand:"github.copilot.open.walkthrough",completionsMenuCommand:"github.copilot.toggleStatusMenu",chatRefreshTokenCommand:"github.copilot.refreshToken",generateCommitMessageCommand:"github.copilot.git.generateCommitMessage",resolveMergeConflictsCommand:"github.copilot.git.resolveMergeConflicts",completionsAdvancedSetting:"github.copilot.advanced",completionsEnablementSetting:"github.copilot.enable",nextEditSuggestionsSetting:"github.copilot.nextEditSuggestions.enabled",tokenEntitlementUrl:"https://api.github.com/copilot_internal/v2/token",mcpRegistryDataUrl:"https://api.github.com/copilot/mcp_registry",managedSettingsUrl:"https://api.github.com/copilot_internal/managed_settings"},trustedExtensionAuthAccess:{github:["GitHub.copilot-chat"],"github-enterprise":["GitHub.copilot-chat"],microsoft:["vscode.github-authentication"]},onboardingKeymaps:[{id:"vscode",label:"VS Code",description:"Default keyboard mapping"},{id:"sublime",label:"Sublime Text",extensionId:"ms-vscode.sublime-keybindings",description:"Keyboard mapping from Sublime Text"},{id:"intellij",label:"IntelliJ / JetBrains",extensionId:"k--kato.intellij-idea-keybindings",description:"Keyboard mapping from IntelliJ IDEA"},{id:"vim",label:"Vim",extensionId:"vscodevim.vim",description:"Vim modal editing"},{id:"eclipse",label:"Eclipse",extensionId:"alphabotsec.vscode-eclipse-keybindings",description:"Keyboard mapping from Eclipse"},{id:"notepadpp",label:"Notepad++",extensionId:"ms-vscode.notepadplusplus-keybindings",description:"Keyboard mapping from Notepad++"}],onboardingThemes:[{id:"dark-2026",label:"Dark 2026",themeId:"Dark 2026",type:"dark"},{id:"hc-dark",label:"Dark High Contrast",themeId:"Default High Contrast",type:"hcDark"},{id:"solarized-dark",label:"Solarized Dark",themeId:"Solarized Dark",type:"dark"},{id:"light-2026",label:"Light 2026",themeId:"Light 2026",type:"light"},{id:"hc-light",label:"Light High Contrast",themeId:"Default High Contrast Light",type:"hcLight"},{id:"solarized-light",label:"Solarized Light",themeId:"Solarized Light",type:"light"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],sessionsWindowAllowedExtensions:[],voiceWsUrl:"wss://falcon-caas.mai.microsoft.com/voice-code/api/v1/realtime/voice",version:"1.136.1"},Object.keys(Bo).length===0&&Object.assign(Bo,{version:"1.104.0-dev",nameShort:"Code - OSS Dev",nameLong:"Code - OSS Dev",applicationName:"code-oss",dataFolderName:".vscode-oss",urlProtocol:"code-oss",reportIssueUrl:"https://github.com/microsoft/vscode/issues/new",licenseName:"MIT",licenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",serverLicenseUrl:"https://github.com/microsoft/vscode/blob/main/LICENSE.txt",defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GitHub Enterprise"}},providerScopes:[]}});var rr=Bo;var zv=class i{constructor(t){this._proxyIdentifierBrand=void 0;this.sid=t,this.nid=++i.count}static{this.count=0}},DW=[];function V(i){let t=new zv(i);return DW[t.nid]=t,t}function qv(i){return DW[i].sid}var Zt=class{constructor(t){this.value=t}};var FA=(o=>(o[o.None=0]="None",o[o.Process=1]="Process",o[o.Output=2]="Output",o[o.Hybrid=3]="Hybrid",o))(FA||{}),AW=class i{static{this._n=0}static mixin(t){return t._id=i._n++,t}};var F={MainThreadAuthentication:V("MainThreadAuthentication"),MainThreadBulkEdits:V("MainThreadBulkEdits"),MainThreadLanguageModels:V("MainThreadLanguageModels"),MainThreadEmbeddings:V("MainThreadEmbeddings"),MainThreadChatAgents2:V("MainThreadChatAgents2"),MainThreadCodeMapper:V("MainThreadCodeMapper"),MainThreadLanguageModelTools:V("MainThreadChatSkills"),MainThreadGitExtension:V("MainThreadGitExtension"),MainThreadClipboard:V("MainThreadClipboard"),MainThreadCommands:V("MainThreadCommands"),MainThreadComments:V("MainThreadComments"),MainThreadConfiguration:V("MainThreadConfiguration"),MainThreadConsole:V("MainThreadConsole"),MainThreadDebugService:V("MainThreadDebugService"),MainThreadDecorations:V("MainThreadDecorations"),MainThreadDiagnostics:V("MainThreadDiagnostics"),MainThreadDialogs:V("MainThreadDiaglogs"),MainThreadDocuments:V("MainThreadDocuments"),MainThreadDocumentContentProviders:V("MainThreadDocumentContentProviders"),MainThreadTextEditors:V("MainThreadTextEditors"),MainThreadEditorInsets:V("MainThreadEditorInsets"),MainThreadEditorTabs:V("MainThreadEditorTabs"),MainThreadErrors:V("MainThreadErrors"),MainThreadTreeViews:V("MainThreadTreeViews"),MainThreadDownloadService:V("MainThreadDownloadService"),MainThreadLanguageFeatures:V("MainThreadLanguageFeatures"),MainThreadLanguages:V("MainThreadLanguages"),MainThreadLogger:V("MainThreadLogger"),MainThreadMessageService:V("MainThreadMessageService"),MainThreadOutputService:V("MainThreadOutputService"),MainThreadProgress:V("MainThreadProgress"),MainThreadQuickDiff:V("MainThreadQuickDiff"),MainThreadAgentEditorComments:V("MainThreadAgentEditorComments"),MainThreadDocumentDiff:V("MainThreadDocumentDiff"),MainThreadQuickOpen:V("MainThreadQuickOpen"),MainThreadStatusBar:V("MainThreadStatusBar"),MainThreadSecretState:V("MainThreadSecretState"),MainThreadStorage:V("MainThreadStorage"),MainThreadSpeech:V("MainThreadSpeechProvider"),MainThreadTelemetry:V("MainThreadTelemetry"),MainThreadMeteredConnection:V("MainThreadMeteredConnection"),MainThreadTerminalService:V("MainThreadTerminalService"),MainThreadTerminalShellIntegration:V("MainThreadTerminalShellIntegration"),MainThreadWebviews:V("MainThreadWebviews"),MainThreadWebviewPanels:V("MainThreadWebviewPanels"),MainThreadWebviewViews:V("MainThreadWebviewViews"),MainThreadCustomEditors:V("MainThreadCustomEditors"),MainThreadUrls:V("MainThreadUrls"),MainThreadUriOpeners:V("MainThreadUriOpeners"),MainThreadProfileContentHandlers:V("MainThreadProfileContentHandlers"),MainThreadWorkspace:V("MainThreadWorkspace"),MainThreadFileSystem:V("MainThreadFileSystem"),MainThreadFileSystemEventService:V("MainThreadFileSystemEventService"),MainThreadExtensionService:V("MainThreadExtensionService"),MainThreadSCM:V("MainThreadSCM"),MainThreadSearch:V("MainThreadSearch"),MainThreadShare:V("MainThreadShare"),MainThreadTask:V("MainThreadTask"),MainThreadWindow:V("MainThreadWindow"),MainThreadPower:V("MainThreadPower"),MainThreadLabelService:V("MainThreadLabelService"),MainThreadNotebook:V("MainThreadNotebook"),MainThreadNotebookDocuments:V("MainThreadNotebookDocumentsShape"),MainThreadNotebookEditors:V("MainThreadNotebookEditorsShape"),MainThreadNotebookKernels:V("MainThreadNotebookKernels"),MainThreadNotebookRenderers:V("MainThreadNotebookRenderers"),MainThreadInteractive:V("MainThreadInteractive"),MainThreadTheming:V("MainThreadTheming"),MainThreadTunnelService:V("MainThreadTunnelService"),MainThreadManagedSockets:V("MainThreadManagedSockets"),MainThreadBrowserTunnelProxy:V("MainThreadBrowserTunnelProxy"),MainThreadTimeline:V("MainThreadTimeline"),MainThreadTesting:V("MainThreadTesting"),MainThreadLocalization:V("MainThreadLocalizationShape"),MainThreadMcp:V("MainThreadMcpShape"),MainThreadAiRelatedInformation:V("MainThreadAiRelatedInformation"),MainThreadAiEmbeddingVector:V("MainThreadAiEmbeddingVector"),MainThreadChatStatus:V("MainThreadChatStatus"),MainThreadChatQuota:V("MainThreadChatQuota"),MainThreadChatInputNotification:V("MainThreadChatInputNotification"),MainThreadAiSettingsSearch:V("MainThreadAiSettingsSearch"),MainThreadDataChannels:V("MainThreadDataChannels"),MainThreadChatSessions:V("MainThreadChatSessions"),MainThreadChatOutputRenderer:V("MainThreadChatOutputRenderer"),MainThreadChatContext:V("MainThreadChatContext"),MainThreadChatDebug:V("MainThreadChatDebug"),MainThreadBrowsers:V("MainThreadBrowsers")},ge={ExtHostCodeMapper:V("ExtHostCodeMapper"),ExtHostCommands:V("ExtHostCommands"),ExtHostConfiguration:V("ExtHostConfiguration"),ExtHostDiagnostics:V("ExtHostDiagnostics"),ExtHostDebugService:V("ExtHostDebugService"),ExtHostDecorations:V("ExtHostDecorations"),ExtHostDocumentsAndEditors:V("ExtHostDocumentsAndEditors"),ExtHostDocuments:V("ExtHostDocuments"),ExtHostDocumentContentProviders:V("ExtHostDocumentContentProviders"),ExtHostDocumentSaveParticipant:V("ExtHostDocumentSaveParticipant"),ExtHostEditors:V("ExtHostEditors"),ExtHostTreeViews:V("ExtHostTreeViews"),ExtHostFileSystem:V("ExtHostFileSystem"),ExtHostFileSystemInfo:V("ExtHostFileSystemInfo"),ExtHostFileSystemEventService:V("ExtHostFileSystemEventService"),ExtHostLanguages:V("ExtHostLanguages"),ExtHostLanguageFeatures:V("ExtHostLanguageFeatures"),ExtHostQuickOpen:V("ExtHostQuickOpen"),ExtHostQuickDiff:V("ExtHostQuickDiff"),ExtHostAgentEditorComments:V("ExtHostAgentEditorComments"),ExtHostStatusBar:V("ExtHostStatusBar"),ExtHostShare:V("ExtHostShare"),ExtHostExtensionService:V("ExtHostExtensionService"),ExtHostLogLevelServiceShape:V("ExtHostLogLevelServiceShape"),ExtHostTerminalService:V("ExtHostTerminalService"),ExtHostTerminalShellIntegration:V("ExtHostTerminalShellIntegration"),ExtHostSCM:V("ExtHostSCM"),ExtHostSearch:V("ExtHostSearch"),ExtHostTask:V("ExtHostTask"),ExtHostWorkspace:V("ExtHostWorkspace"),ExtHostWindow:V("ExtHostWindow"),ExtHostPower:V("ExtHostPower"),ExtHostWebviews:V("ExtHostWebviews"),ExtHostWebviewPanels:V("ExtHostWebviewPanels"),ExtHostCustomEditors:V("ExtHostCustomEditors"),ExtHostWebviewViews:V("ExtHostWebviewViews"),ExtHostEditorInsets:V("ExtHostEditorInsets"),ExtHostEditorTabs:V("ExtHostEditorTabs"),ExtHostProgress:V("ExtHostProgress"),ExtHostComments:V("ExtHostComments"),ExtHostSecretState:V("ExtHostSecretState"),ExtHostStorage:V("ExtHostStorage"),ExtHostUrls:V("ExtHostUrls"),ExtHostUriOpeners:V("ExtHostUriOpeners"),ExtHostChatOutputRenderer:V("ExtHostChatOutputRenderer"),ExtHostProfileContentHandlers:V("ExtHostProfileContentHandlers"),ExtHostOutputService:V("ExtHostOutputService"),ExtHostLabelService:V("ExtHostLabelService"),ExtHostNotebook:V("ExtHostNotebook"),ExtHostNotebookDocuments:V("ExtHostNotebookDocuments"),ExtHostNotebookEditors:V("ExtHostNotebookEditors"),ExtHostNotebookKernels:V("ExtHostNotebookKernels"),ExtHostNotebookRenderers:V("ExtHostNotebookRenderers"),ExtHostNotebookDocumentSaveParticipant:V("ExtHostNotebookDocumentSaveParticipant"),ExtHostInteractive:V("ExtHostInteractive"),ExtHostChatAgents2:V("ExtHostChatAgents"),ExtHostLanguageModelTools:V("ExtHostChatSkills"),ExtHostChatProvider:V("ExtHostChatProvider"),ExtHostChatContext:V("ExtHostChatContext"),ExtHostChatDebug:V("ExtHostChatDebug"),ExtHostSpeech:V("ExtHostSpeech"),ExtHostEmbeddings:V("ExtHostEmbeddings"),ExtHostAiRelatedInformation:V("ExtHostAiRelatedInformation"),ExtHostAiEmbeddingVector:V("ExtHostAiEmbeddingVector"),ExtHostAiSettingsSearch:V("ExtHostAiSettingsSearch"),ExtHostTheming:V("ExtHostTheming"),ExtHostTunnelService:V("ExtHostTunnelService"),ExtHostManagedSockets:V("ExtHostManagedSockets"),ExtHostBrowserTunnelProxy:V("ExtHostBrowserTunnelProxy"),ExtHostAuthentication:V("ExtHostAuthentication"),ExtHostTimeline:V("ExtHostTimeline"),ExtHostTesting:V("ExtHostTesting"),ExtHostTelemetry:V("ExtHostTelemetry"),ExtHostMeteredConnection:V("ExtHostMeteredConnection"),ExtHostLocalization:V("ExtHostLocalization"),ExtHostMcp:V("ExtHostMcp"),ExtHostDataChannels:V("ExtHostDataChannels"),ExtHostChatSessions:V("ExtHostChatSessions"),ExtHostChatQuota:V("ExtHostChatQuota"),ExtHostGitExtension:V("ExtHostGitExtension"),ExtHostBrowsers:V("ExtHostBrowsers")};function MW(i){return i.toJSON()}var oS=class{constructor(t){this._uriTransformer=t}transformIncoming(t){let e=this._uriTransformer.transformIncoming(t);return e===t?t:MW(y.from(e))}transformOutgoing(t){let e=this._uriTransformer.transformOutgoing(t);return e===t?t:MW(y.from(e))}transformOutgoingURI(t){let e=this._uriTransformer.transformOutgoing(t);return e===t?t:y.from(e)}transformOutgoingScheme(t){return this._uriTransformer.transformOutgoingScheme(t)}},LW=new class{transformIncoming(i){return i}transformOutgoing(i){return i}transformOutgoingURI(i){return i}transformOutgoingScheme(i){return i}};function HA(i,t,e,n){if(!i||n>200)return null;if(typeof i=="object"){if(i.$mid===1)return e?y.revive(t.transformIncoming(i)):t.transformIncoming(i);if(i instanceof H)return null;for(let o in i)if(Object.hasOwnProperty.call(i,o)){let r=HA(i[o],t,e,n+1);r!==null&&(i[o]=r)}}return null}function jc(i,t){let e=HA(i,t,!1,0);return e===null?i:e}function OW(i,t){let e=HA(i,t,!0,0);return e===null?i:e}var Kv=class{constructor(){this._actual=null,this._actualOk=null,this._actualErr=null,this._hasValue=!1,this._value=null,this._hasErr=!1,this._err=null}get[Symbol.toStringTag](){return this.toString()}_ensureActual(){return this._actual||(this._actual=new Promise((t,e)=>{this._actualOk=t,this._actualErr=e,this._hasValue&&this._actualOk(this._value),this._hasErr&&this._actualErr(this._err)})),this._actual}resolveOk(t){this._hasValue||this._hasErr||(this._hasValue=!0,this._value=t,this._actual&&this._actualOk(t))}resolveErr(t){this._hasValue||this._hasErr||(this._hasErr=!0,this._err=t,this._actual?this._actualErr(t):Ge(t))}then(t,e){return this._ensureActual().then(t,e)}catch(t){return this._ensureActual().then(void 0,t)}finally(t){return this._ensureActual().finally(t)}},rS=class extends Kv{constructor(){super(),this._hasErr=!0,this._err=new Oe}};function WA(i,t){try{return JSON.stringify(i,t)}catch{return"null"}}var BA="$$ref$$",A3={[BA]:-1};function NW(i,t=null,e=!1){let n=[];return{jsonString:(e?WA:JSON.stringify)(i,(r,s)=>{if(typeof s>"u")return A3;if(typeof s=="object"){if(s instanceof H){let a=n.push(s)-1;return{[BA]:a}}if(t)return t(r,s)}return s}),referencedBuffers:n}}function WW(i,t,e){return JSON.parse(i,(n,o)=>{if(o){let r=o[BA];if(typeof r=="number")return t[r];if(e&&o.$mid===1)return e.transformIncoming(o)}return o})}function UW(i,t){return JSON.stringify(i,t)}function M3(i){return i?(t,e)=>e&&e.$mid===1?i.transformOutgoing(e):e:null}var L3=Symbol.for("rpcProtocol"),O3=Symbol.for("rpcProxy"),FW,HW,iS=class i extends(HW=N,FW=L3,HW){constructor(e,n=null,o=null){super();this[FW]=!0;this._onDidChangeResponsiveState=this._register(new T);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._protocol=e,this._logger=n,this._uriTransformer=o,this._uriReplacer=M3(this._uriTransformer),this._isDisposed=!1,this._locals=[],this._proxies=[];for(let r=0,s=zv.count;r<s;r++)this._locals[r]=null,this._proxies[r]=null;this._lastMessageId=0,this._cancelInvokedHandlers=Object.create(null),this._pendingRPCReplies={},this._responsiveState=0,this._unacknowledgedCount=0,this._unresponsiveTime=0,this._asyncCheckUresponsive=this._register(new Pn(()=>this._checkUnresponsive(),1e3)),this._register(this._protocol.onMessage(r=>this._receiveOneMessage(r)))}static{this.UNRESPONSIVE_TIME=3*1e3}dispose(){this._isDisposed=!0,Object.keys(this._pendingRPCReplies).forEach(e=>{let n=this._pendingRPCReplies[e];delete this._pendingRPCReplies[e],n.resolveErr(Ia())}),super.dispose()}drain(){return typeof this._protocol.drain=="function"?this._protocol.drain():Promise.resolve()}_onWillSendRequest(e){this._unacknowledgedCount===0&&(this._unresponsiveTime=Date.now()+i.UNRESPONSIVE_TIME),this._unacknowledgedCount++,this._asyncCheckUresponsive.isScheduled()||this._asyncCheckUresponsive.schedule()}_onDidReceiveAcknowledge(e){this._unresponsiveTime=Date.now()+i.UNRESPONSIVE_TIME,this._unacknowledgedCount--,this._unacknowledgedCount===0&&this._asyncCheckUresponsive.cancel(),this._setResponsiveState(0)}_checkUnresponsive(){this._unacknowledgedCount!==0&&(Date.now()>this._unresponsiveTime?this._setResponsiveState(1):this._asyncCheckUresponsive.schedule())}_setResponsiveState(e){this._responsiveState!==e&&(this._responsiveState=e,this._onDidChangeResponsiveState.fire(this._responsiveState))}get responsiveState(){return this._responsiveState}transformIncomingURIs(e){return this._uriTransformer?jc(e,this._uriTransformer):e}getProxy(e){let{nid:n,sid:o}=e;return this._proxies[n]||(this._proxies[n]=this._createProxy(n,o)),this._proxies[n]}_createProxy(e,n){let o={get:(r,s)=>(typeof s=="string"&&!r[s]&&s.charCodeAt(0)===36&&(r[s]=(...a)=>this._remoteCall(e,s,a)),s===O3?n:r[s])};return new Proxy(Object.create(null),o)}set(e,n){return this._locals[e.nid]=n,n}assertRegistered(e){for(let n=0,o=e.length;n<o;n++){let r=e[n];if(!this._locals[r.nid])throw new Error(`Missing proxy instance ${r.sid}`)}}_receiveOneMessage(e){if(this._isDisposed)return;let n=e.byteLength,o=Tn.read(e,0),r=o.readUInt8(),s=o.readUInt32();switch(r){case 1:case 2:{let{rpcId:a,method:l,args:d}=Sr.deserializeRequestJSONArgs(o);this._uriTransformer&&(d=jc(d,this._uriTransformer)),this._receiveRequest(n,s,a,l,d,r===2);break}case 3:case 4:{let{rpcId:a,method:l,args:d}=Sr.deserializeRequestMixedArgs(o);this._uriTransformer&&(d=jc(d,this._uriTransformer)),this._receiveRequest(n,s,a,l,d,r===4);break}case 5:{this._logger?.logIncoming(n,s,0,"ack"),this._onDidReceiveAcknowledge(s);break}case 6:{this._receiveCancel(n,s);break}case 7:{this._receiveReply(n,s,void 0);break}case 9:{let a=Sr.deserializeReplyOKJSON(o);this._uriTransformer&&(a=jc(a,this._uriTransformer)),this._receiveReply(n,s,a);break}case 10:{let a=Sr.deserializeReplyOKJSONWithBuffers(o,this._uriTransformer);this._receiveReply(n,s,a);break}case 8:{let a=Sr.deserializeReplyOKVSBuffer(o);this._receiveReply(n,s,a);break}case 11:{let a=Sr.deserializeReplyErrError(o);this._uriTransformer&&(a=jc(a,this._uriTransformer)),this._receiveReplyErr(n,s,a);break}case 12:{this._receiveReplyErr(n,s,void 0);break}default:console.error("received unexpected message"),console.error(e)}}_receiveRequest(e,n,o,r,s,a){this._logger?.logIncoming(e,n,1,`receiveRequest ${qv(o)}.${r}(`,s);let l=String(n),d,c;if(a){let m=new Ee;s.push(m.token),d=this._invokeHandler(o,r,s),c=()=>m.cancel()}else d=this._invokeHandler(o,r,s);c&&(this._cancelInvokedHandlers[l]=c);let u=Sr.serializeAcknowledged(n);this._logger?.logOutgoing(u.byteLength,n,1,"ack"),this._protocol.send(u),d.then(m=>{delete this._cancelInvokedHandlers[l];let g=Sr.serializeReplyOK(n,m,this._uriReplacer);this._logger?.logOutgoing(g.byteLength,n,1,"reply:",m),this._protocol.send(g)},m=>{delete this._cancelInvokedHandlers[l];let g=Sr.serializeReplyErr(n,m);this._logger?.logOutgoing(g.byteLength,n,1,"replyErr:",m),this._protocol.send(g)})}_receiveCancel(e,n){this._logger?.logIncoming(e,n,1,"receiveCancel");let o=String(n),r=this._cancelInvokedHandlers[o];delete this._cancelInvokedHandlers[o],r?.()}_receiveReply(e,n,o){this._logger?.logIncoming(e,n,0,"receiveReply:",o);let r=String(n);if(!this._pendingRPCReplies.hasOwnProperty(r))return;let s=this._pendingRPCReplies[r];delete this._pendingRPCReplies[r],s.resolveOk(o)}_receiveReplyErr(e,n,o){this._logger?.logIncoming(e,n,0,"receiveReplyErr:",o);let r=String(n);if(!this._pendingRPCReplies.hasOwnProperty(r))return;let s=this._pendingRPCReplies[r];delete this._pendingRPCReplies[r];let a;o&&(o.$isError?(a=new Error,a.name=o.name,a.message=o.message,a.stack=o.stack):a=o),s.resolveErr(a)}_invokeHandler(e,n,o){try{return Promise.resolve(this._doInvokeHandler(e,n,o))}catch(r){return Promise.reject(r)}}_doInvokeHandler(e,n,o){let r=this._locals[e];if(!r)throw new Error("Unknown actor "+qv(e));let s=r[n];if(typeof s!="function")throw new Error("Unknown method "+n+" on actor "+qv(e));return s.apply(r,o)}_remoteCall(e,n,o){if(this._isDisposed)return new rS;let r=null;if(o.length>0&&pe.isCancellationToken(o[o.length-1])&&(r=o.pop()),r&&r.isCancellationRequested)return Promise.reject(Ia());let s=Sr.serializeRequestArguments(o,this._uriReplacer),a=++this._lastMessageId,l=String(a),d=new Kv,c=new $;r&&c.add(r.onCancellationRequested(()=>{let m=Sr.serializeCancel(a);this._logger?.logOutgoing(m.byteLength,a,0,"cancel"),this._protocol.send(m)})),this._pendingRPCReplies[l]=new VA(d,c),this._onWillSendRequest(a);let u=Sr.serializeRequest(a,e,n,s,!!r);return this._logger?.logOutgoing(u.byteLength,a,0,`request: ${qv(e)}.${n}(`,o),this._protocol.send(u),d}},VA=class{constructor(t,e){this._promise=t;this._disposable=e}resolveOk(t){this._promise.resolveOk(t),this._disposable.dispose()}resolveErr(t){this._promise.resolveErr(t),this._disposable.dispose()}},Tn=class i{static alloc(t,e,n){let o=new i(H.alloc(n+1+4),0);return o.writeUInt8(t),o.writeUInt32(e),o}static read(t,e){return new i(t,e)}get buffer(){return this._buff}constructor(t,e){this._buff=t,this._offset=e}static sizeUInt8(){return 1}static{this.sizeUInt32=4}writeUInt8(t){this._buff.writeUInt8(t,this._offset),this._offset+=1}readUInt8(){let t=this._buff.readUInt8(this._offset);return this._offset+=1,t}writeUInt32(t){this._buff.writeUInt32BE(t,this._offset),this._offset+=4}readUInt32(){let t=this._buff.readUInt32BE(this._offset);return this._offset+=4,t}static sizeShortString(t){return 1+t.byteLength}writeShortString(t){this._buff.writeUInt8(t.byteLength,this._offset),this._offset+=1,this._buff.set(t,this._offset),this._offset+=t.byteLength}readShortString(){let t=this._buff.readUInt8(this._offset);this._offset+=1;let n=this._buff.slice(this._offset,this._offset+t).toString();return this._offset+=t,n}static sizeLongString(t){return 4+t.byteLength}writeLongString(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}readLongString(){let t=this._buff.readUInt32BE(this._offset);this._offset+=4;let n=this._buff.slice(this._offset,this._offset+t).toString();return this._offset+=t,n}writeBuffer(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}static sizeVSBuffer(t){return 4+t.byteLength}writeVSBuffer(t){this._buff.writeUInt32BE(t.byteLength,this._offset),this._offset+=4,this._buff.set(t,this._offset),this._offset+=t.byteLength}readVSBuffer(){let t=this._buff.readUInt32BE(this._offset);this._offset+=4;let e=this._buff.slice(this._offset,this._offset+t);return this._offset+=t,e}static sizeMixedArray(t){let e=0;e+=1;for(let n=0,o=t.length;n<o;n++){let r=t[n];switch(e+=1,r.type){case 1:e+=this.sizeLongString(r.value);break;case 2:e+=this.sizeVSBuffer(r.value);break;case 3:e+=this.sizeUInt32,e+=this.sizeLongString(r.value);for(let s=0;s<r.buffers.length;++s)e+=this.sizeVSBuffer(r.buffers[s]);break;case 4:break}}return e}writeMixedArray(t){this._buff.writeUInt8(t.length,this._offset),this._offset+=1;for(let e=0,n=t.length;e<n;e++){let o=t[e];switch(o.type){case 1:this.writeUInt8(1),this.writeLongString(o.value);break;case 2:this.writeUInt8(2),this.writeVSBuffer(o.value);break;case 3:this.writeUInt8(3),this.writeUInt32(o.buffers.length),this.writeLongString(o.value);for(let r=0;r<o.buffers.length;++r)this.writeBuffer(o.buffers[r]);break;case 4:this.writeUInt8(4);break}}}readMixedArray(){let t=this._buff.readUInt8(this._offset);this._offset+=1;let e=new Array(t);for(let n=0;n<t;n++)switch(this.readUInt8()){case 1:e[n]=this.readLongString();break;case 2:e[n]=this.readVSBuffer();break;case 3:{let r=this.readUInt32(),s=this.readLongString(),a=[];for(let l=0;l<r;++l)a.push(this.readVSBuffer());e[n]=new Zt(WW(s,a,null));break}case 4:e[n]=void 0;break}return e}};var Sr=class{static _useMixedArgSerialization(t){for(let e=0,n=t.length;e<n;e++)if(t[e]instanceof H||t[e]instanceof Zt||typeof t[e]>"u")return!0;return!1}static serializeRequestArguments(t,e){if(this._useMixedArgSerialization(t)){let n=[];for(let o=0,r=t.length;o<r;o++){let s=t[o];if(s instanceof H)n[o]={type:2,value:s};else if(typeof s>"u")n[o]={type:4};else if(s instanceof Zt){let{jsonString:a,referencedBuffers:l}=NW(s.value,e);n[o]={type:3,value:H.fromString(a),buffers:l}}else n[o]={type:1,value:H.fromString(UW(s,e))}}return{type:1,args:n}}return{type:0,args:UW(t,e)}}static serializeRequest(t,e,n,o,r){switch(o.type){case 0:return this._requestJSONArgs(t,e,n,o.args,r);case 1:return this._requestMixedArgs(t,e,n,o.args,r)}}static _requestJSONArgs(t,e,n,o,r){let s=H.fromString(n),a=H.fromString(o),l=0;l+=Tn.sizeUInt8(),l+=Tn.sizeShortString(s),l+=Tn.sizeLongString(a);let d=Tn.alloc(r?2:1,t,l);return d.writeUInt8(e),d.writeShortString(s),d.writeLongString(a),d.buffer}static deserializeRequestJSONArgs(t){let e=t.readUInt8(),n=t.readShortString(),o=t.readLongString();return{rpcId:e,method:n,args:JSON.parse(o)}}static _requestMixedArgs(t,e,n,o,r){let s=H.fromString(n),a=0;a+=Tn.sizeUInt8(),a+=Tn.sizeShortString(s),a+=Tn.sizeMixedArray(o);let l=Tn.alloc(r?4:3,t,a);return l.writeUInt8(e),l.writeShortString(s),l.writeMixedArray(o),l.buffer}static deserializeRequestMixedArgs(t){let e=t.readUInt8(),n=t.readShortString(),o=t.readMixedArray(),r=new Array(o.length);for(let s=0,a=o.length;s<a;s++){let l=o[s];typeof l=="string"?r[s]=JSON.parse(l):r[s]=l}return{rpcId:e,method:n,args:r}}static serializeAcknowledged(t){return Tn.alloc(5,t,0).buffer}static serializeCancel(t){return Tn.alloc(6,t,0).buffer}static serializeReplyOK(t,e,n){if(typeof e>"u")return this._serializeReplyOKEmpty(t);if(e instanceof H)return this._serializeReplyOKVSBuffer(t,e);if(e instanceof Zt){let{jsonString:o,referencedBuffers:r}=NW(e.value,n,!0);return this._serializeReplyOKJSONWithBuffers(t,o,r)}else return this._serializeReplyOKJSON(t,WA(e,n))}static _serializeReplyOKEmpty(t){return Tn.alloc(7,t,0).buffer}static _serializeReplyOKVSBuffer(t,e){let n=0;n+=Tn.sizeVSBuffer(e);let o=Tn.alloc(8,t,n);return o.writeVSBuffer(e),o.buffer}static deserializeReplyOKVSBuffer(t){return t.readVSBuffer()}static _serializeReplyOKJSON(t,e){let n=H.fromString(e),o=0;o+=Tn.sizeLongString(n);let r=Tn.alloc(9,t,o);return r.writeLongString(n),r.buffer}static _serializeReplyOKJSONWithBuffers(t,e,n){let o=H.fromString(e),r=0;r+=Tn.sizeUInt32,r+=Tn.sizeLongString(o);for(let a of n)r+=Tn.sizeVSBuffer(a);let s=Tn.alloc(10,t,r);s.writeUInt32(n.length),s.writeLongString(o);for(let a of n)s.writeBuffer(a);return s.buffer}static deserializeReplyOKJSON(t){let e=t.readLongString();return JSON.parse(e)}static deserializeReplyOKJSONWithBuffers(t,e){let n=t.readUInt32(),o=t.readLongString(),r=[];for(let s=0;s<n;++s)r.push(t.readVSBuffer());return new Zt(WW(o,r,e))}static serializeReplyErr(t,e){let n=e?WA(ls(e),null):void 0;if(typeof n!="string")return this._serializeReplyErrEmpty(t);let o=H.fromString(n),r=0;r+=Tn.sizeLongString(o);let s=Tn.alloc(11,t,r);return s.writeLongString(o),s.buffer}static deserializeReplyErrError(t){let e=t.readLongString();return JSON.parse(e)}static _serializeReplyErrEmpty(t){return Tn.alloc(12,t,0).buffer}};function jv(i){if(!i)return;let t=i.indexOf("+");return t<0?i:i.substr(0,t)}var sS=["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"];var xe=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"){let n=typeof t=="string"?t:t.value,o=typeof e=="string"?e:e.value;return wn(n,o)}return t._lower===e._lower}static toKey(t){return typeof t=="string"?t.toLowerCase():t._lower}},$o=class{constructor(t){this._set=new Set;if(t)for(let e of t)this.add(e)}get size(){return this._set.size}add(t){this._set.add(xe.toKey(t))}delete(t){return this._set.delete(xe.toKey(t))}has(t){return this._set.has(xe.toKey(t))}},vo=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(t){this._map.delete(xe.toKey(t))}get(t){return this._map.get(xe.toKey(t))}has(t){return this._map.has(xe.toKey(t))}set(t,e){this._map.set(xe.toKey(t),e)}values(){return this._map.values()}forEach(t){this._map.forEach(t)}[Symbol.iterator](){return this._map[Symbol.iterator]()}},em=class extends Error{constructor(t,e,n){let o=n&&e?.message?`${n}: ${e.message}`:n??e?.message;super(`Error in extension ${xe.toKey(t)}: ${o}`,{cause:e}),this.name="ExtensionError",this.extension=t,e?.stack&&(this.stack=e.stack)}};var xae=A("IBuiltinExtensionsScannerService");function $A(i,t){return t&&(i.stack||i.stacktrace)?p(116,null,BW(i),VW(i.stack)||VW(i.stacktrace)):BW(i)}function VW(i){return Array.isArray(i)?i.join(`
`):i}function BW(i){return i.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${i.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof i.code=="string"&&typeof i.errno=="number"&&typeof i.syscall=="string"?p(115,null,i.message):i.message||p(113,null)}function To(i=null,t=!1){if(!i)return p(113,null);if(Array.isArray(i)){let e=nt(i),n=To(e[0],t);return e.length>1?p(114,null,n,e.length):n}if(Pe(i))return i;if(i.detail){let e=i.detail;if(e.error)return $A(e.error,t);if(e.exception)return $A(e.exception,t)}return i.stack?$A(i,t):i.message?i.message:p(113,null)}function to(i){return qA(i,0)}function qA(i,t){switch(typeof i){case"object":return i===null?Ra(349,t):Array.isArray(i)?U3(i,t):F3(i,t);case"string":return tm(i,t);case"boolean":return N3(i,t);case"number":return Ra(i,t);case"undefined":return Ra(937,t);default:return Ra(617,t)}}function Ra(i,t){return(t<<5)-t+i|0}function N3(i,t){return Ra(i?433:863,t)}function tm(i,t){t=Ra(149417,t);for(let e=0,n=i.length;e<n;e++)t=Ra(i.charCodeAt(e),t);return t}function U3(i,t){return t=Ra(104579,t),i.reduce((e,n)=>qA(n,e),t)}function F3(i,t){return t=Ra(181387,t),Object.keys(i).sort().reduce((e,n)=>(e=tm(n,e),qA(i[n],e)),t)}function zA(i,t,e=32){let n=e-t,o=~((1<<n)-1);return(i<<t|(o&i)>>>n)>>>0}function Gv(i,t=32){return i instanceof ArrayBuffer?Yl(H.wrap(new Uint8Array(i))):(i>>>0).toString(16).padStart(t/4,"0")}var $W=class i{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}static{this._bigBlock32=new DataView(new ArrayBuffer(320))}update(t){let e=t.length;if(e===0)return;let n=this._buff,o=this._buffLen,r=this._leftoverHighSurrogate,s,a;for(r!==0?(s=r,a=-1,r=0):(s=t.charCodeAt(0),a=0);;){let l=s;if(Lc(s))if(a+1<e){let d=t.charCodeAt(a+1);gv(d)?(a++,l=Tx(s,d)):l=65533}else{r=s;break}else gv(s)&&(l=65533);if(o=this._push(n,o,l),a++,a<e)s=t.charCodeAt(a);else break}this._buffLen=o,this._leftoverHighSurrogate=r}_push(t,e,n){return n<128?t[e++]=n:n<2048?(t[e++]=192|(n&1984)>>>6,t[e++]=128|(n&63)>>>0):n<65536?(t[e++]=224|(n&61440)>>>12,t[e++]=128|(n&4032)>>>6,t[e++]=128|(n&63)>>>0):(t[e++]=240|(n&1835008)>>>18,t[e++]=128|(n&258048)>>>12,t[e++]=128|(n&4032)>>>6,t[e++]=128|(n&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),e}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()),Gv(this._h0)+Gv(this._h1)+Gv(this._h2)+Gv(this._h3)+Gv(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=i._bigBlock32,e=this._buffDV;for(let u=0;u<64;u+=4)t.setUint32(u,e.getUint32(u,!1),!1);for(let u=64;u<320;u+=4)t.setUint32(u,zA(t.getUint32(u-12,!1)^t.getUint32(u-32,!1)^t.getUint32(u-56,!1)^t.getUint32(u-64,!1),1),!1);let n=this._h0,o=this._h1,r=this._h2,s=this._h3,a=this._h4,l,d,c;for(let u=0;u<80;u++)u<20?(l=o&r|~o&s,d=1518500249):u<40?(l=o^r^s,d=1859775393):u<60?(l=o&r|o&s|r&s,d=2400959708):(l=o^r^s,d=3395469782),c=zA(n,5)+l+a+d+t.getUint32(u*4,!1)&4294967295,a=s,s=r,r=zA(o,30),o=n,n=c;this._h0=this._h0+n&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}};var te=A("logService"),ir=A("loggerService");var Ui=(s=>(s[s.Off=0]="Off",s[s.Trace=1]="Trace",s[s.Debug=2]="Debug",s[s.Info=3]="Info",s[s.Warning=4]="Warning",s[s.Error=5]="Error",s))(Ui||{}),H3=3;function om(i,t){return i!==0&&i<=t}function zW(i,t,e){switch(t){case 1:i.trace(e);break;case 2:i.debug(e);break;case 3:i.info(e);break;case 4:i.warn(e);break;case 5:i.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function nm(i,t=!1){let e="";for(let n=0;n<i.length;n++){let o=i[n];if(o instanceof Error&&(o=To(o,t)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(n>0?" ":"")+o}return e}var aS=class extends N{constructor(){super(...arguments);this.level=H3;this._onDidChangeLogLevel=this._register(new T)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return om(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},od=class extends aS{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...n){this.canLog(1)&&this.log(1,nm([e,...n],!0))}debug(e,...n){this.canLog(2)&&this.log(2,nm([e,...n]))}info(e,...n){this.canLog(3)&&this.log(3,nm([e,...n]))}warn(e,...n){this.canLog(4)&&this.log(4,nm([e,...n]))}error(e,...n){if(this.canLog(5))if(e instanceof Error){let o=Array.prototype.slice.call(arguments);o[0]=e.stack,this.log(5,nm(o))}else this.log(5,nm([e,...n]))}flush(){}};var lS=class extends aS{constructor(e){super();this.loggers=e;e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let n of this.loggers)n.setLevel(e);super.setLevel(e)}trace(e,...n){for(let o of this.loggers)o.trace(e,...n)}debug(e,...n){for(let o of this.loggers)o.debug(e,...n)}info(e,...n){for(let o of this.loggers)o.info(e,...n)}warn(e,...n){for(let o of this.loggers)o.warn(e,...n)}error(e,...n){for(let o of this.loggers)o.error(e,...n)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},dS=class extends N{constructor(e,n,o){super();this.logLevel=e;this.logsHome=n;this._loggers=new Ve;this._onDidChangeLoggers=this._register(new T);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new T);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(o)for(let r of o)this._loggers.set(r.resource,{logger:void 0,info:r})}getLoggerEntry(e){return Pe(e)?[...this._loggers.values()].find(n=>n.info.id===e):this._loggers.get(e)}getLogger(e){return this.getLoggerEntry(e)?.logger}createLogger(e,n){let o=this.toResource(e),r=Pe(e)?e:n?.id??to(o.toString()).toString(16),s=this._loggers.get(o)?.logger,a=n?.logLevel==="always"?1:n?.logLevel;s||(s=this.doCreateLogger(o,a??this.getLogLevel(o)??this.logLevel,{...n,id:r}));let l={logger:s,info:{resource:o,id:r,logLevel:a,name:n?.name,hidden:n?.hidden,group:n?.group,extensionId:n?.extensionId,when:n?.when}};return this.registerLogger(l.info),this._loggers.set(o,l),s}toResource(e){return Pe(e)?gt(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,n){if(y.isUri(e)){let o=e,r=n,s=this._loggers.get(o);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([o,r]))}else{this.logLevel=e;for(let[o,r]of this._loggers.entries())this._loggers.get(o)?.info.logLevel===void 0&&r.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,n){let o=this.getLoggerEntry(e);o&&n!==!o.info.hidden&&(o.info.hidden=!n,this._loggers.set(o.info.resource,o),this._onDidChangeVisibility.fire([o.info.resource,n]))}getLogLevel(e){let n;return e&&(n=this._loggers.get(e)?.info.logLevel),n??this.logLevel}registerLogger(e){let n=this._loggers.get(e.resource);n?n.info.hidden!==e.hidden&&this.setVisibility(e.resource,!e.hidden):(this._loggers.set(e.resource,{info:e,logger:void 0}),this._onDidChangeLoggers.fire({added:[e],removed:[]}))}deregisterLogger(e){let n=this.toResource(e),o=this._loggers.get(n);o&&(o.logger&&o.logger.dispose(),this._loggers.delete(n),this._onDidChangeLoggers.fire({added:[],removed:[o.info]}))}*getRegisteredLoggers(){for(let e of this._loggers.values())yield e.info}getRegisteredLogger(e){return this._loggers.get(e)?.info}dispose(){this._loggers.forEach(e=>e.logger?.dispose()),this._loggers.clear(),super.dispose()}};function W3(i){switch(i){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}var Vae=new k("logLevel",W3(3));var sr=class{constructor(t,e=[],n=!1){this.ctor=t,this.staticArguments=e,this.supportsDelayedInstantiation=n}};var qW=[];function Ue(i,t,e){t instanceof sr||(t=new sr(t,[],!!e)),qW.push([i,t])}function KW(){return qW}var rd=class{constructor(...t){this._entries=new Map;for(let[e,n]of t)this.set(e,n)}set(t,e){let n=this._entries.get(t);return this._entries.set(t,e),n}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}};var Ye=A("IExtHostInitDataService");var KA=class{constructor(t,e){this.key=t;this.data=e;this.incoming=new Map;this.outgoing=new Map}},Qv=class{constructor(t){this._hashFn=t;this._nodes=new Map}roots(){let t=[];for(let e of this._nodes.values())e.outgoing.size===0&&t.push(e);return t}insertEdge(t,e){let n=this.lookupOrInsertNode(t),o=this.lookupOrInsertNode(e);n.outgoing.set(o.key,o),o.incoming.set(n.key,n)}removeNode(t){let e=this._hashFn(t);this._nodes.delete(e);for(let n of this._nodes.values())n.outgoing.delete(e),n.incoming.delete(e)}lookupOrInsertNode(t){let e=this._hashFn(t),n=this._nodes.get(e);return n||(n=new KA(e,t),this._nodes.set(e,n)),n}lookup(t){return this._nodes.get(this._hashFn(t))}isEmpty(){return this._nodes.size===0}toString(){let t=[];for(let[e,n]of this._nodes)t.push(`${e}
	(-> incoming)[${[...n.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...n.outgoing.keys()].join(",")}]
`);return t.join(`
`)}findCycleSlow(){for(let[t,e]of this._nodes){let n=new Set([t]),o=this._findCycle(e,n);if(o)return o}}_findCycle(t,e){for(let[n,o]of t.outgoing){if(e.has(n))return[...e,n].join(" -> ");e.add(n);let r=this._findCycle(o,e);if(r)return r;e.delete(n)}}};var V3=!1,cS=class extends Error{constructor(t){super("cyclic dependency between services"),this.message=t.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${t.toString()}`}},uS=class i{constructor(t=new rd,e=!1,n,o=V3){this._services=t;this._strict=e;this._parent=n;this._enableTracing=o;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(Dn,this),this._globalGraph=o?n?._globalGraph??new Qv(r=>r):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,In(this._children),this._children.clear();for(let t of this._servicesToMaybeDispose)tx(t)&&t.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(t,e){this._throwIfDisposed();let n=this,o=new class extends i{dispose(){n._children.delete(o),super.dispose()}}(t,this._strict,this,this._enableTracing);return this._children.add(o),e?.add(o),o}invokeFunction(t,...e){this._throwIfDisposed();let n=Jv.traceInvocation(this._enableTracing,t),o=!1;try{return t({get:s=>{if(o)throw Ap("service accessor is only valid during the invocation of its target method");let a=this._getOrCreateServiceInstance(s,n);return a||this._throwIfStrict(`[invokeFunction] unknown service '${s}'`,!1),a}},...e)}finally{o=!0,n.stop()}}createInstance(t,...e){this._throwIfDisposed();let n,o;return t instanceof sr?(n=Jv.traceCreation(this._enableTracing,t.ctor),o=this._createInstance(t.ctor,t.staticArguments.concat(e),n)):(n=Jv.traceCreation(this._enableTracing,t),o=this._createInstance(t,e,n)),n.stop(),o}_createInstance(t,e=[],n){let o=Oi.getServiceDependencies(t).sort((a,l)=>a.index-l.index),r=[];for(let a of o){let l=this._getOrCreateServiceInstance(a.id,n);l||this._throwIfStrict(`[createInstance] ${t.name} depends on UNKNOWN service ${a.id}.`,!1),r.push(l)}let s=o.length>0?o[0].index:e.length;if(e.length!==s){console.trace(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);let a=s-e.length;a>0?e=e.concat(new Array(a)):e=e.slice(0,s)}return Reflect.construct(t,e.concat(r))}_setCreatedServiceInstance(t,e){if(this._services.get(t)instanceof sr)this._services.set(t,e);else if(this._parent)this._parent._setCreatedServiceInstance(t,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(t){let e=this._services.get(t);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(t):e}_getOrCreateServiceInstance(t,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(t));let n=this._getServiceInstanceOrDescriptor(t);return n instanceof sr?this._safeCreateAndCacheServiceInstance(t,n,e.branch(t,!0)):(e.branch(t,!1),n)}_safeCreateAndCacheServiceInstance(t,e,n){if(this._activeInstantiations.has(t))throw new Error(`illegal state - RECURSIVELY instantiating service '${t}'`);this._activeInstantiations.add(t);try{return this._createAndCacheServiceInstance(t,e,n)}finally{this._activeInstantiations.delete(t)}}_createAndCacheServiceInstance(t,e,n){let o=new Qv(l=>l.id.toString()),r=0,s=[{id:t,desc:e,_trace:n}],a=new Set;for(;s.length;){let l=s.pop();if(!a.has(String(l.id))){if(a.add(String(l.id)),o.lookupOrInsertNode(l),r++>1e3)throw new cS(o);for(let d of Oi.getServiceDependencies(l.desc.ctor)){let c=this._getServiceInstanceOrDescriptor(d.id);if(c||this._throwIfStrict(`[createInstance] ${t} depends on ${d.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(d.id)),c instanceof sr){let u={id:d.id,desc:c,_trace:l._trace.branch(d.id,!0)};o.insertEdge(l,u),s.push(u)}}}}for(;;){let l=o.roots();if(l.length===0){if(!o.isEmpty())throw new cS(o);break}for(let{data:d}of l){if(this._getServiceInstanceOrDescriptor(d.id)instanceof sr){let u=this._createServiceInstanceWithOwner(d.id,d.desc.ctor,d.desc.staticArguments,d.desc.supportsDelayedInstantiation,d._trace);this._setCreatedServiceInstance(d.id,u)}o.removeNode(d)}}return this._getServiceInstanceOrDescriptor(t)}_createServiceInstanceWithOwner(t,e,n=[],o,r){if(this._services.get(t)instanceof sr)return this._createServiceInstance(t,e,n,o,r,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(t,e,n,o,r);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(t,e,n=[],o,r,s){if(o){let a=new i(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(t);let l=new Map,d=new Lx(()=>{let c=a._createInstance(e,n,r);for(let[u,m]of l){let g=c[u];if(typeof g=="function")for(let h of m)h.disposable=g.apply(c,h.listener)}return l.clear(),s.add(c),c});return new Proxy(Object.create(null),{get(c,u){if(!d.isInitialized&&typeof u=="string"&&(u.startsWith("onDid")||u.startsWith("onWill"))){let h=l.get(u);return h||(h=new mo,l.set(u,h)),(I,x,E)=>{if(d.isInitialized)return d.value[u](I,x,E);{let w={listener:[I,x,E],disposable:void 0},R=h.push(w);return q(()=>{R(),w.disposable?.dispose()})}}}if(u in c)return c[u];let m=d.value,g=m[u];return typeof g!="function"||(g=g.bind(m),c[u]=g),g},set(c,u,m){return d.value[u]=m,!0},getPrototypeOf(c){return e.prototype}})}else{let a=this._createInstance(e,n,r);return s.add(a),a}}_throwIfStrict(t,e){if(e&&console.warn(t),this._strict)throw new Error(t)}};var Jv=class i{constructor(t,e){this.type=t;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends i{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(t,e){return t?new i(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):i._None}static traceCreation(t,e){return t?new i(1,e.name):i._None}static{this._totals=0}branch(t,e){let n=new i(3,t.toString());return this._dep.push([t,e,n]),n}stop(){let t=Date.now()-this._start;i._totals+=t;let e=!1;function n(r,s){let a=[],l=new Array(r+1).join("	");for(let[d,c,u]of s._dep)if(c&&u){e=!0,a.push(`${l}CREATES -> ${d}`);let m=n(r+1,u);m&&a.push(m)}else a.push(`${l}uses -> ${d}`);return a.join(`
`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${n(1,this)}`,`DONE, took ${t.toFixed(2)}ms (grand total ${i._totals.toFixed(2)}ms)`];(t>2||e)&&i.all.add(o.join(`
`))}};var le=A("IExtHostRpcService"),pS=class{constructor(t){this.getProxy=t.getProxy.bind(t),this.set=t.set.bind(t),this.dispose=t.dispose.bind(t),this.assertRegistered=t.assertRegistered.bind(t),this.drain=t.drain.bind(t)}};var xs=A("IURITransformerService"),mS=class{constructor(t){t?(this.transformIncoming=t.transformIncoming.bind(t),this.transformOutgoing=t.transformOutgoing.bind(t),this.transformOutgoingURI=t.transformOutgoingURI.bind(t),this.transformOutgoingScheme=t.transformOutgoingScheme.bind(t)):(this.transformIncoming=e=>e,this.transformOutgoing=e=>e,this.transformOutgoingURI=e=>e,this.transformOutgoingScheme=e=>e)}};var jA=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<this._value.length-1}cmp(t){let e=t.charCodeAt(0),n=this._value.charCodeAt(this._pos);return e-n}value(){return this._value[this._pos]}},GA=class{constructor(t=!0){this._caseSensitive=t}reset(t){return this._value=t,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let t=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(t)this._from++;else break;else t=!1;return this}cmp(t){return this._caseSensitive?Cx(t,this._value,0,t.length,this._from,this._to):Mc(t,this._value,0,t.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},gS=class{constructor(t=!0,e=!0){this._splitOnBackslash=t;this._caseSensitive=e}reset(t){this._from=0,this._to=0,this._value=t,this._valueLen=t.length;for(let e=t.length-1;e>=0;e--,this._valueLen--){let n=this._value.charCodeAt(e);if(!(n===47||this._splitOnBackslash&&n===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let t=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(t)this._from++;else break;else t=!1}return this}cmp(t){return this._caseSensitive?Cx(t,this._value,0,t.length,this._from,this._to):Mc(t,this._value,0,t.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var Yv=class{constructor(t,e){this._ignorePathCasing=t;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(t){return this._value=t,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new gS(!1,!this._ignorePathCasing(t)),this._pathIterator.reset(t.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(t)||(this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5)),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(t){if(this._states[this._stateIdx]===1)return Ac(t,this._value.scheme);if(this._states[this._stateIdx]===2)return Ac(t,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(t);if(this._states[this._stateIdx]===4)return Ri(t,this._value.query);if(this._states[this._stateIdx]===5)return Ri(t,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}},Da=class i{static{this.Val=Symbol("undefined_placeholder")}static wrap(t){return t===void 0?i.Val:t}static unwrap(t){return t===i.Val?void 0:t}},rm=class{constructor(){this.height=1;this.value=void 0;this.key=void 0;this.left=void 0;this.mid=void 0;this.right=void 0}isEmpty(){return!this.left&&!this.mid&&!this.right&&this.value===void 0}rotateLeft(){let t=this.right;return this.right=t.left,t.left=this,this.updateHeight(),t.updateHeight(),t}rotateRight(){let t=this.left;return this.left=t.right,t.right=this,this.updateHeight(),t.updateHeight(),t}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){return this.left?.height??0}get heightRight(){return this.right?.height??0}};var ar=class i{static forUris(t=()=>!1,e=()=>!1){return new i(new Yv(t,e))}static forPaths(t=!1){return new i(new gS(void 0,!t))}static forStrings(){return new i(new jA)}static forConfigKeys(){return new i(new GA)}constructor(t){this._iter=t}clear(){this._root=void 0}fill(t,e){if(e){let n=e.slice(0);gR(n);for(let o of n)this.set(o,t)}else{let n=t.slice(0);gR(n);for(let o of n)this.set(o[0],o[1])}}set(t,e){let n=this._iter.reset(t),o;this._root||(this._root=new rm,this._root.segment=n.value());let r=[];for(o=this._root;;){let a=n.cmp(o.segment);if(a>0)o.left||(o.left=new rm,o.left.segment=n.value()),r.push([-1,o]),o=o.left;else if(a<0)o.right||(o.right=new rm,o.right.segment=n.value()),r.push([1,o]),o=o.right;else if(n.hasNext())n.next(),o.mid||(o.mid=new rm,o.mid.segment=n.value()),r.push([0,o]),o=o.mid;else break}let s=Da.unwrap(o.value);o.value=Da.wrap(e),o.key=t;for(let a=r.length-1;a>=0;a--){let l=r[a][1];l.updateHeight();let d=l.balanceFactor();if(d<-1||d>1){let c=r[a][0],u=r[a+1][0];if(c===1&&u===1)r[a][1]=l.rotateLeft();else if(c===-1&&u===-1)r[a][1]=l.rotateRight();else if(c===1&&u===-1)l.right=r[a+1][1]=r[a+1][1].rotateRight(),r[a][1]=l.rotateLeft();else if(c===-1&&u===1)l.left=r[a+1][1]=r[a+1][1].rotateLeft(),r[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(r[a-1][0]){case-1:r[a-1][1].left=r[a][1];break;case 1:r[a-1][1].right=r[a][1];break;case 0:r[a-1][1].mid=r[a][1];break}else this._root=r[0][1]}}return s}get(t){return Da.unwrap(this._getNode(t)?.value)}_getNode(t){let e=this._iter.reset(t),n=this._root;for(;n;){let o=e.cmp(n.segment);if(o>0)n=n.left;else if(o<0)n=n.right;else if(e.hasNext())e.next(),n=n.mid;else break}return n}has(t){let e=this._getNode(t);return!(e?.value===void 0&&e?.mid===void 0)}delete(t){return this._delete(t,!1)}deleteSuperstr(t){return this._delete(t,!0)}_delete(t,e){let n=this._iter.reset(t),o=[],r=this._root;for(;r;){let s=n.cmp(r.segment);if(s>0)o.push([-1,r]),r=r.left;else if(s<0)o.push([1,r]),r=r.right;else if(n.hasNext())n.next(),o.push([0,r]),r=r.mid;else break}if(r){if(e?(r.left=void 0,r.mid=void 0,r.right=void 0,r.height=1):(r.key=void 0,r.value=void 0),!r.mid&&!r.value)if(r.left&&r.right){let s=[[1,r]],a=this._min(r.right,s);if(a.key){r.key=a.key,r.value=a.value,r.segment=a.segment;let l=a.right;if(s.length>1){let[c,u]=s[s.length-1];switch(c){case-1:u.left=l;break;case 0:wc(!1);case 1:wc(!1)}}else r.right=l;let d=this._balanceByStack(s);if(o.length>0){let[c,u]=o[o.length-1];switch(c){case-1:u.left=d;break;case 0:u.mid=d;break;case 1:u.right=d;break}}else this._root=d}}else{let s=r.left??r.right;if(o.length>0){let[a,l]=o[o.length-1];switch(a){case-1:l.left=s;break;case 0:l.mid=s;break;case 1:l.right=s;break}}else this._root=s}this._root=this._balanceByStack(o)??this._root}}_min(t,e){for(;t.left;)e.push([-1,t]),t=t.left;return t}_balanceByStack(t){for(let e=t.length-1;e>=0;e--){let n=t[e][1];n.updateHeight();let o=n.balanceFactor();if(o>1?(n.right.balanceFactor()>=0||(n.right=n.right.rotateRight()),t[e][1]=n.rotateLeft()):o<-1&&(n.left.balanceFactor()<=0||(n.left=n.left.rotateLeft()),t[e][1]=n.rotateRight()),e>0)switch(t[e-1][0]){case-1:t[e-1][1].left=t[e][1];break;case 1:t[e-1][1].right=t[e][1];break;case 0:t[e-1][1].mid=t[e][1];break}else return t[0][1]}}findSubstr(t){let e=this._iter.reset(t),n=this._root,o;for(;n;){let r=e.cmp(n.segment);if(r>0)n=n.left;else if(r<0)n=n.right;else if(e.hasNext())e.next(),o=Da.unwrap(n.value)||o,n=n.mid;else break}return n&&Da.unwrap(n.value)||o}findSuperstr(t){return this._findSuperstrOrElement(t,!1)}_findSuperstrOrElement(t,e){let n=this._iter.reset(t),o=this._root;for(;o;){let r=n.cmp(o.segment);if(r>0)o=o.left;else if(r<0)o=o.right;else if(n.hasNext())n.next(),o=o.mid;else return o.mid?this._entries(o.mid):e?Da.unwrap(o.value):void 0}}hasElementOrSubtree(t){return this._findSuperstrOrElement(t,!0)!==void 0}forEach(t){for(let[e,n]of this)t(n,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(t){let e=[];return this._dfsEntries(t,e),e[Symbol.iterator]()}_dfsEntries(t,e){t&&(t.left&&this._dfsEntries(t.left,e),t.value!==void 0&&e.push([t.key,Da.unwrap(t.value)]),t.mid&&this._dfsEntries(t.mid,e),t.right&&this._dfsEntries(t.right,e))}_isBalanced(){let t=e=>{if(!e)return!0;let n=e.balanceFactor();return n<-1||n>1?!1:t(e.left)&&t(e.right)};return t(this._root)}};function jW(i,t,e){return Math.min(Math.max(i,t),e)}var fS=class{constructor(){this._next=0}getNext(){return this._next++}},hS=class{constructor(){this._n=1;this._val=0}update(t){return this._val=this._val+(t-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}};var zo=A("fileService");function Qc(i){return i.create===!0}var Jc=(o=>(o[o.Unknown=0]="Unknown",o[o.File=1]="File",o[o.Directory=2]="Directory",o[o.SymbolicLink=64]="SymbolicLink",o))(Jc||{}),Yc=(n=>(n[n.Readonly=1]="Readonly",n[n.Locked=2]="Locked",n[n.Executable=4]="Executable",n))(Yc||{});var id=class i extends Error{constructor(e,n){super(e);this.code=n}static create(e,n){let o=new i(e.toString(),n);return QA(o,n),o}};function Fi(i,t){return id.create(i,t)}function QW(i){return i||Fi(p(3017,null),"Unknown")}function QA(i,t){return i.name=t?`${t} (FileSystemError)`:"FileSystemError",i}function im(i){if(!i)return"Unknown";if(i instanceof id)return i.code;let t=/^(.+) \(FileSystemError\)$/.exec(i.name);if(!t)return"Unknown";switch(t[1]){case"EntryExists":return"EntryExists";case"EntryIsADirectory":return"EntryIsADirectory";case"EntryNotADirectory":return"EntryNotADirectory";case"EntryNotFound":return"EntryNotFound";case"EntryTooLarge":return"EntryTooLarge";case"EntryWriteLocked":return"EntryWriteLocked";case"NoPermissions":return"NoPermissions";case"Unavailable":return"Unavailable"}return"Unknown"}function Xc(i){if(i instanceof Ss)return i.fileOperationResult;switch(im(i)){case"EntryNotFound":return 1;case"EntryIsADirectory":return 0;case"EntryNotADirectory":return 9;case"EntryWriteLocked":return 5;case"NoPermissions":return 6;case"EntryExists":return 4;case"EntryTooLarge":return 7;default:return 10}}var GW=class i{constructor(t,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new mt(()=>{let t=ar.forUris(()=>this.ignorePathCasing);return t.fill(this.rawAdded.map(e=>[e,!0])),t});this.updated=new mt(()=>{let t=ar.forUris(()=>this.ignorePathCasing);return t.fill(this.rawUpdated.map(e=>[e,!0])),t});this.deleted=new mt(()=>{let t=ar.forUris(()=>this.ignorePathCasing);return t.fill(this.rawDeleted.map(e=>[e,!0])),t});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let n of t){switch(n.type){case 1:this.rawAdded.push(n.resource);break;case 0:this.rawUpdated.push(n.resource);break;case 2:this.rawDeleted.push(n.resource);break}this.correlationId!==i.MIXED_CORRELATION&&(typeof n.cId=="number"?this.correlationId===void 0?this.correlationId=n.cId:this.correlationId!==n.cId&&(this.correlationId=i.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=i.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(t,...e){return this.doContains(t,{includeChildren:!1},...e)}affects(t,...e){return this.doContains(t,{includeChildren:!0},...e)}doContains(t,e,...n){if(!t)return!1;let o=n.length>0;return!!((!o||n.includes(1))&&(this.added.value.get(t)||e.includeChildren&&this.added.value.findSuperstr(t))||(!o||n.includes(0))&&(this.updated.value.get(t)||e.includeChildren&&this.updated.value.findSuperstr(t))||(!o||n.includes(2))&&(this.deleted.value.findSubstr(t)||e.includeChildren&&this.deleted.value.findSuperstr(t)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(t){return this.correlationId===t}hasCorrelation(){return typeof this.correlationId=="number"}};function JW(i,t,e){return!i||!t||i===t||t.length>i.length?!1:(t.charAt(t.length-1)!==Dt&&(t+=Dt),e?ka(i,t):i.indexOf(t)===0)}var Ss=class extends Error{constructor(e,n,o){super(e);this.fileOperationResult=n;this.options=o}};var YW="";function JA(i){if(!(typeof i.size!="number"||typeof i.mtime!="number"))return i.mtime.toString(29)+i.size.toString(31)}var Gc=class i{static{this.KB=1024}static{this.MB=i.KB*i.KB}static{this.GB=i.MB*i.KB}static{this.TB=i.GB*i.KB}static formatSize(t){return jn(t)||(t=0),t<i.KB?p(3012,null,t.toFixed(0)):t<i.MB?p(3014,null,(t/i.KB).toFixed(2)):t<i.GB?p(3015,null,(t/i.MB).toFixed(2)):t<i.TB?p(3013,null,(t/i.GB).toFixed(2)):p(3016,null,(t/i.TB).toFixed(2))}};var yS=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(yS||{});(a=>{let i="error",t="warning",e="warn",n="info",o="ignore";function r(l){return l?wn(i,l)?3:wn(t,l)||wn(e,l)?2:wn(n,l)?1:0:0}a.fromValue=r;function s(l){switch(l){case 3:return i;case 2:return t;case 1:return n;default:return o}}a.toString=s})(yS||={});var rt=yS;var XW=rt,ZW=A("notificationService");var Cr=A("contextService");function eV(i){let t=i;return typeof t?.id=="string"&&y.isUri(t.uri)}function tV(i){let t=i;return typeof t?.id=="string"&&y.isUri(t.configPath)}function YA(i){let t=i;return!!(t&&typeof t=="object"&&y.isUri(t.uri)&&typeof t.name=="string"&&typeof t.toResource=="function")}var bS=class{constructor(t,e,n,o,r,s){this._id=t;this._transient=n;this._configuration=o;this.ignorePathCasing=r;this._workspaceName=s;this.foldersMap=ar.forUris(this.ignorePathCasing,()=>!0),this.folders=e}get folders(){return this._folders}set folders(t){this._folders=t,this.updateFoldersMap()}update(t){this._id=t.id,this._configuration=t.configuration,this._transient=t.transient,this._workspaceName=t.name,this.ignorePathCasing=t.ignorePathCasing,this.folders=t.folders}get id(){return this._id}get transient(){return this._transient}get configuration(){return this._configuration}set configuration(t){this._configuration=t}get name(){return this._workspaceName}getFolder(t){return t&&this.foldersMap.findSubstr(t)||null}updateFoldersMap(){this.foldersMap=ar.forUris(this.ignorePathCasing,()=>!0);for(let t of this.folders)this.foldersMap.set(t.uri,t)}toJSON(){return{id:this.id,folders:this.folders,transient:this.transient,configuration:this.configuration,name:this.name}}},Zc=class{constructor(t,e){this.raw=e;this.uri=t.uri,this.index=t.index,this.name=t.name}toResource(t){return gt(this.uri,t)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function Xv(i){return new Zc({uri:i,index:0,name:vv(i)},{uri:i.toString()})}var nV="code-workspace",B3=`.${nV}`,Gle=[{name:p(3721,null),extensions:[nV]}];function oV(i){return(typeof i=="string"?zl(i):yv(i))===B3}var IS=class{constructor(){this._systemSchemes=new Set(Object.keys(B));this._providerInfo=new Map;this.extUri=new vs(t=>{let e=this._providerInfo.get(t.scheme);return!(e===void 0||e&1024)})}$acceptProviderInfos(t,e){e===null?this._providerInfo.delete(t.scheme):this._providerInfo.set(t.scheme,e)}isFreeScheme(t){return!this._providerInfo.has(t)&&!this._systemSchemes.has(t)}getCapabilities(t){return this._providerInfo.get(t)}},ai=A("IExtHostFileSystemInfo");var xS=Object.freeze({create:i=>er(i.map(t=>t.toString())).join(`\r
`),split:i=>i.split(`\r
`),parse:i=>xS.split(i).filter(t=>!t.startsWith("#"))});var sde=new Uint32Array(10);var ade=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),lde=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),dde=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]),cde=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 iV(...i){return function(t,e){for(let n=0,o=i.length;n<o;n++){let r=i[n](t,e);if(r)return r}return null}}var bde=sV.bind(void 0,!1),CS=sV.bind(void 0,!0);function sV(i,t,e){if(!e||e.length<t.length)return null;let n;return i?n=ka(e,t):n=e.indexOf(t)===0,n?t.length>0?[{start:0,end:t.length}]:[]:null}function $3(i,t){if(i.length>t.length)return null;let e=t.toLowerCase().indexOf(i.toLowerCase());return e===-1?null:[{start:e,end:e+i.length}]}function z3(i,t){return i.length>t.length?null:XA(i.toLowerCase(),t.toLowerCase(),0,0)}function XA(i,t,e,n){if(e===i.length)return[];if(n===t.length)return null;if(i[e]===t[n]){let o=null;return(o=XA(i,t,e+1,n+1))?lV({start:n,end:n+1},o):null}return XA(i,t,e,n+1)}function eM(i){return 97<=i&&i<=122}function sm(i){return 65<=i&&i<=90}function tM(i){return 48<=i&&i<=57}function q3(i){return i===32||i===9||i===10||i===13}var K3=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(i=>K3.add(i.charCodeAt(0)));function aV(i){return eM(i)||sm(i)||tM(i)}function lV(i,t){return t.length===0?t=[i]:i.end===t[0].start?t[0].start=i.start:t.unshift(i),t}function dV(i,t){for(let e=t;e<i.length;e++){let n=i.charCodeAt(e);if(sm(n)||tM(n)||e>0&&!aV(i.charCodeAt(e-1)))return e}return i.length}function ZA(i,t,e,n){if(e===i.length)return[];if(n===t.length)return null;if(i[e]!==t[n].toLowerCase())return null;{let o=null,r=n+1;for(o=ZA(i,t,e+1,n+1);!o&&(r=dV(t,r))<t.length;)o=ZA(i,t,e+1,r),r++;return o===null?null:lV({start:n,end:n+1},o)}}function j3(i){let t=0,e=0,n=0,o=0,r=0;for(let c=0;c<i.length;c++)r=i.charCodeAt(c),sm(r)&&t++,eM(r)&&e++,aV(r)&&n++,tM(r)&&o++;let s=t/i.length,a=e/i.length,l=n/i.length,d=o/i.length;return{upperPercent:s,lowerPercent:a,alphaPercent:l,numericPercent:d}}function G3(i){let{upperPercent:t,lowerPercent:e}=i;return e===0&&t>.6}function Q3(i){let{upperPercent:t,lowerPercent:e,alphaPercent:n,numericPercent:o}=i;return e>.2&&t<.8&&n>.6&&o<.2}function J3(i){let t=0,e=0,n=0,o=0;for(let r=0;r<i.length;r++)n=i.charCodeAt(r),sm(n)&&t++,eM(n)&&e++,q3(n)&&o++;return(t===0||e===0)&&o===0?i.length<=30:t<=5}function cV(i,t){if(!t||(t=t.trim(),t.length===0)||!J3(i))return null;t.length>60&&(t=t.substring(0,60));let e=j3(t);if(!Q3(e)){if(!G3(e))return null;t=t.toLowerCase()}let n=null,o=0;for(i=i.toLowerCase();o<t.length&&(n=ZA(i,t,0,o))===null;)o=dV(t,o+1);return n}var Ide=iV(CS,cV,$3),xde=iV(CS,cV,z3),Sde=new Xr(1e4);var SS=128;function nM(){let i=[],t=[];for(let e=0;e<=SS;e++)t[e]=0;for(let e=0;e<=SS;e++)i.push(t.slice(0));return i}function uV(i){let t=[];for(let e=0;e<=i;e++)t[e]=0;return t}var Cde=uV(2*SS),Tde=uV(2*SS),Ede=nM(),wde=nM(),kde=nM();var Y3;(e=>{e.Default=[-100,0];function t(n){return!n||n.length===2&&n[0]===-100&&n[1]===0}e.isDefault=t})(Y3||={});var rV=class{constructor(t,e){this.firstMatchCanBeWeak=t;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};var oM=Object.create(null);function v(i,t){if(Pe(t)){let e=oM[t];if(e===void 0)throw new Error(`${i} references an unknown codicon: ${t}`);t=e}return oM[i]=t,{id:i}}function pV(){return oM}var mV={add:v("add",6e4),plus:v("plus",6e4),gistNew:v("gist-new",6e4),repoCreate:v("repo-create",6e4),lightbulb:v("lightbulb",60001),lightBulb:v("light-bulb",60001),repo:v("repo",60002),repoDelete:v("repo-delete",60002),gistFork:v("gist-fork",60003),repoForked:v("repo-forked",60003),gitPullRequest:v("git-pull-request",60004),gitPullRequestAbandoned:v("git-pull-request-abandoned",60004),recordKeys:v("record-keys",60005),keyboard:v("keyboard",60005),tag:v("tag",60006),gitPullRequestLabel:v("git-pull-request-label",60006),tagAdd:v("tag-add",60006),tagRemove:v("tag-remove",60006),person:v("person",60007),personFollow:v("person-follow",60007),personOutline:v("person-outline",60007),personFilled:v("person-filled",60007),sourceControl:v("source-control",60008),mirror:v("mirror",60009),mirrorPublic:v("mirror-public",60009),star:v("star",60010),starAdd:v("star-add",60010),starDelete:v("star-delete",60010),starEmpty:v("star-empty",60010),comment:v("comment",60011),commentAdd:v("comment-add",60011),alert:v("alert",60012),warning:v("warning",60012),search:v("search",60013),searchSave:v("search-save",60013),logOut:v("log-out",60014),signOut:v("sign-out",60014),logIn:v("log-in",60015),signIn:v("sign-in",60015),eye:v("eye",60016),eyeUnwatch:v("eye-unwatch",60016),eyeWatch:v("eye-watch",60016),circleFilled:v("circle-filled",60017),primitiveDot:v("primitive-dot",60017),closeDirty:v("close-dirty",60017),debugBreakpoint:v("debug-breakpoint",60017),debugBreakpointDisabled:v("debug-breakpoint-disabled",60017),debugHint:v("debug-hint",60017),terminalDecorationSuccess:v("terminal-decoration-success",60017),primitiveSquare:v("primitive-square",60018),edit:v("edit",60019),pencil:v("pencil",60019),info:v("info",60020),issueOpened:v("issue-opened",60020),gistPrivate:v("gist-private",60021),gitForkPrivate:v("git-fork-private",60021),lock:v("lock",60021),mirrorPrivate:v("mirror-private",60021),close:v("close",60022),removeClose:v("remove-close",60022),x:v("x",60022),repoSync:v("repo-sync",60023),sync:v("sync",60023),clone:v("clone",60024),desktopDownload:v("desktop-download",60024),beaker:v("beaker",60025),microscope:v("microscope",60025),vm:v("vm",60026),deviceDesktop:v("device-desktop",60026),file:v("file",60027),more:v("more",60028),ellipsis:v("ellipsis",60028),kebabHorizontal:v("kebab-horizontal",60028),mailReply:v("mail-reply",60029),reply:v("reply",60029),organization:v("organization",60030),organizationFilled:v("organization-filled",60030),organizationOutline:v("organization-outline",60030),newFile:v("new-file",60031),fileAdd:v("file-add",60031),newFolder:v("new-folder",60032),fileDirectoryCreate:v("file-directory-create",60032),trash:v("trash",60033),trashcan:v("trashcan",60033),history:v("history",60034),clock:v("clock",60034),folder:v("folder",60035),fileDirectory:v("file-directory",60035),symbolFolder:v("symbol-folder",60035),logoGithub:v("logo-github",60036),markGithub:v("mark-github",60036),github:v("github",60036),terminal:v("terminal",60037),console:v("console",60037),repl:v("repl",60037),zap:v("zap",60038),symbolEvent:v("symbol-event",60038),error:v("error",60039),stop:v("stop",60039),variable:v("variable",60040),symbolVariable:v("symbol-variable",60040),array:v("array",60042),symbolArray:v("symbol-array",60042),symbolModule:v("symbol-module",60043),symbolPackage:v("symbol-package",60043),symbolNamespace:v("symbol-namespace",60043),symbolObject:v("symbol-object",60043),symbolMethod:v("symbol-method",60044),symbolFunction:v("symbol-function",60044),symbolConstructor:v("symbol-constructor",60044),symbolBoolean:v("symbol-boolean",60047),symbolNull:v("symbol-null",60047),symbolNumeric:v("symbol-numeric",60048),symbolNumber:v("symbol-number",60048),symbolStructure:v("symbol-structure",60049),symbolStruct:v("symbol-struct",60049),symbolParameter:v("symbol-parameter",60050),symbolTypeParameter:v("symbol-type-parameter",60050),symbolKey:v("symbol-key",60051),symbolText:v("symbol-text",60051),symbolReference:v("symbol-reference",60052),goToFile:v("go-to-file",60052),symbolEnum:v("symbol-enum",60053),symbolValue:v("symbol-value",60053),symbolRuler:v("symbol-ruler",60054),symbolUnit:v("symbol-unit",60054),activateBreakpoints:v("activate-breakpoints",60055),archive:v("archive",60056),arrowBoth:v("arrow-both",60057),arrowDown:v("arrow-down",60058),arrowLeft:v("arrow-left",60059),arrowRight:v("arrow-right",60060),arrowSmallDown:v("arrow-small-down",60061),arrowSmallLeft:v("arrow-small-left",60062),arrowSmallRight:v("arrow-small-right",60063),arrowSmallUp:v("arrow-small-up",60064),arrowUp:v("arrow-up",60065),bell:v("bell",60066),bold:v("bold",60067),book:v("book",60068),bookmark:v("bookmark",60069),debugBreakpointConditionalUnverified:v("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:v("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:v("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:v("debug-breakpoint-data-unverified",60072),debugBreakpointData:v("debug-breakpoint-data",60073),debugBreakpointDataDisabled:v("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:v("debug-breakpoint-log-unverified",60074),debugBreakpointLog:v("debug-breakpoint-log",60075),debugBreakpointLogDisabled:v("debug-breakpoint-log-disabled",60075),briefcase:v("briefcase",60076),broadcast:v("broadcast",60077),browser:v("browser",60078),bug:v("bug",60079),calendar:v("calendar",60080),caseSensitive:v("case-sensitive",60081),check:v("check",60082),checklist:v("checklist",60083),chevronDown:v("chevron-down",60084),chevronLeft:v("chevron-left",60085),chevronRight:v("chevron-right",60086),chevronUp:v("chevron-up",60087),chromeClose:v("chrome-close",60088),chromeMaximize:v("chrome-maximize",60089),chromeMinimize:v("chrome-minimize",60090),chromeRestore:v("chrome-restore",60091),circleOutline:v("circle-outline",60092),circle:v("circle",60092),debugBreakpointUnverified:v("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:v("terminal-decoration-incomplete",60092),circleSlash:v("circle-slash",60093),circuitBoard:v("circuit-board",60094),clearAll:v("clear-all",60095),clippy:v("clippy",60096),closeAll:v("close-all",60097),cloudDownload:v("cloud-download",60098),cloudUpload:v("cloud-upload",60099),code:v("code",60100),collapseAll:v("collapse-all",60101),colorMode:v("color-mode",60102),commentDiscussion:v("comment-discussion",60103),creditCard:v("credit-card",60105),dash:v("dash",60108),dashboard:v("dashboard",60109),database:v("database",60110),debugContinue:v("debug-continue",60111),debugDisconnect:v("debug-disconnect",60112),debugPause:v("debug-pause",60113),debugRestart:v("debug-restart",60114),debugStart:v("debug-start",60115),debugStepInto:v("debug-step-into",60116),debugStepOut:v("debug-step-out",60117),debugStepOver:v("debug-step-over",60118),debugStop:v("debug-stop",60119),debug:v("debug",60120),deviceCameraVideo:v("device-camera-video",60121),deviceCamera:v("device-camera",60122),deviceMobile:v("device-mobile",60123),diffAdded:v("diff-added",60124),diffIgnored:v("diff-ignored",60125),diffModified:v("diff-modified",60126),diffRemoved:v("diff-removed",60127),diffRenamed:v("diff-renamed",60128),diff:v("diff",60129),diffSidebyside:v("diff-sidebyside",60129),discard:v("discard",60130),editorLayout:v("editor-layout",60131),emptyWindow:v("empty-window",60132),exclude:v("exclude",60133),extensions:v("extensions",60134),eyeClosed:v("eye-closed",60135),fileBinary:v("file-binary",60136),fileCode:v("file-code",60137),fileMedia:v("file-media",60138),filePdf:v("file-pdf",60139),fileSubmodule:v("file-submodule",60140),fileSymlinkDirectory:v("file-symlink-directory",60141),fileSymlinkFile:v("file-symlink-file",60142),fileZip:v("file-zip",60143),files:v("files",60144),filter:v("filter",60145),flame:v("flame",60146),foldDown:v("fold-down",60147),foldUp:v("fold-up",60148),fold:v("fold",60149),folderActive:v("folder-active",60150),folderOpened:v("folder-opened",60151),gear:v("gear",60152),gift:v("gift",60153),gistSecret:v("gist-secret",60154),gist:v("gist",60155),gitCommit:v("git-commit",60156),gitCompare:v("git-compare",60157),compareChanges:v("compare-changes",60157),gitMerge:v("git-merge",60158),githubAction:v("github-action",60159),githubAlt:v("github-alt",60160),globe:v("globe",60161),grabber:v("grabber",60162),graph:v("graph",60163),gripper:v("gripper",60164),heart:v("heart",60165),home:v("home",60166),horizontalRule:v("horizontal-rule",60167),hubot:v("hubot",60168),inbox:v("inbox",60169),issueReopened:v("issue-reopened",60171),issues:v("issues",60172),italic:v("italic",60173),jersey:v("jersey",60174),json:v("json",60175),bracket:v("bracket",60175),kebabVertical:v("kebab-vertical",60176),key:v("key",60177),law:v("law",60178),lightbulbAutofix:v("lightbulb-autofix",60179),linkExternal:v("link-external",60180),link:v("link",60181),listOrdered:v("list-ordered",60182),listUnordered:v("list-unordered",60183),liveShare:v("live-share",60184),loading:v("loading",60185),location:v("location",60186),mailRead:v("mail-read",60187),mail:v("mail",60188),markdown:v("markdown",60189),megaphone:v("megaphone",60190),mention:v("mention",60191),milestone:v("milestone",60192),gitPullRequestMilestone:v("git-pull-request-milestone",60192),mortarBoard:v("mortar-board",60193),move:v("move",60194),multipleWindows:v("multiple-windows",60195),mute:v("mute",60196),noNewline:v("no-newline",60197),note:v("note",60198),octoface:v("octoface",60199),openPreview:v("open-preview",60200),package:v("package",60201),paintcan:v("paintcan",60202),pin:v("pin",60203),play:v("play",60204),run:v("run",60204),plug:v("plug",60205),preserveCase:v("preserve-case",60206),preview:v("preview",60207),project:v("project",60208),pulse:v("pulse",60209),question:v("question",60210),quote:v("quote",60211),radioTower:v("radio-tower",60212),reactions:v("reactions",60213),references:v("references",60214),refresh:v("refresh",60215),regex:v("regex",60216),remoteExplorer:v("remote-explorer",60217),remote:v("remote",60218),remove:v("remove",60219),replaceAll:v("replace-all",60220),replace:v("replace",60221),repoClone:v("repo-clone",60222),repoForcePush:v("repo-force-push",60223),repoPull:v("repo-pull",60224),repoPush:v("repo-push",60225),report:v("report",60226),requestChanges:v("request-changes",60227),rocket:v("rocket",60228),rootFolderOpened:v("root-folder-opened",60229),rootFolder:v("root-folder",60230),rss:v("rss",60231),ruby:v("ruby",60232),saveAll:v("save-all",60233),saveAs:v("save-as",60234),save:v("save",60235),screenFull:v("screen-full",60236),screenNormal:v("screen-normal",60237),searchStop:v("search-stop",60238),server:v("server",60240),settingsGear:v("settings-gear",60241),settings:v("settings",60242),shield:v("shield",60243),smiley:v("smiley",60244),sortPrecedence:v("sort-precedence",60245),splitHorizontal:v("split-horizontal",60246),splitVertical:v("split-vertical",60247),squirrel:v("squirrel",60248),starFull:v("star-full",60249),starHalf:v("star-half",60250),symbolClass:v("symbol-class",60251),symbolColor:v("symbol-color",60252),symbolConstant:v("symbol-constant",60253),symbolEnumMember:v("symbol-enum-member",60254),symbolField:v("symbol-field",60255),symbolFile:v("symbol-file",60256),symbolInterface:v("symbol-interface",60257),symbolKeyword:v("symbol-keyword",60258),symbolMisc:v("symbol-misc",60259),symbolOperator:v("symbol-operator",60260),symbolProperty:v("symbol-property",60261),wrench:v("wrench",60261),wrenchSubaction:v("wrench-subaction",60261),symbolSnippet:v("symbol-snippet",60262),tasklist:v("tasklist",60263),telescope:v("telescope",60264),textSize:v("text-size",60265),threeBars:v("three-bars",60266),thumbsdown:v("thumbsdown",60267),thumbsup:v("thumbsup",60268),tools:v("tools",60269),triangleDown:v("triangle-down",60270),triangleLeft:v("triangle-left",60271),triangleRight:v("triangle-right",60272),triangleUp:v("triangle-up",60273),twitter:v("twitter",60274),unfold:v("unfold",60275),unlock:v("unlock",60276),unmute:v("unmute",60277),unverified:v("unverified",60278),verified:v("verified",60279),versions:v("versions",60280),vmActive:v("vm-active",60281),vmOutline:v("vm-outline",60282),vmRunning:v("vm-running",60283),watch:v("watch",60284),whitespace:v("whitespace",60285),wholeWord:v("whole-word",60286),window:v("window",60287),wordWrap:v("word-wrap",60288),zoomIn:v("zoom-in",60289),zoomOut:v("zoom-out",60290),listFilter:v("list-filter",60291),listFlat:v("list-flat",60292),listSelection:v("list-selection",60293),selection:v("selection",60293),listTree:v("list-tree",60294),debugBreakpointFunctionUnverified:v("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:v("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:v("debug-breakpoint-function-disabled",60296),debugStackframeActive:v("debug-stackframe-active",60297),circleSmallFilled:v("circle-small-filled",60298),debugStackframeDot:v("debug-stackframe-dot",60298),terminalDecorationMark:v("terminal-decoration-mark",60298),debugStackframe:v("debug-stackframe",60299),debugStackframeFocused:v("debug-stackframe-focused",60299),debugBreakpointUnsupported:v("debug-breakpoint-unsupported",60300),symbolString:v("symbol-string",60301),debugReverseContinue:v("debug-reverse-continue",60302),debugStepBack:v("debug-step-back",60303),debugRestartFrame:v("debug-restart-frame",60304),debugAlt:v("debug-alt",60305),callIncoming:v("call-incoming",60306),callOutgoing:v("call-outgoing",60307),menu:v("menu",60308),expandAll:v("expand-all",60309),feedback:v("feedback",60310),gitPullRequestReviewer:v("git-pull-request-reviewer",60310),groupByRefType:v("group-by-ref-type",60311),ungroupByRefType:v("ungroup-by-ref-type",60312),account:v("account",60313),gitPullRequestAssignee:v("git-pull-request-assignee",60313),bellDot:v("bell-dot",60314),debugConsole:v("debug-console",60315),library:v("library",60316),output:v("output",60317),runAll:v("run-all",60318),syncIgnored:v("sync-ignored",60319),pinned:v("pinned",60320),githubInverted:v("github-inverted",60321),serverProcess:v("server-process",60322),serverEnvironment:v("server-environment",60323),pass:v("pass",60324),issueClosed:v("issue-closed",60324),stopCircle:v("stop-circle",60325),playCircle:v("play-circle",60326),record:v("record",60327),debugAltSmall:v("debug-alt-small",60328),vmConnect:v("vm-connect",60329),cloud:v("cloud",60330),merge:v("merge",60331),export:v("export",60332),graphLeft:v("graph-left",60333),magnet:v("magnet",60334),notebook:v("notebook",60335),redo:v("redo",60336),checkAll:v("check-all",60337),pinnedDirty:v("pinned-dirty",60338),passFilled:v("pass-filled",60339),circleLargeFilled:v("circle-large-filled",60340),circleLarge:v("circle-large",60341),circleLargeOutline:v("circle-large-outline",60341),combine:v("combine",60342),gather:v("gather",60342),table:v("table",60343),variableGroup:v("variable-group",60344),typeHierarchy:v("type-hierarchy",60345),typeHierarchySub:v("type-hierarchy-sub",60346),typeHierarchySuper:v("type-hierarchy-super",60347),gitPullRequestCreate:v("git-pull-request-create",60348),runAbove:v("run-above",60349),runBelow:v("run-below",60350),notebookTemplate:v("notebook-template",60351),debugRerun:v("debug-rerun",60352),workspaceTrusted:v("workspace-trusted",60353),workspaceUntrusted:v("workspace-untrusted",60354),workspaceUnknown:v("workspace-unknown",60355),terminalCmd:v("terminal-cmd",60356),terminalDebian:v("terminal-debian",60357),terminalLinux:v("terminal-linux",60358),terminalPowershell:v("terminal-powershell",60359),terminalTmux:v("terminal-tmux",60360),terminalUbuntu:v("terminal-ubuntu",60361),terminalBash:v("terminal-bash",60362),arrowSwap:v("arrow-swap",60363),copy:v("copy",60364),personAdd:v("person-add",60365),filterFilled:v("filter-filled",60366),wand:v("wand",60367),debugLineByLine:v("debug-line-by-line",60368),inspect:v("inspect",60369),layers:v("layers",60370),layersDot:v("layers-dot",60371),layersActive:v("layers-active",60372),compass:v("compass",60373),compassDot:v("compass-dot",60374),compassActive:v("compass-active",60375),azure:v("azure",60376),issueDraft:v("issue-draft",60377),gitPullRequestClosed:v("git-pull-request-closed",60378),gitPullRequestDraft:v("git-pull-request-draft",60379),debugAll:v("debug-all",60380),debugCoverage:v("debug-coverage",60381),runErrors:v("run-errors",60382),folderLibrary:v("folder-library",60383),debugContinueSmall:v("debug-continue-small",60384),beakerStop:v("beaker-stop",60385),graphLine:v("graph-line",60386),graphScatter:v("graph-scatter",60387),pieChart:v("pie-chart",60388),bracketDot:v("bracket-dot",60389),bracketError:v("bracket-error",60390),lockSmall:v("lock-small",60391),azureDevops:v("azure-devops",60392),verifiedFilled:v("verified-filled",60393),newline:v("newline",60394),layout:v("layout",60395),layoutActivitybarLeft:v("layout-activitybar-left",60396),layoutActivitybarRight:v("layout-activitybar-right",60397),layoutPanelLeft:v("layout-panel-left",60398),layoutPanelCenter:v("layout-panel-center",60399),layoutPanelJustify:v("layout-panel-justify",60400),layoutPanelRight:v("layout-panel-right",60401),layoutPanel:v("layout-panel",60402),layoutSidebarLeft:v("layout-sidebar-left",60403),layoutSidebarRight:v("layout-sidebar-right",60404),layoutStatusbar:v("layout-statusbar",60405),layoutMenubar:v("layout-menubar",60406),layoutCentered:v("layout-centered",60407),target:v("target",60408),indent:v("indent",60409),recordSmall:v("record-small",60410),errorSmall:v("error-small",60411),terminalDecorationError:v("terminal-decoration-error",60411),arrowCircleDown:v("arrow-circle-down",60412),arrowCircleLeft:v("arrow-circle-left",60413),arrowCircleRight:v("arrow-circle-right",60414),arrowCircleUp:v("arrow-circle-up",60415),layoutSidebarRightOff:v("layout-sidebar-right-off",60416),layoutPanelOff:v("layout-panel-off",60417),layoutSidebarLeftOff:v("layout-sidebar-left-off",60418),blank:v("blank",60419),heartFilled:v("heart-filled",60420),map:v("map",60421),mapHorizontal:v("map-horizontal",60421),foldHorizontal:v("fold-horizontal",60421),mapFilled:v("map-filled",60422),mapHorizontalFilled:v("map-horizontal-filled",60422),foldHorizontalFilled:v("fold-horizontal-filled",60422),circleSmall:v("circle-small",60423),bellSlash:v("bell-slash",60424),bellSlashDot:v("bell-slash-dot",60425),commentUnresolved:v("comment-unresolved",60426),gitPullRequestGoToChanges:v("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:v("git-pull-request-new-changes",60428),searchFuzzy:v("search-fuzzy",60429),commentDraft:v("comment-draft",60430),send:v("send",60431),sparkle:v("sparkle",60432),insert:v("insert",60433),mic:v("mic",60434),thumbsdownFilled:v("thumbsdown-filled",60435),thumbsupFilled:v("thumbsup-filled",60436),coffee:v("coffee",60437),snake:v("snake",60438),game:v("game",60439),vr:v("vr",60440),chip:v("chip",60441),piano:v("piano",60442),music:v("music",60443),micFilled:v("mic-filled",60444),repoFetch:v("repo-fetch",60445),copilot:v("copilot",60446),lightbulbSparkle:v("lightbulb-sparkle",60447),robot:v("robot",60448),sparkleFilled:v("sparkle-filled",60449),diffSingle:v("diff-single",60450),diffMultiple:v("diff-multiple",60451),surroundWith:v("surround-with",60452),share:v("share",60453),gitStash:v("git-stash",60454),gitStashApply:v("git-stash-apply",60455),gitStashPop:v("git-stash-pop",60456),vscode:v("vscode",60457),vscodeInsiders:v("vscode-insiders",60458),codeOss:v("code-oss",60459),runCoverage:v("run-coverage",60460),runAllCoverage:v("run-all-coverage",60461),coverage:v("coverage",60462),githubProject:v("github-project",60463),mapVertical:v("map-vertical",60464),foldVertical:v("fold-vertical",60464),mapVerticalFilled:v("map-vertical-filled",60465),foldVerticalFilled:v("fold-vertical-filled",60465),goToSearch:v("go-to-search",60466),percentage:v("percentage",60467),sortPercentage:v("sort-percentage",60467),attach:v("attach",60468),goToEditingSession:v("go-to-editing-session",60469),editSession:v("edit-session",60470),codeReview:v("code-review",60471),copilotWarning:v("copilot-warning",60472),python:v("python",60473),copilotLarge:v("copilot-large",60474),copilotWarningLarge:v("copilot-warning-large",60475),keyboardTab:v("keyboard-tab",60476),copilotBlocked:v("copilot-blocked",60477),copilotNotConnected:v("copilot-not-connected",60478),flag:v("flag",60479),lightbulbEmpty:v("lightbulb-empty",60480),symbolMethodArrow:v("symbol-method-arrow",60481),copilotUnavailable:v("copilot-unavailable",60482),repoPinned:v("repo-pinned",60483),keyboardTabAbove:v("keyboard-tab-above",60484),keyboardTabBelow:v("keyboard-tab-below",60485),gitPullRequestDone:v("git-pull-request-done",60486),mcp:v("mcp",60487),extensionsLarge:v("extensions-large",60488),layoutPanelDock:v("layout-panel-dock",60489),layoutSidebarLeftDock:v("layout-sidebar-left-dock",60490),layoutSidebarRightDock:v("layout-sidebar-right-dock",60491),copilotInProgress:v("copilot-in-progress",60492),copilotError:v("copilot-error",60493),copilotSuccess:v("copilot-success",60494),chatSparkle:v("chat-sparkle",60495),searchSparkle:v("search-sparkle",60496),editSparkle:v("edit-sparkle",60497),copilotSnooze:v("copilot-snooze",60498),sendToRemoteAgent:v("send-to-remote-agent",60499),commentDiscussionSparkle:v("comment-discussion-sparkle",60500),chatSparkleWarning:v("chat-sparkle-warning",60501),chatSparkleError:v("chat-sparkle-error",60502),collection:v("collection",60503),newCollection:v("new-collection",60504),thinking:v("thinking",60505),build:v("build",60506),commentDiscussionQuote:v("comment-discussion-quote",60507),cursor:v("cursor",60508),eraser:v("eraser",60509),fileText:v("file-text",60510),quotes:v("quotes",60512),rename:v("rename",60513),runWithDeps:v("run-with-deps",60514),debugConnected:v("debug-connected",60515),strikethrough:v("strikethrough",60516),openInProduct:v("open-in-product",60517),indexZero:v("index-zero",60518),agent:v("agent",60519),editCode:v("edit-code",60520),repoSelected:v("repo-selected",60521),skip:v("skip",60522),mergeInto:v("merge-into",60523),gitBranchChanges:v("git-branch-changes",60524),gitBranchStagedChanges:v("git-branch-staged-changes",60525),gitBranchConflicts:v("git-branch-conflicts",60526),gitBranch:v("git-branch",60527),gitBranchCreate:v("git-branch-create",60527),gitBranchDelete:v("git-branch-delete",60527),searchLarge:v("search-large",60528),terminalGitBash:v("terminal-git-bash",60529),windowActive:v("window-active",60530),forward:v("forward",60531),download:v("download",60532),clockface:v("clockface",60533),unarchive:v("unarchive",60534),sessionInProgress:v("session-in-progress",60535),collectionSmall:v("collection-small",60536),vmSmall:v("vm-small",60537),cloudSmall:v("cloud-small",60538),addSmall:v("add-small",60539),removeSmall:v("remove-small",60540),worktreeSmall:v("worktree-small",60541),worktree:v("worktree",60542),screenCut:v("screen-cut",60543),ask:v("ask",60544),openai:v("openai",60545),claude:v("claude",60546),openInWindow:v("open-in-window",60547),newSession:v("new-session",60548),terminalSecure:v("terminal-secure",60549),chatImport:v("chat-import",60550),chatExport:v("chat-export",60551),shareWindow:v("share-window",60552),circleSlashCompact:v("circle-slash-compact",60553),copilotCompact:v("copilot-compact",60554),folderOpenedCompact:v("folder-opened-compact",60555),folderCompact:v("folder-compact",60556),gearCompact:v("gear-compact",60557),gitBranchCompact:v("git-branch-compact",60558),libraryCompact:v("library-compact",60559),recordKeysCompact:v("record-keys-compact",60560),remoteCompact:v("remote-compact",60561),repoForkedCompact:v("repo-forked-compact",60562),repoCompact:v("repo-compact",60563),shieldCompact:v("shield-compact",60564),sparkleCompact:v("sparkle-compact",60565),symbolColorCompact:v("symbol-color-compact",60566),windowCompact:v("window-compact",60567),errorCompact:v("error-compact",60568),warningCompact:v("warning-compact",60569),passCompact:v("pass-compact",60570),important:v("important",60571),importantCompact:v("important-compact",60572),rocketCompact:v("rocket-compact",60573),unpin:v("unpin",60574),addCompact:v("add-compact",60575),attachCompact:v("attach-compact",60576),beakerCompact:v("beaker-compact",60577),checkCompact:v("check-compact",60578),checklistCompact:v("checklist-compact",60579),chevronDownCompact:v("chevron-down-compact",60580),chevronLeftCompact:v("chevron-left-compact",60581),chevronRightCompact:v("chevron-right-compact",60582),chevronUpCompact:v("chevron-up-compact",60583),circleFilledCompact:v("circle-filled-compact",60584),circleSmallFilledCompact:v("circle-small-filled-compact",60585),closeCompact:v("close-compact",60586),collapseAllCompact:v("collapse-all-compact",60587),commentCompact:v("comment-compact",60588),commentUnresolvedCompact:v("comment-unresolved-compact",60589),debugConnectedCompact:v("debug-connected-compact",60590),debugDisconnectCompact:v("debug-disconnect-compact",60591),editCompact:v("edit-compact",60592),fileMediaCompact:v("file-media-compact",60593),gitFetch:v("git-fetch",60594),lightbulbCompact:v("lightbulb-compact",60595),loadingCompact:v("loading-compact",60596),passFilledCompact:v("pass-filled-compact",60597),projectCompact:v("project-compact",60598),refreshCompact:v("refresh-compact",60599),searchCompact:v("search-compact",60600),sessionInProgressCompact:v("session-in-progress-compact",60601),syncCompact:v("sync-compact",60602),terminalCompact:v("terminal-compact",60603),vmPending:v("vm-pending",60604),worktreeCompact:v("worktree-compact",60605),developerTools:v("developer-tools",60606),cloudCompact:v("cloud-compact",60607),agentCompact:v("agent-compact",60608),askCompact:v("ask-compact",60609),settingsCompact:v("settings-compact",60610),vmCompact:v("vm-compact",60611),runCompact:v("run-compact",60612),gitPullRequestComment:v("git-pull-request-comment",60613),gitPullRequestError:v("git-pull-request-error",60614),rightPanelHide:v("right-panel-hide",60615),rightPanelShow:v("right-panel-show",60616),vscodeInsidersOutline:v("vscode-insiders-outline",60617),vscodeOutline:v("vscode-outline",60618),voiceMode:v("voice-mode",60619),voiceModeCompact:v("voice-mode-compact",60620),micDownload:v("mic-download",60621),micDownloadCompact:v("mic-download-compact",60622),voiceModeDownload:v("voice-mode-download",60623),voiceModeDownloadCompact:v("voice-mode-download-compact",60624),googleGemini:v("google-gemini",60625),kimi:v("kimi",60626),microsoft:v("microsoft",60627),fish1Happy:v("fish1-happy",60628),fish1Neutral:v("fish1-neutral",60629),fish1Sad:v("fish1-sad",60630),fish1VerySad:v("fish1-very-sad",60631),fish2Happy:v("fish2-happy",60632),fish2Neutral:v("fish2-neutral",60633),fish2Sad:v("fish2-sad",60634),fish2VerySad:v("fish2-very-sad",60635),fish3Happy:v("fish3-happy",60636),fish3Neutral:v("fish3-neutral",60637),fish3Sad:v("fish3-sad",60638),fish3VerySad:v("fish3-very-sad",60639),fish4Happy:v("fish4-happy",60640),fish4Neutral:v("fish4-neutral",60641),fish4Sad:v("fish4-sad",60642),fish4VerySad:v("fish4-very-sad",60643),personVoice:v("person-voice",60644),personVoiceCompact:v("person-voice-compact",60645),personVoiceFilled:v("person-voice-filled",60646),personVoiceFilledCompact:v("person-voice-filled-compact",60647),cloudDownloadCompact:v("cloud-download-compact",60648),cloudUploadCompact:v("cloud-upload-compact",60649),micCompact:v("mic-compact",60650),arrowUpCompact:v("arrow-up-compact",60651),xai:v("xai",60652),arrowCircleUpSparkle:v("arrow-circle-up-sparkle",60653),closeSmall:v("close-small",60654),bookCompact:v("book-compact",60655),micOff:v("mic-off",60656),micOffCompact:v("mic-off-compact",60657),copilotDot:v("copilot-dot",60658),copilotDotCompact:v("copilot-dot-compact",60659)};var X3={dialogError:v("dialog-error","error"),dialogWarning:v("dialog-warning","warning"),dialogInfo:v("dialog-info","info"),dialogClose:v("dialog-close","close"),treeItemExpanded:v("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:v("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:v("tree-filter-on-type-off","list-selection"),treeFilterClear:v("tree-filter-clear","close"),treeItemLoading:v("tree-item-loading","loading"),menuSelection:v("menu-selection","check"),menuSubmenu:v("menu-submenu","chevron-right"),menuBarMore:v("menubar-more","more"),scrollbarButtonLeft:v("scrollbar-button-left","triangle-left"),scrollbarButtonRight:v("scrollbar-button-right","triangle-right"),scrollbarButtonUp:v("scrollbar-button-up","triangle-up"),scrollbarButtonDown:v("scrollbar-button-down","triangle-down"),toolBarMore:v("toolbar-more","more"),quickInputBack:v("quick-input-back","arrow-left"),dropDownButton:v("drop-down-button",60084),symbolCustomColor:v("symbol-customcolor",60252),exportIcon:v("export",60332),workspaceUnspecified:v("workspace-unspecified",60355),newLine:v("newline",60394),thumbsDownFilled:v("thumbsdown-filled",60435),thumbsUpFilled:v("thumbsup-filled",60436),gitFetch:v("git-fetch",60445),lightbulbSparkleAutofix:v("lightbulb-sparkle-autofix",60447),debugBreakpointPending:v("debug-breakpoint-pending",60377),chatImport:v("chat-import",60550),chatExport:v("chat-export",60551)},de={...mV,...X3};var am;(t=>{function i(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}t.isThemeColor=i})(am||={});var ct;(x=>{x.iconNameSegment="[A-Za-z0-9]+",x.iconNameExpression="[A-Za-z0-9-]+",x.iconModifierExpression="~[A-Za-z]+",x.iconNameCharacter="[A-Za-z0-9~-]";let o=new RegExp(`^(${x.iconNameExpression})(${x.iconModifierExpression})?$`);function r(E){let w=o.exec(E.id);if(!w)return r(de.error);let[,R,L]=w,U=["codicon","codicon-"+R];return L&&U.push("codicon-modifier-"+L.substring(1)),U}x.asClassNameArray=r;function s(E){return r(E).join(" ")}x.asClassName=s;function a(E){return"."+r(E).join(".")}x.asCSSSelector=a;function l(E){return!!E&&typeof E=="object"&&typeof E.id=="string"&&(typeof E.color>"u"||am.isThemeColor(E.color))}x.isThemeIcon=l;let d=new RegExp(`^\\$\\((${x.iconNameExpression}(?:${x.iconModifierExpression})?)\\)$`);function c(E){let w=d.exec(E);if(!w)return;let[,R]=w;return{id:R}}x.fromString=c;function u(E){return{id:E}}x.fromId=u;function m(E,w){let R=E.id,L=R.lastIndexOf("~");return L!==-1&&(R=R.substring(0,L)),w&&(R=`${R}~${w}`),{id:R}}x.modify=m;function g(E){let w=E.id.lastIndexOf("~");if(w!==-1)return E.id.substring(w+1)}x.getModifier=g;function h(E,w){return E.id===w.id&&E.color?.id===w.color?.id}x.isEqual=h;function f(E){return E?.id===de.file.id}x.isFile=f;function I(E){return E?.id===de.folder.id}x.isFolder=I})(ct||={});var rM=new RegExp(`\\$\\(${ct.iconNameExpression}(?:${ct.iconModifierExpression})?\\)`,"g"),Z3=new RegExp(`(\\\\)?${rM.source}`,"g");function gV(i){return i.replace(Z3,(t,e)=>e?t:`\\${t}`)}var $de=new RegExp(`\\\\${rM.source}`,"g");var zde=new RegExp(`(\\s)?(\\\\)?${rM.source}(\\s)?`,"g");var qde=new RegExp(`\\$\\(${ct.iconNameCharacter}+\\)`,"g");var _t=class i{static lift(t){let e=new i(t.value,t);return e.uris=t.uris,e.baseUri=t.baseUri?y.revive(t.baseUri):void 0,e}constructor(t="",e=!1){if(this.value=t,typeof this.value!="string")throw $e("value");typeof e=="boolean"?(this.isTrusted=e,this.supportThemeIcons=!1,this.supportHtml=!1,this.supportAlertSyntax=!1):(this.isTrusted=e.isTrusted??void 0,this.supportThemeIcons=e.supportThemeIcons??!1,this.supportHtml=e.supportHtml??!1,this.supportAlertSyntax=e.supportAlertSyntax??!1)}appendText(t,e=0){return this.value+=e6(this.supportThemeIcons?gV(t):t).replace(/([ \t]+)/g,(n,o)=>"&nbsp;".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,e===1?`\\
`:`

`),this}appendMarkdown(t){return this.value+=t,this}appendCodeblock(t,e){return this.value+=`
${t6(e,t)}
`,this}appendLink(t,e,n){return this.value+="[",this.value+=this._escape(e,"]"),this.value+="](",this.value+=this._escape(String(t),")"),n&&(this.value+=` "${this._escape(this._escape(n,'"'),")")}"`),this.value+=")",this}_escape(t,e){let n=new RegExp(nr(e),"g");return t.replace(n,(o,r)=>t.charAt(r-1)!=="\\"?`\\${o}`:o)}};function qo(i){return i instanceof _t?!0:i&&typeof i=="object"?typeof i.value=="string"&&(typeof i.isTrusted=="boolean"||typeof i.isTrusted=="object"||i.isTrusted===void 0)&&(typeof i.supportThemeIcons=="boolean"||i.supportThemeIcons===void 0)&&(typeof i.supportAlertSyntax=="boolean"||i.supportAlertSyntax===void 0):!1}function e6(i){return i.replace(/[\\`*_{}[\]()#+!~]/g,"\\$&").replace(/^([ \t]*)-/gm,"$1\\-")}function t6(i,t){let e=i.match(/^`+/gm)?.reduce((o,r)=>o.length>r.length?o:r).length??0,n=e>=3?e+1:3;return[`${"`".repeat(n)}${t}`,i,`${"`".repeat(n)}`].join(`
`)}function iM(i){let t=Math.max(0,...(i.match(/`+/g)??[]).map(r=>r.length)),e="`".repeat(t+1),o=i.startsWith("`")||i.endsWith("`")?` ${i} `:i;return`${e}${o}${e}`}function fV(i){let t=[],e=i.split("|").map(o=>o.trim());i=e[0];let n=e[1];if(n){let o=/height=(\d+)/.exec(n),r=/width=(\d+)/.exec(n),s=o?o[1]:"",a=r?r[1]:"",l=isFinite(parseInt(a)),d=isFinite(parseInt(s));l&&t.push(`width="${a}"`),d&&t.push(`height="${s}"`)}return{href:i,dimensions:t}}function lM(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tu=lM();function xV(i){tu=i}var SV=/[&<>"']/,o6=new RegExp(SV.source,"g"),CV=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,r6=new RegExp(CV.source,"g"),i6={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hV=i=>i6[i];function Fr(i,t){if(t){if(SV.test(i))return i.replace(o6,hV)}else if(CV.test(i))return i.replace(r6,hV);return i}var s6=/(^|[^\[])\^/g;function nn(i,t){let e=typeof i=="string"?i:i.source;t=t||"";let n={replace:(o,r)=>{let s=typeof r=="string"?r:r.source;return s=s.replace(s6,"$1"),e=e.replace(o,s),n},getRegex:()=>new RegExp(e,t)};return n}function vV(i){try{i=encodeURI(i).replace(/%25/g,"%")}catch{return null}return i}var ny={exec:()=>null};function yV(i,t){let e=i.replace(/\|/g,(r,s,a)=>{let l=!1,d=s;for(;--d>=0&&a[d]==="\\";)l=!l;return l?"|":" |"}),n=e.split(/ \|/),o=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(/\\\|/g,"|");return n}function ey(i,t,e){let n=i.length;if(n===0)return"";let o=0;for(;o<n;){let r=i.charAt(n-o-1);if(r===t&&!e)o++;else if(r!==t&&e)o++;else break}return i.slice(0,n-o)}function a6(i,t){if(i.indexOf(t[1])===-1)return-1;let e=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===t[0])e++;else if(i[n]===t[1]&&(e--,e<0))return n;return-1}function bV(i,t,e,n){let o=t.href,r=t.title?Fr(t.title):null,s=i[1].replace(/\\([\[\]])/g,"$1");if(i[0].charAt(0)!=="!"){n.state.inLink=!0;let a={type:"link",raw:e,href:o,title:r,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,a}return{type:"image",raw:e,href:o,title:r,text:Fr(s)}}function l6(i,t){let e=i.match(/^(\s+)(?:```)/);if(e===null)return t;let n=e[1];return t.split(`
`).map(o=>{let r=o.match(/^\s+/);if(r===null)return o;let[s]=r;return s.length>=n.length?o.slice(n.length):o}).join(`
`)}var dm=class{options;rules;lexer;constructor(t){this.options=t||tu}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ey(n,`
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],o=l6(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){let o=ey(n,"#");(this.options.pedantic||!o||/ $/.test(o))&&(n=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:ey(e[0],`
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=ey(e[0],`
`).split(`
`),o="",r="",s=[];for(;n.length>0;){let a=!1,l=[],d;for(d=0;d<n.length;d++)if(/^ {0,3}>/.test(n[d]))l.push(n[d]),a=!0;else if(!a)l.push(n[d]);else break;n=n.slice(d);let c=l.join(`
`),u=c.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
${c}`:c,r=r?`${r}
${u}`:u;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=m,n.length===0)break;let g=s[s.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let h=g,f=h.raw+`
`+n.join(`
`),I=this.blockquote(f);s[s.length-1]=I,o=o.substring(0,o.length-h.raw.length)+I.raw,r=r.substring(0,r.length-h.text.length)+I.text;break}else if(g?.type==="list"){let h=g,f=h.raw+`
`+n.join(`
`),I=this.list(f);s[s.length-1]=I,o=o.substring(0,o.length-g.raw.length)+I.raw,r=r.substring(0,r.length-h.raw.length)+I.raw,n=f.substring(s[s.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:o,tokens:s,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),o=n.length>1,r={type:"list",raw:"",ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]};n=o?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=o?n:"[*+-]");let s=new RegExp(`^( {0,3}${n})((?:[	 ][^\\n]*)?(?:\\n|$))`),a=!1;for(;t;){let l=!1,d="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let u=e[2].split(`
`,1)[0].replace(/^\t+/,x=>" ".repeat(3*x.length)),m=t.split(`
`,1)[0],g=!u.trim(),h=0;if(this.options.pedantic?(h=2,c=u.trimStart()):g?h=e[1].length+1:(h=e[2].search(/[^ ]/),h=h>4?1:h,c=u.slice(h),h+=e[1].length),g&&/^ *$/.test(m)&&(d+=m+`
`,t=t.substring(m.length+1),l=!0),!l){let x=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),E=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),R=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;t;){let L=t.split(`
`,1)[0];if(m=L,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),w.test(m)||R.test(m)||x.test(m)||E.test(t))break;if(m.search(/[^ ]/)>=h||!m.trim())c+=`
`+m.slice(h);else{if(g||u.search(/[^ ]/)>=4||w.test(u)||R.test(u)||E.test(u))break;c+=`
`+m}!g&&!m.trim()&&(g=!0),d+=L+`
`,t=t.substring(L.length+1),u=m.slice(h)}}r.loose||(a?r.loose=!0:/\n *\n *$/.test(d)&&(a=!0));let f=null,I;this.options.gfm&&(f=/^\[[ xX]\] /.exec(c),f&&(I=f[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:d,task:!!f,checked:I,loose:!1,text:c,tokens:[]}),r.raw+=d}r.items[r.items.length-1].raw=r.items[r.items.length-1].raw.trimEnd(),r.items[r.items.length-1].text=r.items[r.items.length-1].text.trimEnd(),r.raw=r.raw.trimEnd();for(let l=0;l<r.items.length;l++)if(this.lexer.state.top=!1,r.items[l].tokens=this.lexer.blockTokens(r.items[l].text,[]),!r.loose){let d=r.items[l].tokens.filter(u=>u.type==="space"),c=d.length>0&&d.some(u=>/\n.*\n/.test(u.raw));r.loose=c}if(r.loose)for(let l=0;l<r.items.length;l++)r.items[l].loose=!0;return r}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(/\s+/g," "),o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:o,title:r}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!/[:|]/.test(e[2]))return;let n=yV(e[1]),o=e[2].replace(/^\||\| *$/g,"").split("|"),r=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===o.length){for(let a of o)/^ *-+: *$/.test(a)?s.align.push("right"):/^ *:-+: *$/.test(a)?s.align.push("center"):/^ *:-+ *$/.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(let a of r)s.rows.push(yV(a,s.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[d]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:Fr(e[1])}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let s=ey(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=a6(e[2],"()");if(s>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let o=e[2],r="";if(this.options.pedantic){let s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);s&&(o=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(n)?o=o.slice(1):o=o.slice(1,-1)),bV(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let o=(n[2]||n[1]).replace(/\s+/g," "),r=e[o.toLowerCase()];if(!r){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return bV(n,r,n[0],this.lexer)}}emStrong(t,e,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...o[0]].length-1,a,l,d=s,c=0,u=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(o=u.exec(e))!=null;){if(a=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!a)continue;if(l=[...a].length,o[3]||o[4]){d+=l;continue}else if((o[5]||o[6])&&s%3&&!((s+l)%3)){c+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+c);let m=[...o[0]][0].length,g=t.slice(0,s+o.index+m+l);if(Math.min(s,l)%2){let f=g.slice(1,-1);return{type:"em",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}let h=g.slice(2,-2);return{type:"strong",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," "),o=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return o&&r&&(n=n.substring(1,n.length-1)),n=Fr(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,o;return e[2]==="@"?(n=Fr(e[1]),o="mailto:"+n):(n=Fr(e[1]),o=n),{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,o;if(e[2]==="@")n=Fr(e[0]),o="mailto:"+n;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);n=Fr(e[0]),e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n;return this.lexer.state.inRawBlock?n=e[0]:n=Fr(e[0]),{type:"text",raw:e[0],text:n}}}},d6=/^(?: *(?:\n|$))+/,c6=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,u6=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ry=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,p6=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,TV=/(?:[*+-]|\d{1,9}[.)])/,EV=nn(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,TV).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),dM=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,m6=/^[^\n]+/,cM=/(?!\s*\])(?:\\.|[^\[\]\\])+/,g6=nn(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",cM).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),f6=nn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,TV).getRegex(),wS="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",uM=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,h6=nn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",uM).replace("tag",wS).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wV=nn(dM).replace("hr",ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wS).getRegex(),v6=nn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wV).getRegex(),pM={blockquote:v6,code:c6,def:g6,fences:u6,heading:p6,hr:ry,html:h6,lheading:EV,list:f6,newline:d6,paragraph:wV,table:ny,text:m6},IV=nn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wS).getRegex(),y6={...pM,table:IV,paragraph:nn(dM).replace("hr",ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",IV).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",wS).getRegex()},b6={...pM,html:nn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",uM).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ny,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nn(dM).replace("hr",ry).replace("heading",` *#{1,6} *[^
]`).replace("lheading",EV).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},kV=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,I6=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,PV=/^( {2,}|\\)\n(?!\s*$)/,x6=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,iy="\\p{P}\\p{S}",S6=nn(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,iy).getRegex(),C6=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,T6=nn(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,iy).getRegex(),E6=nn("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,iy).getRegex(),w6=nn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,iy).getRegex(),k6=nn(/\\([punct])/,"gu").replace(/punct/g,iy).getRegex(),P6=nn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_6=nn(uM).replace("(?:-->|$)","-->").getRegex(),R6=nn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_6).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ES=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D6=nn(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ES).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_V=nn(/^!?\[(label)\]\[(ref)\]/).replace("label",ES).replace("ref",cM).getRegex(),RV=nn(/^!?\[(ref)\](?:\[\])?/).replace("ref",cM).getRegex(),A6=nn("reflink|nolink(?!\\()","g").replace("reflink",_V).replace("nolink",RV).getRegex(),mM={_backpedal:ny,anyPunctuation:k6,autolink:P6,blockSkip:C6,br:PV,code:I6,del:ny,emStrongLDelim:T6,emStrongRDelimAst:E6,emStrongRDelimUnd:w6,escape:kV,link:D6,nolink:RV,punctuation:S6,reflink:_V,reflinkSearch:A6,tag:R6,text:x6,url:ny},M6={...mM,link:nn(/^!?\[(label)\]\((.*?)\)/).replace("label",ES).getRegex(),reflink:nn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ES).getRegex()},sM={...mM,escape:nn(kV).replace("])","~|])").getRegex(),url:nn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},L6={...sM,br:nn(PV).replace("{2,}","*").getRegex(),text:nn(sM.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},TS={normal:pM,gfm:y6,pedantic:b6},ty={normal:mM,gfm:sM,breaks:L6,pedantic:M6},Aa=class i{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||tu,this.options.tokenizer=this.options.tokenizer||new dm,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={block:TS.normal,inline:ty.normal};this.options.pedantic?(e.block=TS.pedantic,e.inline=ty.pedantic):this.options.gfm&&(e.block=TS.gfm,this.options.breaks?e.inline=ty.breaks:e.inline=ty.gfm),this.tokenizer.rules=e}static get rules(){return{block:TS,inline:ty}}static lex(t,e){return new i(e).lex(t)}static lexInline(t,e){return new i(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
`),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let n=this.inlineQueue[e];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],n=!1){this.options.pedantic?t=t.replace(/\t/g,"    ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(a,l,d)=>l+"    ".repeat(d.length));let o,r,s;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(o=a.call({lexer:this},t,e))?(t=t.substring(o.raw.length),e.push(o),!0):!1))){if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length),o.raw.length===1&&e.length>0?e[e.length-1].raw+=`
`:e.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length),r=e[e.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+o.raw,r.text+=`
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length),r=e[e.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+o.raw,r.text+=`
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),e.push(o);continue}if(s=t,this.options.extensions&&this.options.extensions.startBlock){let a=1/0,l=t.slice(1),d;this.options.extensions.startBlock.forEach(c=>{d=c.call({lexer:this},l),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(s=t.substring(0,a+1))}if(this.state.top&&(o=this.tokenizer.paragraph(s))){r=e[e.length-1],n&&r?.type==="paragraph"?(r.raw+=`
`+o.raw,r.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(o),n=s.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length),r=e[e.length-1],r&&r.type==="text"?(r.raw+=`
`+o.raw,r.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(o);continue}if(t){let a="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let n,o,r,s=t,a,l,d;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(n=c.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),o=e[e.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),o=e[e.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(n=this.tokenizer.emStrong(t,s,d)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),e.push(n);continue}if(r=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0,u=t.slice(1),m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},u),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(r=t.substring(0,c+1))}if(n=this.tokenizer.inlineText(r)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),l=!0,o=e[e.length-1],o&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):e.push(n);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return e}},cm=class{options;parser;constructor(t){this.options=t||tu}space(t){return""}code({text:t,lang:e,escaped:n}){let o=(e||"").match(/^\S*/)?.[0],r=t.replace(/\n$/,"")+`
`;return o?'<pre><code class="language-'+Fr(o)+'">'+(n?r:Fr(r,!0))+`</code></pre>
`:"<pre><code>"+(n?r:Fr(r,!0))+`</code></pre>
`}blockquote({tokens:t}){return`<blockquote>
${this.parser.parse(t)}</blockquote>
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
`}hr(t){return`<hr>
`}list(t){let e=t.ordered,n=t.start,o="";for(let a=0;a<t.items.length;a++){let l=t.items[a];o+=this.listitem(l)}let r=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+r+s+`>
`+o+"</"+r+`>
`}listitem(t){let e="";if(t.task){let n=this.checkbox({checked:!!t.checked});t.loose?t.tokens.length>0&&t.tokens[0].type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
`}table(t){let e="",n="";for(let r=0;r<t.header.length;r++)n+=this.tablecell(t.header[r]);e+=this.tablerow({text:n});let o="";for(let r=0;r<t.rows.length;r++){let s=t.rows[r];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);o+=this.tablerow({text:n})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+o+`</table>
`}tablerow({text:t}){return`<tr>
${t}</tr>
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${t}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let o=this.parser.parseInline(n),r=vV(t);if(r===null)return o;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+e+'"'),s+=">"+o+"</a>",s}image({href:t,title:e,text:n}){let o=vV(t);if(o===null)return n;t=o;let r=`<img src="${t}" alt="${n}"`;return e&&(r+=` title="${e}"`),r+=">",r}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):t.text}},oy=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Ma=class i{options;renderer;textRenderer;constructor(t){this.options=t||tu,this.options.renderer=this.options.renderer||new cm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oy}static parse(t,e){return new i(e).parse(t)}static parseInline(t,e){return new i(e).parseInline(t)}parse(t,e=!0){let n="";for(let o=0;o<t.length;o++){let r=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){let a=r,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=l||"";continue}}let s=r;switch(s.type){case"space":{n+=this.renderer.space(s);continue}case"hr":{n+=this.renderer.hr(s);continue}case"heading":{n+=this.renderer.heading(s);continue}case"code":{n+=this.renderer.code(s);continue}case"table":{n+=this.renderer.table(s);continue}case"blockquote":{n+=this.renderer.blockquote(s);continue}case"list":{n+=this.renderer.list(s);continue}case"html":{n+=this.renderer.html(s);continue}case"paragraph":{n+=this.renderer.paragraph(s);continue}case"text":{let a=s,l=this.renderer.text(a);for(;o+1<t.length&&t[o+1].type==="text";)a=t[++o],l+=`
`+this.renderer.text(a);e?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):n+=l;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,e){e=e||this.renderer;let n="";for(let o=0;o<t.length;o++){let r=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){let a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=a||"";continue}}let s=r;switch(s.type){case"escape":{n+=e.text(s);break}case"html":{n+=e.html(s);break}case"link":{n+=e.link(s);break}case"image":{n+=e.image(s);break}case"strong":{n+=e.strong(s);break}case"em":{n+=e.em(s);break}case"codespan":{n+=e.codespan(s);break}case"br":{n+=e.br(s);break}case"del":{n+=e.del(s);break}case"text":{n+=e.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},lm=class{options;constructor(t){this.options=t||tu}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}},aM=class{defaults=lM();options=this.setOptions;parse=this.parseMarkdown(Aa.lex,Ma.parse);parseInline=this.parseMarkdown(Aa.lexInline,Ma.parseInline);Parser=Ma;Renderer=cm;TextRenderer=oy;Lexer=Aa;Tokenizer=dm;Hooks=lm;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let o of t)switch(n=n.concat(e.call(this,o)),o.type){case"table":{let r=o;for(let s of r.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of r.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=o;n=n.concat(this.walkTokens(r.items,e));break}default:{let r=o;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(s=>{let a=r[s].flat(1/0);n=n.concat(this.walkTokens(a,e))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=e.renderers[r.name];s?e.renderers[r.name]=function(...a){let l=r.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[r.level];s?s.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),o.extensions=e),n.renderer){let r=this.defaults.renderer||new cm(this.defaults);for(let s in n.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,l=n.renderer[a],d=r[a];r[a]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u||""}}o.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new dm(this.defaults);for(let s in n.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,l=n.tokenizer[a],d=r[a];r[a]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u}}o.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new lm;for(let s in n.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;let a=s,l=n.hooks[a],d=r[a];lm.passThroughHooks.has(s)?r[a]=c=>{if(this.defaults.async)return Promise.resolve(l.call(r,c)).then(m=>d.call(r,m));let u=l.call(r,c);return d.call(r,u)}:r[a]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=d.apply(r,c)),u}}o.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,s=n.walkTokens;o.walkTokens=function(a){let l=[];return l.push(s.call(this,a)),r&&(l=l.concat(r.call(this,a))),l}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Aa.lex(t,e??this.defaults)}parser(t,e){return Ma.parse(t,e??this.defaults)}parseMarkdown(t,e){return(o,r)=>{let s={...r},a={...this.defaults,...s},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(o):o).then(d=>t(d,a)).then(d=>a.hooks?a.hooks.processAllTokens(d):d).then(d=>a.walkTokens?Promise.all(this.walkTokens(d,a.walkTokens)).then(()=>d):d).then(d=>e(d,a)).then(d=>a.hooks?a.hooks.postprocess(d):d).catch(l);try{a.hooks&&(o=a.hooks.preprocess(o));let d=t(o,a);a.hooks&&(d=a.hooks.processAllTokens(d)),a.walkTokens&&this.walkTokens(d,a.walkTokens);let c=e(d,a);return a.hooks&&(c=a.hooks.postprocess(c)),c}catch(d){return l(d)}}}onError(t,e){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,t){let o="<p>An error occurred:</p><pre>"+Fr(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},eu=new aM;function Qt(i,t){return eu.parse(i,t)}Qt.options=Qt.setOptions=function(i){return eu.setOptions(i),Qt.defaults=eu.defaults,xV(Qt.defaults),Qt};Qt.getDefaults=lM;Qt.defaults=tu;Qt.use=function(...i){return eu.use(...i),Qt.defaults=eu.defaults,xV(Qt.defaults),Qt};Qt.walkTokens=function(i,t){return eu.walkTokens(i,t)};Qt.parseInline=eu.parseInline;Qt.Parser=Ma;Qt.parser=Ma.parse;Qt.Renderer=cm;Qt.TextRenderer=oy;Qt.Lexer=Aa;Qt.lexer=Aa.lex;Qt.Tokenizer=dm;Qt.Hooks=lm;Qt.parse=Qt;var ece=Qt.options,tce=Qt.setOptions,nce=Qt.use,oce=Qt.walkTokens,rce=Qt.parseInline;var ice=Ma.parse,sce=Aa.lex;var Tr=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list",html:"text/html"}),N6={".css":"text/css",".csv":"text/csv",".htm":"text/html",".html":"text/html",".ics":"text/calendar",".js":"text/javascript",".mjs":"text/javascript",".txt":"text/plain",".xml":"text/xml"},U6={".aac":"audio/x-aac",".avi":"video/x-msvideo",".avif":"image/avif",".bmp":"image/bmp",".flv":"video/x-flv",".gif":"image/gif",".ico":"image/x-icon",".jpe":["image/jpg","image/jpeg"],".jpeg":["image/jpg","image/jpeg"],".jpg":["image/jpg","image/jpeg"],".m1v":"video/mpeg",".m2a":"audio/mpeg",".m2v":"video/mpeg",".m3a":"audio/mpeg",".mid":"audio/midi",".midi":"audio/midi",".mk3d":"video/x-matroska",".mks":"video/x-matroska",".mkv":"video/x-matroska",".mov":"video/quicktime",".movie":"video/x-sgi-movie",".mp2":"audio/mpeg",".mp2a":"audio/mpeg",".mp3":"audio/mpeg",".mp4":"video/mp4",".mp4a":"audio/mp4",".mp4v":"video/mp4",".mpe":"video/mpeg",".mpeg":"video/mpeg",".mpg":"video/mpeg",".mpg4":"video/mp4",".mpga":"audio/mpeg",".oga":"audio/ogg",".ogg":"audio/ogg",".opus":"audio/opus",".ogv":"video/ogg",".png":"image/png",".psd":"image/vnd.adobe.photoshop",".qt":"video/quicktime",".spx":"audio/ogg",".svg":"image/svg+xml",".tga":"image/x-tga",".tif":"image/tiff",".tiff":"image/tiff",".wav":"audio/x-wav",".webm":"video/webm",".webp":"image/webp",".wma":"audio/x-ms-wma",".wmv":"video/x-ms-wmv",".woff":"application/font-woff"};function kS(i){for(let t of[N6,U6])for(let e in t){let n=t[e];if(Array.isArray(n)?n.includes(i):n===i)return e}}var F6=/^(.+)\/(.+?)(;.+)?$/;function gM(i,t){let e=F6.exec(i);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:t?void 0:i}function PS(i){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(i)}var Ko=Symbol("unset"),_S=class{constructor(){this.root=new sy;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||Mt.empty()}get entries(){return this.root.children?.entries()||Mt.empty()}insert(t,e,n){this.opNode(t,o=>o._value=e,n)}mutate(t,e){this.opNode(t,n=>n._value=e(n._value===Ko?void 0:n._value))}mutatePath(t,e){this.opNode(t,()=>{},n=>e(n))}delete(t){let e=this.getPathToKey(t);if(!e)return;let n=e.length-1,o=e[n].node._value;if(o!==Ko){for(this._size--,e[n].node._value=Ko;n>0;n--){let{node:r,part:s}=e[n];if(r.children?.size||r._value!==Ko)break;e[n-1].node.children.delete(s)}return o}}*deleteRecursive(t){let e=this.getPathToKey(t);if(!e)return;let n=e[e.length-1].node;for(let o=e.length-1;o>0;o--){let r=e[o-1];if(r.node.children.delete(e[o].part),r.node.children.size>0||r.node._value!==Ko)break}for(let o of DV(n))o._value!==Ko&&(this._size--,yield o._value);n===this.root&&(this.root._value=Ko,this.root.children=void 0)}find(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return;e=o}return e._value===Ko?void 0:e._value}hasKeyOrParent(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;if(o._value!==Ko)return!0;e=o}return!1}hasKeyOrChildren(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;e=o}return!0}hasKey(t){let e=this.root;for(let n of t){let o=e.children?.get(n);if(!o)return!1;e=o}return e._value!==Ko}getPathToKey(t){let e=[{part:"",node:this.root}],n=0;for(let o of t){let r=e[n].node.children?.get(o);if(!r)return;e.push({part:o,node:r}),n++}return e}opNode(t,e,n){let o=this.root;for(let a of t){if(o.children)if(o.children.has(a))o=o.children.get(a);else{let l=new sy;o.children.set(a,l),o=l}else{let l=new sy;o.children=new Map([[a,l]]),o=l}n?.(o)}let r=o._value===Ko?0:1;e(o);let s=o._value===Ko?0:1;this._size+=s-r}*values(){for(let{_value:t}of DV(this.root))t!==Ko&&(yield t)}};function*DV(i){let t=[i];for(;t.length>0;){let e=t.pop();if(yield e,e.children)for(let n of e.children.values())t.push(n)}}var sy=class{constructor(){this._value=Ko}get value(){return this._value===Ko?void 0:this._value}set value(t){this._value=t===void 0?Ko:t}};var Un=class i{constructor(t,e){this.lineNumber=t,this.column=e}with(t=this.lineNumber,e=this.column){return t===this.lineNumber&&e===this.column?this:new i(t,e)}delta(t=0,e=0){return this.with(Math.max(1,this.lineNumber+t),Math.max(1,this.column+e))}equals(t){return i.equals(this,t)}static equals(t,e){return!t&&!e?!0:!!t&&!!e&&t.lineNumber===e.lineNumber&&t.column===e.column}isBefore(t){return i.isBefore(this,t)}static isBefore(t,e){return t.lineNumber<e.lineNumber?!0:e.lineNumber<t.lineNumber?!1:t.column<e.column}isBeforeOrEqual(t){return i.isBeforeOrEqual(this,t)}static isBeforeOrEqual(t,e){return t.lineNumber<e.lineNumber?!0:e.lineNumber<t.lineNumber?!1:t.column<=e.column}static compare(t,e){let n=t.lineNumber|0,o=e.lineNumber|0;if(n===o){let r=t.column|0,s=e.column|0;return r-s}return n-o}clone(){return new i(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(t){return new i(t.lineNumber,t.column)}static isIPosition(t){return!!t&&typeof t.lineNumber=="number"&&typeof t.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};var ze=class i{constructor(t,e,n,o){t>n||t===n&&e>o?(this.startLineNumber=n,this.startColumn=o,this.endLineNumber=t,this.endColumn=e):(this.startLineNumber=t,this.startColumn=e,this.endLineNumber=n,this.endColumn=o)}isEmpty(){return i.isEmpty(this)}static isEmpty(t){return t.startLineNumber===t.endLineNumber&&t.startColumn===t.endColumn}containsPosition(t){return i.containsPosition(this,t)}static containsPosition(t,e){return!(e.lineNumber<t.startLineNumber||e.lineNumber>t.endLineNumber||e.lineNumber===t.startLineNumber&&e.column<t.startColumn||e.lineNumber===t.endLineNumber&&e.column>t.endColumn)}static strictContainsPosition(t,e){return!(e.lineNumber<t.startLineNumber||e.lineNumber>t.endLineNumber||e.lineNumber===t.startLineNumber&&e.column<=t.startColumn||e.lineNumber===t.endLineNumber&&e.column>=t.endColumn)}containsRange(t){return i.containsRange(this,t)}static containsRange(t,e){return!(e.startLineNumber<t.startLineNumber||e.endLineNumber<t.startLineNumber||e.startLineNumber>t.endLineNumber||e.endLineNumber>t.endLineNumber||e.startLineNumber===t.startLineNumber&&e.startColumn<t.startColumn||e.endLineNumber===t.endLineNumber&&e.endColumn>t.endColumn)}strictContainsRange(t){return i.strictContainsRange(this,t)}static strictContainsRange(t,e){return!(e.startLineNumber<t.startLineNumber||e.endLineNumber<t.startLineNumber||e.startLineNumber>t.endLineNumber||e.endLineNumber>t.endLineNumber||e.startLineNumber===t.startLineNumber&&e.startColumn<=t.startColumn||e.endLineNumber===t.endLineNumber&&e.endColumn>=t.endColumn)}plusRange(t){return i.plusRange(this,t)}static plusRange(t,e){let n,o,r,s;return e.startLineNumber<t.startLineNumber?(n=e.startLineNumber,o=e.startColumn):e.startLineNumber===t.startLineNumber?(n=e.startLineNumber,o=Math.min(e.startColumn,t.startColumn)):(n=t.startLineNumber,o=t.startColumn),e.endLineNumber>t.endLineNumber?(r=e.endLineNumber,s=e.endColumn):e.endLineNumber===t.endLineNumber?(r=e.endLineNumber,s=Math.max(e.endColumn,t.endColumn)):(r=t.endLineNumber,s=t.endColumn),new i(n,o,r,s)}intersectRanges(t){return i.intersectRanges(this,t)}static intersectRanges(t,e){let n=t.startLineNumber,o=t.startColumn,r=t.endLineNumber,s=t.endColumn,a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn;return n<a?(n=a,o=l):n===a&&(o=Math.max(o,l)),r>d?(r=d,s=c):r===d&&(s=Math.min(s,c)),n>r||n===r&&o>s?null:new i(n,o,r,s)}equalsRange(t){return i.equalsRange(this,t)}static equalsRange(t,e){return!t&&!e?!0:!!t&&!!e&&t.startLineNumber===e.startLineNumber&&t.startColumn===e.startColumn&&t.endLineNumber===e.endLineNumber&&t.endColumn===e.endColumn}getEndPosition(){return i.getEndPosition(this)}static getEndPosition(t){return new Un(t.endLineNumber,t.endColumn)}getStartPosition(){return i.getStartPosition(this)}static getStartPosition(t){return new Un(t.startLineNumber,t.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(t,e){return new i(this.startLineNumber,this.startColumn,t,e)}setStartPosition(t,e){return new i(t,e,this.endLineNumber,this.endColumn)}collapseToStart(){return i.collapseToStart(this)}static collapseToStart(t){return new i(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn)}collapseToEnd(){return i.collapseToEnd(this)}static collapseToEnd(t){return new i(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn)}delta(t){return new i(this.startLineNumber+t,this.startColumn,this.endLineNumber+t,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(t,e=t){return new i(t.lineNumber,t.column,e.lineNumber,e.column)}static lift(t){return t?new i(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):null}static isIRange(t){return!!t&&typeof t.startLineNumber=="number"&&typeof t.startColumn=="number"&&typeof t.endLineNumber=="number"&&typeof t.endColumn=="number"}static areIntersectingOrTouching(t,e){return!(t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn||e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn)}static areIntersecting(t,e){return!(t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<=e.startColumn||e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<=t.startColumn)}static areOnlyIntersecting(t,e){return!(t.endLineNumber<e.startLineNumber-1||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn-1||e.endLineNumber<t.startLineNumber-1||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn-1)}static compareRangesUsingStarts(t,e){if(t&&e){let r=t.startLineNumber|0,s=e.startLineNumber|0;if(r===s){let a=t.startColumn|0,l=e.startColumn|0;if(a===l){let d=t.endLineNumber|0,c=e.endLineNumber|0;if(d===c){let u=t.endColumn|0,m=e.endColumn|0;return u-m}return d-c}return a-l}return r-s}return(t?1:0)-(e?1:0)}static compareRangesUsingEnds(t,e){return t.endLineNumber===e.endLineNumber?t.endColumn===e.endColumn?t.startLineNumber===e.startLineNumber?t.startColumn-e.startColumn:t.startLineNumber-e.startLineNumber:t.endColumn-e.endColumn:t.endLineNumber-e.endLineNumber}static spansMultipleLines(t){return t.endLineNumber>t.startLineNumber}toJSON(){return this}};var RS=class{constructor(){this._tokenizationSupports=new Map;this._factories=new Map;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._colorMap=null}handleChange(t){this._onDidChange.fire({changedLanguages:t,changedColorMap:!1})}register(t,e){return this._tokenizationSupports.set(t,e),this.handleChange([t]),q(()=>{this._tokenizationSupports.get(t)===e&&(this._tokenizationSupports.delete(t),this.handleChange([t]))})}get(t){return this._tokenizationSupports.get(t)||null}registerFactory(t,e){this._factories.get(t)?.dispose();let n=new fM(this,t,e);return this._factories.set(t,n),q(()=>{let o=this._factories.get(t);!o||o!==n||(this._factories.delete(t),o.dispose())})}async getOrCreate(t){let e=this.get(t);if(e)return e;let n=this._factories.get(t);return!n||n.isResolved?null:(await n.resolve(),this.get(t))}isResolved(t){if(this.get(t))return!0;let n=this._factories.get(t);return!!(!n||n.isResolved)}setColorMap(t){this._colorMap=t,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}},fM=class extends N{constructor(e,n,o){super();this._registry=e;this._languageId=n;this._factory=o;this._isDisposed=!1;this._resolvePromise=null;this._isResolved=!1}get isResolved(){return this._isResolved}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){let e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}};var W6;(r=>{let i=new Map;i.set(0,de.symbolMethod),i.set(1,de.symbolFunction),i.set(2,de.symbolConstructor),i.set(3,de.symbolField),i.set(4,de.symbolVariable),i.set(5,de.symbolClass),i.set(6,de.symbolStruct),i.set(7,de.symbolInterface),i.set(8,de.symbolModule),i.set(9,de.symbolProperty),i.set(10,de.symbolEvent),i.set(11,de.symbolOperator),i.set(12,de.symbolUnit),i.set(13,de.symbolValue),i.set(15,de.symbolEnum),i.set(14,de.symbolConstant),i.set(16,de.symbolEnumMember),i.set(17,de.symbolKeyword),i.set(28,de.symbolSnippet),i.set(18,de.symbolText),i.set(19,de.symbolColor),i.set(20,de.symbolFile),i.set(21,de.symbolReference),i.set(22,de.symbolCustomColor),i.set(23,de.symbolFolder),i.set(24,de.symbolTypeParameter),i.set(25,de.account),i.set(26,de.issues),i.set(27,de.tools);function t(s){let a=i.get(s);return a||(console.info("No codicon found for CompletionItemKind "+s),a=de.symbolProperty),a}r.toIcon=t;function e(s){switch(s){case 0:return p(907,null);case 1:return p(903,null);case 2:return p(895,null);case 3:return p(900,null);case 4:return p(920,null);case 5:return p(892,null);case 6:return p(913,null);case 7:return p(904,null);case 8:return p(908,null);case 9:return p(910,null);case 10:return p(899,null);case 11:return p(909,null);case 12:return p(917,null);case 13:return p(919,null);case 14:return p(894,null);case 15:return p(897,null);case 16:return p(898,null);case 17:return p(906,null);case 18:return p(914,null);case 19:return p(893,null);case 20:return p(901,null);case 21:return p(911,null);case 22:return p(896,null);case 23:return p(902,null);case 24:return p(916,null);case 25:return p(918,null);case 26:return p(905,null);case 27:return p(915,null);case 28:return p(912,null);default:return""}}r.toLabel=e;let n=new Map;n.set("method",0),n.set("function",1),n.set("constructor",2),n.set("field",3),n.set("variable",4),n.set("class",5),n.set("struct",6),n.set("interface",7),n.set("module",8),n.set("property",9),n.set("event",10),n.set("operator",11),n.set("unit",12),n.set("value",13),n.set("constant",14),n.set("enum",15),n.set("enum-member",16),n.set("enumMember",16),n.set("keyword",17),n.set("snippet",28),n.set("text",18),n.set("color",19),n.set("file",20),n.set("reference",21),n.set("customcolor",22),n.set("folder",23),n.set("type-parameter",24),n.set("typeParameter",24),n.set("account",25),n.set("issue",26),n.set("tool",27);function o(s,a){let l=n.get(s);return typeof l>"u"&&!a&&(l=9),l}r.fromString=o})(W6||={});function MV(i){return!!i&&y.isUri(i.uri)&&ze.isIRange(i.range)&&(ze.isIRange(i.originSelectionRange)||ze.isIRange(i.targetSelectionRange))}function hM(i){return!!i&&y.isUri(i.uri)&&ze.isIRange(i.range)}var Lce={17:p(868,null),16:p(869,null),4:p(870,null),13:p(871,null),8:p(872,null),9:p(873,null),21:p(874,null),23:p(875,null),7:p(876,null),0:p(877,null),11:p(878,null),10:p(879,null),19:p(880,null),5:p(881,null),1:p(882,null),2:p(883,null),20:p(884,null),15:p(885,null),18:p(886,null),24:p(887,null),3:p(888,null),6:p(889,null),14:p(890,null),22:p(891,null),25:p(922,null),12:p(923,null)};var vM;(o=>{let i=new Map;i.set(0,de.symbolFile),i.set(1,de.symbolModule),i.set(2,de.symbolNamespace),i.set(3,de.symbolPackage),i.set(4,de.symbolClass),i.set(5,de.symbolMethod),i.set(6,de.symbolProperty),i.set(7,de.symbolField),i.set(8,de.symbolConstructor),i.set(9,de.symbolEnum),i.set(10,de.symbolInterface),i.set(11,de.symbolFunction),i.set(12,de.symbolVariable),i.set(13,de.symbolConstant),i.set(14,de.symbolString),i.set(15,de.symbolNumber),i.set(16,de.symbolBoolean),i.set(17,de.symbolArray),i.set(18,de.symbolObject),i.set(19,de.symbolKey),i.set(20,de.symbolNull),i.set(21,de.symbolEnumMember),i.set(22,de.symbolStruct),i.set(23,de.symbolEvent),i.set(24,de.symbolOperator),i.set(25,de.symbolTypeParameter);function t(r){let s=i.get(r);return s||(console.info("No codicon found for SymbolKind "+r),s=de.symbolProperty),s}o.toIcon=t;let e=new Map;e.set(0,20),e.set(1,8),e.set(2,8),e.set(3,8),e.set(4,5),e.set(5,0),e.set(6,9),e.set(7,3),e.set(8,2),e.set(9,15),e.set(10,7),e.set(11,1),e.set(12,4),e.set(13,14),e.set(14,18),e.set(15,13),e.set(16,13),e.set(17,13),e.set(18,13),e.set(19,17),e.set(20,13),e.set(21,16),e.set(22,6),e.set(23,10),e.set(24,11),e.set(25,24);function n(r){let s=e.get(r);return s===void 0&&(console.info("No completion kind found for SymbolKind "+r),s=20),s}o.toCompletionKind=n})(vM||={});var La=class i{constructor(t){this.value=t}static{this.Comment=new i("comment")}static{this.Imports=new i("imports")}static{this.Region=new i("region")}static fromValue(t){switch(t){case"comment":return i.Comment;case"imports":return i.Imports;case"region":return i.Region}return new i(t)}};var yM;(t=>{function i(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}t.is=i})(yM||={});var Oce=new RS;var bM=(o=>(o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=4]="Right",o[o.Full=7]="Full",o))(bM||{});var nu=class{constructor(t,e){this._findMatchBrand=void 0;this.range=t,this.matches=e}};var AS=class{constructor(t,e,n){this.regex=t,this.wordSeparators=e,this.simpleSearch=n}},MS=class{constructor(t,e,n){this.reverseEdits=t;this.changes=e;this.trimAutoWhitespaceLineNumbers=n}};var um=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(um||{});(a=>{function i(l,d){return d-l}a.compare=i;let t=Object.create(null);t[8]=p(3105,null),t[4]=p(3109,null),t[2]=p(3107,null);function e(l){return t[l]||""}a.toString=e;let n=Object.create(null);n[8]=p(3106,null),n[4]=p(3110,null),n[2]=p(3108,null);function o(l){return n[l]||""}a.toStringPlural=o;function r(l){switch(l){case rt.Error:return 8;case rt.Warning:return 4;case rt.Info:return 2;case rt.Ignore:return 1}}a.fromSeverity=r;function s(l){switch(l){case 8:return rt.Error;case 4:return rt.Warning;case 2:return rt.Info;case 1:return rt.Ignore}}a.toSeverity=s})(um||={});var V6;(n=>{function t(o){return e(o,!0)}n.makeKey=t;function e(o,r){let s=[""];return o.source?s.push(o.source.replace("\xA6","\\\xA6")):s.push(""),o.code?typeof o.code=="string"?s.push(o.code.replace("\xA6","\\\xA6")):s.push(o.code.value.replace("\xA6","\\\xA6")):s.push(""),o.severity!==void 0&&o.severity!==null?s.push(um.toString(o.severity)):s.push(""),o.message&&r?s.push(o.message.replace("\xA6","\\\xA6")):s.push(""),o.startLineNumber!==void 0&&o.startLineNumber!==null?s.push(o.startLineNumber.toString()):s.push(""),o.startColumn!==void 0&&o.startColumn!==null?s.push(o.startColumn.toString()):s.push(""),o.endLineNumber!==void 0&&o.endLineNumber!==null?s.push(o.endLineNumber.toString()):s.push(""),o.endColumn!==void 0&&o.endColumn!==null?s.push(o.endColumn.toString()):s.push(""),s.push(""),s.join("\xA6")}n.makeKeyOptionalMessage=e})(V6||={});var Vce=A("markerService");var B6=A("progressService");var Gce=Object.freeze({total(){},worked(){},done(){}}),Cs=class{constructor(t){this.callback=t}static{this.None=Object.freeze({report(){}})}get value(){return this._value}report(t){this._value=t,this.callback(this._value)}},LS=class extends N{constructor(e,n){super();this.deferred=new jt;n.withProgress(e,o=>(this.reporter=o,this.lastStep&&o.report(this.lastStep),this.deferred.p)),this._register(q(()=>this.deferred.complete()))}report(e){this.reporter?this.reporter.report(e):this.lastStep=e}};LS=_([S(1,B6)],LS);var Qce=A("editorProgressService");var IM=class{constructor(){this.data=new Map}add(t,e){Xn(Pe(t)),Xn(st(e)),Xn(!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=>{ZI(t.dispose)&&t.dispose()}),this.data.clear()}},wt=new IM;var xM=class extends N{constructor(e,n="",o="",r=!0,s){super();this._onDidChange=this._register(new T);this._enabled=!0;this._id=e,this._label=n,this._cssClass=o,this._enabled=r,this._actionCallback=s}get onDidChange(){return this._onDidChange.event}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,n){this._actionCallback&&await this._actionCallback(e)}};var OV=class i{constructor(){this.id=i.ID;this.label="";this.tooltip="";this.class="separator";this.enabled=!1;this.checked=void 0}static join(...t){let e=[];for(let n of t)n.length&&(e.length?e=[...e,new i,...n]:e=n);return e}static clean(t){for(;t.length>0&&t[0].id===i.ID;)t.shift();for(;t.length>0&&t[t.length-1].id===i.ID;)t.pop();for(let e=t.length-2;e>=0;e--)t[e].id===i.ID&&t[e+1].id===i.ID&&t.splice(e+1,1);return t}static{this.ID="vs.actions.separator"}async run(){}},ay=class{constructor(t,e,n,o){this.tooltip="";this.enabled=!0;this.checked=void 0;this.id=t,this.label=e,this.class=o,this._actions=n}get actions(){return this._actions}async run(){}},NV=class i extends xM{static{this.ID="vs.actions.empty"}constructor(){super(i.ID,p(46,null),void 0,!1)}};var $6={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},PM={id:"default",displayName:p(7378,null),providerDisplayName:p(7375,null)};function NS(i){if(Oa(i))return!1;let t=i;return t?.original!==void 0&&t.modified!==void 0}function UV(i){if(Oa(i))return!1;let t=i;return!t||t.resources&&!Array.isArray(t.resources)?!1:!!t.resources||!!t.multiDiffSource}function SM(i){if(Oa(i)||NS(i))return!1;let t=i;return t?.primary!==void 0&&t.secondary!==void 0}function OS(i){if(Oa(i))return!1;let t=i;return y.isUri(t?.base?.resource)&&y.isUri(t?.input1?.resource)&&y.isUri(t?.input2?.resource)&&y.isUri(t?.result?.resource)}var CM=class{constructor(){this.mapIdToSaveSource=new Map}registerSource(t,e){let n=this.mapIdToSaveSource.get(t);return n||(n={source:t,label:e},this.mapIdToSaveSource.set(t,n)),n.source}getSourceLabel(t){return this.mapIdToSaveSource.get(t)?.label??t}},wue=new CM;var TM=class extends N{};function Oa(i){return i instanceof TM}function z6(i){let t=i;return y.isUri(t?.preferredResource)}function q6(i){let t=i;return Oa(t?.primary)&&Oa(t?.secondary)}function FV(i){let t=i;return Oa(t?.modified)&&Oa(t?.original)}var EM=class{getOriginalUri(t,e){if(!t)return;if(OS(t))return wM.getOriginalUri(t.result,e);if(e?.supportSideBySide){let{primary:o,secondary:r}=this.getSideEditors(t);if(o&&r){if(e?.supportSideBySide===3)return{primary:this.getOriginalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getOriginalUri(r,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getOriginalUri(o,{filterByScheme:e.filterByScheme})??this.getOriginalUri(r,{filterByScheme:e.filterByScheme});t=e.supportSideBySide===1?o:r}}if(NS(t)||UV(t)||SM(t)||OS(t))return;let n=z6(t)?t.preferredResource:t.resource;return!n||!e?.filterByScheme?n:this.filterUri(n,e.filterByScheme)}getSideEditors(t){return q6(t)||SM(t)?{primary:t.primary,secondary:t.secondary}:FV(t)||NS(t)?{primary:t.modified,secondary:t.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(t,e){if(!t)return;if(OS(t))return wM.getCanonicalUri(t.result,e);if(e?.supportSideBySide){let{primary:o,secondary:r}=this.getSideEditors(t);if(o&&r){if(e?.supportSideBySide===3)return{primary:this.getCanonicalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getCanonicalUri(r,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getCanonicalUri(o,{filterByScheme:e.filterByScheme})??this.getCanonicalUri(r,{filterByScheme:e.filterByScheme});t=e.supportSideBySide===1?o:r}}if(NS(t)||UV(t)||SM(t)||OS(t))return;let n=t.resource;return!n||!e?.filterByScheme?n:this.filterUri(n,e.filterByScheme)}filterUri(t,e){if(Array.isArray(e)){if(e.some(n=>t.scheme===n))return t}else if(e===t.scheme)return t}};var wM=new EM;var kM=class{constructor(){this.editorSerializerConstructors=new Map;this.editorSerializerInstances=new Map}start(t){let e=this.instantiationService=t.get(Dn);for(let[n,o]of this.editorSerializerConstructors)this.createEditorSerializer(n,o,e);this.editorSerializerConstructors.clear()}createEditorSerializer(t,e,n){let o=n.createInstance(e);this.editorSerializerInstances.set(t,o)}registerFileEditorFactory(t){if(this.fileEditorFactory)throw new Error("Can only register one file editor factory.");this.fileEditorFactory=t}getFileEditorFactory(){return ki(this.fileEditorFactory)}registerEditorSerializer(t,e){if(this.editorSerializerConstructors.has(t)||this.editorSerializerInstances.has(t))throw new Error(`A editor serializer with type ID '${t}' was already registered.`);return this.instantiationService?this.createEditorSerializer(t,e,this.instantiationService):this.editorSerializerConstructors.set(t,e),q(()=>{this.editorSerializerConstructors.delete(t),this.editorSerializerInstances.delete(t)})}getEditorSerializer(t){return this.editorSerializerInstances.get(typeof t=="string"?t:t.typeId)}};wt.add($6.EditorFactory,new kM);var Rue=A("agentHostConnectionsService");var _M=class{constructor(){this._contributions=new Set}register(t){return this._contributions.add(t),{dispose:()=>this._contributions.delete(t)}}getActivators(t){return Array.from(this._contributions).filter(e=>e.matchSessionType(t))}};wt.add("workbench.contrib.chatSessions.asyncActivation",new _M);var RM;(l=>(l.CopilotCLI="copilotcli",l.CopilotCloud="copilot-cloud-agent",l.Local="local",l.Codex="openai-codex",l.Growth="copilot-growth",l.AgentHostCopilot="agent-host-copilotcli",l.AgentHostClaude="agent-host-claude",l.AgentHostCodex="agent-host-codex"))(RM||={});var pm=RM.Local,K6;(o=>{function i(r){return new Map(Object.entries(r))}o.fromRecord=i;function t(r){let s=Object.create(null),a=n(r);for(let[l,d]of a)s[l]=d;return s}o.toRecord=t;function e(r){if(!r)return;let s=n(r);return Array.from(s,([a,l])=>({optionId:a,value:typeof l=="string"?l:l.id}))}o.toStrValueArray=e;function n(r){return r instanceof Map?r:Object.entries(r)}})(K6||={});var j6=A("chatSessionsService");var Hr;(s=>{s.scheme=B.vscodeLocalChatSession;function t(a){let l=eo(H.wrap(new TextEncoder().encode(a)),!1,!0);return y.from({scheme:s.scheme,authority:pm,path:"/"+l})}s.forSession=t;function e(){let a=Math.floor(Math.random()*1e9);return t(`chat-${a}`)}s.getNewSessionUri=e;function n(a){let l=r(a);return l?.chatSessionType===pm?l.sessionId:void 0}s.parseLocalSessionId=n;function o(a){return!!n(a)}s.isLocalSession=o;function r(a){if(a.scheme!==s.scheme||!a.authority)return;let l=a.path.split("/");if(l.length!==2)return;let d=a.authority,c=fo(l[1]);return{chatSessionType:d,sessionId:new TextDecoder().decode(c.buffer)}}})(Hr||={});function sd(i){let t=Hr.parseLocalSessionId(i);return t||i.toString()}function ou(i){return i.scheme===B.vscodeChatEditor?pm:i.scheme===Hr.scheme?i.authority||pm:i.scheme}function ru(i){return i.path.startsWith("/untitled-")}function G6(i){if(!i||typeof i!="object")return!1;if(ct.isThemeIcon(i)||y.isUri(i))return!0;let t=i;return y.isUri(t.light)&&y.isUri(t.dark)}var ly;(r=>{r.icon=de.error;function t(s){return{filterUri:s.resource,owner:s.owner,problemMessage:s.message,filterRange:{startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,startColumn:s.startColumn,endColumn:s.endColumn}}}r.fromMarker=t;function e(s){return{id:n(s),name:o(s),icon:r.icon,value:s,kind:"diagnostic",...s}}r.toEntry=e;function n(s){return[s.filterUri,s.owner,s.filterSeverity,s.filterRange?.startLineNumber,s.filterRange?.startColumn].join(":")}r.id=n;function o(s){let a;if((u=>(u[u.MaxChars=30]="MaxChars",u[u.MaxSpaceLookback=10]="MaxSpaceLookback"))(a||={}),s.problemMessage){if(s.problemMessage.length<30)return s.problemMessage;let d=s.problemMessage.lastIndexOf(" ",30);return d===-1||d+10<30?s.problemMessage.substring(0,30)+"\u2026":s.problemMessage.substring(0,d)+"\u2026"}let l=p(12950,null);return s.filterUri&&(l=p(12951,null,Ze(s.filterUri))),l}r.label=o})(ly||={});function HV(i){return typeof i=="object"&&i!==null&&i.$mid==="agentHostChatReference"}function WV(i,t,e,n,o){let r;try{r=y.parse(i.chatResource)}catch{return}return{kind:"chatReference",id:t,name:e,value:r,endTurn:i.endTurn,range:n,_meta:o}}var ad;(n=>{function i(o){return y.isUri(o.value)?o.value:hM(o.value)?o.value.uri:void 0}n.toUri=i;function t(o){if(o.value instanceof Uint8Array){let r={...o};return r.value={$base64:eo(H.wrap(o.value))},r}return US(o)&&o.imageData instanceof Uint8Array?{...o,imageData:{$base64:eo(H.wrap(o.imageData))}}:o}n.toExport=t;function e(o){if(o&&"values"in o&&Array.isArray(o.values))return{kind:"generic",id:o.id??"",name:o.name,value:o.values[0]?.value,range:o.range,modelDescription:o.modelDescription,references:o.references};if(o.value&&typeof o.value=="object"&&"$base64"in o.value&&typeof o.value.$base64=="string"){let r={...o};return r.value=fo(o.value.$base64).buffer,r}return US(o)&&o.imageData&&typeof o.imageData=="object"&&"$base64"in o.imageData&&typeof o.imageData.$base64=="string"?{...o,imageData:fo(o.imageData.$base64).buffer}:o}n.fromExport=e})(ad||={});function VV(i){return i.kind==="implicit"}function BV(i){return i.kind==="string"}function DM(i){return i.kind==="image"}function US(i){return i.kind==="element"}function dy(i){return i.kind==="promptFile"}function $V(i){return i.kind==="promptText"}function zV(i){let t=i;return typeof t=="object"&&t!==null&&(typeof t.value=="string"||typeof t.value>"u")&&(typeof t.name=="string"||typeof t.name>"u")&&(t.resourceUri===void 0||y.isUri(t.resourceUri))&&(typeof t.name=="string"||y.isUri(t.resourceUri))&&(t.iconPath===void 0||G6(t.iconPath))&&y.isUri(t.uri)&&typeof t.handle=="number"}function ld(i,t,e,n=!1,o){return{id:`${t}__${i.toString()}`,name:`prompt:${Ze(i)}`,value:i,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:t!=="vscode.instructions.file.reference",originLabel:e,toolReferences:o,automaticallyAdded:n}}function qV(i,t=!1,e){return{id:"vscode.customizations.index",name:"prompt:customizationsIndex",value:i,kind:"promptText",modelDescription:"Chat customizations index",automaticallyAdded:t,toolReferences:e}}function KV(i,t){return{kind:"tool",id:i.id,icon:ct.isThemeIcon(i.icon)?i.icon:void 0,name:i.displayName,value:void 0,range:t}}var iu=class{constructor(t){this._ids=new Set;this._entries=[];t&&this.add(...t)}add(...t){for(let e of t)this._ids.has(e.id)||(this._ids.add(e.id),this._entries.push(e))}insertFirst(t){this._ids.has(t.id)||(this._ids.add(t.id),this._entries.unshift(t))}remove(t){this._ids.delete(t.id),this._entries=this._entries.filter(e=>e.id!==t.id)}has(t){return this._ids.has(t.id)}asArray(){return this._entries.slice(0)}get length(){return this._entries.length}};var Fn=class{constructor(t,e,n){this.owner=t;this.debugNameSource=e;this.referenceFn=n}getDebugName(t){return JV(t,this)}},jV=new Map,AM=new WeakMap;function JV(i,t){let e=AM.get(i);if(e)return e;let n=Q6(i,t);if(n){let o=jV.get(n)??0;o++,jV.set(n,o);let r=o===1?n:`${n}#${o}`;return AM.set(i,r),r}}function Q6(i,t){let e=AM.get(i);if(e)return e;let n=t.owner?Y6(t.owner)+".":"",o,r=t.debugNameSource;if(r!==void 0)if(typeof r=="function"){if(o=r(),o!==void 0)return n+o}else return n+r;let s=t.referenceFn;if(s!==void 0&&(o=cy(s),o!==void 0))return n+o;if(t.owner!==void 0){let a=J6(t.owner,i);if(a!==void 0)return n+a}}function J6(i,t){for(let e in i)if(i[e]===t)return e}var GV=new Map,QV=new WeakMap;function Y6(i){let t=QV.get(i);if(t)return t;let e=MM(i)??"Object",n=GV.get(e)??0;n++,GV.set(e,n);let o=n===1?e:`${e}#${n}`;return QV.set(i,o),o}function MM(i){let t=i.constructor;if(t)return t.name==="Object"?void 0:t.name}function cy(i){let t=i.toString(),n=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(t);return(n?n[1]:void 0)?.trim()}function jo(i,t){return i===t}function X6(){return(i,t)=>i===t}function LM(i,t,e){return dn(i,t,e??jo)}function Z6(i){return(t,e)=>dn(t,e,i??jo)}function mm(i,t){if(i===t)return!0;if(Array.isArray(i)&&Array.isArray(t)){if(i.length!==t.length)return!1;for(let e=0;e<i.length;e++)if(!mm(i[e],t[e]))return!1;return!0}if(i&&typeof i=="object"&&t&&typeof t=="object"&&Object.getPrototypeOf(i)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let e=i,n=t,o=Object.keys(e),r=Object.keys(n),s=new Set(r);if(o.length!==r.length)return!1;for(let a of o)if(!s.has(a)||!mm(e[a],n[a]))return!1;return!0}return!1}function eK(){return(i,t)=>mm(i,t)}function tK(i,t){return JSON.stringify(i)===JSON.stringify(t)}function nK(){return(i,t)=>JSON.stringify(i)===JSON.stringify(t)}function oK(){return(i,t)=>i.equals(t)}function rK(i,t,e){return i==null||t===void 0||t===null?t===i:e(i,t)}function iK(i){return(t,e)=>t==null||e===void 0||e===null?e===t:i(t,e)}var sK;(u=>(u.strict=jo,u.strictC=X6,u.array=LM,u.arrayC=Z6,u.structural=mm,u.structuralC=eK,u.jsonStringify=tK,u.jsonStringifyC=nK,u.thisC=oK,u.ifDefined=rK,u.ifDefinedC=iK))(sK||={});function OM(i){let t=new Error("BugIndicatingErrorRecovery: "+i);Ge(t),console.error("recovered from an error that indicates a bug",t)}var su;function uy(i){su?su instanceof FS?su.loggers.push(i):su=new FS([su,i]):su=i}function on(){return su}var NM;function YV(i){NM=i}function XV(i){NM&&NM(i)}var FS=class{constructor(t){this.loggers=t}handleObservableCreated(t,e){for(let n of this.loggers)n.handleObservableCreated(t,e)}handleOnListenerCountChanged(t,e){for(let n of this.loggers)n.handleOnListenerCountChanged(t,e)}handleObservableUpdated(t,e){for(let n of this.loggers)n.handleObservableUpdated(t,e)}handleAutorunCreated(t,e){for(let n of this.loggers)n.handleAutorunCreated(t,e)}handleAutorunDisposed(t){for(let e of this.loggers)e.handleAutorunDisposed(t)}handleAutorunDependencyChanged(t,e,n){for(let o of this.loggers)o.handleAutorunDependencyChanged(t,e,n)}handleAutorunStarted(t){for(let e of this.loggers)e.handleAutorunStarted(t)}handleAutorunFinished(t){for(let e of this.loggers)e.handleAutorunFinished(t)}handleDerivedDependencyChanged(t,e,n){for(let o of this.loggers)o.handleDerivedDependencyChanged(t,e,n)}handleDerivedCleared(t){for(let e of this.loggers)e.handleDerivedCleared(t)}handleBeginTransaction(t){for(let e of this.loggers)e.handleBeginTransaction(t)}handleEndTransaction(t){for(let e of this.loggers)e.handleEndTransaction(t)}};function Na(i,t){let e=new dd(i,t);try{i(e)}finally{e.finish()}}function UM(i,t,e){i?t(i):Na(t,e)}var dd=class{constructor(t,e){this._fn=t;this._getDebugName=e;this._updatingObservers=[];on()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():cy(this._fn)}updateObserver(t,e){if(!this._updatingObservers){OM("Transaction already finished!"),Na(n=>{n.updateObserver(t,e)});return}this._updatingObservers.push({observer:t,observable:e}),t.beginUpdate(e)}finish(){let t=this._updatingObservers;if(!t){OM("transaction.finish() has already been called!");return}for(let e=0;e<t.length;e++){let{observer:n,observable:o}=t[e];n.endUpdate(o)}this._updatingObservers=null,on()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var En;(n=>{let i=!1;function t(){i=!0}n.enable=t;function e(){if(!i)return;let o=Error,r=o.stackTraceLimit;o.stackTraceLimit=3;let s=new Error().stack;return o.stackTraceLimit=r,FM.fromStack(s,2)}n.ofCaller=e})(En||={});var FM=class i{constructor(t,e,n,o){this.fileName=t;this.line=e;this.column=n;this.id=o}static fromStack(t,e){let n=t.split(`
`),o=aK(n[e+1]);if(o)return new i(o.fileName,o.line,o.column,o.id)}};function aK(i){let t=i.match(/\((.*):(\d+):(\d+)\)/);if(t)return{fileName:t[1],line:parseInt(t[2]),column:parseInt(t[3]),id:i};let e=i.match(/at ([^\(\)]*):(\d+):(\d+)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:i}}var HM;function ZV(i){HM=i}var eB;function tB(i){eB=i}var nB;function oB(i){nB=i}var WM;function rB(i){WM=i}var py=class{get TChange(){return null}reportChanges(){this.get()}read(t){return t?t.readObservable(this):this.get()}map(t,e,n=En.ofCaller()){let o=e===void 0?void 0:t,r=e===void 0?t:e;return HM({owner:o,debugName:()=>{let s=cy(r);if(s!==void 0)return s;let l=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(r.toString());if(l)return`${this.debugName}.${l[2]}`;if(!o)return`${this.debugName} (mapped)`},debugReferenceFn:r},s=>r(this.read(s),s),n)}flatten(){return HM({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},t=>this.read(t).read(t))}recomputeInitiallyAndOnChange(t,e){return t.add(eB(this,e)),this}keepObserved(t){return t.add(nB(this)),this}get debugValue(){return this.get()}get debug(){return new VM(this)}},VM=class{constructor(t){this.observable=t}getDependencyGraph(){return WM(this.observable,{type:"dependencies"})}getObserverGraph(){return WM(this.observable,{type:"observers"})}},Er=class extends py{constructor(e){super();this._observers=new Set;on()?.handleObservableCreated(this,e)}addObserver(e){let n=this._observers.size;this._observers.add(e),n===0&&this.onFirstObserverAdded(),n!==this._observers.size&&on()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let n=this._observers.delete(e);n&&this._observers.size===0&&this.onLastObserverRemoved(),n&&on()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!on();return XV(this),e||on()?.handleObservableCreated(this,En.ofCaller()),this}debugGetObservers(){return this._observers}};function An(i,t,e=En.ofCaller()){let n;return typeof i=="string"?n=new Fn(void 0,i,void 0):n=new Fn(i,void 0,void 0),new Ts(n,t,jo,e)}var Ts=class extends Er{constructor(e,n,o,r){super(r);this._debugNameData=e;this._equalityComparator=o;this._value=n,on()?.handleObservableUpdated(this,{hadValue:!1,newValue:n,change:void 0,didChange:!0,oldValue:void 0})}get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}get(){return this._value}set(e,n,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let r;n||(n=r=new dd(()=>{},()=>`Setting ${this.debugName}`));try{let s=this._value;this._setValue(e),on()?.handleObservableUpdated(this,{oldValue:s,newValue:e,change:o,didChange:!0,hadValue:!0});for(let a of this._observers)n.updateObserver(a,this),a.handleChange(this,o)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}};var HS=class extends Er{constructor(e,n,o,r){super(r);this._debugNameData=e;this._equalityComparator=o;this._isUpToDate=!0;this._deltas=[];this._updateCounter=0;this._value=n}get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(let e of this._deltas){on()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let n of this._observers)n.handleChange(this,e)}this._deltas.length=0}else{on()?.handleObservableUpdated(this,{change:void 0,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let e of this._observers)e.handleChange(this,void 0)}}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(let e of this._observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();let e=[...this._observers];for(let n of e)n.endUpdate(this)}}addObserver(e){let n=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),n&&e.beginUpdate(this)}removeObserver(e){let n=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),n&&e.endUpdate(this)}set(e,n,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let r;n||(n=r=new dd(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),o!==void 0&&this._deltas.push(o),n.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,a)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(let s of this._observers)s.handlePossibleChange(this)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};function Ua(i,t,e=En.ofCaller()){return i.lazy?new HS(new Fn(i.owner,i.debugName,void 0),t,i.equalsFn??jo,e):new Ts(new Fn(i.owner,i.debugName,void 0),t,i.equalsFn??jo,e)}function lK(i){switch(i){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var Fa=class{constructor(t,e,n,o){this._debugNameData=t;this._runFn=e;this._changeTracker=n;this._state=2;this._updateCount=0;this._disposed=!1;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._isRunning=!1;this._iteration=0;this._store=void 0;this._delayedStore=void 0;this._changeSummary=this._changeTracker?.createChangeSummary(void 0),on()?.handleAutorunCreated(this,o),this._run(),Vl(this)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}dispose(){if(!this._disposed){this._disposed=!0;for(let t of this._dependencies)t.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),on()?.handleAutorunDisposed(this),Bl(this)}}_run(){let t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t,this._state=3;try{if(!this._disposed){on()?.handleAutorunStarted(this);let e=this._changeSummary,n=this._delayedStore;n!==void 0&&(this._delayedStore=void 0);try{this._isRunning=!0,this._changeTracker&&(this._changeTracker.beforeUpdate?.(this,e),this._changeSummary=this._changeTracker.createChangeSummary(e)),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._runFn(this,e)}catch(o){Ll(o)}finally{this._isRunning=!1,n!==void 0&&n.dispose()}}}finally{this._disposed||on()?.handleAutorunFinished(this);for(let e of this._dependenciesToBeRemoved)e.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(t){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(t){try{if(this._updateCount===1){this._iteration=1;do{if(this._checkIterations())return;if(this._state===1){this._state=3;for(let e of this._dependencies)if(e.reportChanges(),this._state===2)break}this._iteration++,this._state!==3&&this._run()}while(this._state!==3)}}finally{this._updateCount--}sv(()=>this._updateCount>=0)}handlePossibleChange(t){this._state===3&&this._isDependency(t)&&(this._checkIterations(),this._state=1)}handleChange(t,e){if(this._isDependency(t)){on()?.handleAutorunDependencyChanged(this,t,e);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:t,change:e,didChange:o=>o===t},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(n){Ll(n)}}}_isDependency(t){return this._dependencies.has(t)&&!this._dependenciesToBeRemoved.has(t)}_ensureNoRunning(){if(!this._isRunning)throw new At("The reader object cannot be used outside its compute function!")}readObservable(t){if(this._ensureNoRunning(),this._disposed)return t.get();t.addObserver(this);let e=t.get();return this._dependencies.add(t),this._dependenciesToBeRemoved.delete(t),e}get store(){if(this._ensureNoRunning(),this._disposed)throw new At("Cannot access store after dispose");return this._store===void 0&&(this._store=new $),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new At("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new $),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:lK(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(Ll(new At(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function Eo(i,t=En.ofCaller()){return new Fa(new Fn(void 0,void 0,i),i,void 0,t)}function BM(i,t,e=En.ofCaller()){let n,o=!1;n=Eo(r=>{t({delayedStore:r.delayedStore,store:r.store,readObservable:r.readObservable.bind(r),dispose:()=>{n?i.delete(n):o=!0}})},e),o?n.dispose():i.add(n)}function dK(i){switch(i){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var no=class extends Er{constructor(e,n,o,r=void 0,s,a){super(a);this._debugNameData=e;this._computeFn=n;this._changeTracker=o;this._handleLastObserverRemoved=r;this._equalityComparator=s;this._state=0;this._value=void 0;this._updateCount=0;this._dependencies=new Set;this._dependenciesToBeRemoved=new Set;this._changeSummary=void 0;this._isUpdating=!1;this._isComputing=!1;this._didReportChange=!1;this._isInBeforeUpdate=!1;this._isReaderValid=!1;this._store=void 0;this._delayedStore=void 0;this._removedObserverToCallEndUpdateOn=null;this._changeSummary=this._changeTracker?.createChangeSummary(void 0)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}onLastObserverRemoved(){this._state=0,this._value=void 0,on()?.handleDerivedCleared(this);for(let e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._delayedStore!==void 0&&(this._delayedStore.dispose(),this._delayedStore=void 0),this._handleLastObserverRemoved?.()}get(){if(this._isComputing,this._observers.size===0){let n;try{this._isReaderValid=!0;let o;this._changeTracker&&(o=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,o)),n=this._computeFn(this,o)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),n}else{do{if(this._state===1){for(let n of this._dependencies)if(n.reportChanges(),this._state===2)break}this._state===1&&(this._state=3),this._state!==3&&this._recompute()}while(this._state!==3);return this._value}}_recompute(){let e=!1;this._isComputing=!0,this._didReportChange=!1;let n=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=n;try{let o=this._changeSummary;this._isReaderValid=!0,this._changeTracker&&(this._isInBeforeUpdate=!0,this._changeTracker.beforeUpdate?.(this,o),this._isInBeforeUpdate=!1,this._changeSummary=this._changeTracker?.createChangeSummary(o));let r=this._state!==0,s=this._value;this._state=3;let a=this._delayedStore;a!==void 0&&(this._delayedStore=void 0);try{this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._value=this._computeFn(this,o)}finally{this._isReaderValid=!1;for(let l of this._dependenciesToBeRemoved)l.removeObserver(this);this._dependenciesToBeRemoved.clear(),a!==void 0&&a.dispose()}e=this._didReportChange||r&&!this._equalityComparator(s,this._value),on()?.handleObservableUpdated(this,{oldValue:s,newValue:this._value,change:void 0,didChange:e,hadValue:r})}catch(o){Ll(o)}if(this._isComputing=!1,!this._didReportChange&&e)for(let o of this._observers)o.handleChange(this,void 0);else this._didReportChange=!1}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){if(this._isUpdating)throw new At("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{let n=this._updateCount===1;if(this._state===3&&(this._state=1,!n))for(let o of this._observers)o.handlePossibleChange(this);if(n)for(let o of this._observers)o.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){let n=[...this._observers];for(let o of n)o.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){let o=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(let r of o)r.endUpdate(this)}}sv(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(let n of this._observers)n.handlePossibleChange(this)}}handleChange(e,n){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){on()?.handleDerivedDependencyChanged(this,e,n);let o=!1;try{o=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:n,didChange:s=>s===e},this._changeSummary):!0}catch(s){Ll(s)}let r=this._state===3;if(o&&(this._state===1||r)&&(this._state=2,r))for(let s of this._observers)s.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new At("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);let n=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),n}reportChange(e){this._ensureReaderValid(),this._didReportChange=!0;for(let n of this._observers)n.handleChange(this,e)}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new $),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new $),this._delayedStore}addObserver(e){let n=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),n&&(this._removedObserverToCallEndUpdateOn?.delete(e)||e.beginUpdate(this))}removeObserver(e){this._observers.has(e)&&this._updateCount>0&&(this._removedObserverToCallEndUpdateOn||(this._removedObserverToCallEndUpdateOn=new Set),this._removedObserverToCallEndUpdateOn.add(e)),super.removeObserver(e)}debugGetState(){return{state:this._state,stateStr:dK(this._state),updateCount:this._updateCount,isComputing:this._isComputing,dependencies:this._dependencies,value:this._value}}debugSetValue(e){this._value=e}debugRecompute(){this.beginUpdate(this);try{this._isComputing?this._state=2:this._recompute()}finally{this.endUpdate(this)}}setValue(e,n,o){this._value=e;let r=this._observers;n.updateObserver(this,this);for(let s of r)s.handleChange(this,o)}};function Ha(i,t,e=En.ofCaller()){return t!==void 0?new no(new Fn(i,void 0,t),t,void 0,void 0,jo,e):new no(new Fn(void 0,void 0,i),i,void 0,void 0,jo,e)}function my(i,t,e=En.ofCaller()){return new no(new Fn(i.owner,i.debugName,i.debugReferenceFn),t,void 0,i.onLastObserverRemoved,i.equalsFn??jo,e)}ZV(my);function wo(...i){let t,e,n,o;return i.length===2?[e,n]=i:[t,e,n,o]=i,new li(new Fn(t,void 0,n),e,n,()=>li.globalTransaction,jo,o??En.ofCaller())}var li=class extends Er{constructor(e,n,o,r,s,a){super(a);this._debugNameData=e;this.event=n;this._getValue=o;this._getTransaction=r;this._equalityComparator=s;this._hasValue=!1;this.handleEvent=e=>{let n=this._getValue(e),o=this._value,r=this._hasValue,s=!r||!this._equalityComparator(o,n),a=!1;s&&(this._value=n,this._hasValue=!0,r&&(a=!0,UM(this._getTransaction(),l=>{on()?.handleObservableUpdated(this,{oldValue:o,newValue:n,change:void 0,didChange:s,hadValue:r});for(let d of this._observers)l.updateObserver(d,this),d.handleChange(this,void 0)},()=>{let l=this.getDebugName();return"Event fired"+(l?`: ${l}`:"")}))),a||on()?.handleObservableUpdated(this,{oldValue:o,newValue:n,change:void 0,didChange:s,hadValue:r})}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){let e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this._subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this._subscription.dispose(),this._subscription=void 0,this._hasValue=!1,this._value=void 0}get(){return this._subscription?(this._hasValue||this.handleEvent(void 0),this._value):this._getValue(void 0)}debugSetValue(e){this._value=e}debugGetState(){return{value:this._value,hasValue:this._hasValue}}};(e=>{e.Observer=li;function t(n,o){let r=!1;li.globalTransaction===void 0&&(li.globalTransaction=n,r=!0);try{o()}finally{r&&(li.globalTransaction=void 0)}}e.batchEventsGlobally=t})(wo||={});function VS(i,t=En.ofCaller()){return typeof i=="string"?new WS(i,void 0,t):new WS(void 0,i,t)}var WS=class extends Er{constructor(e,n,o){super(o);this._debugName=e;this._owner=n}get debugName(){return new Fn(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}trigger(e,n){if(!e){Na(o=>{this.trigger(o,n)},()=>`Trigger signal ${this.debugName}`);return}for(let o of this._observers)e.updateObserver(o,this),o.handleChange(this,n)}get(){}};function iB(i){let t=new BS(!1,void 0);return i.addObserver(t),q(()=>{i.removeObserver(t)})}oB(iB);function sB(i,t){let e=new BS(!0,t);i.addObserver(e);try{e.beginUpdate(i)}finally{e.endUpdate(i)}return q(()=>{i.removeObserver(e)})}tB(sB);var BS=class{constructor(t,e){this._forceRecompute=t;this._handleValue=e;this._counter=0}beginUpdate(t){this._counter++}endUpdate(t){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(t.get()):t.reportChanges()),this._counter--}handlePossibleChange(t){}handleChange(t,e){}};function $S(i){return new $M(i)}var $M=class extends py{constructor(e){super();this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}log(){return this}toString(){return`Const: ${this.value}`}};function gy(i,t,e=En.ofCaller()){return new zM(typeof i=="string"?i:new Fn(i,void 0,void 0),t,e)}var zM=class extends Er{constructor(e,n,o){super(o);this.event=n;this.handleEvent=()=>{Na(e=>{for(let n of this._observers)e.updateObserver(n,this),n.handleChange(this,void 0)},()=>this.debugName)};this.debugName=typeof e=="string"?e:e.getDebugName(this)??"Observable Signal From Event"}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}};var zS;function aB(i){zS||(zS=new fy,uy(zS)),zS.addFilteredObj(i)}var fy=class{constructor(){this.indentation=0;this.changedObservablesSets=new WeakMap}addFilteredObj(t){this._filteredObjects||(this._filteredObjects=new Set),this._filteredObjects.add(t)}_isIncluded(t){return this._filteredObjects?.has(t)??!0}textToConsoleArgs(t){return gK([gm(vK("|  ",this.indentation)),t])}formatInfo(t){return t.hadValue?t.didChange?[gm(" "),di(Wr(t.oldValue,70),{color:"red",strikeThrough:!0}),gm(" "),di(Wr(t.newValue,60),{color:"green"})]:[gm(" (unchanged)")]:[gm(" "),di(Wr(t.newValue,60),{color:"green"}),gm(" (initial)")]}handleObservableCreated(t){if(t instanceof no){let e=t;if(this.changedObservablesSets.set(e,new Set),!1){let o=[];e.__debugUpdating=o;let r=e.beginUpdate;e.beginUpdate=a=>(o.push(a),r.apply(e,[a]));let s=e.endUpdate;e.endUpdate=a=>{let l=o.indexOf(a);return l===-1&&console.error("endUpdate called without beginUpdate",e.debugName,a.debugName),o.splice(l,1),s.apply(e,[a])}}}}handleOnListenerCountChanged(t,e){}handleObservableUpdated(t,e){if(this._isIncluded(t)){if(t instanceof no){this._handleDerivedRecomputed(t,e);return}console.log(...this.textToConsoleArgs([fm("observable value changed"),di(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(t){if(t.size!==0)return di(" (changed deps: "+[...t].map(e=>e.debugName).join(", ")+")",{color:"gray"})}handleDerivedDependencyChanged(t,e,n){this._isIncluded(t)&&this.changedObservablesSets.get(t)?.add(e)}_handleDerivedRecomputed(t,e){if(!this._isIncluded(t))return;let n=this.changedObservablesSets.get(t);n&&(console.log(...this.textToConsoleArgs([fm("derived recomputed"),di(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e),this.formatChanges(n),{data:[{fn:t._debugNameData.referenceFn??t._computeFn}]}])),n.clear())}handleDerivedCleared(t){this._isIncluded(t)&&console.log(...this.textToConsoleArgs([fm("derived cleared"),di(t.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(t,e){this._isIncluded(t)&&console.log(...this.textToConsoleArgs([fm("observable from event triggered"),di(t.debugName,{color:"BlueViolet"}),...this.formatInfo(e),{data:[{fn:t._getValue}]}]))}handleAutorunCreated(t){this._isIncluded(t)&&this.changedObservablesSets.set(t,new Set)}handleAutorunDisposed(t){}handleAutorunDependencyChanged(t,e,n){this._isIncluded(t)&&this.changedObservablesSets.get(t).add(e)}handleAutorunStarted(t){let e=this.changedObservablesSets.get(t);e&&(this._isIncluded(t)&&console.log(...this.textToConsoleArgs([fm("autorun"),di(t.debugName,{color:"BlueViolet"}),this.formatChanges(e),{data:[{fn:t._debugNameData.referenceFn??t._runFn}]}])),e.clear(),this.indentation++)}handleAutorunFinished(t){this.indentation--}handleBeginTransaction(t){let e=t.getDebugName();e===void 0&&(e=""),this._isIncluded(t)&&console.log(...this.textToConsoleArgs([fm("transaction"),di(e,{color:"BlueViolet"}),{data:[{fn:t._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function gK(i){let t=new Array,e=[],n="";function o(s){if("length"in s)for(let a of s)a&&o(a);else"text"in s?(n+=`%c${s.text}`,t.push(s.style),s.data&&e.push(...s.data)):"data"in s&&e.push(...s.data)}o(i);let r=[n,...t];return r.push(...e),r}function gm(i){return di(i,{color:"black"})}function fm(i){return di(yK(`${i}: `,10),{color:"black",bold:!0})}function di(i,t={color:"black"}){function e(o){return Object.entries(o).reduce((r,[s,a])=>`${r}${s}:${a};`,"")}let n={color:t.color};return t.strikeThrough&&(n["text-decoration"]="line-through"),t.bold&&(n["font-weight"]="bold"),{text:i,style:e(n)}}function Wr(i,t){switch(typeof i){case"number":return""+i;case"string":return i.length+2<=t?`"${i}"`:`"${i.substr(0,t-7)}"+...`;case"boolean":return i?"true":"false";case"undefined":return"undefined";case"object":return i===null?"null":Array.isArray(i)?fK(i,t):hK(i,t);case"symbol":return i.toString();case"function":return`[[Function${i.name?" "+i.name:""}]]`;default:return""+i}}function fK(i,t){let e="[ ",n=!0;for(let o of i){if(n||(e+=", "),e.length-5>t){e+="...";break}n=!1,e+=`${Wr(o,t-e.length)}`}return e+=" ]",e}function hK(i,t){if(typeof i.toString=="function"&&i.toString!==Object.prototype.toString){let r=i.toString();return r.length<=t?r:r.substring(0,t-3)+"..."}let e=MM(i),n=e?e+"(":"{ ",o=!0;for(let[r,s]of Object.entries(i)){if(o||(n+=", "),n.length-5>t){n+="...";break}o=!1,n+=`${r}: ${Wr(s,t-n.length)}`}return n+=e?")":" }",n}function vK(i,t){let e="";for(let n=1;n<=t;n++)e+=i;return e}function yK(i,t){for(;i.length<t;)i+=" ";return i}var qS=class i{constructor(t,e){this._channelFactory=t;this._getHandler=e;this._channel=this._channelFactory({handleNotification:r=>{let s=r,a=this._getHandler().notifications[s[0]];if(!a)throw new Error(`Unknown notification "${s[0]}"!`);a(...s[1])},handleRequest:r=>{let s=r;try{return{type:"result",value:this._getHandler().requests[s[0]](...s[1])}}catch(a){return{type:"error",value:a}}}});let n=new Proxy({},{get:(r,s)=>{if(s!=="then")return async(...a)=>{let l=await this._channel.sendRequest([s,a]);if(l.type==="error")throw l.value;return l.value}}}),o=new Proxy({},{get:(r,s)=>{if(s!=="then")return(...a)=>{this._channel.sendNotification([s,a])}}});this.api={notifications:o,requests:n}}static createHost(t,e){return new i(t,e)}static createClient(t,e){return new i(t,e)}};function lB(i,t){let e=globalThis,n=[],o,{channel:r,handler:s}=bK({sendNotification:l=>{o?o.sendNotification(l):n.push(l)}}),a;return(e.$$debugValueEditor_debugChannels??(e.$$debugValueEditor_debugChannels={}))[i]=l=>{a=t(),o=l;for(let d of n)l.sendNotification(d);return n=[],s},qS.createClient(r,()=>{if(!a)throw new Error("Not supported");return a})}function bK(i){let t;return{channel:n=>(t=n,{sendNotification:o=>{i.sendNotification(o)},sendRequest:o=>{throw new Error("not supported")}}),handler:{handleRequest:n=>n.type==="notification"?t?.handleNotification(n.data):t?.handleRequest(n.data)}}}var KS=class{constructor(){this._timeout=void 0}throttle(t,e){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,t()},e))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}};function qM(i,t){for(let e in t)i[e]&&typeof i[e]=="object"&&t[e]&&typeof t[e]=="object"?qM(i[e],t[e]):i[e]=t[e]}function KM(i,t){for(let e in t)t[e]===null?delete i[e]:i[e]&&typeof i[e]=="object"&&t[e]&&typeof t[e]=="object"?KM(i[e],t[e]):i[e]=t[e]}var jS=class i{constructor(){this._declarationId=0;this._instanceId=0;this._declarations=new Map;this._instanceInfos=new WeakMap;this._aliveInstances=new Map;this._activeTransactions=new Set;this._channel=lB("observableDevTools",()=>({notifications:{setDeclarationIdFilter:t=>{},logObservableValue:t=>{console.log("logObservableValue",t)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{let t={};for(let e of this._declarations.values())t[e.id]=e;return{decls:t}},getSummarizedInstances:()=>null,getObservableValueInfo:t=>({observers:[...this._aliveInstances.get(t).debugGetObservers()].map(n=>this._formatObserver(n)).filter(Uo)}),getDerivedInfo:t=>{let e=this._aliveInstances.get(t);return{dependencies:[...e.debugGetState().dependencies].map(n=>this._formatObservable(n)).filter(Uo),observers:[...e.debugGetObservers()].map(n=>this._formatObserver(n)).filter(Uo)}},getAutorunInfo:t=>({dependencies:[...this._aliveInstances.get(t).debugGetState().dependencies].map(n=>this._formatObservable(n)).filter(Uo)}),getTransactionState:()=>this.getTransactionState(),setValue:(t,e)=>{let n=this._aliveInstances.get(t);if(n instanceof no)n.debugSetValue(e);else if(n instanceof Ts)n.debugSetValue(e);else if(n instanceof li)n.debugSetValue(e);else throw new At("Observable is not supported");let o=[...n.debugGetObservers()];for(let r of o)r.beginUpdate(n);for(let r of o)r.handleChange(n,void 0);for(let r of o)r.endUpdate(n)},getValue:t=>{let e=this._aliveInstances.get(t);if(e instanceof no)return Wr(e.debugGetState().value,200);if(e instanceof Ts)return Wr(e.debugGetState().value,200)},logValue:t=>{let e=this._aliveInstances.get(t);if(e&&"get"in e)console.log("Logged Value:",e.get());else throw new At("Observable is not supported")},rerun:t=>{let e=this._aliveInstances.get(t);if(e instanceof no)e.debugRecompute();else if(e instanceof Fa)e.debugRerun();else throw new At("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new KS;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};En.enable()}static{this._instance=void 0}static getInstance(){return i._instance===void 0&&(i._instance=new i),i._instance}getTransactionState(){let t=[],e=[...this._activeTransactions];if(e.length===0)return;let n=e.flatMap(r=>r.debugGetUpdatingObservers()??[]).map(r=>r.observer),o=new Set;for(;n.length>0;){let r=n.shift();if(o.has(r))continue;o.add(r);let s=this._getInfo(r,a=>{o.has(a)||n.push(a)});s&&t.push(s)}return{names:e.map(r=>r.getDebugName()??"tx"),affected:t}}_getObservableInfo(t){let e=this._instanceInfos.get(t);if(!e){Ge(new At("No info found"));return}return e}_getAutorunInfo(t){let e=this._instanceInfos.get(t);if(!e){Ge(new At("No info found"));return}return e}_getInfo(t,e){if(t instanceof no){let n=[...t.debugGetObservers()];for(let l of n)e(l);let o=this._getObservableInfo(t);if(!o)return;let r=t.debugGetState(),s={name:t.debugName,instanceId:o.instanceId,updateCount:r.updateCount},a=[...o.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(Uo);if(r.isComputing)return{...s,type:"observable/derived",state:"updating",changedDependencies:a,initialComputation:!1};switch(r.state){case 0:return{...s,type:"observable/derived",state:"noValue"};case 3:return{...s,type:"observable/derived",state:"upToDate"};case 2:return{...s,type:"observable/derived",state:"stale",changedDependencies:a};case 1:return{...s,type:"observable/derived",state:"possiblyStale"}}}else if(t instanceof Fa){let n=this._getAutorunInfo(t);if(!n)return;let o={name:t.debugName,instanceId:n.instanceId,updateCount:n.updateCount},r=[...n.changedObservables].map(s=>this._instanceInfos.get(s).instanceId);if(t.debugGetState().isRunning)return{...o,type:"autorun",state:"updating",changedDependencies:r};switch(t.debugGetState().state){case 3:return{...o,type:"autorun",state:"upToDate"};case 2:return{...o,type:"autorun",state:"stale",changedDependencies:r};case 1:return{...o,type:"autorun",state:"possiblyStale"}}}}_formatObservable(t){let e=this._getObservableInfo(t);if(e)return{name:t.debugName,instanceId:e.instanceId}}_formatObserver(t){if(t instanceof no)return{name:t.toString(),instanceId:this._getObservableInfo(t)?.instanceId};let e=this._getAutorunInfo(t);if(e)return{name:t.toString(),instanceId:e.instanceId}}_handleChange(t){KM(this._fullState,t),this._pendingChanges===null?this._pendingChanges=t:qM(this._pendingChanges,t),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(t,e){if(!e)return-1;let n=this._declarations.get(e.id);return n===void 0&&(n={id:this._declarationId++,type:t,url:e.fileName,line:e.line,column:e.column},this._declarations.set(e.id,n),this._handleChange({decls:{[n.id]:n}})),n.id}handleObservableCreated(t,e){let o={declarationId:this._getDeclarationId("observable/value",e),instanceId:this._instanceId++,listenerCount:0,lastValue:void 0,updateCount:0,changedObservables:new Set};this._instanceInfos.set(t,o)}handleOnListenerCountChanged(t,e){let n=this._getObservableInfo(t);if(n){if(n.listenerCount===0&&e>0){let o=t instanceof no?"observable/derived":"observable/value";this._aliveInstances.set(n.instanceId,t),this._handleChange({instances:{[n.instanceId]:{instanceId:n.instanceId,declarationId:n.declarationId,formattedValue:n.lastValue,type:o,name:t.debugName}}})}else n.listenerCount>0&&e===0&&(this._handleChange({instances:{[n.instanceId]:null}}),this._aliveInstances.delete(n.instanceId));n.listenerCount=e}}handleObservableUpdated(t,e){if(t instanceof no){this._handleDerivedRecomputed(t,e);return}let n=this._getObservableInfo(t);n&&e.didChange&&(n.lastValue=Wr(e.newValue,30),n.listenerCount>0&&this._handleChange({instances:{[n.instanceId]:{formattedValue:n.lastValue}}}))}handleAutorunCreated(t,e){let o={declarationId:this._getDeclarationId("autorun",e),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(t,o),this._aliveInstances.set(o.instanceId,t),o&&this._handleChange({instances:{[o.instanceId]:{instanceId:o.instanceId,declarationId:o.declarationId,runCount:0,type:"autorun",name:t.debugName}}})}handleAutorunDisposed(t){let e=this._getAutorunInfo(t);e&&(this._handleChange({instances:{[e.instanceId]:null}}),this._instanceInfos.delete(t),this._aliveInstances.delete(e.instanceId))}handleAutorunDependencyChanged(t,e,n){let o=this._getAutorunInfo(t);o&&o.changedObservables.add(e)}handleAutorunStarted(t){}handleAutorunFinished(t){let e=this._getAutorunInfo(t);e&&(e.changedObservables.clear(),e.updateCount++,this._handleChange({instances:{[e.instanceId]:{runCount:e.updateCount}}}))}handleDerivedDependencyChanged(t,e,n){let o=this._getObservableInfo(t);o&&o.changedObservables.add(e)}_handleDerivedRecomputed(t,e){let n=this._getObservableInfo(t);if(!n)return;let o=Wr(e.newValue,30);n.updateCount++,n.changedObservables.clear(),n.lastValue=o,n.listenerCount>0&&this._handleChange({instances:{[n.instanceId]:{formattedValue:o,recomputationCount:n.updateCount}}})}handleDerivedCleared(t){let e=this._getObservableInfo(t);e&&(e.lastValue=void 0,e.changedObservables.clear(),e.listenerCount>0&&this._handleChange({instances:{[e.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(t){this._activeTransactions.add(t)}handleEndTransaction(t){this._activeTransactions.delete(t)}};function dB(i,t){let e=t?.debugNamePostProcessor??(r=>r),n=au.from(i,e);if(!n)return"";let o=new Set;return t.type==="observers"?uB(n,0,o,t).trim():cB(n,0,o,t).trim()}function cB(i,t,e,n){let o="		".repeat(t),r=[];if(e.has(i.sourceObj))return r.push(`${o}* ${i.type} ${i.name} (already listed)`),r.join(`
`);if(e.add(i.sourceObj),r.push(`${o}* ${i.type} ${i.name}:`),r.push(`${o}  value: ${Wr(i.value,50)}`),r.push(`${o}  state: ${i.state}`),i.dependencies.length>0){r.push(`${o}  dependencies:`);for(let a of i.dependencies){let l=au.from(a,n.debugNamePostProcessor??(d=>d))??au.unknown(a);r.push(cB(l,t+1,e,n))}}return r.join(`
`)}function uB(i,t,e,n){let o="		".repeat(t),r=[];if(e.has(i.sourceObj))return r.push(`${o}* ${i.type} ${i.name} (already listed)`),r.join(`
`);if(e.add(i.sourceObj),r.push(`${o}* ${i.type} ${i.name}:`),r.push(`${o}  value: ${Wr(i.value,50)}`),r.push(`${o}  state: ${i.state}`),i.observers.length>0){r.push(`${o}  observers:`);for(let a of i.observers){let l=au.from(a,n.debugNamePostProcessor??(d=>d))??au.unknown(a);r.push(uB(l,t+1,e,n))}}return r.join(`
`)}var au=class i{constructor(t,e,n,o,r,s,a){this.sourceObj=t;this.name=e;this.type=n;this.value=o;this.state=r;this.dependencies=s;this.observers=a}static from(t,e){if(t instanceof Fa){let n=t.debugGetState();return new i(t,e(t.debugName),"autorun",void 0,n.stateStr,Array.from(n.dependencies),[])}else if(t instanceof no){let n=t.debugGetState();return new i(t,e(t.debugName),"derived",n.value,n.stateStr,Array.from(n.dependencies),Array.from(t.debugGetObservers()))}else if(t instanceof Ts){let n=t.debugGetState();return new i(t,e(t.debugName),"observableValue",n.value,"upToDate",[],Array.from(t.debugGetObservers()))}else if(t instanceof li){let n=t.debugGetState();return new i(t,e(t.debugName),"fromEvent",n.value,n.hasValue?"upToDate":"initial",[],Array.from(t.debugGetObservers()))}}static unknown(t){return new i(t,"(unknown)","unknown",void 0,"unknown",[],[])}};rB(dB);YV(aB);var SK=!1;SK&&uy(new fy);Fo&&Fo.VSCODE_DEV_DEBUG_OBSERVABLES&&uy(jS.getInstance());function CK(i){return!!i&&typeof i=="object"&&"uri"in i&&i.uri instanceof y&&"version"in i&&typeof i.version=="number"&&"ranges"in i&&Array.isArray(i.ranges)&&i.ranges.every(ze.isIRange)}function mB(i){return!!i&&typeof i=="object"&&"documents"in i&&Array.isArray(i.documents)&&i.documents.every(CK)}function gB(i){return!!i&&typeof i=="object"&&"command"in i&&"language"in i}var Fe;(m=>{let i;(R=>(R[R.Streaming=0]="Streaming",R[R.WaitingForConfirmation=1]="WaitingForConfirmation",R[R.Executing=2]="Executing",R[R.WaitingForPostApproval=3]="WaitingForPostApproval",R[R.Completed=4]="Completed",R[R.Cancelled=5]="Cancelled",R[R.WaitingForAuthentication=6]="WaitingForAuthentication"))(i=m.StateKind||={});function t(g,h){if(g.kind==="toolInvocationSerialized")return g.isConfirmed===void 0||typeof g.isConfirmed=="boolean"?{type:g.isConfirmed?4:0}:g.isConfirmed;let f=g.state.read(h);if(!(f.type===0||f.type===1))return f.type===5?{type:f.reason}:f.confirmed}m.executionConfirmedOrDenied=t;function e(g,h){let f=t(g);if(f)return Promise.resolve(f);let I=new $;return new Promise(x=>{h&&I.add(h.onCancellationRequested(()=>{x({type:0})})),I.add(Eo(E=>{let w=t(g,E);w&&(I.dispose(),x(w))}))}).finally(()=>{I.dispose()})}m.awaitConfirmation=e;function n(g,h){let f=g.state.read(h);if(f.type===4)return f.postConfirmed||{type:1};if(f.type===5)return{type:f.reason}}function o(g,h){let f=g?.state.get();return f?.type===1||f?.type===3?(f.confirm(h),!0):!1}m.confirmWith=o;function r(g,h){let f=n(g);if(f)return Promise.resolve(f);let I=new $;return new Promise(x=>{h&&I.add(h.onCancellationRequested(()=>{x({type:0})})),I.add(Eo(E=>{let w=n(g,E);w&&(I.dispose(),x(w))}))}).finally(()=>{I.dispose()})}m.awaitPostConfirmation=r;function s(g,h){if(g.kind==="toolInvocationSerialized")return g.resultDetails;let f=g.state.read(h);if(f.type===4||f.type===3)return f.resultDetails}m.resultDetails=s;function a(g,h){if(g.kind==="toolInvocationSerialized")return!0;let f=g.state.read(h);return f.type===4||f.type===5}m.isComplete=a;function l(g,h){return!!(g.presentation==="hidden"||g.presentation==="hiddenAfterComplete"&&a(g,h))}m.isEffectivelyHidden=l;function d(g,h){return g.kind==="toolInvocationSerialized"?!1:g.state.read(h).type===0}m.isStreaming=d;function c(g,h){if(g.kind==="toolInvocationSerialized")return;let f=g.state.read(h);if(f.type!==0)return f.parameters}m.getParameters=c;function u(g,h){if(g.kind==="toolInvocationSerialized")return;let f=g.state.read(h);if(f.type!==0)return f.confirmationMessages}m.getConfirmationMessages=u})(Fe||={});var TK;(o=>{function i(r){return r.kind==="sent"}o.isSent=i;function t(r){return r.kind==="rejected"}o.isRejected=t;function e(r){return r.kind==="queued"}o.isQueued=e;function n(r){if(r.kind!=="sent")throw new Error(`Expected ChatSendResult to be 'sent', but was '${r.kind}'`)}o.assertSent=n})(TK||={});var wr=A("IChatService");var $t=A("configurationService");function fB(i){switch(i){case 1:return"APPLICATION";case 2:return"USER";case 3:return"USER_LOCAL";case 4:return"USER_REMOTE";case 5:return"WORKSPACE";case 6:return"WORKSPACE_FOLDER";case 7:return"DEFAULT";case 8:return"MEMORY"}}function GS(i,t){let e=Object.create(null);for(let n in i)jM(e,n,i[n],t);return e}function jM(i,t,e,n){let o=t.split("."),r=o.pop(),s=i;for(let a=0;a<o.length;a++){let l=o[a],d=s[l];switch(typeof d){case"undefined":d=s[l]=Object.create(null);break;case"object":if(d===null){n(`Ignoring ${t} as ${o.slice(0,a+1).join(".")} is null`);return}break;default:n(`Ignoring ${t} as ${o.slice(0,a+1).join(".")} is ${JSON.stringify(d)}`);return}s=d}if(typeof s=="object"&&s!==null)try{s[r]=e}catch{n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(s)}`)}else n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(s)}`)}function hB(i,t){let e=t.split(".");vB(i,e)}function vB(i,t){if(!i)return;let e=i,n=t.shift();if(t.length===0){delete e[n];return}if(Object.keys(e).indexOf(n)!==-1){let o=e[n];typeof o=="object"&&o!==null&&!Array.isArray(o)&&(vB(o,t),Object.keys(o).length===0&&delete e[n])}}function hy(i,t,e){function n(s,a){let l=s;for(let d of a){if(typeof l!="object"||l===null)return;l=l[d]}return l}let o=t.split("."),r=n(i,o);return typeof r>"u"?e:r}function yB(i){return i.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var cve=new k("isMac",St,p(2810,null)),uve=new k("isLinux",Xe,p(2809,null)),pve=new k("isWindows",Te,p(2814,null)),bB=new k("isWeb",ei,p(2813,null)),GM=new k("isMacNative",St&&!ei,p(2811,null)),mve=new k("isIOS",zH,p(2808,null)),gve=new k("isMobile",qH,p(2812,null)),fve=new k("isDevelopment",!1,!0),hve=new k("productQualityType","",p(2815,null)),EK="inputFocus",vve=new k(EK,!1,p(2807,null));var QM=A("languageService");var JM=A("modelService");var Fve=new k("workbenchState",void 0,{type:"string",description:p(7373,null)}),Hve=new k("workspaceFolderCount",0,p(7374,null)),Wve=new k("openFolderWorkspaceSupport",!0,!0),Vve=new k("enterMultiRootWorkspaceSupport",!0,!0),Bve=new k("emptyWorkspaceSupport",!0,!0),$ve=new k("dirtyWorkingCopies",!1,p(7313,null)),IB=new k("remoteName","",p(7350,null)),zve=new k("virtualWorkspace","",p(7372,null)),qve=new k("temporaryWorkspace",!1,p(7366,null)),xB=new k("isSessionsWindow",!1,p(7336,null)),Kve=new k("hasWebFileSystemAccess",!1,!0),jve=new k("embedderIdentifier",void 0,p(7325,null)),Gve=new k("inAutomation",!1,p(7328,null)),Qve=new k("isFullscreen",!1,p(7334,null)),Jve=new k("isAuxiliaryWindowFocusedContext",!1,p(7331,null)),Yve=new k("isWindowAlwaysOnTop",!1,p(7338,null)),SB=new k("isAuxiliaryWindow",!1,p(7330,null)),wK=lt.or(GM,lt.and(lt.notEquals("config.window.menuBarVisibility","hidden"),lt.notEquals("config.window.menuBarVisibility","toggle"),lt.notEquals("config.window.menuBarVisibility","compact"))),Xve=lt.and(GM.negate(),wK),Zve=new k("activeEditorIsDirty",!1,p(7301,null)),eye=new k("activeEditorIsNotPreview",!1,p(7304,null)),tye=new k("activeEditorIsFirstInGroup",!1,p(7302,null)),nye=new k("activeEditorIsLastInGroup",!1,p(7303,null)),oye=new k("activeEditorIsPinned",!1,p(7305,null)),rye=new k("activeEditorIsReadonly",!1,p(7306,null)),iye=new k("activeCompareEditorCanSwap",!1,p(7289,null)),sye=new k("activeEditorCanToggleReadonly",!0,p(7296,null)),aye=new k("activeEditorCanRevert",!1,p(7295,null)),lye=new k("activeEditorCanSplitInGroup",!0),dye=new k("activeEditorCannotClose",!1,p(7294,null)),cye=new k("activeEditor",null,{type:"string",description:p(7292,null)}),uye=new k("activeEditorAvailableEditorIds","",p(7293,null)),pye=new k("textCompareEditorVisible",!1,p(7368,null)),mye=new k("textCompareEditorActive",!1,p(7367,null)),gye=new k("sideBySideEditorActive",!1,p(7363,null)),fye=new k("activeCustomEditorDiffCanToggleLayout",!1,p(7290,null)),hye=new k("activeCustomEditorTextDiff",!1,p(7291,null)),vye=new k("groupEditorsCount",0,p(7327,null)),yye=new k("isTopRightEditorGroup",!1,p(7337,null)),bye=new k("activeEditorGroupEmpty",!1,p(7297,null)),Iye=new k("activeEditorGroupIndex",0,p(7298,null)),xye=new k("activeEditorGroupLast",!1,p(7299,null)),Sye=new k("activeEditorGroupLocked",!1,p(7300,null)),kK=new k("multipleEditorGroups",!1,p(7340,null)),Cye=kK.toNegated(),Tye=new k("multipleEditorsSelectedInGroup",!1,p(7341,null)),Eye=new k("twoEditorsSelectedInGroup",!1,p(7371,null)),wye=new k("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,p(7360,null)),kye=new k("editorPartMultipleEditorGroups",!1,p(7323,null)),Pye=new k("editorPartMaximizedEditorGroup",!1,p(7316,null)),_ye=new k("editorPartModal",!1,p(7317,null)),Rye=new k("editorPartModalVisible",!1,p(7322,null)),Dye=new k("editorPartModalMaximized",!1,p(7318,null)),Aye=new k("editorPartModalNavigation",!1,p(7319,null)),Mye=new k("editorPartModalSidebar",!1,p(7320,null)),Lye=new k("editorPartModalSidebarVisible",!1,p(7321,null)),Oye=new k("editorIsOpen",!1,p(7315,null)),Nye=new k("editorAreaFocus",!1,p(7314,null)),Uye=new k("inZenMode",!1,p(7329,null)),Fye=new k("isCenteredLayout",!1,p(7335,null)),Hye=new k("splitEditorsVertically",!1,p(7364,null)),Wye=new k("mainEditorAreaVisible",!0,p(7339,null)),Vye=new k("editorTabsVisible",!0,p(7324,null)),Bye=new k("sideBarVisible",!1,p(7362,null)),$ye=new k("sideBarFocus",!1,p(7361,null)),zye=new k("activeViewlet","",p(7308,null)),qye=new k("statusBarFocused",!1,p(7365,null)),Kye=new k("titleBarStyle","custom",p(7369,null)),jye=new k("titleBarVisible",!1,p(7370,null)),Gye=new k("isCompactTitleBar",!1,p(7332,null)),Qye=new k("bannerFocused",!1,p(7312,null)),Jye=new k("notificationFocus",!0,p(7343,null)),Yye=new k("notificationCenterVisible",!1,p(7342,null)),Xye=new k("notificationToastsVisible",!1,p(7344,null)),Zye=new k("activeAuxiliary","",p(7288,null)),ebe=new k("auxiliaryBarFocus",!1,p(7309,null)),tbe=new k("auxiliaryBarVisible",!1,p(7311,null)),nbe=new k("secondarySideBarVisible",!1,p(7359,null)),obe=new k("auxiliaryBarMaximized",!1,p(7310,null)),rbe=new k("activePanel","",p(7307,null)),ibe=new k("panelFocus",!1,p(7346,null)),sbe=new k("panelPosition","bottom",p(7348,null)),abe=new k("panelAlignment","center",p(7345,null)),lbe=new k("panelVisible",!1,p(7349,null)),dbe=new k("panelMaximized",!1,p(7347,null)),cbe=new k("focusedView","",p(7326,null));var lr=class{constructor(t,e,n,o){this._contextKeyService=t;this._fileService=e;this._languageService=n;this._modelService=o;this._schemeKey=lr.Scheme.bindTo(this._contextKeyService),this._filenameKey=lr.Filename.bindTo(this._contextKeyService),this._dirnameKey=lr.Dirname.bindTo(this._contextKeyService),this._pathKey=lr.Path.bindTo(this._contextKeyService),this._langIdKey=lr.LangId.bindTo(this._contextKeyService),this._resourceKey=lr.Resource.bindTo(this._contextKeyService),this._extensionKey=lr.Extension.bindTo(this._contextKeyService),this._hasResource=lr.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=lr.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new k("resourceScheme",void 0,{type:"string",description:p(7357,null)})}static{this.Filename=new k("resourceFilename",void 0,{type:"string",description:p(7354,null)})}static{this.Dirname=new k("resourceDirname",void 0,{type:"string",description:p(7352,null)})}static{this.Path=new k("resourcePath",void 0,{type:"string",description:p(7356,null)})}static{this.LangId=new k("resourceLangId",void 0,{type:"string",description:p(7355,null)})}static{this.Resource=new k("resource",void 0,{type:"URI",description:p(7351,null)})}static{this.Extension=new k("resourceExtname",void 0,{type:"string",description:p(7353,null)})}static{this.HasResource=new k("resourceSet",void 0,{type:"boolean",description:p(7358,null)})}static{this.IsFileSystemResource=new k("isFileSystemResource",void 0,{type:"boolean",description:p(7333,null)})}_setLangId(){let t=this.get();if(!t){this._langIdKey.set(null);return}let e=this._modelService.getModel(t)?.getLanguageId()??this._languageService.guessLanguageIdByFilepathOrFirstLine(t);this._langIdKey.set(e)}set(t){t=t??void 0,!Sn(this._value,t)&&(this._value=t,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.set(t?t.toString():null),this._schemeKey.set(t?t.scheme:null),this._filenameKey.set(t?Ze(t):null),this._dirnameKey.set(t?this.uriToPath(Ho(t)):null),this._pathKey.set(t?this.uriToPath(t):null),this._setLangId(),this._extensionKey.set(t?yv(t):null),this._hasResource.set(!!t),this._isFileSystemResource.set(t?this._fileService.hasProvider(t):!1)}))}uriToPath(t){return t.scheme===B.file?t.fsPath:t.path}reset(){this._value=void 0,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.reset(),this._schemeKey.reset(),this._filenameKey.reset(),this._dirnameKey.reset(),this._pathKey.reset(),this._langIdKey.reset(),this._extensionKey.reset(),this._hasResource.reset(),this._isFileSystemResource.reset()})}get(){return this._value}};lr=_([S(0,Ir),S(1,zo),S(2,QM),S(3,JM)],lr);var QS=class extends lr{constructor(e,n,o,r){super(e,n,o,r);this._disposables=new $;this._disposables.add(n.onDidChangeFileSystemProviderRegistrations(()=>{let s=this.get();this._isFileSystemResource.set(!!(s&&n.hasProvider(s)))})),this._disposables.add(r.onModelAdded(s=>{Sn(s.uri,this.get())&&this._setLangId()})),this._disposables.add(r.onModelLanguageChanged(s=>{Sn(s.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};QS=_([S(0,Ir),S(1,zo),S(2,QM),S(3,JM)],QS);var JS="chat.disableAIFeatures";var PK={"**/.mcp.json":!1,"**/.npmrc":!1,"**/.vscode/*.json":!1,"**/.github/agents/**":!1,"**/.github/hooks/**":!1,"**/.claude/agents/**":!1,"**/.claude/settings.json":!1,"**/.claude/settings.local.json":!1},mbe={"**/*":!0,"**/.git/**":!1,"**/{package.json,server.xml,build.rs,web.config,.gitattributes,.env,Cargo.toml}":!1,"**/{.npmrc,.yarnrc,.yarnrc.yml,.pnpmfile.js,.pnpmfile.cjs,.pnpmfile.mjs,pnpm-workspace.yaml}":!1,"**/*.{code-workspace,csproj,fsproj,vbproj,vcxproj,proj,targets,props,gradle,gradle.kts}":!1,"**/gradle.properties":!1,"**/ruby_lsp/*/addon":!1,"**/*.lock":!1,"**/*-lock.{yaml,json}":!1,...PK};var YS=A("dialogService");var bbe=A("fileDialogService");var Es=A("productService"),CB="vscode://schemas/vscode-product";function TB(i){let t=!1,e=new Map,n=new Map;if(_K(i,c=>{if(i===c)return!0;let u=JSON.stringify(c);if(u.length<30)return!0;let m=e.get(u);if(!m){let g={schemas:[c]};return e.set(u,g),n.set(c,g),!0}return m.schemas.push(c),n.set(c,m),t=!0,!1}),e.clear(),!t)return JSON.stringify(i);let r="$defs";for(;i.hasOwnProperty(r);)r+="_";let s=[];function a(c){return JSON.stringify(c,(u,m)=>{if(m!==c){let g=n.get(m);if(g&&g.schemas.length>1)return g.id||(g.id=`_${s.length}`,s.push(g.schemas[0])),{$ref:`#/${r}/${g.id}`}}return m})}let l=a(i),d=[];for(let c=0;c<s.length;c++)d.push(`"_${c}":${a(s[c])}`);return d.length?`${l.substring(0,l.length-1)},"${r}":{${d.join(",")}}}`:l}function hm(i){return typeof i=="object"&&i!==null}function _K(i,t){if(!i||typeof i!="object")return;let e=(...l)=>{for(let d of l)hm(d)&&s.push(d)},n=(...l)=>{for(let d of l)if(hm(d))for(let c in d){let u=d[c];hm(u)&&s.push(u)}},o=(...l)=>{for(let d of l)if(Array.isArray(d))for(let c of d)hm(c)&&s.push(c)},r=l=>{if(Array.isArray(l))for(let d of l)hm(d)&&s.push(d);else hm(l)&&s.push(l)},s=[i],a=s.pop();for(;a;)t(a)&&(e(a.additionalItems,a.additionalProperties,a.not,a.contains,a.propertyNames,a.if,a.then,a.else,a.unevaluatedItems,a.unevaluatedProperties),n(a.definitions,a.$defs,a.properties,a.patternProperties,a.dependencies,a.dependentSchemas),o(a.anyOf,a.allOf,a.oneOf,a.prefixItems),r(a.items)),a=s.pop()}var lu={JSONContribution:"base.contributions.json"};function EB(i){return i.length>0&&i.charAt(i.length-1)==="#"?i.substring(0,i.length-1):i}var YM=class extends N{constructor(){super(...arguments);this.schemasById={};this.schemaAssociations={};this._onDidChangeSchema=this._register(new T);this.onDidChangeSchema=this._onDidChangeSchema.event;this._onDidChangeSchemaAssociations=this._register(new T);this.onDidChangeSchemaAssociations=this._onDidChangeSchemaAssociations.event}registerSchema(e,n,o){let r=EB(e);this.schemasById[r]=n,this._onDidChangeSchema.fire(e),o&&o.add(q(()=>{delete this.schemasById[r],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,n){let o=EB(e);return this.schemaAssociations[o]||(this.schemaAssociations[o]=[]),this.schemaAssociations[o].includes(n)||(this.schemaAssociations[o].push(n),this._onDidChangeSchemaAssociations.fire()),q(()=>{let r=this.schemaAssociations[o];if(r){let s=r.indexOf(n);s!==-1&&(r.splice(s,1),r.length===0&&delete this.schemaAssociations[o],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let n=this.schemasById[e];return n?TB(n):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},RK=new YM;wt.add(lu.JSONContribution,RK);var kr={Configuration:"base.contributions.configuration"};function DK(i,t){return i===t?!0:!i||!t?!1:typeof i=="string"||typeof t=="string"?i===t:i.id===t.id}var XS={properties:{},patternProperties:{}},ZS={properties:{},patternProperties:{}},eC={properties:{},patternProperties:{}},tC={properties:{},patternProperties:{}},nC={properties:{},patternProperties:{}},oC={properties:{},patternProperties:{}},vy={properties:{},patternProperties:{}},du="vscode://schemas/settings/resourceLanguage";var rC=wt.as(lu.JSONContribution),XM=class extends N{constructor(){super();this.registeredConfigurationDefaults=[];this.excludedAgentHostSyncKeys=new Map;this.overrideIdentifiers=new Set;this._onDidSchemaChange=this._register(new T);this.onDidSchemaChange=this._onDidSchemaChange.event;this._onDidUpdateConfiguration=this._register(new T);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:p(2792,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.policyReferenceConfigurations=new Map,this.agentHostSyncConfigurations=new Map,this.excludedConfigurationProperties={},rC.registerSchema(du,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,n=!0){return this.registerConfigurations([e],n),e}registerConfigurations(e,n=!0){let o=new Set;this.doRegisterConfigurations(e,n,o),rC.registerSchema(du,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let n=new Set;this.doDeregisterConfigurations(e,n),rC.registerSchema(du,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n})}updateConfigurations({add:e,remove:n}){let o=new Set;this.doDeregisterConfigurations(n,o),this.doRegisterConfigurations(e,!1,o),rC.registerSchema(du,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}registerDefaultConfigurations(e){let n=new Set;this.doRegisterDefaultConfigurations(e,n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,n){this.registeredConfigurationDefaults.push(...e);let o=[];for(let{overrides:r,source:s}of e)for(let a in r){n.add(a);let l=this.configurationDefaultsOverrides.get(a)??this.configurationDefaultsOverrides.set(a,{configurationDefaultOverrides:[]}).get(a),d=r[a];if(l.configurationDefaultOverrides.push({value:d,source:s}),ci.test(a)){let c=this.mergeDefaultConfigurationsForOverrideIdentifier(a,d,s,l.configurationDefaultOverrideValue);if(!c)continue;l.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(a,c,s),o.push(...vm(a))}else{let c=this.mergeDefaultConfigurationsForConfigurationProperty(a,d,s,l.configurationDefaultOverrideValue);if(!c)continue;l.configurationDefaultOverrideValue=c;let u=this.configurationProperties[a];u&&(this.updatePropertyDefaultValue(a,u),this.updateSchema(a,u))}}this.doRegisterOverrideIdentifiers(o)}deregisterDefaultConfigurations(e){let n=new Set;this.doDeregisterDefaultConfigurations(e,n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(e,n){for(let o of e){let r=this.registeredConfigurationDefaults.indexOf(o);r!==-1&&this.registeredConfigurationDefaults.splice(r,1)}for(let{overrides:o,source:r}of e)for(let s in o){let a=this.configurationDefaultsOverrides.get(s);if(!a)continue;let l=a.configurationDefaultOverrides.findIndex(d=>r?DK(d.source,r):d.value===o[s]);if(l!==-1){if(a.configurationDefaultOverrides.splice(l,1),a.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(s),ci.test(s)){let d;for(let c of a.configurationDefaultOverrides)d=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c.value,c.source,d);d&&!Wl(d.value)?(a.configurationDefaultOverrideValue=d,this.updateDefaultOverrideProperty(s,d,r)):(this.configurationDefaultsOverrides.delete(s),delete this.configurationProperties[s],delete this.defaultLanguageConfigurationOverridesNode.properties[s])}else{let d;for(let u of a.configurationDefaultOverrides)d=this.mergeDefaultConfigurationsForConfigurationProperty(s,u.value,u.source,d);a.configurationDefaultOverrideValue=d;let c=this.configurationProperties[s];c&&(this.updatePropertyDefaultValue(s,c),this.updateSchema(s,c))}n.add(s)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,n,o){let r={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:n.value,description:p(2791,null,yB(e)),$ref:du,defaultDefaultValue:n.value,source:o,defaultValueSource:o};this.configurationProperties[e]=r,this.defaultLanguageConfigurationOverridesNode.properties[e]=r}mergeDefaultConfigurationsForOverrideIdentifier(e,n,o,r){let s=r?.value||{},a=r?.source??new Map;if(!(a instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(n)){let d=n[l];if(st(d)&&(cs(s[l])||st(s[l]))){if(s[l]={...s[l]??{},...d},o)for(let u in d)a.set(`${l}.${u}`,o)}else s[l]=d,o?a.set(l,o):a.delete(l)}return{value:s,source:a}}mergeDefaultConfigurationsForConfigurationProperty(e,n,o,r){let s=this.configurationProperties[e],a=r?.value??s?.defaultDefaultValue,l=o;if(st(n)&&(s!==void 0&&s.type==="object"||s===void 0&&(cs(a)||st(a)))){if(l=r?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let c in n)o&&l.set(`${e}.${c}`,o);n={...st(a)?a:{},...n}}return{value:n,source:l}}deltaConfiguration(e){let n=!1,o=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,o),n=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,o),n=!0),e.removedConfigurations&&this.doDeregisterConfigurations(e.removedConfigurations,o),e.addedConfigurations&&this.doRegisterConfigurations(e.addedConfigurations,!1,o),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o,defaultsOverrides:n})}notifyConfigurationSchemaUpdated(...e){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let n of e)this.overrideIdentifiers.add(n);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,n,o){e.forEach(r=>{this.validateAndRegisterProperties(r,n,r.extensionInfo,r.restrictedProperties,void 0,o),this.configurationContributors.push(r),this.registerJSONConfiguration(r)})}doDeregisterConfigurations(e,n){let o=r=>{let s=this.excludedAgentHostSyncKeys.get(r);if(s){for(let a of s)n.add(a),this.agentHostSyncConfigurations.delete(a);this.excludedAgentHostSyncKeys.delete(r)}if(r.properties)for(let a in r.properties){n.add(a);let l=this.configurationProperties[a];if(l?.policy?.name&&this.policyConfigurations.delete(l.policy.name),this.agentHostSyncConfigurations.delete(a),l?.policyReference?.name){let d=this.policyReferenceConfigurations.get(l.policyReference.name);d&&(d.delete(a),d.size===0&&this.policyReferenceConfigurations.delete(l.policyReference.name))}delete this.configurationProperties[a],this.removeFromSchema(a,r.properties[a])}r.allOf?.forEach(a=>o(a))};for(let r of e){o(r);let s=this.configurationContributors.indexOf(r);s!==-1&&this.configurationContributors.splice(s,1)}}validateAndRegisterProperties(e,n=!0,o,r,s=4,a){s=Wt(e.scope)?s:e.scope;let l=e.properties;if(l)for(let c in l){let u=l[c];if(u.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},n&&MK(c,u,o?.id)){delete l[c];continue}u.source=o,u.defaultDefaultValue=l[c].default,this.updatePropertyDefaultValue(c,u),ci.test(c)?u.scope=void 0:(u.scope=Wt(u.scope)?s:u.scope,u.restricted=Wt(u.restricted)?!!r?.includes(c):u.restricted),u.experiment?u.tags?.some(I=>I.toLowerCase()==="onexp")||(u.tags=u.tags??[],u.tags.push("onExP")):u.tags?.some(I=>I.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${c}'. Please use 'experiment' property instead.`),u.experiment={mode:"startup"});let m=l[c].hasOwnProperty("included")&&!l[c].included,g=l[c].policy?.name,h=l[c].policyReference?.name,f=l[c].agentHost;if(f&&this.agentHostSyncConfigurations.set(c,f),m){if(this.excludedConfigurationProperties[c]=l[c],g&&(this.policyConfigurations.set(g,c),a.add(c)),h&&(this.addPolicyReferenceConfiguration(h,c),a.add(c)),f){a.add(c);let I=this.excludedAgentHostSyncKeys.get(e);I||(I=new Set,this.excludedAgentHostSyncKeys.set(e,I)),I.add(c)}delete l[c]}else a.add(c),g&&this.policyConfigurations.set(g,c),h&&this.addPolicyReferenceConfiguration(h,c),this.configurationProperties[c]=l[c],!l[c].deprecationMessage&&l[c].markdownDeprecationMessage&&(l[c].deprecationMessage=l[c].markdownDeprecationMessage)}let d=e.allOf;if(d)for(let c of d)this.validateAndRegisterProperties(c,n,o,r,s,a)}addPolicyReferenceConfiguration(e,n){let o=this.policyReferenceConfigurations.get(e);o||(o=new Set,this.policyReferenceConfigurations.set(e,o)),o.add(n)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getPolicyReferenceConfigurations(){return this.policyReferenceConfigurations}getAgentHostSyncConfigurations(){return this.agentHostSyncConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){let e=new Map;for(let[n,o]of this.configurationDefaultsOverrides)o.configurationDefaultOverrideValue&&e.set(n,o.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let n=o=>{let r=o.properties;if(r)for(let a in r)this.updateSchema(a,r[a]);o.allOf?.forEach(n)};n(e)}updateSchema(e,n){switch(XS.properties[e]=n,n.scope){case 1:ZS.properties[e]=n;break;case 2:tC.properties[e]=n;break;case 3:eC.properties[e]=n;break;case 7:nC.properties[e]=n;break;case 4:oC.properties[e]=n;break;case 5:vy.properties[e]=n;break;case 6:vy.properties[e]=n,this.resourceLanguageSettingsSchema.properties[e]=n;break}}removeFromSchema(e,n){switch(delete XS.properties[e],n.scope){case 1:delete ZS.properties[e];break;case 2:delete tC.properties[e];break;case 3:delete eC.properties[e];break;case 7:delete nC.properties[e];break;case 4:delete oC.properties[e];break;case 5:case 6:delete vy.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let n=`[${e}]`,o={type:"object",description:p(2793,null),errorMessage:p(2794,null),$ref:du};this.updatePropertyDefaultValue(n,o),XS.properties[n]=o,ZS.properties[n]=o,eC.properties[n]=o,tC.properties[n]=o,nC.properties[n]=o,oC.properties[n]=o,vy.properties[n]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:p(2793,null),errorMessage:p(2794,null),$ref:du};XS.patternProperties[cd]=e,ZS.patternProperties[cd]=e,eC.patternProperties[cd]=e,tC.patternProperties[cd]=e,nC.patternProperties[cd]=e,oC.patternProperties[cd]=e,vy.patternProperties[cd]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,n){let o=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,r,s;o&&(!n.disallowConfigurationDefault||!o.source)&&(r=o.value,s=o.source),cs(r)&&(r=n.defaultDefaultValue,s=void 0),cs(r)&&(r=AK(n.type)),n.default=r,n.defaultValueSource=s}},kB="\\[([^\\]]+)\\]",wB=new RegExp(kB,"g"),cd=`^(${kB})+$`,ci=new RegExp(cd);function vm(i){let t=[];if(ci.test(i)){let e=wB.exec(i);for(;e?.length;){let n=e[1].trim();n&&t.push(n),e=wB.exec(i)}}return er(t)}function AK(i){switch(Array.isArray(i)?i[0]:i){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var yy=new XM;wt.add(kr.Configuration,yy);function MK(i,t,e){if(!i.trim())return p(2789,null);if(ci.test(i))return p(2790,null,i);if(yy.getConfigurationProperties()[i]!==void 0&&(!e||!LK.has(e.toLowerCase())))return p(2788,null,i);if(t.policy&&t.policyReference)return p(2786,null,i);if(t.policy?.name&&yy.getPolicyConfigurations().get(t.policy?.name)!==void 0)return p(2787,null,i,t.policy?.name,yy.getPolicyConfigurations().get(t.policy?.name));if(t.agentHost){for(let[n,o]of yy.getAgentHostSyncConfigurations())if(o.key===t.agentHost.key&&n!==i)return p(2785,null,i,t.agentHost.key,n)}return null}var LK=new Set(rr.defaultChatAgent?[rr.defaultChatAgent.extensionId,rr.defaultChatAgent.chatExtensionId].map(i=>i.toLowerCase()):[]);var sC=A("requestService");var e1=class{constructor(t){this.original=t}toJSON(){if(!this.headers){let t=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?t[e]="*****":t[e]=this.original[e];this.headers=t}return this.headers}},iC=class extends N{constructor(e){super();this.logService=e;this.counter=0;this._onDidCompleteRequest=this._register(new T);this.onDidCompleteRequest=this._onDidCompleteRequest.event}async logAndRequest(e,n){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new e1(e.headers??{}));let r=Date.now();try{let s=await n();return this.logService.trace(`${o} - end`,e.type,s.res.statusCode,s.res.headers),this._onDidCompleteRequest.fire({callSite:e.callSite,latency:Date.now()-r,statusCode:s.res.statusCode}),s}catch(s){throw this.logService.error(`${o} - error`,e.type,ds(s)),s}}};function OK(i){return i.res.statusCode&&i.res.statusCode>=200&&i.res.statusCode<300||i.res.statusCode===1223}function RB(i){return i.res.statusCode===204}async function t1(i){return RB(i)?null:(await lD(i.stream)).toString()}async function DB(i){if(!OK(i))throw new Error("Server returned "+i.res.statusCode);if(RB(i))return null;let e=(await lD(i.stream)).toString();try{return JSON.parse(e)}catch(n){throw n.message+=`:
`+e,n}}var ym=!0,ZM=[],PB,_B;function NK(i=!0,t=!0){if(PB===i&&_B===t)return;PB=i,_B=t;let e=wt.as(kr.Configuration),n=ZM;ZM=[{id:"http",order:15,title:p(3223,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:t,markdownDescription:p(3238,null),restricted:!0}}},{id:"http",order:15,title:p(3223,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:p(3221,null),restricted:!0}}},{id:"http",order:15,title:p(3223,null),type:"object",scope:i?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:p(3226,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,agentHost:{key:"http.proxy",scope:"ambient",transform:o=>typeof o=="string"?o:""}},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:p(3234,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:p(3228,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,agentHost:{key:"http.proxyKerberosServicePrincipal",scope:"ambient",transform:o=>typeof o=="string"?o:""}},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:p(3225,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,agentHost:{key:"http.noProxy",scope:"ambient",transform:o=>Array.isArray(o)?o:[]}},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:p(3227,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[p(3231,null),p(3232,null),p(3230,null),p(3233,null)],default:"override",markdownDescription:p(3229,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:p(3235,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:ym,markdownDescription:p(3236,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:p(3237,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:p(3222,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.webSocketAdditionalSupport":{type:"boolean",default:!0,markdownDescription:p(3239,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:p(3224,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:ZM,remove:n})}NK();var ud=class i extends N{constructor(e,n=Object.create(null)){super();this.database=e;this.options=n;this._onDidChangeStorage=this._register(new gs);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new Pa(i.DEFAULT_FLUSH_DELAY));this.pendingDeletes=new Set;this.pendingInserts=new Map;this.pendingClose=void 0;this.whenFlushedCallbacks=[];this.registerListeners()}static{this.DEFAULT_FLUSH_DELAY=100}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((n,o)=>this.acceptExternal(o,n)),e.deleted?.forEach(n=>this.acceptExternal(n,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,n){if(this.state===2)return;let o=!1;Wt(n)?o=this.cache.delete(e):this.cache.get(e)!==n&&(this.cache.set(e,n),o=!0),o&&this._onDidChangeStorage.fire({key:e,external:!0})}get items(){return this.cache}get size(){return this.cache.size}async init(){this.state===0&&(this.state=1,this.options.hint!==0&&(this.cache=await this.database.getItems()))}get(e,n){let o=this.cache.get(e);return Wt(o)?n:o}getBoolean(e,n){let o=this.get(e);return Wt(o)?n:o==="true"}getNumber(e,n){let o=this.get(e);return Wt(o)?n:parseInt(o,10)}getObject(e,n){let o=this.get(e);return Wt(o)?n:Vx(o)}async set(e,n,o=!1){if(this.state===2)return;if(Wt(n))return this.delete(e,o);let r=st(n)||Array.isArray(n)?aW(n):String(n);if(this.cache.get(e)!==r)return this.cache.set(e,r),this.pendingInserts.set(e,r),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:o}),this.doFlush()}async delete(e,n=!1){if(!(this.state===2||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:n}),this.doFlush()}async optimize(){if(this.state!==2)return await this.flush(0),this.database.optimize()}async close(){return this.pendingClose||(this.pendingClose=this.doClose()),this.pendingClose}async doClose(){this.state=2;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;let 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===2||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===1?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===1}},cu=class{constructor(){this.onDidChangeItemsExternal=ye.None;this.items=new Map}async getItems(){return this.items}async updateItems(t){t.insert?.forEach((e,n)=>this.items.set(n,e)),t.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}},AB="__$__migratedStorageMarker",MB=class i extends ud{constructor(){super(...arguments);this.migratedKeys=new Set;this.fallbackStorage=void 0;this.isFallbackStorageReadonly=!1}async init(){await super.init(),this.migratedKeys=this.loadMigratedKeys()}setFallbackStorage(e,n){this.fallbackStorage=e,this.isFallbackStorageReadonly=n}static{this.INTERNAL_KEY_PREFIX="__$__"}get(e,n){if(!e.startsWith(i.INTERNAL_KEY_PREFIX)&&!this.migratedKeys.has(e)&&cs(super.get(e))){this.migratedKeys.add(e);let o=this.fallbackStorage?.items.get(e);cs(o)||(this.set(e,o),this.isFallbackStorageReadonly||this.fallbackStorage?.delete(e),this.persistMigratedKeys())}return super.get(e,n)}loadMigratedKeys(){let e=super.get(AB);if(e)try{return new Set(JSON.parse(e))}catch{}return new Set}persistMigratedKeys(){this.set(AB,JSON.stringify([...this.migratedKeys]))}};var uu=A("environmentService"),LB=uu;var Vr=A("IUriIdentityService");var Iy="agents",UK={settings:!0,keybindings:!0,prompts:!0,mcp:!0,languageModels:!0,snippets:!0,tasks:!0,extensions:!0};function NB(i){let t=i;return!!(t&&typeof t=="object"&&typeof t.id=="string"&&typeof t.isDefault=="boolean"&&typeof t.name=="string"&&y.isUri(t.location)&&y.isUri(t.globalStorageHome)&&y.isUri(t.settingsResource)&&y.isUri(t.keybindingsResource)&&y.isUri(t.tasksResource)&&y.isUri(t.snippetsHome)&&y.isUri(t.promptsHome)&&y.isUri(t.extensionsResource)&&y.isUri(t.mcpResource)&&y.isUri(t.languageModelsResource)&&y.isUri(t.agentPluginsHome))}var pd=A("IUserDataProfilesService");function ws(i,t){return{id:i.id,isDefault:i.isDefault,name:i.name,icon:i.icon,location:y.revive(i.location).with({scheme:t}),globalStorageHome:y.revive(i.globalStorageHome).with({scheme:t}),settingsResource:y.revive(i.settingsResource).with({scheme:t}),keybindingsResource:y.revive(i.keybindingsResource).with({scheme:t}),tasksResource:y.revive(i.tasksResource).with({scheme:t}),snippetsHome:y.revive(i.snippetsHome).with({scheme:t}),promptsHome:y.revive(i.promptsHome).with({scheme:t}),extensionsResource:y.revive(i.extensionsResource).with({scheme:t}),mcpResource:y.revive(i.mcpResource).with({scheme:t}),languageModelsResource:y.revive(i.languageModelsResource).with({scheme:t}),agentPluginsHome:y.revive(i.agentPluginsHome),cacheHome:y.revive(i.cacheHome).with({scheme:t}),useDefaultFlags:i.useDefaultFlags,isTransient:i.isTransient,isInternal:i.isInternal,isAgentsWindowProfile:i.isAgentsWindowProfile,workspaces:i.workspaces?.map(e=>y.revive(e))}}function aC(i,t,e,n,o,r){let s=i===Iy;return{id:i,name:t,location:e,isDefault:!1,icon:o?.icon,globalStorageHome:r&&o?.useDefaultFlags?.globalState?r.globalStorageHome:gt(e,"globalStorage"),settingsResource:r&&o?.useDefaultFlags?.settings?r.settingsResource:gt(e,"settings.json"),keybindingsResource:r&&o?.useDefaultFlags?.keybindings?r.keybindingsResource:gt(e,"keybindings.json"),tasksResource:r&&o?.useDefaultFlags?.tasks?r.tasksResource:gt(e,"tasks.json"),snippetsHome:r&&o?.useDefaultFlags?.snippets?r.snippetsHome:gt(e,"snippets"),promptsHome:r&&o?.useDefaultFlags?.prompts?r.promptsHome:gt(e,"prompts"),extensionsResource:r&&o?.useDefaultFlags?.extensions?r.extensionsResource:gt(e,"extensions.json"),mcpResource:r&&o?.useDefaultFlags?.mcp?r.mcpResource:gt(e,"mcp.json"),languageModelsResource:r&&o?.useDefaultFlags?.languageModels?r.languageModelsResource:gt(e,"chatLanguageModels.json"),agentPluginsHome:r?r.agentPluginsHome:gt(e,"agent-plugins"),cacheHome:gt(n,i),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,isInternal:s||o?.transient,isAgentsWindowProfile:s,workspaces:o?.workspaces}}var OB="builtin",lC=class extends N{constructor(e,n,o,r){super();this.environmentService=e;this.fileService=n;this.uriIdentityService=o;this.logService=r;this._onDidChangeProfiles=this._register(new T);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._onWillCreateProfile=this._register(new T);this.onWillCreateProfile=this._onWillCreateProfile.event;this._onWillRemoveProfile=this._register(new T);this.onWillRemoveProfile=this._onWillRemoveProfile.event;this._onDidResetWorkspaces=this._register(new T);this.onDidResetWorkspaces=this._onDidResetWorkspaces.event;this.profileCreationPromises=new Map;this.transientProfilesObject={profiles:[],emptyWindows:new Map};this.profilesHome=gt(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=gt(this.environmentService.cacheHome,"CachedProfilesData")}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]}init(){this._profilesObject=void 0}get profilesObject(){if(!this._profilesObject){let e=this.createDefaultProfile(),n=[e];try{for(let r of this.getStoredProfiles()){if(this.isInvalidProfile(r)){this.logService.warn("Skipping the invalid stored profile",r.location||r.name);continue}let s=Ze(r.location);n.push(aC(s,r.name,r.location,this.profilesCacheHome,{icon:r.icon,useDefaultFlags:s===Iy?UK:r.useDefaultFlags},e))}}catch(r){this.logService.error(r)}let o=new Map;if(n.length)try{let r=this.getStoredProfileAssociations();if(r.workspaces)for(let[s,a]of Object.entries(r.workspaces)){let l=y.parse(s),d=n.find(c=>c.id===a);if(d){let c=d.workspaces?d.workspaces.slice(0):[];c.push(l),d.workspaces=c}}if(r.emptyWindows)for(let[s,a]of Object.entries(r.emptyWindows)){let l=n.find(d=>d.id===a);l&&o.set(s,l)}}catch(r){this.logService.error(r)}this._profilesObject={profiles:n,emptyWindows:o}}return this._profilesObject}isInvalidProfile(e){return!e.name||!Pe(e.name)||!e.location}createDefaultProfile(){let e=aC("__default__profile__",p(3678,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let n="Temp",o=new RegExp(`${nr(n)}\\s(\\d+)`),r=0;for(let a of this.profiles){let l=o.exec(a.name),d=l?parseInt(l[1]):0;r=d>r?d:r}let s=`${n} ${r+1}`;return this.createProfile(to(_e()).toString(16),s,{transient:!0},e)}async createNamedProfile(e,n,o){return this.createProfile(to(_e()).toString(16),e,n,o)}async createProfile(e,n,o,r){return await this.doCreateProfile(e,n,o,r)}async doCreateProfile(e,n,o,r){if(!Pe(n)||!n)throw new Error("Name of the profile is mandatory and must be of type `string`");let s=this.profileCreationPromises.get(n);return s||(s=(async()=>{try{if(this.profiles.find(u=>u.id===e||e!==Iy&&!u.isTransient&&!o?.transient&&u.name===n))throw new Error(`Profile with ${n} name already exists`);let l=r?this.getWorkspace(r):void 0;y.isUri(l)&&(o={...o,workspaces:[l]});let d=aC(e,n,this.uriIdentityService.extUri.joinPath(this.profilesHome,...e===Iy?[OB,e]:[e]),this.profilesCacheHome,e===Iy?{}:o,this.defaultProfile);await this.fileService.createFolder(d.location);let c=[];return this._onWillCreateProfile.fire({profile:d,join(u){c.push(u)}}),await ii.settled(c),l&&!y.isUri(l)&&this.updateEmptyWindowAssociation(l,d,!!d.isTransient),this.updateProfiles([d],[],[]),this.profiles.find(u=>u.id===d.id)??d}finally{this.profileCreationPromises.delete(n)}})(),this.profileCreationPromises.set(n,s)),s}async updateProfile(e,n){if(e.isAgentsWindowProfile)throw new Error("Cannot update agents window profile");let o=[];for(let s of this.profiles){let a;if(e.id===s.id)s.isDefault?n.workspaces&&(a=s,a.workspaces=n.workspaces):a=aC(s.id,n.name??s.name,s.location,this.profilesCacheHome,{icon:n.icon===null?void 0:n.icon??s.icon,transient:n.transient??s.isTransient,useDefaultFlags:n.useDefaultFlags??s.useDefaultFlags,workspaces:n.workspaces??s.workspaces},this.defaultProfile);else if(n.workspaces){let l=s.workspaces?.filter(d=>!n.workspaces?.some(c=>this.uriIdentityService.extUri.isEqual(d,c)));s.workspaces?.length!==l?.length&&(a=s,a.workspaces=l)}a&&o.push(a)}if(!o.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],o);let r=this.profiles.find(s=>s.id===e.id);if(!r)throw new Error(`Profile '${e.name}' was not updated`);return r}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let n=this.profiles.find(r=>r.id===e.id);if(!n)throw new Error(`Profile '${e.name}' does not exist`);let o=[];this._onWillRemoveProfile.fire({profile:n,join(r){o.push(r)}});try{await Promise.allSettled(o)}catch(r){this.logService.error(r)}this.updateProfiles([],[n],[]);try{await this.fileService.del(n.cacheHome,{recursive:!0})}catch(r){Xc(r)!==1&&this.logService.error(r)}}async setProfileForWorkspace(e,n){let o=this.profiles.find(s=>s.id===n.id);if(!o)throw new Error(`Profile '${n.name}' does not exist`);let r=this.getWorkspace(e);if(y.isUri(r)){let s=o.workspaces?[...o.workspaces]:[];s.some(a=>this.uriIdentityService.extUri.isEqual(a,r))||(s.push(r),await this.updateProfile(o,{workspaces:s}))}else this.updateEmptyWindowAssociation(r,o,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,n=!1){let o=this.getWorkspace(e);if(y.isUri(o)){let r=this.getProfileForWorkspace(e);r&&this.updateProfile(r,{workspaces:r.workspaces?.filter(s=>!this.uriIdentityService.extUri.isEqual(s,o))})}else this.updateEmptyWindowAssociation(o,void 0,n),this.updateStoredProfiles(this.profiles)}async resetWorkspaces(){this.transientProfilesObject.emptyWindows.clear(),this.profilesObject.emptyWindows.clear();for(let e of this.profiles)e.workspaces=void 0;this.updateProfiles([],[],this.profiles),this._onDidResetWorkspaces.fire()}async cleanUp(){try{if(await this.fileService.exists(this.profilesHome)){let e=await this.fileService.resolve(this.profilesHome);await Promise.all((e.children||[]).filter(n=>n.isDirectory&&n.name!==OB&&this.profiles.every(o=>!this.uriIdentityService.extUri.isEqual(o.location,n.resource))).map(n=>this.fileService.del(n.resource,{recursive:!0})))}}catch(e){this.logService.error("Error deleting redundant profile folders",e)}try{let e=this.getStoredProfiles(),n=[];for(let o of this.getStoredProfiles())this.isInvalidProfile(o)?this.logService.warn(`Invalid user data profile found: ${o.name}`):n.push(o);e.length!==n.length&&this.saveStoredProfiles(n)}catch(e){this.logService.error("Error removing invalid stored profiles",e)}}async cleanUpTransientProfiles(){let e=this.transientProfilesObject.profiles.filter(n=>!this.isProfileAssociatedToWorkspace(n));await Promise.allSettled(e.map(n=>this.removeProfile(n)))}getProfileForWorkspace(e){let n=this.getWorkspace(e);return y.isUri(n)&&this.uriIdentityService.extUri.isEqual(n,this.environmentService.agentSessionsWorkspace)?this.profiles.find(o=>o.isAgentsWindowProfile):y.isUri(n)?this.profiles.find(o=>o.workspaces?.some(r=>this.uriIdentityService.extUri.isEqual(r,n))):this.profilesObject.emptyWindows.get(n)??this.transientProfilesObject.emptyWindows.get(n)}getWorkspace(e){return eV(e)?e.uri:tV(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(n=>this.uriIdentityService.extUri.isEqual(n.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(n=>this.uriIdentityService.extUri.isEqual(n.location,e.location)))}updateProfiles(e,n,o,r=!1){let s=[...this.profiles,...e],a=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let d of s){if(n.some(c=>d.id===c.id)){for(let c of[...this.profilesObject.emptyWindows.keys()])d.id===this.profilesObject.emptyWindows.get(c)?.id&&this.profilesObject.emptyWindows.delete(c);continue}if(!d.isDefault){d=o.find(u=>d.id===u.id)??d;let c=a.find(u=>d.id===u.id);if(d.isTransient)this.transientProfilesObject.profiles.push(d);else if(c){for(let[u,m]of this.transientProfilesObject.emptyWindows.entries())if(d.id===m.id){this.transientProfilesObject.emptyWindows.delete(u),this.profilesObject.emptyWindows.set(u,d);break}}}d.workspaces?.length===0&&(d.workspaces=void 0),l.push(d)}this.updateStoredProfiles(l),r||this.triggerProfilesChanges(e,n,o)}triggerProfilesChanges(e,n,o){this._onDidChangeProfiles.fire({added:e,removed:n,updated:o,all:this.profiles})}updateEmptyWindowAssociation(e,n,o){o=n?.isTransient?!0:o,o?n?this.transientProfilesObject.emptyWindows.set(e,n):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),n?this.profilesObject.emptyWindows.set(e,n):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){let n=[],o={},r={};for(let s of e)if(!s.isTransient&&(s.isDefault||n.push({location:s.location,name:s.name,icon:s.icon,useDefaultFlags:s.useDefaultFlags}),s.workspaces))for(let a of s.workspaces)o[a.toString()]=s.id;for(let[s,a]of this.profilesObject.emptyWindows.entries())r[s.toString()]=a.id;this.saveStoredProfileAssociations({workspaces:o,emptyWindows:r}),this.saveStoredProfiles(n),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};lC=_([S(0,uu),S(1,zo),S(2,Vr),S(3,te)],lC);var FK="__$__isNewStorageMarker",dC="__$__targetStorageMarker",yo=A("storageService");function HK(i){let t=i.get(dC);if(t)try{return JSON.parse(t)}catch{}return Object.create(null)}var o1=class i extends N{constructor(e={flushInterval:i.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new gs);this._onDidChangeTarget=this._register(new gs);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new T);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new tn);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this._applicationSharedKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new Pn(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,n,o){return ye.filter(this._onDidChangeValue.event,r=>r.scope===e&&(n===void 0||r.key===n),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=oD(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){In([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Bt("code/willInitStorage");try{await this.doInitialize()}finally{Bt("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,n){let{key:o,external:r}=n;if(o===dC){switch(e){case-2:this._applicationSharedKeyTargets=void 0;break;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:o,target:this.getKeyTargets(e)[o],external:r})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,n,o){return this.getStorage(n)?.get(e,o)}getBoolean(e,n,o){return this.getStorage(n)?.getBoolean(e,o)}getNumber(e,n,o){return this.getStorage(n)?.getNumber(e,o)}getObject(e,n,o){return this.getStorage(n)?.getObject(e,o)}storeAll(e,n){this.withPausedEmitters(()=>{for(let o of e)this.store(o.key,o.value,o.scope,o.target,n)})}store(e,n,o,r,s=!1){if(Wt(n)){this.remove(e,o,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,o,r),this.getStorage(o)?.set(e,n,s)})}remove(e,n,o=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,n,void 0),this.getStorage(n)?.delete(e,o)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,n){let o=[],r=this.getKeyTargets(e);for(let s of Object.keys(r))r[s]===n&&o.push(s);return o}updateKeyTarget(e,n,o,r=!1){let s=this.getKeyTargets(n);typeof o=="number"?s[e]!==o&&(s[e]=o,this.getStorage(n)?.set(dC,JSON.stringify(s),r)):typeof s[e]=="number"&&(delete s[e],this.getStorage(n)?.set(dC,JSON.stringify(s),r))}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}get applicationSharedKeyTargets(){return this._applicationSharedKeyTargets||(this._applicationSharedKeyTargets=this.loadKeyTargets(-2)),this._applicationSharedKeyTargets}getKeyTargets(e){switch(e){case-2:return this.applicationSharedKeyTargets;case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){let n=this.getStorage(e);return n?HK(n):Object.create(null)}isNew(e){return this.getBoolean(FK,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let n=this.getStorage(-1),o=this.getStorage(-2),r=this.getStorage(0),s=this.getStorage(1);switch(e){case 0:await ii.settled([n?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),r?.whenFlushed()??Promise.resolve(),s?.whenFlushed()??Promise.resolve()]);break;case 1:await ii.settled([n?.flush(0)??Promise.resolve(),o?.flush(0)??Promise.resolve(),r?.flush(0)??Promise.resolve(),s?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,n=this.getStorage(-2)?.items??new Map,o=this.getStorage(0)?.items??new Map,r=this.getStorage(1)?.items??new Map;return WK(e,n,o,r,this.getLogDetails(-1)??"",this.getLogDetails(-2)??"",this.getLogDetails(0)??"",this.getLogDetails(1)??"")}async optimize(e){return await this.flush(),this.getStorage(e)?.optimize()}async switch(e,n){return this.emitWillSaveState(0),NB(e)?this.switchToProfile(e,n):this.switchToWorkspace(e,n)}canSwitchProfile(e,n){return!(e.id===n.id||UB(n)&&UB(e))}switchData(e,n,o){this.withPausedEmitters(()=>{let r=new Set;for(let[s,a]of e)r.add(s),n.get(s)!==a&&this.emitDidChangeValue(o,{key:s,external:!0});for(let[s]of n.items)r.has(s)||this.emitDidChangeValue(o,{key:s,external:!0})})}};function UB(i){return i.isDefault||!!i.useDefaultFlags?.globalState}var cC=class extends o1{constructor(){super();this.applicationStorage=this._register(new ud(new cu,{hint:1}));this.applicationSharedStorage=this._register(new ud(new cu,{hint:1}));this.profileStorage=this._register(new ud(new cu,{hint:1}));this.workspaceStorage=this._register(new ud(new cu,{hint:1}));this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e))),this._register(this.applicationSharedStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-2,e)))}getStorage(e){switch(e){case-2:return this.applicationSharedStorage;case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}getLogDetails(e){switch(e){case-2:return"inMemory (application-shared)";case-1:return"inMemory (application)";case 0:return"inMemory (profile)";default:return"inMemory (workspace)"}}async doInitialize(){}async switchToProfile(){}async switchToWorkspace(){}shouldFlushWhenIdle(){return!1}hasScope(e){return!1}};async function WK(i,t,e,n,o,r,s,a){let l=R=>{try{return JSON.parse(R)}catch{return R}},d=new Map,c=new Map;i.forEach((R,L)=>{d.set(L,R),c.set(L,l(R))});let u=new Map,m=new Map;t.forEach((R,L)=>{u.set(L,R),m.set(L,l(R))});let g=new Map,h=new Map;e.forEach((R,L)=>{g.set(L,R),h.set(L,l(R))});let f=new Map,I=new Map;n.forEach((R,L)=>{f.set(L,R),I.set(L,l(R))}),console.group(o!==s?`Storage: Application (path: ${o})`:`Storage: Application & Profile (path: ${o}, default profile)`);let x=[];d.forEach((R,L)=>{x.push({key:L,value:R})}),console.table(x),console.groupEnd(),console.log(c),console.group(`Storage: Application Shared (path: ${r})`);let E=[];if(u.forEach((R,L)=>{E.push({key:L,value:R})}),console.table(E),console.groupEnd(),console.log(m),o!==s){console.group(`Storage: Profile (path: ${s}, profile specific)`);let R=[];g.forEach((L,U)=>{R.push({key:U,value:L})}),console.table(R),console.groupEnd(),console.log(h)}console.group(`Storage: Workspace (path: ${a})`);let w=[];f.forEach((R,L)=>{w.push({key:L,value:R})}),console.table(w),console.groupEnd(),console.log(I)}var ui=A("telemetryService");var JIe=A("customEndpointTelemetryService");var uC="__";function FB(i){return typeof i=="object"&&i!==null&&"wwwAuthenticate"in i&&typeof i.wwwAuthenticate=="string"}var HB=A("IAuthenticationService");var ZIe=A("IAuthenticationExtensionsService");var pC=A("openerService");var md=uu;var WB=A("lifecycleService");function VB(i){return i.state==="pending"||i.state==="blocked"}var mC=A("defaultAccountService");var gxe=3600*1e3;function VK(i){let t=i?.includes("Visual-Studio-Code"),e=i?.includes("github"),n=i?.includes("microsoft")||i?.includes("ms-copilot")||i?.includes("MicrosoftCopilot");return t?"vscode":e?"github":n?"microsoft":void 0}function BB(i,t){return i===!0||VK(t)!==void 0}var Ie;(a=>(a.Setup={hidden:new k("chatSetupHidden",!1,!0),installed:new k("chatSetupInstalled",!1,!0),disabled:new k("chatSetupDisabled",!1,!0),disabledInWorkspace:new k("chatSetupDisabledInWorkspace",!1,!0),untrusted:new k("chatSetupUntrusted",!1,!0),later:new k("chatSetupLater",!1,!0),registered:new k("chatSetupRegistered",!1,!0),completed:new k("chatSetupCompleted",!1,!0)},a.Entitlement={signedOut:new k("chatEntitlementSignedOut",!1,!0),canSignUp:new k("chatPlanCanSignUp",!1,!0),planFree:new k("chatPlanFree",!1,!0),planPro:new k("chatPlanPro",!1,!0),planEdu:new k("chatPlanEdu",!1,!0),planProPlus:new k("chatPlanProPlus",!1,!0),planMax:new k("chatPlanMax",!1,!0),planBusiness:new k("chatPlanBusiness",!1,!0),planEnterprise:new k("chatPlanEnterprise",!1,!0),organisations:new k("chatEntitlementOrganisations",void 0,!0),internal:new k("chatEntitlementInternal",!1,!0),sku:new k("chatEntitlementSku",void 0,!0)},a.chatQuotaExceeded=new k("chatQuotaExceeded",!1,!0),a.completionsQuotaExceeded=new k("completionsQuotaExceeded",!1,!0),a.chatAnonymous=new k("chatAnonymous",!1,!0),a.clientByokEnabled=new k("github.copilot.clientByokEnabled",!0,!0),a.hasByokModels=new k("github.copilot.hasByokModels",!1,!0)))(Ie||={});var BK=A("chatEntitlementService");function $K(i){return i===10||i===6||i===7||i===11||i===8||i===9}var gC={upgradePlanUrl:rr.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:rr.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:rr.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:rr.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:rr.defaultChatAgent?.completionsQuotaExceededContext??""},zB="chat.allowAnonymousAccess";function r1(i,t,e){return!(i.getValue(zB)!==!0||t!==1||e.hidden||e.disabledInWorkspace)}function qB(i,t,e){e.publicLog2("chatEntitlements",{chatHidden:!!i.hidden,chatDisabled:!!i.disabled,chatEntitlement:i.entitlement,chatRegistered:!!i.registered,chatAnonymous:r1(t,i.entitlement,i)})}var Wa=class extends N{constructor(e,n,o,r,s,a,l,d){super();this.contextKeyService=r;this.configurationService=s;this.telemetryService=a;this.logService=l;this.storageService=d;this._onDidChangeQuotaExceeded=this._register(new T);this.onDidChangeQuotaExceeded=this._onDidChangeQuotaExceeded.event;this._onDidChangeQuotaRemaining=this._register(new T);this.onDidChangeQuotaRemaining=this._onDidChangeQuotaRemaining.event;this._onDidChangeUsageBasedBilling=this._register(new T);this.onDidChangeUsageBasedBilling=this._onDidChangeUsageBasedBilling.event;this.ExtensionQuotaContextKeys={chatQuotaExceeded:gC.chatQuotaExceededContext,completionsQuotaExceeded:gC.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new T);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=wo(this.onDidChangeAnonymous,()=>this.anonymous);let c=this.storageService.getBoolean(Wa.CACHED_UBB_STORAGE_KEY,0);if(this._quotas=c!==void 0?{usageBasedBilling:c}:{},this.chatQuotaExceededContextKey=Ie.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=Ie.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=Ie.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.contextKeyService.getContextKeyValue(Ie.clientByokEnabled.key)===void 0&&Ie.clientByokEnabled.bindTo(this.contextKeyService),this.onDidChangeEntitlement=ye.map(ye.filter(this.contextKeyService.onDidChangeContext,m=>m.affectsSome(new Set([Ie.Entitlement.planEdu.key,Ie.Entitlement.planPro.key,Ie.Entitlement.planBusiness.key,Ie.Entitlement.planEnterprise.key,Ie.Entitlement.planProPlus.key,Ie.Entitlement.planMax.key,Ie.Entitlement.planFree.key,Ie.Entitlement.canSignUp.key,Ie.Entitlement.signedOut.key,Ie.Entitlement.organisations.key,Ie.Entitlement.internal.key,Ie.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=wo(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=ye.map(ye.filter(this.contextKeyService.onDidChangeContext,m=>m.affectsSome(new Set([Ie.Setup.completed.key,Ie.Setup.hidden.key,Ie.Setup.disabled.key,Ie.Setup.untrusted.key,Ie.Setup.installed.key,Ie.Setup.later.key,Ie.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=wo(this.onDidChangeSentiment,()=>this.sentiment),ei&&!o.remoteAuthority&&!o.isSessionsWindow){Ie.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!n.defaultChatAgent)return;let u=this.context=new mt(()=>this._register(e.createInstance(Hi)));this.requests=new mt(()=>this._register(e.createInstance(Cy,u.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:m=>this.acceptQuotas(m)}))),this.registerListeners()}static{this.CACHED_UBB_STORAGE_KEY="chat.usageBasedBilling"}get entitlement(){return this.contextKeyService.getContextKeyValue(Ie.Entitlement.planEdu.key)===!0?10:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planMax.key)===!0?11:this.contextKeyService.getContextKeyValue(Ie.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(Ie.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(Ie.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(Ie.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(Ie.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(Ie.Entitlement.sku.key)}get copilotTrackingId(){return this.context?.value.state.copilotTrackingId}get clientByokEnabled(){return this.contextKeyService.getContextKeyValue("github.copilot.clientByokEnabled")===!0}get hasByokModels(){return this.contextKeyService.getContextKeyValue("github.copilot.hasByokModels")===!0}get quotas(){return this._quotas}registerListeners(){let e=new Set([this.ExtensionQuotaContextKeys.chatQuotaExceeded,this.ExtensionQuotaContextKeys.completionsQuotaExceeded]),n=this._register(new tn);this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(e)&&(n.value&&n.value.cancel(),n.value=new Ee,this.update(n.value.token))}));let o=this.anonymous,r=()=>{let s=this.anonymous;s!==o&&(o=s,this.anonymousContextKey.set(s),this.context?.hasValue&&qB(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(zB)&&r()})),this._register(this.onDidChangeEntitlement(()=>r())),this._register(this.onDidChangeSentiment(()=>r()))}acceptQuotas(e){let n=this._quotas,o=this.quotaCopilotTrackingId===this.copilotTrackingId?n:{},r={...e,chat:e.chat?Sy(o.chat,e.chat):void 0,completions:e.completions?Sy(o.completions,e.completions):void 0,premiumChat:e.premiumChat?Sy(o.premiumChat,e.premiumChat):void 0,sessionRateLimit:e.sessionRateLimit?Sy(o.sessionRateLimit,e.sessionRateLimit):void 0,weeklyRateLimit:e.weeklyRateLimit?Sy(o.weeklyRateLimit,e.weeklyRateLimit):void 0};this.quotaCopilotTrackingId=this.copilotTrackingId,this._quotas=r,this.updateContextKeys(),n.usageBasedBilling!==r.usageBasedBilling&&(r.usageBasedBilling!==void 0?this.storageService.store(Wa.CACHED_UBB_STORAGE_KEY,r.usageBasedBilling,0,1):this.storageService.remove(Wa.CACHED_UBB_STORAGE_KEY,0)),this.logService.getLevel()===1&&this.logService.trace(`[chat entitlement]: acceptQuotas: ${JSON.stringify(r)}`);let{changed:s}=this.compareQuotas(n.chat,r.chat),{changed:a}=this.compareQuotas(n.completions,r.completions),{changed:l}=this.compareQuotas(n.premiumChat,r.premiumChat);(s.exceeded||a.exceeded||l.exceeded)&&this._onDidChangeQuotaExceeded.fire();let d=n.sessionRateLimit?.percentRemaining!==r.sessionRateLimit?.percentRemaining,c=n.weeklyRateLimit?.percentRemaining!==r.weeklyRateLimit?.percentRemaining;(s.remaining||a.remaining||l.remaining||d||c||n.usageBasedBilling!==r.usageBasedBilling)&&this._onDidChangeQuotaRemaining.fire(),n.usageBasedBilling!==r.usageBasedBilling&&this._onDidChangeUsageBasedBilling.fire(),n.additionalUsageEnabled!==void 0&&r.additionalUsageEnabled!==void 0&&n.additionalUsageEnabled!==r.additionalUsageEnabled&&this.telemetryService.publicLog2("chatAdditionalSpendConfiguration",{enabled:r.additionalUsageEnabled??!1,entitlement:this.entitlement}),r.additionalUsageEnabled&&r.premiumChat?.percentRemaining===0&&n.premiumChat?.percentRemaining!==void 0&&n.premiumChat.percentRemaining>0&&this.telemetryService.publicLog2("chatAdditionalSpendActive",{entitlement:this.entitlement,additionalUsageCount:r.additionalUsageCount??0})}compareQuotas(e,n){return{changed:{exceeded:e?.percentRemaining===0!=(n?.percentRemaining===0),remaining:e?.percentRemaining!==n?.percentRemaining||e?.usageBasedBilling!==n?.usageBasedBilling||e?.creditsUsed!==n?.creditsUsed}}}clearQuotas(){this.acceptQuotas({})}updateContextKeys(){let e=this._quotas.chat?.percentRemaining===0,n=this._quotas.premiumChat?.unlimited?this._quotas.premiumChat.hasQuota===!1:this._quotas.premiumChat?.percentRemaining===0,o=this._quotas.additionalUsageEnabled??!1,r=this.entitlement===8||this.entitlement===9;this.chatQuotaExceededContextKey.set(e||n&&(r||!o)),this.completionsQuotaExceededContextKey.set(this._quotas.completions?.percentRemaining===0)}get sentiment(){return{completed:this.contextKeyService.getContextKeyValue(Ie.Setup.completed.key)===!0,installed:this.contextKeyService.getContextKeyValue(Ie.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(Ie.Setup.hidden.key)===!0,disabledInWorkspace:this.contextKeyService.getContextKeyValue(Ie.Setup.disabledInWorkspace.key)===!0,disabled:this.contextKeyService.getContextKeyValue(Ie.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(Ie.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(Ie.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(Ie.Setup.registered.key)===!0}}get anonymous(){return r1(this.configurationService,this.entitlement,this.sentiment)}markAnonymousRateLimited(){this.anonymous&&(this.chatQuotaExceededContextKey.set(!0),this._onDidChangeQuotaExceeded.fire())}markSetupCompleted(){this.context?.value.update({completed:!0})}setForceHidden(e){this.context?this.context.value.setForceHidden(e):Ie.Setup.hidden.bindTo(this.contextKeyService).set(e)}async update(e){await this.requests?.value.forceResolveEntitlement(e)}};Wa=_([S(0,Dn),S(1,Es),S(2,md),S(3,Ir),S(4,$t),S(5,ui),S(6,te),S(7,yo)],Wa);function Sy(i,t){let e={...i,...t};for(let n of Object.keys(t))t[n]===void 0&&i?.[n]!==void 0&&(e[n]=i[n]);return e}function zK(i){let t={resetDate:i.quota_reset_date_utc??i.quota_reset_date??i.limited_user_reset_date,resetDateHasTime:typeof i.quota_reset_date_utc=="string",usageBasedBilling:i.token_based_billing,canUpgradePlan:i.can_upgrade_plan};if(i.monthly_quotas?.chat&&typeof i.limited_user_quotas?.chat=="number"&&(t.chat={percentRemaining:Math.min(100,Math.max(0,i.limited_user_quotas.chat/i.monthly_quotas.chat*100)),unlimited:!1}),i.monthly_quotas?.completions&&typeof i.limited_user_quotas?.completions=="number"&&(t.completions={percentRemaining:Math.min(100,Math.max(0,i.limited_user_quotas.completions/i.monthly_quotas.completions*100)),unlimited:!1}),i.quota_snapshots){for(let n of["chat","completions","premium_interactions"]){let o=i.quota_snapshots[n];if(!o)continue;let r=o.entitlement!==void 0?Number(o.entitlement):void 0,s=o.credits_used!==void 0?Number(o.credits_used):void 0;if(!o.unlimited&&r===0)continue;let a=o.quota_remaining!==void 0?Number(o.quota_remaining):void 0,l={percentRemaining:Math.min(100,Math.max(0,o.percent_remaining)),unlimited:o.unlimited,hasQuota:o.has_quota,usageBasedBilling:i.token_based_billing,resetAt:o.quota_reset_at||void 0,entitlement:r!==void 0&&Number.isFinite(r)&&r>=0?r:void 0,quotaRemaining:a!==void 0&&Number.isFinite(a)&&a>=0?a:void 0,creditsUsed:s!==void 0&&Number.isFinite(s)&&s>=0?s:void 0};switch(n){case"chat":t.chat=l;break;case"completions":t.completions=l;break;case"premium_interactions":t.premiumChat=l;break}}let e=i.quota_snapshots.premium_interactions;t.additionalUsageEnabled=e?.overage_permitted??!1,t.additionalUsageCount=e?.overage_count??0,t.additionalUsageEntitlement=e?.overage_entitlement??0}return t}var Cy=class extends N{constructor(e,n,o,r,s,a,l,d,c,u){super();this.context=e;this.chatQuotasAccessor=n;this.telemetryService=o;this.logService=r;this.requestService=s;this.dialogService=a;this.openerService=l;this.lifecycleService=d;this.defaultAccountService=c;this.authenticationService=u;this.pendingResolveCts=new Ee;this.state={entitlement:this.context.state.entitlement},this.registerListeners(),this.resolve()}registerListeners(){this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.resolve())),this._register(this.context.onDidChange(()=>{(this.context.state.disabled||this.context.state.entitlement===1)&&(this.state={entitlement:this.state.entitlement,quotas:void 0},this.chatQuotasAccessor.clearQuotas())}))}async resolve(){this.pendingResolveCts.dispose(!0);let e=this.pendingResolveCts=new Ee,n=await this.defaultAccountService.getDefaultAccount();if(e.token.isCancellationRequested)return;let o;n?this.state.entitlement===1&&(o={entitlement:2}):o={entitlement:1},o&&this.update(o),n&&await this.resolveEntitlement(n,e.token)}async resolveEntitlement(e,n){let o=await this.doResolveEntitlement(e,n);return typeof o?.entitlement=="number"&&!n.isCancellationRequested&&this.update(o),o}async doResolveEntitlement(e,n){if(n.isCancellationRequested)return;let o=e.entitlementsData;if(!o)return this.logService.trace("[chat entitlement]: no entitlements data available on default account"),{entitlement:o===null?1:2};let r;o.access_type_sku==="free_limited_copilot"?r=5:o.access_type_sku==="free_educational_quota"?r=10:o.can_signup_for_limited?r=3:o.copilot_plan==="individual_edu"?r=10:o.copilot_plan==="individual"?r=6:o.copilot_plan==="individual_pro"?r=7:o.copilot_plan==="individual_max"?r=11:o.copilot_plan==="business"?r=8:o.copilot_plan==="enterprise"?r=9:r=4;let s={entitlement:r,organisations:o.organization_login_list,isStaff:o.is_staff,quotas:this.toQuotas(o),sku:o.access_type_sku,copilotTrackingId:o.analytics_tracking_id};return this.logService.trace(`[chat entitlement]: resolved to ${s.entitlement}, quotas: ${JSON.stringify(s.quotas)}`),this.telemetryService.publicLog2("chatInstallEntitlement",{entitlement:s.entitlement,tid:o.analytics_tracking_id,sku:s.sku,quotaChatUnlimited:s.quotas?.chat?.unlimited,quotaChatHasQuota:s.quotas?.chat?.hasQuota,quotaChatEntitlement:s.quotas?.chat?.entitlement,quotaPremiumChat:s.quotas?.premiumChat?.percentRemaining,quotaPremiumChatUnlimited:s.quotas?.premiumChat?.unlimited,quotaPremiumChatHasQuota:s.quotas?.premiumChat?.hasQuota,quotaPremiumChatEntitlement:s.quotas?.premiumChat?.entitlement,quotaCompletions:s.quotas?.completions?.percentRemaining,quotaCompletionsUnlimited:s.quotas?.completions?.unlimited,quotaCompletionsHasQuota:s.quotas?.completions?.hasQuota,quotaCompletionsEntitlement:s.quotas?.completions?.entitlement,quotaResetDate:s.quotas?.resetDate,usageBasedBilling:s.quotas?.usageBasedBilling,additionalUsageEnabled:s.quotas?.additionalUsageEnabled,additionalUsageCount:s.quotas?.additionalUsageCount,canUpgradePlan:s.quotas?.canUpgradePlan}),s}toQuotas(e){return zK(e)}async request(e,n,o,r,s,a){let l;for(let d of r){if(s.isCancellationRequested)return l;try{let c=await this.requestService.request({type:n,url:e,data:n==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${d.accessToken}`},callSite:a},s),u=c.res.statusCode;if(u&&u!==200){l=c;continue}return c}catch(c){s.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${c}`)}}return l}update(e){this.state=e,this.context.update({entitlement:this.state.entitlement,organisations:this.state.organisations,isStaff:this.state.isStaff,sku:this.state.sku,copilotTrackingId:this.state.copilotTrackingId}),e.quotas&&this.chatQuotasAccessor.acceptQuotas(e.quotas)}async forceResolveEntitlement(e=pe.None){let n=await this.defaultAccountService.refresh({refreshEntitlements:!0});if(n)return this.resolveEntitlement(n,e)}async signUpFree(){let e=await this.getSessions();if(e.length!==0)return this.doSignUpFree(e)}async doSignUpFree(e){let n={restricted_telemetry:this.telemetryService.telemetryLevel===0?"disabled":"enabled",public_code_suggestions:"enabled"},o=await this.request(gC.entitlementSignupLimitedUrl,"POST",n,e,pe.None,"chatEntitlementService.signUpFree");if(!o)return await this.onUnknownSignUpError(p(22856,null),"[chat entitlement] sign-up: no response")?this.doSignUpFree(e):{errorCode:1};if(o.res.statusCode&&o.res.statusCode!==200){if(o.res.statusCode===422)try{let l=await t1(o);if(l){let d=JSON.parse(l);if(typeof d.message=="string"&&d.message)return this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${d.message})`,d.message),{errorCode:o.res.statusCode}}}catch{}return await this.onUnknownSignUpError(p(22857,null,o.res.statusCode),`[chat entitlement] sign-up: unexpected status code ${o.res.statusCode}`)?this.doSignUpFree(e):{errorCode:o.res.statusCode}}let r=null;try{r=await t1(o)}catch{}if(!r)return await this.onUnknownSignUpError(p(22855,null),"[chat entitlement] sign-up: response has no content")?this.doSignUpFree(e):{errorCode:2};let s;try{s=JSON.parse(r),this.logService.trace(`[chat entitlement] sign-up: response is ${r}`)}catch(a){return await this.onUnknownSignUpError(p(22854,null),`[chat entitlement] sign-up: error parsing response (${a})`)?this.doSignUpFree(e):{errorCode:3}}return this.update({entitlement:5}),!!s?.subscribed}async getSessions(){let e=await this.defaultAccountService.getDefaultAccount();if(e){let o=(await this.authenticationService.getSessions(e.authenticationProvider.id)).filter(r=>r.id===e.sessionId);if(o.length)return o}return[...await this.authenticationService.getSessions(this.defaultAccountService.getDefaultAccountAuthenticationProvider().id)]}async onUnknownSignUpError(e,n){if(this.logService.error(n),!this.lifecycleService.willShutdown){let{confirmed:o}=await this.dialogService.confirm({type:rt.Error,message:p(22858,null),detail:e,primaryButton:p(22853,null)});return o}return!1}onUnprocessableSignUpError(e,n){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:rt.Error,message:p(22859,null),detail:n,buttons:[{label:p(22845,null),run:()=>{}},{label:p(22844,null),run:()=>this.openerService.open(y.parse(gC.upgradePlanUrl))}]})}async signIn(e){let n=await this.defaultAccountService.signIn({additionalScopes:e?.additionalScopes,extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e?.useSocialProvider});if(!n)return{};let o=await this.doResolveEntitlement(n,pe.None);return{defaultAccount:n,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};Cy=_([S(2,ui),S(3,te),S(4,sC),S(5,YS),S(6,pC),S(7,WB),S(8,mC),S(9,HB)],Cy);var Hi=class extends N{constructor(e,n,o,r,s){super();this.storageService=n;this.logService=o;this.configurationService=r;this.telemetryService=s;this.suspendedState=void 0;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.updateBarrier=void 0;this._forceHidden=!1;this.canSignUpContextKey=Ie.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=Ie.Entitlement.signedOut.bindTo(e),this.freeContextKey=Ie.Entitlement.planFree.bindTo(e),this.eduContextKey=Ie.Entitlement.planEdu.bindTo(e),this.proContextKey=Ie.Entitlement.planPro.bindTo(e),this.proPlusContextKey=Ie.Entitlement.planProPlus.bindTo(e),this.maxContextKey=Ie.Entitlement.planMax.bindTo(e),this.businessContextKey=Ie.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=Ie.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=Ie.Entitlement.organisations.bindTo(e),this.isInternalContextKey=Ie.Entitlement.internal.bindTo(e),this.skuContextKey=Ie.Entitlement.sku.bindTo(e),this.completedContext=Ie.Setup.completed.bindTo(e),this.hiddenContext=Ie.Setup.hidden.bindTo(e),this.disabledInWorkspaceContext=Ie.Setup.disabledInWorkspace.bindTo(e),this.laterContext=Ie.Setup.later.bindTo(e),this.installedContext=Ie.Setup.installed.bindTo(e),this.disabledContext=Ie.Setup.disabled.bindTo(e),this.untrustedContext=Ie.Setup.untrusted.bindTo(e),this.registeredContext=Ie.Setup.registered.bindTo(e),this._state=this.storageService.getObject(Hi.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,0)??{entitlement:1,organisations:void 0,isStaff:void 0,sku:void 0,copilotTrackingId:void 0},this.storageService.getBoolean(Hi.CHAT_ENTITLEMENT_CONTEXT_MIGRATED_STORAGE_KEY,0)===!0||(this.storageService.store(Hi.CHAT_ENTITLEMENT_CONTEXT_MIGRATED_STORAGE_KEY,!0,0,1),this._state.installed&&!this._state.completed&&(this._state.completed=!0,this.storageService.store(Hi.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,this._state,0,1))),this.updateContextSync(),this.registerListeners()}static{this.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY="chat.setupContext"}static{this.CHAT_ENTITLEMENT_CONTEXT_MIGRATED_STORAGE_KEY="chat.setupContext.migrated.v1"}get state(){return this.withConfiguration(this.suspendedState??this._state)}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(JS)&&this.updateContext()}))}withConfiguration(e){return this._forceHidden||this.configurationService.getValue(JS)===!0?{...e,hidden:!0}:e}setForceHidden(e){this._forceHidden!==e&&(this._forceHidden=e,this.updateContext())}async update(e){this.logService.trace(`[chat entitlement context] update(): ${JSON.stringify(e)}`);let n=JSON.stringify(this._state);if(typeof e.installed=="boolean"&&typeof e.disabled=="boolean"&&typeof e.untrusted=="boolean"&&(this._state.installed=e.installed,this._state.disabled=e.disabled,this._state.untrusted=e.untrusted,this._state.disabledInWorkspace=e.disabledInWorkspace,e.installed&&!e.disabled&&(e.hidden=!1)),typeof e.hidden=="boolean"&&(this._state.hidden=e.hidden),typeof e.later=="boolean"&&(this._state.later=e.later),typeof e.completed=="boolean"&&(this._state.completed=e.completed),typeof e.entitlement=="number"&&(this._state.entitlement=e.entitlement,this._state.organisations=e.organisations,this._state.isStaff=e.isStaff,this._state.sku=e.sku,this._state.copilotTrackingId=e.copilotTrackingId,this._state.entitlement===5||$K(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),r1(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),n!==JSON.stringify(this._state))return this.storageService.store(Hi.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,{...this._state,later:void 0},0,1),this.updateContext()}async updateContext(){await this.updateBarrier?.wait(),this.updateContextSync()}updateContextSync(){let e=this.withConfiguration(this._state);this.signedOutContextKey.set(e.entitlement===1),this.canSignUpContextKey.set(e.entitlement===3),this.freeContextKey.set(e.entitlement===5),this.eduContextKey.set(e.entitlement===10),this.proContextKey.set(e.entitlement===6),this.proPlusContextKey.set(e.entitlement===7),this.maxContextKey.set(e.entitlement===11),this.businessContextKey.set(e.entitlement===8),this.enterpriseContextKey.set(e.entitlement===9),this.organisationsContextKey.set(e.organisations),this.isInternalContextKey.set(BB(e.isStaff,e.organisations)),this.skuContextKey.set(e.sku),this.completedContext.set(!!e.completed),this.hiddenContext.set(!!e.hidden),this.disabledInWorkspaceContext.set(!!e.disabledInWorkspace),this.laterContext.set(!!e.later),this.installedContext.set(!!e.installed),this.disabledContext.set(!!e.disabled),this.untrustedContext.set(!!e.untrusted),this.registeredContext.set(!!e.registered),this.logService.trace(`[chat entitlement context] updateContext(): ${JSON.stringify(e)}`),qB(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new kn}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};Hi=_([S(0,Ir),S(1,yo),S(2,te),S(3,$t),S(4,ui)],Hi);Ue(BK,Wa,0);var qK="forceRemoteSettingsRefresh",KK="sandbox.enabled",oSe={[qK]:{type:"boolean"},[KK]:{type:"boolean"}};var rSe=A("managedSettingsService");var iSe=A("nativeManagedSettingsService");function jB(i){let t={};for(let e in i){let n=i[e].managedSettings;if(n)for(let o in n)t[o]=n[o]}return t}function GB(i){for(let t in i){let e=i[t].managedSettings;if(e&&!Wl(e))return!0}return!1}function QB(i,t,e){let n={};for(let o in t){let r=i[o];r!==void 0&&(typeof r===t[o].type?n[o]=r:e?.(`Ignoring managed setting "${o}": expected ${t[o].type}, got ${typeof r}`))}return n}var KB=["nativeMdm","server","file"];function JB(i,t,e){let n={nativeMdm:i,server:t,file:e},o=new Map;for(let a of KB){let l=n[a];if(l)for(let d of Object.keys(l)){let c=l[d];if(c===void 0)continue;let u=o.get(d);u?u.contributions.push({channel:a,value:c}):o.set(d,{value:c,source:a,contributions:[{channel:a,value:c}]})}}let r=new Set,s=[];for(let[a,l]of o)s.push([a,l.value]),r.add(l.source);return{values:Object.fromEntries(s),resolutions:o,activeSources:KB.filter(a=>r.has(a))}}var sSe=A("fileManagedSettingsService");function jK(i){return{type:i.type,managedSettings:i.managedSettings,restrictedValue:i.restrictedValue}}function YB(i){if(i.restrictedValue!==void 0)return i.restrictedValue;switch(i.type){case"boolean":return!1;case"number":return 0;case"string":return""}}var pSe=A("policy"),fC=class extends N{constructor(){super(...arguments);this.policyDefinitions={};this.policies=new Map;this.policyValueSources=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}async updatePolicyDefinitions(e){let n=!1;for(let o of Object.keys(e))this.policyDefinitions[o]!==e[o]&&(this.policyDefinitions[o]=e[o],n=!0);return n&&await this._updatePolicyDefinitions(this.policyDefinitions),this.getPolicyValues()}getPolicyValue(e){return this.policies.get(e)}getPolicyValueSource(e){return this.getStoredPolicyValueSource(e)}getStoredPolicyValueSource(e){if(this.policies.has(e))return this.policyValueSources.get(e)??"device"}serialize(){return Mt.reduce(Object.entries(this.policyDefinitions),(e,[n,o])=>({...e,[n]:{definition:jK(o),value:this.policies.get(n)}}),{})}getPolicyValues(){return Mt.reduce(this.policies.entries(),(e,[n,o])=>({...e,[n]:o}),{})}updatePolicyValue(e,n,o="device"){if(n===void 0){let a=this.policies.delete(e),l=this.policyValueSources.delete(e);return a||l}let r=this.policies.get(e)!==n,s=this.getStoredPolicyValueSource(e)!==o;return!r&&!s?!1:(this.policies.set(e,n),this.policyValueSources.set(e,o),!0)}clearPolicyValues(){this.policies.clear(),this.policyValueSources.clear()}};var XB="ChatApprovedAccountOrganizations";var e4=new k("chatAccountPolicyGateActive",!1,{type:"boolean",description:p(23364,null)}),OSe=A("accountPolicyGateService"),hC=class extends fC{constructor(e,n,o,r,s){super();this.logService=e;this.defaultAccountService=n;this._gateInfo={state:"inactive"};this._onDidChangeGateInfo=this._register(new T);this.onDidChangeGateInfo=this._onDidChangeGateInfo.event;this._managedSettings={};this._onDidChangeManagedSettings=this._register(new T);this.onDidChangeManagedSettings=this._onDidChangeManagedSettings.event;this.managedPolicyReader=o,this.nativeManagedSettingsService=r,this.fileManagedSettingsService=s,this._updatePolicyDefinitions(this.policyDefinitions),this._register(this.defaultAccountService.onDidChangePolicyData(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this._register(this.defaultAccountService.onDidChangeManagedSettingsFreshness(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this.managedPolicyReader&&this._register(this.managedPolicyReader.onDidChange(a=>{a.includes(XB)&&this._updatePolicyDefinitions(this.policyDefinitions)})),this.nativeManagedSettingsService&&this._register(this.nativeManagedSettingsService.onDidChangeManagedSettings(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this.fileManagedSettingsService&&this._register(this.fileManagedSettingsService.onDidChangeManagedSettings(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this.defaultAccountService.getDefaultAccount().then(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})}get gateInfo(){return this._gateInfo}getManagedSettingValue(e){return this._managedSettings[e]}async _updatePolicyDefinitions(e){this.logService.trace(`AccountPolicyService#_updatePolicyDefinitions: Got ${Object.keys(e).length} policy definitions`);let n=await this.updateCopilotManagedSettingDefinitions(e),o=[],r=this.getPolicyData(n),s=this._gateInfo;this._gateInfo=this.computeGateInfo();let a=!Et(s,this._gateInfo),l=this._gateInfo.state==="restricted"&&this._gateInfo.reason!=="policyNotResolved";for(let d in e){let c=this.resolvePolicyValue(e[d],r,l);this.updatePolicyValue(d,c?.value,c?.source)&&o.push(d)}o.length&&this._onDidChange.fire(o),a&&this._onDidChangeGateInfo.fire(this._gateInfo)}resolvePolicyValue(e,n,o){if(o&&(e.value!==void 0||e.restrictedValue!==void 0))return{value:YB(e),source:"accountGate"};let r=e.value;if(!n||!r)return;let{policyData:s,managedSettingResolutions:a}=n,l=r(s);if(l===void 0)return;let d="account";if(e.managedSettings){let c=s.managedSettings??{},u=Object.keys(e.managedSettings).filter(m=>Object.hasOwn(c,m));if(u.length>0){let m=h=>({...s,managedSettings:Object.fromEntries(Object.entries(c).filter(([f])=>!h.has(f)))}),g=new Set(u);if(r(m(g))!==l){let h=new Set;for(let x of u){let E=a.get(x)?.source;E&&h.add(E)}let f=new Set;for(let x of h){let E=new Set(u.filter(w=>a.get(w)?.source===x));r(m(E))!==l&&f.add(x)}let I=f.size>0?f:h;d=I.size===1?ZB(Array.from(I)[0]):"mixedManagedSettings"}}}if(d==="account"&&s.managedSettingsActive===!0&&r({...s,managedSettingsActive:!1})!==l){let c=new Set;for(let u of a.values())c.add(u.source);c.size>0&&(d=c.size===1?ZB(Array.from(c)[0]):"mixedManagedSettings")}return{value:l,source:d}}async updateCopilotManagedSettingDefinitions(e){return!this.nativeManagedSettingsService||!GB(e)?this.nativeManagedSettingsService?.managedSettings:this.nativeManagedSettingsService.updatePolicyDefinitions(e)}getPolicyData(e){let n=this.defaultAccountService.policyData??void 0,o=e??this.nativeManagedSettingsService?.managedSettings,r=this.fileManagedSettingsService?.managedSettings,s=JB(o,n?.managedSettings,r);if(Et(this._managedSettings,s.values)||(this._managedSettings=s.values,this._onDidChangeManagedSettings.fire()),!n&&s.activeSources.length===0)return;let a=jB(this.policyDefinitions),l=QB(s.values,a,d=>this.logService.warn(`[AccountPolicy] ${d}`));return{policyData:{...n,managedSettings:l,managedSettingsActive:s.activeSources.length>0},managedSettingResolutions:s.resolutions}}computeGateInfo(){let e=this.defaultAccountService.managedSettingsFreshness;if(VB(e))return{state:"restricted",reason:"managedSettingsRefresh",managedSettingsFreshness:e};if(!this.managedPolicyReader)return{state:"inactive"};let n=this.managedPolicyReader.getPolicyValue(XB),o=GK(n);if(o.length===0)return{state:"inactive"};let r=this.defaultAccountService.currentDefaultAccount;if(!r)return{state:"restricted",reason:"noAccount",approvedOrganizations:o};let s=this.defaultAccountService.getDefaultAccountAuthenticationProvider();return r.authenticationProvider.id!==s.id?{state:"restricted",reason:"wrongProvider",approvedOrganizations:o}:!o.includes("*")&&!(r.entitlementsData?.organization_login_list??[]).map(d=>d.toLowerCase()).some(d=>o.includes(d))?{state:"restricted",reason:"orgNotApproved",approvedOrganizations:o}:this.defaultAccountService.policyData===null?{state:"restricted",reason:"policyNotResolved",approvedOrganizations:o}:{state:"satisfied",approvedOrganizations:o}}};hC=_([S(0,te),S(1,mC)],hC);function ZB(i){switch(i){case"nativeMdm":return"nativeMdm";case"server":return"serverManagedSettings";case"file":return"fileManagedSettings"}}function GK(i){let t=i;if(typeof t=="string")try{t=JSON.parse(t)}catch{}return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim().toLowerCase()).filter(e=>e.length>0):[]}function t4(i){return i.scheme!==B.file&&i.scheme!==B.vscodeRemote}function QK(i){if(i.folders.length)return i.folders.every(t=>t4(t.uri))?i.folders[0].uri:void 0;if(i.configuration&&t4(i.configuration))return i.configuration}function n4(i){return QK(i)?.scheme}var zSe={Extensions:{name:{key:"extensionsConfigurationTitle",value:p(138,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:p(141,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:p(139,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:p(140,null)}},Update:{name:{key:"updateConfigurationTitle",value:p(142,null)}}};var XSe=new k("agentHostEnabled",!1,{type:"boolean",description:p(1885,null)}),YK=A("agentHostEnablementService"),XK=wt.as(kr.Configuration);XK.registerConfiguration({id:"chatAgentHost",title:p(1890,null),type:"object",properties:{"chat.editor.preferCopilotHarness":{type:"boolean",description:p(1888,null),default:!1,tags:["experimental"],experiment:{mode:"startup"},policy:{name:"ChatEditorPreferCopilotHarness",category:"InteractiveSession",minimumVersion:"1.134",localization:{description:{key:"chat.editor.preferCopilotHarness.policy",value:p(1889,null)}}}},"chat.defaultToCopilotHarness":{type:"boolean",description:p(1886,null),default:!1,tags:["experimental"],experiment:{mode:"startup"}},"chat.editor.localAgent.enabled":{type:"boolean",description:p(1887,null),default:!0,tags:["experimental"],experiment:{mode:"startup"}}}});var vC=(o=>(o.Default="default",o.Assisted="assisted",o.AutoApprove="autoApprove",o.Autopilot="autopilot",o))(vC||{}),bCe=new Set(Object.values(vC));var Wi=(o=>(o.Chat="panel",o.Terminal="terminal",o.Notebook="notebook",o.EditorInline="editor",o))(Wi||{});(t=>{function i(e){switch(e){case"panel":return"panel";case"terminal":return"terminal";case"notebook":return"notebook";case"editor":return"editor"}return"panel"}t.fromRaw=i})(Wi||={});var ICe=new Set([B.vscodeChatEditor,B.vscodeChatResponseResource,B.walkThrough,B.vscodeLocalChatSession,B.vscodeSettings,B.webviewPanel,B.vscodeUserData,B.extension,"ccreq","openai-codex"]),xCe=[B.vscodeChatInput,B.sessionsChatInput];var SCe=lt.and(Ie.Setup.hidden.negate(),Ie.Setup.disabledInWorkspace.negate(),xB.negate(),lt.has("config.chat.agent.enabled"),SB.negate());var CCe=new k("inModelsEditor",!1),TCe=new k("inModelsSearch",!1);var Pr;(re=>{re.responseVote=new k("chatSessionResponseVote","",{type:"string",description:p(12944,null)}),re.responseDetectedAgentCommand=new k("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:p(12915,null)}),re.responseSupportsIssueReporting=new k("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:p(12906,null)}),re.responseIsFiltered=new k("chatSessionResponseFiltered",!1,{type:"boolean",description:p(12904,null)}),re.responseHasError=new k("chatSessionResponseError",!1,{type:"boolean",description:p(12902,null)}),re.responseHasFeedbackSurvey=new k("chatSessionResponseHasFeedbackSurvey",!1,{type:"boolean",description:p(12905,null)}),re.responseFeedbackSurveyOpen=new k("chatSessionResponseFeedbackSurveyOpen",!1,{type:"boolean",description:p(12903,null)}),re.requestInProgress=new k("chatSessionRequestInProgress",!1,{type:"boolean",description:p(12943,null)}),re.hasActiveRequest=new k("chatSessionHasActiveRequest",!1,{type:"boolean",description:p(12907,null)}),re.currentlyEditing=new k("chatSessionCurrentlyEditing",!1,{type:"boolean",description:p(12941,null)}),re.currentlyEditingInput=new k("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:p(12942,null)});let u;(tv=>(tv.Sent="s",tv.Queue="q",tv.Steer="st"))(u=re.EditingRequestType||={}),re.editingRequestType=new k("chatEditingSentRequest",void 0,{type:"string",description:p(12868,null)}),re.isResponse=new k("chatResponse",!1,{type:"boolean",description:p(12901,null)}),re.isRequest=new k("chatRequest",!1,{type:"boolean",description:p(12899,null)}),re.isFirstRequest=new k("chatFirstRequest",!1,{type:"boolean",description:p(12874,null)}),re.isPendingRequest=new k("chatRequestIsPending",!1,{type:"boolean",description:p(12900,null)}),re.itemId=new k("chatItemId","",{type:"string",description:p(12886,null)}),re.lastItemId=new k("chatLastItemId",[],{type:"string",description:p(12887,null)}),re.editApplied=new k("chatEditApplied",!1,{type:"boolean",description:p(12862,null)}),re.inputHasText=new k("chatInputHasText",!1,{type:"boolean",description:p(12940,null)}),re.inputHasSendableContent=new k("chatInputHasSendableContent",!1,{type:"boolean",description:p(12939,null)}),re.inputHasFocus=new k("chatInputHasFocus",!1,{type:"boolean",description:p(12938,null)}),re.inChatInput=new k("inChatInput",!1,{type:"boolean",description:p(12936,null)}),re.inChatSession=new k("inChat",!1,{type:"boolean",description:p(12929,null)}),re.inChatQuestionCarousel=new k("inChatQuestionCarousel",!1,{type:"boolean",description:p(12932,null)}),re.chatQuestionCarouselHasTerminal=new k("chatQuestionCarouselHasTerminal",!1,{type:"boolean",description:p(12897,null)}),re.inChatEditor=new k("inChatEditor",!1,{type:"boolean",description:p(12931,null)}),re.findSupported=new k("chatFindSupported",!1,{type:"boolean",description:p(12871,null)}),re.findWidgetVisible=new k("chatFindWidgetVisible",!1,{type:"boolean",description:p(12873,null)}),re.findInputFocused=new k("chatFindInputFocused",!1,{type:"boolean",description:p(12870,null)}),re.findWidgetFocused=new k("chatFindWidgetFocused",!1,{type:"boolean",description:p(12872,null)}),re.inChatTodoList=new k("inChatTodoList",!1,{type:"boolean",description:p(12935,null)}),re.inChatTip=new k("inChatTip",!1,{type:"boolean",description:p(12934,null)}),re.inChatComposer=new k("inChatComposer",!1,{type:"boolean",description:p(12930,null)}),re.multipleChatTips=new k("multipleChatTips",!1,{type:"boolean",description:p(12947,null)}),re.inChatTerminalToolOutput=new k("inChatTerminalToolOutput",!1,{type:"boolean",description:p(12933,null)}),re.chatModeKind=new k("chatAgentKind","ask",{type:"string",description:p(12843,null)}),re.chatPermissionLevel=new k("chatPermissionLevel","default",{type:"string",description:p(12896,null)}),re.chatModeName=new k("chatModeName","",{type:"string",description:p(12890,null)}),re.chatModelId=new k("chatModelId","",{type:"string",description:p(12888,null)}),re.speechToTextRecording=new k("chatSpeechToTextRecording",!1,{type:"boolean",description:p(12923,null)}),re.speechToTextConfigured=new k("chatSpeechToTextConfigured",!1,{type:"boolean",description:p(12921,null)}),re.speechToTextPreparing=new k("chatSpeechToTextPreparing",!1,{type:"boolean",description:p(12922,null)}),re.supported=lt.or(bB.negate(),IB.notEqualsTo(""),lt.has("config.chat.experimental.serverlessWebEnabled")),re.enabled=new k("chatIsEnabled",!1,{type:"boolean",description:p(12883,null)}),re.accountPolicyGateActive=e4,re.lockedToCodingAgent=new k("lockedToCodingAgent",!1,{type:"boolean",description:p(12946,null)}),re.lockedCodingAgentId=new k("lockedCodingAgentId","",{type:"string",description:p(12945,null)}),re.readOnly=new k("chatIsReadonly",!1,{type:"boolean",description:p(12885,null)}),re.chatIsAgentHostSession=new k("chatIsAgentHostSession",!1,{type:"boolean",description:p(12882,null)}),re.chatAgentHostProviderId=new k("chatAgentHostProviderId","",{type:"string",description:p(12859,null)}),re.chatAgentHostHasImmutablePrimaryWorkingDirectory=new k("chatAgentHostHasImmutablePrimaryWorkingDirectory",!1,{type:"boolean",description:p(12858,null)}),re.chatAgentHostFolderPickerVisible=new k("chatAgentHostFolderPickerVisible",!1,{type:"boolean",description:p(12857,null)}),re.chatSessionHasCustomAgentTarget=new k("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:p(12908,null)}),re.chatSessionHasTargetedModels=new k("chatSessionHasTargetedModels",!1,{type:"boolean",description:p(12912,null)}),re.agentSupportsAttachments=new k("agentSupportsAttachments",!1,{type:"boolean",description:p(12856,null)}),re.withinEditSessionDiff=new k("withinEditSessionDiff",!1,{type:"boolean",description:p(12949,null)}),re.filePartOfEditSession=new k("filePartOfEditSession",!1,{type:"boolean",description:p(12925,null)}),re.extensionParticipantRegistered=new k("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:p(12893,null)}),re.panelParticipantRegistered=new k("chatPanelParticipantRegistered",!1,{type:"boolean",description:p(12895,null)}),re.chatEditingCanUndo=new k("chatEditingCanUndo",!1,{type:"boolean",description:p(12864,null)}),re.chatEditingCanRedo=new k("chatEditingCanRedo",!1,{type:"boolean",description:p(12863,null)}),re.languageModelsAreUserSelectable=new k("chatModelsAreUserSelectable",!1,{type:"boolean",description:p(12889,null)}),re.nonCopilotLanguageModelsAreUserSelectable=new k("chatNonCopilotModelsAreUserSelectable",!1,{type:"boolean",description:p(12892,null)}),re.chatSessionHasModels=new k("chatSessionHasModels",!1,{type:"boolean",description:p(12911,null)}),re.chatSessionOptionsValid=new k("chatSessionOptionsValid",!0,{type:"boolean",description:p(12914,null)}),re.extensionInvalid=new k("chatExtensionInvalid",!1,{type:"boolean",description:p(12869,null)}),re.inputCursorAtTop=new k("chatCursorAtTop",!1),re.inputHasAgent=new k("chatInputHasAgent",!1),re.location=new k("chatLocation",void 0),re.inQuickChat=new k("quickChatHasFocus",!1,{type:"boolean",description:p(12937,null)}),re.inAgentSessionsWelcome=new k("inAgentSessionsWelcome",!1,{type:"boolean",description:p(12927,null)}),re.inAutomationsDialog=new k("inAutomationsDialog",!1,{type:"boolean",description:p(12928,null)}),re.chatSessionType=new k("chatSessionType","",{type:"string",description:p(12919,null)}),re.hasFileAttachments=new k("chatHasFileAttachments",!1,{type:"boolean",description:p(12878,null)}),re.chatSessionIsEmpty=new k("chatSessionIsEmpty",!0,{type:"boolean",description:p(12913,null)}),re.hasPendingRequests=new k("chatHasPendingRequests",!1,{type:"boolean",description:p(12880,null)}),re.chatSessionHasDebugData=new k("chatSessionHasDebugData",!1,{type:"boolean",description:p(12909,null)}),re.chatSessionHasDebugTools=new k("chatSessionHasDebugTools",!1,{type:"boolean",description:p(12910,null)}),re.remoteJobCreating=new k("chatRemoteJobCreating",!1,{type:"boolean",description:p(12898,null)}),re.hasRemoteCodingAgent=new k("hasRemoteCodingAgent",!1,p(12926,null)),re.hasCanDelegateProviders=new k("chatHasCanDelegateProviders",!1,{type:"boolean",description:p(12877,null)}),re.enableRemoteCodingAgentPromptFileOverlay=new k("enableRemoteCodingAgentPromptFileOverlay",!1,p(12924,null)),re.skipChatRequestInProgressMessage=new k("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:p(12920,null)}),re.Setup=Ie.Setup,re.Entitlement=Ie.Entitlement,re.chatQuotaExceeded=Ie.chatQuotaExceeded,re.completionsQuotaExceeded=Ie.completionsQuotaExceeded,re.Editing={hasToolConfirmation:new k("chatHasToolConfirmation",!1,{type:"boolean",description:p(12867,null)}),hasElicitationRequest:new k("chatHasElicitationRequest",!1,{type:"boolean",description:p(12865,null)}),hasQuestionCarousel:new k("chatHasQuestionCarousel",!1,{type:"boolean",description:p(12866,null)})},re.Tools={toolsCount:new k("toolsCount",0,{type:"number",description:p(12948,null)})},re.foregroundSessionCount=new k("chatForegroundSessionCount",0,{type:"number",description:p(12875,null)}),re.Modes={hasCustomChatModes:new k("chatHasCustomAgents",!1,{type:"boolean",description:p(12876,null)}),agentModeDisabledByPolicy:new k("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:p(12860,null)})},re.panelLocation=new k("chatPanelLocation",void 0,{type:"number",description:p(12894,null)}),re.agentSessionsViewerFocused=new k("agentSessionsViewerFocused",!0,{type:"boolean",description:p(12851,null)}),re.agentSessionsViewerOrientation=new k("agentSessionsViewerOrientation",void 0,{type:"number",description:p(12852,null)}),re.agentSessionsViewerPosition=new k("agentSessionsViewerPosition",void 0,{type:"number",description:p(12853,null)}),re.agentSessionsViewerVisible=new k("agentSessionsViewerVisible",void 0,{type:"boolean",description:p(12854,null)}),re.agentSessionType=new k("chatSessionType","",{type:"string",description:p(12855,null)}),re.agentSessionPullRequest=new k("chatSessionPullRequest","",{type:"string",description:p(12849,null)}),re.chatSessionSupportsDelegation=new k("chatSessionSupportsDelegation",!0,{type:"boolean",description:p(12916,null)}),re.hasPendingDelegationTarget=new k("chatHasPendingDelegationTarget",!1,{type:"boolean",description:p(12879,null)}),re.chatSessionSupportsFork=new k("chatSessionSupportsFork",!1,{type:"boolean",description:p(12917,null)}),re.chatSessionSupportsRename=new k("chatSessionSupportsRename",!1,{type:"boolean",description:p(12918,null)}),re.agentSessionSection=new k("agentSessionSection","",{type:"string",description:p(12850,null)}),re.isArchivedAgentSession=new k("agentSessionIsArchived",!1,{type:"boolean",description:p(12846,null)}),re.isPinnedAgentSession=new k("agentSessionIsPinned",!1,{type:"boolean",description:p(12847,null)}),re.isReadAgentSession=new k("agentSessionIsRead",!1,{type:"boolean",description:p(12848,null)}),re.hasMultipleAgentSessionsSelected=new k("agentSessionHasMultipleSelected",!1,{type:"boolean",description:p(12845,null)}),re.hasAgentSessionChanges=new k("agentSessionHasChanges",!1,{type:"boolean",description:p(12844,null)}),re.isKatexMathElement=new k("chatIsKatexMathElement",!1,{type:"boolean",description:p(12884,null)}),re.hasUsedCreateSlashCommands=new k("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:p(12881,null)}),re.contextUsageHasBeenOpened=new k("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:p(12861,null)}),re.newChatButtonExperimentIcon=new k("chatNewChatButtonExperimentIcon","",{type:"string",description:p(12891,null)})})(Pr||={});var ZK;(n=>(n.inEditingMode=lt.or(Pr.chatModeKind.isEqualTo("edit"),Pr.chatModeKind.isEqualTo("agent")),n.isAgentHostSession=Pr.chatIsAgentHostSession.isEqualTo(!0),n.isAgentHostSessionItem=lt.or(lt.regex(Pr.agentSessionType.key,/^agent-host-/),lt.regex(Pr.agentSessionType.key,/^remote-/))))(ZK||={});var i1=class{constructor(t){this.options=t}getItemLabel(t){return t.label}getItemDescription(t){if(!this.options?.skipDescription)return t.description}getItemPath(t){if(!this.options?.skipPath)return t.resource?.scheme===B.file?t.resource.fsPath:t.resource?.path}},FCe=new i1,o4=A("quickInputService");var r4=A("encryptionService"),VCe=A("encryptionMainService");var Ey="secret://";function IC(i){return`${Ey}${i}`}async function ej(i,t,e,n){let o=IC(i);n?.trace("[secrets] getting secret for key:",o);let r=t(o);if(!r){n?.trace("[secrets] no secret found for key:",o);return}n?.trace("[secrets] decrypting secret for key:",o);let s=await e(r);return n?.trace("[secrets] decrypted secret for key:",o),s}async function tj(i,t,e,n,o){o?.trace("[secrets] encrypting secret for key:",i);let r=await n(t),s=IC(i);o?.trace("[secrets] storing encrypted secret for key:",s),e(s,r),o?.trace("[secrets] stored encrypted secret for key:",s)}var nj=['{"extensionId":"vscode.github-authentication","key":"github.auth"}'],i4=A("secretStorageService"),bC=class extends N{constructor(e,n,o,r){super();this._useInMemoryStorage=e;this._storageService=n;this._encryptionService=o;this._logService=r;this.onDidChangeSecretEmitter=this._register(new T);this.onDidChangeSecret=this.onDidChangeSecretEmitter.event;this._sequencer=new Ql;this._type="unknown";this._onDidChangeValueDisposable=this._register(new $);this._lazyStorageService=new mt(()=>this.initialize())}useSharedStorage(e){return Te&&nj.includes(e)}get type(){return this._type}get resolvedStorageService(){return this._lazyStorageService.value}get(e){return this._sequencer.queue(e,async()=>{let n=await this.resolvedStorageService;try{return await ej(e,o=>this.getValueFromStorage(e,o,n),this._type==="in-memory"?o=>Promise.resolve(o):o=>this._encryptionService.decrypt(o),this._logService)}catch(o){this._logService.error(o);let r=IC(e);this._logService.trace("[secrets] deleting invalid secret for key:",r),this.removeValueFromStorage(e,r,n),this._logService.trace("[secrets] deleted invalid secret for key:",r);return}})}set(e,n){return this._sequencer.queue(e,async()=>{let o=await this.resolvedStorageService;try{await tj(e,n,(r,s)=>this.setValueInStorage(e,r,s,o),this._type==="in-memory"?r=>Promise.resolve(r):r=>this._encryptionService.encrypt(r),this._logService)}catch(r){throw this._logService.error(r),r}})}delete(e){return this._sequencer.queue(e,async()=>{let n=await this.resolvedStorageService,o=IC(e);this._logService.trace("[secrets] deleting secret for key:",o),this.removeValueFromStorage(e,o,n),this._logService.trace("[secrets] deleted secret for key:",o)})}keys(){return this._sequencer.queue("__keys__",async()=>{let e=await this.resolvedStorageService;this._logService.trace("[secrets] fetching keys of all secrets");let n=e.keys(-1,1);return this._logService.trace("[secrets] fetched keys of all secrets"),n.filter(o=>o.startsWith(Ey)).map(o=>o.slice(Ey.length))})}getValueFromStorage(e,n,o){return this.useSharedStorage(e)?(this._logService.trace(`[SecretStorageService] Fetching value for cross-app shared secret: ${n}`),o.get(n,-2)):o.get(n,-1)}removeValueFromStorage(e,n,o){let r=this.useSharedStorage(e)?-2:-1;o.remove(n,r)}setValueInStorage(e,n,o,r){if(this.useSharedStorage(e)){this._logService.trace(`[SecretStorageService] Setting value for cross-app shared secret: ${n}`),r.store(n,o,-2,1);return}r.store(n,o,-1,1)}async initialize(){let e;if(!this._useInMemoryStorage&&await this._encryptionService.isEncryptionAvailable())this._logService.trace("[SecretStorageService] Encryption is available, using persisted storage"),this._type="persisted",e=this._storageService;else{if(this._type==="in-memory")return this._storageService;this._logService.trace("[SecretStorageService] Encryption is not available, falling back to in-memory storage"),this._type="in-memory",e=this._register(new cC)}return this._onDidChangeValueDisposable.clear(),this._onDidChangeValueDisposable.add(ye.any(e.onDidChangeValue(-1,void 0,this._onDidChangeValueDisposable),e.onDidChangeValue(-2,void 0,this._onDidChangeValueDisposable))(n=>{this.onDidChangeValue(n.key)})),e}reinitialize(){this._lazyStorageService=new mt(()=>this.initialize())}onDidChangeValue(e){if(!e.startsWith(Ey))return;let n=e.slice(Ey.length);this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${n}`),this.onDidChangeSecretEmitter.fire(n)}};bC=_([S(1,yo),S(2,r4),S(3,te)],bC);var wy="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",hTe=new RegExp(wy);var vTe=A("extensionGalleryService");var yTe=A("extensionManagementService");var bTe=A("IGlobalExtensionEnablementService"),ITe=A("IExtensionTipsService"),xTe=A("IAllowedExtensionsService");var STe=xa(2919,"Extensions"),CTe=xa(2936,"Preferences"),oj="extensions.allowed";wt.as(kr.Configuration).registerConfiguration({id:"extensions",order:30,title:p(2935,null),type:"object",properties:{[oj]:{type:"object",markdownDescription:p(2925,null),default:"*",defaultSnippets:[{body:{},description:p(2930,null)},{body:{"*":!0},description:p(2926,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:p(2931,null)}}},additionalProperties:!1,patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{anyOf:[{type:["boolean","string"],enum:[!0,!1,"stable"],description:p(2923,null),enumDescriptions:[p(2929,null),p(2927,null),p(2928,null)]},{type:"array",items:{type:"string"},description:p(2924,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:p(2918,null),enumDescriptions:[p(2934,null),p(2932,null),p(2933,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:p(2920,null),enumDescriptions:[p(2922,null),p(2921,null)]}}}}});var fd=class{constructor(t){this.value=t;this.isTrustedTelemetryValue=!0}},s1=class{constructor(){this.telemetryLevel=0;this.sessionId="someValue.sessionId";this.machineId="someValue.machineId";this.sqmId="someValue.sqmId";this.devDeviceId="someValue.devDeviceId";this.firstSessionDate="someValue.firstSessionDate";this.sendErrorTelemetry=!1}publicLog(){}publicLog2(){}publicLogError(){}publicLogError2(){}setExperimentProperty(){}setCommonProperty(){}},qTe=new s1;var rj="telemetry",l4={id:rj,name:p(3263,null)};function d4(i,t){if(!i)return"none";let e=jv(i),n=t?.remoteExtensionTips;if(n&&Object.prototype.hasOwnProperty.call(n,e))return e;let o=t?.virtualWorkspaceExtensionTips;return o&&Object.prototype.hasOwnProperty.call(o,e)?e:"other"}function ij(i,t){if(!i||!i.includes("/")&&!i.includes("\\"))return i;let e=i,n=[];for(let l of t)for(;;){let d=l.exec(i);if(!d)break;n.push([d.index,l.lastIndex])}let o=/(?:^|[\\\/])((node_modules|node_modules\.asar)[\\\/].*)$/,r=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,s=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w\-\._@]+(\\\\|\\|\/))+[\w\-\._@]*/g,a=0;for(e="";;){let l=s.exec(i);if(!l)break;if(!n.some(([c,u])=>l.index<u&&c<s.lastIndex)){let c=r.exec(l[0]);if(c)e+=i.substring(a,l.index)+"<REDACTED: user-file-path>/"+c[2];else{let u=o.exec(l[0]);u?e+=i.substring(a,l.index)+"<REDACTED: user-file-path>/"+u[1]:e+=i.substring(a,l.index)+"<REDACTED: user-file-path>"}a=s.lastIndex}}return a<i.length&&(e+=i.substr(a)),e}var c4=[{label:"URL",regex:/[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]*/},{label:"Google API Key",regex:/AIza[A-Za-z0-9_\\\-]{35}/},{label:"JWT",regex:/eyJ[0eXAiOiJKV1Qi|hbGci|a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+/},{label:"Slack Token",regex:/xox[pbar]\-[A-Za-z0-9]/},{label:"GitHub Token",regex:/(gh[psuro]_[a-zA-Z0-9]{36}|github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})/},{label:"Generic Secret",regex:/(key|token|sig|secret|signature|password|passwd|pwd|android:value)[^a-zA-Z0-9]/i},{label:"CLI Credentials",regex:/((login|psexec|(certutil|psexec)\.exe).{1,50}(\s-u(ser(name)?)?\s+.{3,100})?\s-(admin|user|vm|root)?p(ass(word)?)?\s+["']?[^$\-\/\s]|(^|[\s\r\n\\])net(\.exe)?.{1,5}(user\s+|share\s+\/user:| user -? secrets ? set) \s + [^ $\s \/])/},{label:"Microsoft Entra ID",regex:/eyJ(?:0eXAiOiJKV1Qi|hbGci|[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.)/},{label:"Email",regex:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/}];function a4(i,t=i){for(let e of c4)if(e.regex.test(t))return`<REDACTED: ${e.label}>`;return i}function sj(i){if(!i)return i;let t=!1;for(let n of c4)if(n.regex.test(i)){t=!0;break}if(!t)return i;if(!i.includes(`
`))return a4(i);let e=i.split(`
`);for(let n=0;n<e.length;n++){let o=n<e.length-1?e[n]+`
`:e[n];e[n]=a4(e[n],o)}return e.join(`
`)}function a1(i,t){return i?Mi(i,e=>{if(e instanceof fd||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let n=e.replaceAll("%20"," ");n=ij(n,t);for(let o of t)n=n.replace(o,"");return n=sj(n),n}}):{}}function u4(i,t){return i.uuid&&t.uuid?i.uuid===t.uuid:i.id===t.id?!0:Ac(i.id,t.id)===0}var dEe=new xe("pprice.better-merge");var l1=class{constructor(){this._generators=new Map;this._cache=new WeakMap}register(t,e){this._generators.set(t,e)}readActivationEvents(t){return this._cache.has(t)||this._cache.set(t,this._readActivationEvents(t)),this._cache.get(t)}createActivationEventsMap(t){let e=Object.create(null);for(let n of t){let o=this.readActivationEvents(n);o.length>0&&(e[xe.toKey(n.identifier)]=o)}return e}_readActivationEvents(t){if(typeof t.main>"u"&&typeof t.browser>"u")return[];let e=Array.isArray(t.activationEvents)?t.activationEvents.slice(0):[];for(let n=0;n<e.length;n++)e[n]==="onUri"&&(e[n]=`onUri:${xe.toKey(t.identifier)}`);if(!t.contributes)return e;for(let n in t.contributes){let o=this._generators.get(n);if(!o)continue;let r=t.contributes[n],s=Array.isArray(r)?r:[r];try{e.push(...o(s))}catch(a){Ge(a)}}return e}},d1=new l1;var m4=Object.freeze({identifier:new xe("nullExtensionDescription"),name:"Null Extension Description",version:"0.0.0",publisher:"vscode",engines:{vscode:""},extensionLocation:y.parse("void:location"),isBuiltin:!1,targetPlatform:"undefined",isUserBuiltin:!1,isUnderDevelopment:!1,preRelease:!1});var CC=A("extensionService"),ky=class{constructor(t){this.dependency=t}};function Le(i,t){if(!i.enabledApiProposals)return!1;let e=i.enabledApiProposals.includes(t);return!e&&SC?.(i,t)&&(e=!0),e||aj(i,t),e}var xC,p4=new Set;function g4(i){return xC=i,q(()=>{xC===i&&(xC=void 0)})}function aj(i,t){let e=xC;if(!e)return;let n=`${xe.toKey(i.identifier)}/${t}`;p4.has(n)||(p4.add(n),e({extensionId:i.identifier.value,proposalName:t}))}var SC;var lj="none";function f4(i,t){if(t!=="stable")return N.None;let e=new Set;if(i!==void 0&&i!==lj)for(let o of i.split(",")){let r=o.trim(),s=r.indexOf(":");if(s<=0||s===r.length-1)continue;let a=xe.toKey(r.slice(0,s)),l=r.slice(s+1);e.add(`${a}:${l}`)}let n=i===void 0?()=>!0:(o,r)=>e.has(`${xe.toKey(o.identifier)}:${r}`);return SC=n,q(()=>{SC===n&&(SC=void 0)})}function M(i,t){if(!Le(i,t))throw new Error(`Extension '${i.identifier.value}' CANNOT use API proposal: ${t}.
Its package.json#enabledApiProposals-property declares: ${i.enabledApiProposals?.join(", ")??"[]"} but NOT ${t}.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${i.identifier.value}`)}var dj={activeComment:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.d.ts"},agentEditorComments:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.agentEditorComments.d.ts"},agentSessionsWorkspace:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.agentSessionsWorkspace.d.ts"},agentsWindowConfiguration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.agentsWindowConfiguration.d.ts"},aiRelatedInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts"},aiSettingsSearch:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiSettingsSearch.d.ts"},aiTextSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts"},authIssuers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authIssuers.d.ts"},authLearnMore:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authLearnMore.d.ts"},authProviderSpecific:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authProviderSpecific.d.ts"},authSession:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts"},authSessionAccountIcon:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSessionAccountIcon.d.ts"},authSessionAudience:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSessionAudience.d.ts"},authenticationChallenges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authenticationChallenges.d.ts"},browser:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.browser.d.ts"},canonicalUriProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts"},chatContextProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatContextProvider.d.ts"},chatDebug:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatDebug.d.ts"},chatHooks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatHooks.d.ts"},chatInputNotification:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatInputNotification.d.ts"},chatOutputRenderer:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatOutputRenderer.d.ts"},chatParticipantAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts"},chatParticipantPrivate:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts"},chatPromptFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts"},chatProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts"},chatReferenceBinaryData:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts"},chatReferenceDiagnostic:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatReferenceDiagnostic.d.ts"},chatSessionCustomizationProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatSessionCustomizationProvider.d.ts"},chatSessionsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts"},chatStatusItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatStatusItem.d.ts"},chatTab:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatTab.d.ts"},codeActionAI:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionAI.d.ts"},codeActionRanges:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codeActionRanges.d.ts"},codiconDecoration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.codiconDecoration.d.ts"},commentReactor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReactor.d.ts"},commentReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentReveal.d.ts"},commentThreadApplicability:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts"},commentingRangeHint:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentingRangeHint.d.ts"},commentsDraftState:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.commentsDraftState.d.ts"},contribAccessibilityHelpContent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts"},contribChatEditorInlineGutterMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribChatEditorInlineGutterMenu.d.ts"},contribCommentEditorActionsMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts"},contribCommentPeekContext:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts"},contribCommentThreadAdditionalMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts"},contribCommentsViewThreadMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts"},contribDebugCreateConfiguration:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts"},contribDiffEditorGutterToolBarMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts"},contribEditSessions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditSessions.d.ts"},contribEditorContentMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts"},contribLabelFormatterWorkspaceTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts"},contribLanguageModelToolSets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribLanguageModelToolSets.d.ts"},contribMenuBarHome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts"},contribMergeEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts"},contribMultiDiffEditorMenus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts"},contribNotebookStaticPreloads:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts"},contribRemoteHelp:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts"},contribShareMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribShareMenu.d.ts"},contribSourceControlArtifactGroupMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactGroupMenu.d.ts"},contribSourceControlArtifactMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlArtifactMenu.d.ts"},contribSourceControlHistoryItemMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts"},contribSourceControlHistoryTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts"},contribSourceControlInputBoxMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts"},contribSourceControlTitleMenu:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts"},contribStatusBarItems:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts"},contribViewContainerTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts"},contribViewsRemote:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsRemote.d.ts"},contribViewsWelcome:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts"},css:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.css.d.ts"},customEditorDiffs:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorDiffs.d.ts"},customEditorMove:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts"},dataChannels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.dataChannels.d.ts"},debugVisualization:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.debugVisualization.d.ts"},defaultChatParticipant:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts"},devDeviceId:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.devDeviceId.d.ts"},diffCommand:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts"},diffContentOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffContentOptions.d.ts"},documentDiff:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentDiff.d.ts"},documentFiltersExclusive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts"},documentSyntaxHighlighting:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentSyntaxHighlighting.d.ts"},editSessionIdentityProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts"},editorHoverVerbosityLevel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts"},editorInsets:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts"},embeddings:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.embeddings.d.ts"},envIsConnectionMetered:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts"},environmentPower:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.environmentPower.d.ts"},extensionAffinity:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionAffinity.d.ts"},extensionRuntime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts"},extensionsAny:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts"},externalUriOpener:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts"},fileSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts"},fileSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts"},findFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findFiles2.d.ts"},findTextInFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts"},findTextInFiles2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles2.d.ts"},fsChunks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts"},inlineCompletionsAdditions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts"},interactive:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactive.d.ts"},interactiveWindow:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts"},ipc:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts"},languageModelCapabilities:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelCapabilities.d.ts"},languageModelPricing:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelPricing.d.ts"},languageModelProxy:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelProxy.d.ts"},languageModelSystem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelSystem.d.ts"},languageModelThinkingPart:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelThinkingPart.d.ts"},languageModelToolResultAudience:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolResultAudience.d.ts"},languageModelToolSupportsModel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageModelToolSupportsModel.d.ts"},languageStatusText:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.d.ts"},linkPresentation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.linkPresentation.d.ts"},mappedEditsProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts"},markdownAlertSyntax:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.markdownAlertSyntax.d.ts"},mcpServerDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpServerDefinitions.d.ts"},mcpToolDefinitions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.mcpToolDefinitions.d.ts"},multiDocumentHighlightProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts"},nativeWindowHandle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts"},newSymbolNamesProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts"},notebookCellExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecution.d.ts"},notebookControllerAffinityHidden:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts"},notebookDeprecated:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts"},notebookExecution:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookExecution.d.ts"},notebookKernelSource:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts"},notebookLiveShare:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts"},notebookMessaging:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts"},notebookMime:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts"},notebookReplDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookReplDocument.d.ts"},notebookVariableProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts"},portsAttributes:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts"},profileContentHandlers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.profileContentHandlers.d.ts"},quickDiffProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts"},quickPickItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts"},quickPickSortByLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts"},remoteCodingAgents:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.remoteCodingAgents.d.ts"},resolvers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts"},scmActionButton:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts"},scmArtifactProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts"},scmHistoryProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts"},scmMultiDiffEditor:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts"},scmProviderOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmProviderOptions.d.ts"},scmSelectedProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts"},scmTextDocument:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmTextDocument.d.ts"},scmValidation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts"},shareProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.shareProvider.d.ts"},speech:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.speech.d.ts"},statusBarItemTooltip:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts"},tabInputMultiDiff:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts"},tabInputTextMerge:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts"},taskExecutionTerminal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts"},taskPresentationGroup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts"},taskProblemMatcherStatus:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskProblemMatcherStatus.d.ts"},taskRunOptions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskRunOptions.d.ts"},telemetry:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetry.d.ts"},terminalCompletionProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts"},terminalDataWriteEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts"},terminalDimensions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts"},terminalExecuteCommandEvent:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts"},terminalQuickFixProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts"},terminalRemoteResolver:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalRemoteResolver.d.ts"},terminalSelection:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts"},terminalShellEnv:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts"},terminalTitle:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalTitle.d.ts"},testObserver:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts"},testRelatedCode:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts"},textDocumentChangeReason:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentChangeReason.d.ts"},textEditorDiffInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts"},textSearchComplete2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts"},textSearchProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts"},textSearchProvider2:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider2.d.ts"},timeline:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts"},tokenInformation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts"},toolInvocationApproveCombination:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolInvocationApproveCombination.d.ts"},toolProgress:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.toolProgress.d.ts"},treeItemMarkdownLabel:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeItemMarkdownLabel.d.ts"},treeViewActiveItem:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts"},treeViewMarkdownMessage:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts"},treeViewReveal:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts"},tunnelFactory:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnelFactory.d.ts"},tunnels:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts"},valueSelectionInQuickPick:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts"},workspaceTrust:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts"}},Py=Object.freeze(dj);var g1=wt.as(lu.JSONContribution);var c1=class i{constructor(t,e){this.added=t;this.removed=e}static _toSet(t){let e=new $o;for(let n=0,o=t.length;n<o;n++)e.add(t[n].description.identifier);return e}static compute(t,e){if(!t||!t.length)return new i(e,[]);if(!e||!e.length)return new i([],t);let n=this._toSet(t),o=this._toSet(e),r=e.filter(a=>!n.has(a.description.identifier)),s=t.filter(a=>!o.has(a.description.identifier));return new i(r,s)}},u1=class{constructor(t,e,n){this.name=t,this.defaultExtensionKind=e,this.canHandleResolver=n,this._handler=null,this._users=null,this._delta=null}setHandler(t){if(this._handler!==null)throw new Error("Handler already set!");return this._handler=t,this._handle(),{dispose:()=>{this._handler=null}}}acceptUsers(t){this._delta=c1.compute(this._users,t),this._users=t,this._handle()}_handle(){if(!(this._handler===null||this._users===null||this._delta===null))try{this._handler(this._users,this._delta)}catch(t){Ge(t)}}},cj={type:"string",enum:["ui","workspace"],enumDescriptions:[p(23133,null),p(23213,null)]},h4="vscode://schemas/vscode-extensions",p1={properties:{engines:{type:"object",description:p(23197,null),properties:{vscode:{type:"string",description:p(23198,null),default:"^1.105.0"}}},publisher:{description:p(23209,null),type:"string"},displayName:{description:p(23194,null),type:"string"},categories:{description:p(23188,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:sS},{type:"string",const:"Languages",deprecationMessage:p(23189,null)}]}},galleryBanner:{type:"object",description:p(23201,null),properties:{color:{description:p(23202,null),type:"string"},theme:{description:p(23203,null),type:"string",enum:["dark","light"]}}},contributes:{description:p(23190,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:p(23207,null)},enableProposedApi:{type:"boolean",deprecationMessage:p(23196,null)},enabledApiProposals:{markdownDescription:p(23195,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(Py).map(i=>i),markdownEnumDescriptions:Object.values(Py).map(i=>i.proposal)}},api:{markdownDescription:p(23168,null),type:"string",enum:["none"],enumDescriptions:[p(23169,null)]},activationEvents:{description:p(23134,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:p(23165,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:p(23148,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:p(23138,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:p(23140,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:p(23143,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:p(23142,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:p(23144,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:p(23141,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:p(23167,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:p(23156,null),body:"onStartupFinished"},{label:"onTaskType",description:p(23157,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:p(23146,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:p(23145,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:p(23155,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:p(23163,null)},{label:"onUri",body:"onUri",description:p(23162,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:p(23153,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:p(23139,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:p(23152,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:p(23135,null)},{label:"onRenderer",description:p(23154,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:p(23159,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:p(23160,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:p(23164,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:p(23147,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:p(23137,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:p(23136,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:p(23149,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:p(23150,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:p(23158,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:p(23161,null)},{label:"onMcpCollection",description:p(23151,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:p(23166,null),body:"*"}]}},badges:{type:"array",description:p(23170,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:p(23173,null)},href:{type:"string",description:p(23172,null)},description:{type:"string",description:p(23171,null)}}}},markdown:{type:"string",description:p(23206,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:p(23210,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:p(23200,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:wy}},extensionAffinity:{description:p(23199,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:wy}},extensionPack:{description:p(23191,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:wy}},extensionKind:{description:p(23126,null),type:"array",items:cj,default:["workspace"],defaultSnippets:[{body:["ui"],description:p(23128,null)},{body:["workspace"],description:p(23130,null)},{body:["ui","workspace"],description:p(23129,null)},{body:["workspace","ui"],description:p(23131,null)},{body:[],description:p(23127,null)}]},capabilities:{description:p(23174,null),type:"object",properties:{virtualWorkspaces:{description:p(23182,null),type:["boolean","object"],defaultSnippets:[{label:"limited",body:{supported:"${1:limited}",description:"${2}"}},{label:"false",body:{supported:!1,description:"${2}"}}],default:(!0).valueOf,properties:{supported:{markdownDescription:p(23184,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[p(23186,null),p(23187,null),p(23185,null)]},description:{type:"string",markdownDescription:p(23183,null)}}},untrustedWorkspaces:{description:p(23175,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:p(23178,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[p(23180,null),p(23181,null),p(23179,null)]},restrictedConfigurations:{description:p(23177,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:p(23176,null)}}}}},sponsor:{description:p(23192,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:p(23193,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:p(23211,null),type:"string"},"vscode:uninstall":{description:p(23212,null),type:"string"}}},icon:{type:"string",description:p(23204,null)},l10n:{type:"string",description:p(23205,null)},pricing:{type:"string",markdownDescription:p(23208,null),enum:["Free","Trial"],default:"Free"}}},m1=class{constructor(){this._extensionPoints=new Map}registerExtensionPoint(t){if(this._extensionPoints.has(t.extensionPoint))throw new Error("Duplicate extension point: "+t.extensionPoint);let e=new u1(t.extensionPoint,t.defaultExtensionKind,t.canHandleResolver);return this._extensionPoints.set(t.extensionPoint,e),t.activationEventsGenerator&&d1.register(t.extensionPoint,t.activationEventsGenerator),p1.properties.contributes.properties[t.extensionPoint]=t.jsonSchema,g1.registerSchema(h4,p1),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},v4={ExtensionsRegistry:"ExtensionsRegistry"};wt.add(v4.ExtensionsRegistry,new m1);var TC=wt.as(v4.ExtensionsRegistry);g1.registerSchema(h4,p1);g1.registerSchema(CB,{properties:{extensionEnabledApiProposals:{description:p(23132,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(Py),markdownEnumDescriptions:Object.values(Py).map(i=>i.proposal)}}]}}}});var y4=A("ILanguageModelsConfigurationService");var Ps="copilot";var uj=new Set(["openai","anthropic","gemini","ollama","openrouter","azure","xai","customoai","customendpoint"]),pj="3p-extension",mj=["github.copilot-chat","github.copilot"];function gj(i,t){if(!(!i||i===Ps))return uj.has(i)&&t&&mj.some(e=>xe.equals(t,e))?i:pj}var Im;(c=>{function i(u){return(typeof u.capabilities?.agentMode>"u"||u.capabilities.agentMode)&&!!u.capabilities?.toolCalling}c.suitableForAgentMode=i;function t(u){return`${u.name} (${u.vendor})`}c.asQualifiedName=t;function e(u,m){return m.vendor===Ps&&u===m.name?!0:u===t(m)}c.matchesQualifiedName=e;function n(u){return!!u.promo&&u.promo.discountPercent>0}c.hasPromoDiscount=n;function o(u){return!!u.promo&&u.promo.discountPercent>=0&&!!u.promo.message}c.hasPromoMessage=o;function r(u){return o(u)&&u.promo.showBanner!==!1}c.hasPromoBanner=r;function s(u){if(!u)return;let m=new Date(u);if(isNaN(m.getTime()))return;let g=m.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"});return p(13072,null,g)}c.getPromoEndsAtLabel=s,c.autoModelSelectionDocsUrl="https://docs.github.com/en/copilot/concepts/models/auto-model-selection";function l(u){let m=p(13066,null),g=p(13068,null,c.autoModelSelectionDocsUrl);if(typeof u=="number"&&u>0){let h=p(13067,null,u);return`${m} ${h} ${g}`}return`${m} ${g}`}c.getAutoModelDescription=l;function d(u){return u.byokModelIdentifier}c.getAgentHostByokManageModelsIdentifier=d})(Im||={});var EC=A("ILanguageModelsService");var b4={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:p(13092,null)},displayName:{type:"string",description:p(13088,null)},configuration:{type:"object",description:p(13084,null),anyOf:[{$ref:"http://json-schema.org/draft-07/schema#"},{properties:{properties:{type:"object",additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:p(13085,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:p(13085,null)}}}}}]},managementCommand:{type:"string",description:p(13090,null),deprecated:!0,deprecationMessage:p(13091,null)},deprecation:{type:"object",description:p(13086,null),properties:{link:{type:"string",description:p(13087,null)}}},when:{type:"string",description:p(13094,null)}}};function fj(i,t){let e=y.parse(i);return e.scheme===B.vscode&&t?e.with({scheme:t}):e}var hj=TC.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:p(13083,null),oneOf:[b4,{type:"array",items:b4}]},activationEventsGenerator:function*(i){for(let t of i)yield`onLanguageModelChatProvider:${t.vendor}`}}),I4="chatModelRecentlyUsed",x4="chatModelPinned",S4="chatModelVisibility",bm="copilot/auto",vj="auto";function f1(i,t){return i===bm?!1:t?t.vendor===Ps&&t.id===vj?!1:Im.getAgentHostByokManageModelsIdentifier(t)===void 0:!0}var h1="chat.participantNameRegistry",v1="chat.modelsControl";function yj(i,t,e){if(!i?.properties)return[];let n=[];for(let[o,r]of Object.entries(i.properties)){if(!r.enum||!Array.isArray(r.enum)||r.enum.length<1)continue;let s=t[o]??r.default,a=(typeof r.title=="string"?r.title:void 0)??o.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,m=>m.toUpperCase()),l=r.default,d=r.enumItemLabels,c=r.enumDescriptions,u=r.enum.map((m,g)=>{let h=d?.[g]??String(m),f=m===l?p(13079,null,h):h,I=c?.[g]??"";return{id:`configureModel.${o}.${m}`,label:f,class:void 0,enabled:!0,tooltip:I,checked:s===m,run:()=>e(o,m)}});n.push(new ay(`configureModel.${o}`,a,u))}return n}var pu=class{constructor(t,e,n,o,r,s,a,l,d,c,u,m){this._extensionService=t;this._logService=e;this._storageService=n;this._contextKeyService=o;this._languageModelsConfigurationService=r;this._quickInputService=s;this._secretStorageService=a;this._productService=l;this._requestService=d;this._notificationService=c;this._openerService=u;this._telemetryService=m;this._store=new $;this._providers=new Map;this._vendors=new Map;this._deprecationNoticeShownVendors=new Set;this._onDidChangeLanguageModelVendors=this._store.add(new T);this.onDidChangeLanguageModelVendors=this._onDidChangeLanguageModelVendors.event;this._modelsGroups=new Map;this._modelCache=new Map;this._resolveLMSequencer=new Ql;this._modelConfigurations=new Map;this._onLanguageModelChange=this._store.add(new T);this.onDidChangeLanguageModels=this._onLanguageModelChange.event;this._recentlyUsedModelIds=[];this._pinnedModelIds=[];this._hiddenModelIds=new Set;this._onDidChangeModelsControlManifest=this._store.add(new T);this.onDidChangeModelsControlManifest=this._onDidChangeModelsControlManifest.event;this._onDidChangePinnedModels=this._store.add(new T);this.onDidChangePinnedModels=this._onDidChangePinnedModels.event;this._onDidChangeModelVisibility=this._store.add(new T);this.onDidChangeModelVisibility=this._onDidChangeModelVisibility.event;this._modelsControlManifest={free:{},paid:{}};this._chatControlDisposed=!1;this._restrictedChatParticipants=An(this,Object.create(null));this.restrictedChatParticipants=this._restrictedChatParticipants;this._hasUserSelectableModels=Pr.languageModelsAreUserSelectable.bindTo(o),this._hasNonCopilotUserSelectableModels=Pr.nonCopilotLanguageModelsAreUserSelectable.bindTo(o),this._recentlyUsedModelIds=this._readRecentlyUsedModels(),this._pinnedModelIds=this._readPinnedModels(),this._readVisibility(),this._initChatControlData(),this._store.add(this.onDidChangeLanguageModels(()=>{let g=!1,h=!1;for(let f of this._modelCache.values())if(f.isUserSelectable!==!1&&(g=!0,f.vendor!==Ps)){h=!0;break}this._hasUserSelectableModels.set(g),this._hasNonCopilotUserSelectableModels.set(h),this._refreshModelsControlManifest()})),this._store.add(this._languageModelsConfigurationService.onDidChangeLanguageModelGroups(g=>this._onDidChangeLanguageModelGroups(g))),this._store.add(hj.setHandler((g,{added:h,removed:f})=>{let I=[],x=[];for(let E of h)for(let w of Mt.wrap(E.value)){if(this._vendors.has(w.vendor)){E.collector.error(p(13093,null,w.vendor));continue}if(fs(w.vendor)){E.collector.error(p(13089,null));continue}if(w.vendor.trim()!==w.vendor){E.collector.error(p(13095,null));continue}I.push(w)}for(let E of f)for(let w of Mt.wrap(E.value))x.push(w);this.deltaLanguageModelChatProviderDescriptors(I,x)}))}static{this.SECRET_KEY_PREFIX="chat.lm.secret."}static{this.SECRET_INPUT="${input:{0}}"}deltaLanguageModelChatProviderDescriptors(t,e){let n=[],o=[];for(let r of t){if(this._vendors.has(r.vendor)){this._logService.error(`The vendor '${r.vendor}' is already registered and cannot be registered twice`);continue}if(fs(r.vendor)){this._logService.error("The vendor field cannot be empty.");continue}if(r.vendor.trim()!==r.vendor){this._logService.error("The vendor field cannot start or end with whitespace.");continue}let s={vendor:r.vendor,displayName:r.displayName,configuration:r.configuration,managementCommand:r.managementCommand,deprecation:r.deprecation,when:r.when,isDefault:r.vendor===Ps};this._vendors.set(r.vendor,s),n.push(r.vendor)}for(let r of e)this._vendors.delete(r.vendor),this._providers.delete(r.vendor),this._clearModelCache(r.vendor),this._modelsGroups.delete(r.vendor),o.push(r.vendor);for(let[r,s]of this._providers)this._vendors.has(r)||this._providers.delete(r);if((n.length>0||o.length>0)&&(this._onDidChangeLanguageModelVendors.fire([...n,...o]),o.length>0))for(let r of o)this._onLanguageModelChange.fire(r)}async _onDidChangeLanguageModelGroups(t){let e=new Set(t.map(n=>n.vendor));await Promise.all(Array.from(e).map(n=>this._resolveAllLanguageModels(n,!0)))}getVendors(){return Array.from(this._vendors.values()).filter(t=>{if(!t.when)return!0;let e=lt.deserialize(t.when);return e?this._contextKeyService.contextMatchesRules(e):!1})}getLanguageModelIds(){return Array.from(this._modelCache.keys())}lookupLanguageModel(t){return this._modelCache.get(t)}lookupLanguageModelByQualifiedName(t){for(let[e,n]of this._modelCache.entries())if(Im.matchesQualifiedName(t,n))return{metadata:n,identifier:e}}async _resolveAllLanguageModels(t,e){let n=this._vendors.get(t);if(!n)return;let o=this._providers.get(t);if(o||(await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${t}`),o=this._providers.get(t)),!o){this._logService.warn(`[LM] No provider registered for vendor ${t}`);return}return this._resolveLMSequencer.queue(t,async()=>{let r=[],s=[];try{let g=await o.provideLanguageModelChatInfo({silent:e},pe.None);if(g.length){r.push(...g);let h=[];for(let f of g)n.isDefault?f.metadata.isUserSelectable!==!1?h.push(f.identifier):this._logService.trace(`[LM] Skipping model ${f.identifier} from model picker as it is not user selectable.`):h.push(f.identifier);s.push({modelIdentifiers:h})}}catch(g){s.push({modelIdentifiers:[],status:{message:ds(g),severity:rt.Error}})}let a=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),l=new Map;for(let g of a){if(g.vendor!==t)continue;if(!n.configuration&&r.length>0){if(g.settings)for(let f of r){let I=g.settings[f.metadata.id];I&&l.set(f.identifier,{...I})}s.push({group:g,modelIdentifiers:[]});continue}let h=await this._resolveConfiguration(g,n.configuration);try{let f=await o.provideLanguageModelChatInfo({group:g.name,silent:e,configuration:h},pe.None);if(f.length){for(let I=0;I<f.length;I++)f[I].metadata.detail||(f[I]={...f[I],metadata:{...f[I].metadata,detail:g.name}});r.push(...f),s.push({group:g,modelIdentifiers:f.map(I=>I.identifier)})}if(g.settings)for(let I of f){let x=g.settings[I.metadata.id];x&&l.set(I.identifier,{...x})}}catch(f){s.push({group:g,modelIdentifiers:[],status:{message:ds(f),severity:rt.Error}})}}let d=this._modelsGroups.has(t),c=this._modelsGroups.get(t)??[];this._modelsGroups.set(t,s);let u=this._clearModelCache(t),m=!d;for(let g of r){if(this._modelCache.has(g.identifier)){this._logService.warn(`[LM] Model ${g.identifier} is already registered. Skipping.`);continue}this._modelCache.set(g.identifier,g.metadata),m=m||!Et(u.get(g.identifier),g.metadata),u.delete(g.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${t}`,r),m=m||u.size>0,m||(m=this._hasGroupStructureChanged(c,s)),this._clearModelConfigurations(t);for(let[g,h]of l)this._modelCache.has(g)&&this._modelConfigurations.set(g,h);m?this._onLanguageModelChange.fire(t):this._logService.trace(`[LM] No changes in language models for vendor ${t}`)})}_hasGroupStructureChanged(t,e){if(t.length!==e.length)return!0;for(let n=0;n<t.length;n++){let o=t[n],r=e[n];if(o.group?.name!==r.group?.name||o.group?.vendor!==r.group?.vendor||o.status?.message!==r.status?.message||o.status?.severity!==r.status?.severity||o.modelIdentifiers.length!==r.modelIdentifiers.length)return!0}return!1}getLanguageModelGroups(t){return this._modelsGroups.get(t)??[]}hasResolvedVendor(t){return this._modelsGroups.has(t)}async selectLanguageModels(t){if(t.vendor)await this._resolveAllLanguageModels(t.vendor,!0);else{let n=Array.from(this._vendors.keys());await Promise.all(n.map(o=>this._resolveAllLanguageModels(o,!0)))}let e=[];for(let[n,o]of this._modelCache)(t.vendor===void 0||o.vendor===t.vendor)&&(t.family===void 0||o.family===t.family)&&(t.version===void 0||o.version===t.version)&&(t.id===void 0||o.id===t.id)&&e.push(n);return this._logService.trace("[LM] selected language models",t,e),e}registerLanguageModelProvider(t,e){if(this._logService.trace("[LM] registering language model provider",t,e),!this._vendors.has(t))throw new Error(`Chat model provider uses UNKNOWN vendor ${t}.`);if(this._providers.has(t))throw new Error(`Chat model provider for vendor ${t} is already registered.`);this._providers.set(t,e);let n=e.onDidChange(()=>{this._resolveAllLanguageModels(t,!0)});return q(()=>{this._logService.trace("[LM] UNregistered language model provider",t),this._clearModelCache(t),this._modelsGroups.delete(t),this._providers.delete(t),n.dispose()})}async sendChatRequest(t,e,n,o,r){let s=this._modelCache.get(t),a=this._providers.get(s?.vendor||"");if(!a)throw new Error(`Chat provider for model ${t} is not registered.`);s&&(this._logProviderUsageTelemetry(s),this._maybeShowProviderDeprecationNotice(s));let l=this.getModelConfiguration(t),d=l?{...o,configuration:{...l,...o.configuration}}:o;return a.sendChatRequest(t,n,e,d,r)}_maybeShowProviderDeprecationNotice(t){let e=this._vendors.get(t.vendor),n=e?.deprecation?.link;if(!n||this._deprecationNoticeShownVendors.has(t.vendor))return;this._deprecationNoticeShownVendors.add(t.vendor);let o=(e.displayName||t.vendor).replace(/\s*\(deprecated\)\s*$/i,"");this._notificationService.prompt(rt.Info,p(13074,null,o),[{label:p(13073,null),run:()=>{this._openerService.open(fj(n,this._productService.urlProtocol))}}],{neverShowAgain:{id:`chat.providerDeprecation.${t.vendor}`,scope:2}})}_logProviderUsageTelemetry(t){let e=gj(t?.vendor,t?.extension);e&&this._telemetryService.publicLog2("chat.languageModelRequest",{provider:e,isBYOK:!!t?.isBYOK})}_resolveModelConfigurationWithDefaults(t,e){let n=this._modelConfigurations.get(t),o=e?.configurationSchema;if(!o?.properties&&!n)return;let r={};if(o?.properties)for(let[s,a]of Object.entries(o.properties))a.default!==void 0&&(r[s]=a.default);if(!(!n&&Object.keys(r).length===0))return{...r,...n}}computeTokenLength(t,e,n){let o=this._modelCache.get(t);if(!o)throw new Error(`Chat model ${t} could not be found.`);let r=this._providers.get(o.vendor);if(!r)throw new Error(`Chat provider for model ${t} is not registered.`);return r.provideTokenCount(t,e,n)}getModelConfiguration(t){let e=this._modelCache.get(t);return this._resolveModelConfigurationWithDefaults(t,e)}async setModelConfiguration(t,e){let n=this._modelCache.get(t);if(!n)return;let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),r;if(r=o.find(d=>d.vendor===n.vendor&&d.settings?.[n.id]!==void 0),!r){let c=this._modelsGroups.get(n.vendor)?.find(u=>u.modelIdentifiers.includes(t)&&u.group)?.group;c&&(r=o.find(u=>u.vendor===c.vendor&&u.name===c.name)??c)}r||(r=o.find(d=>d.vendor===n.vendor));let a={...this._modelConfigurations.get(t)??{},...e},l=n.configurationSchema;if(l?.properties)for(let[d,c]of Object.entries(a)){let u=l.properties[d];u?.default!==void 0&&u.default===c&&delete a[d]}if(r){let d=r.settings??{},c;Object.keys(a).length===0?(c={...d},delete c[n.id]):c={...d,[n.id]:a};let u={...r,settings:Object.keys(c).length>0?c:void 0};!u.settings&&Object.keys(u).filter(m=>m!=="name"&&m!=="vendor"&&m!=="range"&&m!=="modelsRange"&&m!=="settings").length===0?await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(r):await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(r,u)}else if(Object.keys(a).length>0){let d=this._vendors.get(n.vendor);if(!d)return;let c={name:d.displayName,vendor:n.vendor,settings:{[n.id]:a}};await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(c)}Object.keys(a).length>0?this._modelConfigurations.set(t,a):this._modelConfigurations.delete(t),this._onLanguageModelChange.fire(n.vendor)}getModelConfigurationActions(t){let e=this._modelCache.get(t),n=this._modelConfigurations.get(t)??{};return yj(e?.configurationSchema,n,(o,r)=>this.setModelConfiguration(t,{[o]:r}))}async configureLanguageModelsProviderGroup(t,e){let n=this.getVendors().find(({vendor:l})=>l===t);if(!n)throw new Error(`Vendor ${t} not found.`);if(n.managementCommand){await this._resolveAllLanguageModels(n.vendor,!1);return}let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),r=o.find(l=>l.vendor===t&&l.name===e),s=await this.promptForName(o,n,r);if(!s)return;let a=r?await this._resolveConfiguration(r,n.configuration):void 0;try{let l=n.configuration?await this.promptForConfiguration(s,n.configuration,a):void 0;if(n.configuration&&!l)return;let d=await this._resolveLanguageModelProviderGroup(s,t,l,n.configuration),c=r?await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(r,d):await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(d);if(n.configuration&&this.requireConfiguring(n.configuration)){let u=this.getSnippetForFirstUnconfiguredProperty(l??{},n.configuration);await this._languageModelsConfigurationService.configureLanguageModels({group:c,snippet:u})}}catch(l){if(Yt(l))return;throw l}}async renameLanguageModelsProviderGroup(t,e){let n=this.getVendors().find(({vendor:a})=>a===t);if(!n)throw new Error(`Vendor ${t} not found.`);let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),r=o.find(a=>a.vendor===t&&a.name===e);if(!r)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);let s=await this.promptForName(o,n,r);!s||s===r.name||await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(r,{...r,name:s})}async updateLanguageModelsProviderGroupApiKey(t,e){let n=this.getVendors().find(({vendor:a})=>a===t),o=n?.configuration,r=o?.properties?.apiKey;if(!n||!o||!r)return;let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(a=>a.vendor===t&&a.name===e);if(!s)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);try{let a=await this._resolveConfiguration(s,o),l=await this.promptForValue(s.name,"apiKey",r,!!o.required?.includes("apiKey"),a);if(l===void 0||l===a.apiKey)return;let d={...a,apiKey:l},c={...await this._resolveLanguageModelProviderGroup(s.name,t,d,o),settings:s.settings};await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(s,c),await this._deleteSecretsInConfiguration(s,o)}catch(a){if(Yt(a))return;throw a}}async addLanguageModelsProviderGroupModel(t,e){let n=this.getVendors().find(({vendor:d})=>d===t),r=n?.configuration?.properties?.models;if(!n||!r)return;let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(d=>d.vendor===t&&d.name===e);if(!s)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);let a=Array.isArray(s.models),l=a?this.getSnippetForArrayItem(r):this.getSnippetForProperty("models",r);l&&await this._languageModelsConfigurationService.configureLanguageModels({group:s,snippet:l,snippetTarget:a?"models":"group"})}async openLanguageModelsProviderGroupSettings(t,e){let n=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(o=>o.vendor===t&&o.name===e);if(!n)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);await this._languageModelsConfigurationService.configureLanguageModels({group:n})}async configureModel(t){let e=this._modelCache.get(t);if(!e||!e.configurationSchema)return;let n=this._modelsGroups.get(e.vendor),o;if(n){for(let s of n)if(s.modelIdentifiers.includes(t)&&s.group){o=s.group;break}}if(!o){let s=this.getVendors().find(d=>d.vendor===e.vendor);if(!s)return;let l={name:s.displayName,vendor:e.vendor,settings:{[e.id]:{}}};o=await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(l),await this._resolveAllLanguageModels(e.vendor,!0)}let r=this._getModelConfigurationSnippet(e.id,e.configurationSchema);await this._languageModelsConfigurationService.configureLanguageModels({group:o,snippet:r})}_getModelConfigurationSnippet(t,e){let n=[];if(e.properties)for(let[r,s]of Object.entries(e.properties))if(s.defaultSnippets?.[0]){let a=s.defaultSnippets[0],l=a.bodyText??JSON.stringify(a.body,null,"			");l=l.replace(/"(\^[^"]*)"/g,(d,c)=>c.substring(1)),n.push(`			"${r}": ${l}`)}else s.default!==void 0?n.push(`			"${r}": ${JSON.stringify(s.default)}`):n.push(`			"${r}": \${${r}}`);let o=n.length>0?`{
${n.join(`,
`)}
		}`:`{
			$0
		}`;return`"settings": {
		"${t}": ${o}
	}`}async addLanguageModelsProviderGroup(t,e,n){let o=this.getVendors().find(({vendor:s})=>s===e);if(!o)throw new Error(`Vendor ${e} not found.`);let r=await this._resolveLanguageModelProviderGroup(t,e,n,o.configuration);await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(r)}async removeLanguageModelsProviderGroup(t,e){let n=this.getVendors().find(({vendor:s})=>s===t);if(!n)throw new Error(`Vendor ${t} not found.`);let r=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(s=>s.vendor===t&&s.name===e);if(!r)throw new Error(`Language model provider group ${e} for vendor ${t} not found.`);await this._deleteSecretsInConfiguration(r,n.configuration),await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(r)}requireConfiguring(t){if(t.additionalProperties)return!0;if(!t.properties)return!1;for(let e of Object.keys(t.properties))if(!this.canPromptForProperty(t.properties[e]))return!0;return!1}getSnippetForFirstUnconfiguredProperty(t,e){if(e.properties){for(let n of Object.keys(e.properties))if(t[n]===void 0){let o=e.properties[n],r=this.getSnippetForProperty(n,o);if(r)return r}}}getSnippetForProperty(t,e){let n=this.getDefaultSnippetBodyText(e);return n?`"${t}": ${n}`:void 0}getSnippetForArrayItem(t){return this.getDefaultSnippetBodyText(t,!0)}getDefaultSnippetBodyText(t,e=!1){let n=t.defaultSnippets?.[0];if(!n)return;let o=e?Array.isArray(n.body)&&n.body.length>0?JSON.stringify(n.body[0],null,"	"):void 0:n.bodyText??JSON.stringify(n.body,null,"	");if(o)return o.replace(/"(\^[^"]*)"/g,(r,s)=>s.substring(1))}async promptForName(t,e,n){let o=n?.name;if(!o){o=e.displayName;let a=1;for(;t.some(l=>l.vendor===e.vendor&&l.name===o);)a++,o=`${e.displayName} ${a}`}let r,s=new $;try{await new Promise(a=>{let l=s.add(this._quickInputService.createInputBox());l.title=p(13075,null),l.placeholder=p(13078,null),l.value=o,l.ignoreFocusOut=!0,s.add(l.onDidChangeValue(d=>{if(!d){l.validationMessage=p(13076,null),l.severity=rt.Error;return}if(t.some(c=>c!==n&&c.vendor===e.vendor&&c.name===d)){l.validationMessage=p(13080,null),l.severity=rt.Error;return}l.validationMessage=void 0,l.severity=rt.Ignore})),s.add(l.onDidAccept(async()=>{r=l.value,l.hide()})),s.add(l.onDidHide(()=>a())),l.show()})}finally{s.dispose()}return r}async promptForConfiguration(t,e,n){if(!e.properties)return;let o=n?{...n}:{};for(let r of Object.keys(e.properties)){let s=e.properties[r],a=!!e.required?.includes(r),l=await this.promptForValue(t,r,s,a,n);l!==void 0&&(o[r]=l)}return o}async promptForValue(t,e,n,o,r){if(!n||!this.canPromptForProperty(n))return;if(n.type==="array"&&n.items&&!Array.isArray(n.items)&&n.items.enum){let a=await this.promptForArray(t,e,n);return a===void 0?void 0:a}if(n.type==="string"&&Array.isArray(n.enum)&&n.enum.length>0)return this.promptForEnum(t,e,n,r);let s=await this.promptForInput(t,e,n,o,r);if(s!==void 0)return s}canPromptForProperty(t){return!t||typeof t=="boolean"?!1:!!(t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.enum||t.type==="string"||t.type==="number"||t.type==="integer"||t.type==="boolean")}getDescriptionPlaintext(t){if(t.description)return t.description;let e=t.markdownDescription;if(e)return e.replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1")}async promptForArray(t,e,n){if(!n.items||Array.isArray(n.items)||!n.items.enum)return;let o=n.items.enum,r=new $;try{return await new Promise(s=>{let a=r.add(this._quickInputService.createQuickPick());a.title=`${t}: ${n.title??e}`,a.items=o.map(l=>({label:l})),a.placeholder=this.getDescriptionPlaintext(n)??p(13081,null,e),a.canSelectMany=!0,a.ignoreFocusOut=!0,r.add(a.onDidAccept(()=>{s(a.selectedItems.map(l=>l.label)),a.hide()})),r.add(a.onDidHide(()=>{s(void 0)})),a.show()})}finally{r.dispose()}}async promptForEnum(t,e,n,o){let r=n.enum;if(!Array.isArray(r)||r.length===0)return;let s=n.enumDescriptions,a=Array.isArray(n.enumItemLabels)?n.enumItemLabels:void 0,l=o?.[e]!==void 0?String(o[e]):n.default!==void 0?String(n.default):void 0,d=r.map((u,m)=>({label:a?.[m]??String(u),description:s?.[m],id:String(u)})),c=new $;try{return await new Promise(u=>{let m=c.add(this._quickInputService.createQuickPick());if(m.title=`${t}: ${n.title??e}`,m.items=d,m.placeholder=this.getDescriptionPlaintext(n)??p(13081,null,e),m.ignoreFocusOut=!0,l!==void 0){let g=d.find(h=>h.id===l);g&&(m.activeItems=[g])}c.add(m.onDidAccept(()=>{let g=m.selectedItems[0];u(g?.id),m.hide()})),c.add(m.onDidHide(()=>{u(void 0)})),m.show()})}finally{c.dispose()}}async promptForInput(t,e,n,o,r){let s=new $;try{let a=d=>{if(!d&&o)return p(13082,null)},l=await new Promise((d,c)=>{let u=s.add(this._quickInputService.createInputBox());u.title=`${t}: ${n.title??e}`,u.placeholder=p(13077,null,e),u.password=!!n.secret,u.ignoreFocusOut=!0,r?.[e]?u.value=String(r?.[e]):n.default&&(u.value=String(n.default));let m=this.getDescriptionPlaintext(n);m&&(u.prompt=m),s.add(u.onDidChangeValue(g=>{let h=a(g);h?(u.validationMessage=h,u.severity=rt.Error):(u.validationMessage=void 0,u.severity=rt.Ignore)})),s.add(u.onDidAccept(()=>{let g=a(u.value);if(g){u.validationMessage=g,u.severity=rt.Error;return}d(u.value),u.hide()})),s.add(u.onDidHide(g=>{g.reason===2?c(new Oe):d(void 0)})),u.show()});return l?n.type==="number"||n.type==="integer"?Number(l):n.type==="boolean"?l==="true":l:void 0}finally{s.dispose()}}encodeSecretKey(t){return l2(pu.SECRET_INPUT,t)}decodeSecretKey(t){if(Pe(t))return t.substring(t.indexOf(":")+1,t.length-1)}_clearModelCache(t){let e=new Map;for(let[n,o]of this._modelCache.entries())o.vendor===t&&(e.set(n,o),this._modelCache.delete(n));return e}_clearModelConfigurations(t){for(let[e]of this._modelConfigurations)(this._modelCache.get(e)?.vendor===t||e.startsWith(`${t}/`))&&this._modelConfigurations.delete(e)}async _resolveConfiguration(t,e){if(!e)return{};let n={};for(let o in t){if(o==="vendor"||o==="name"||o==="range"||o==="modelsRange"||o==="settings")continue;let r=t[o];if(e.properties?.[o]?.secret){let s=this.decodeSecretKey(r);r=s?await this._secretStorageService.get(s):void 0}n[o]=r}return n}async _resolveLanguageModelProviderGroup(t,e,n,o){if(!o)return{name:t,vendor:e};let r={};for(let s in n){let a=n[s];if(o.properties?.[s]?.secret&&Pe(a)){let l=`${pu.SECRET_KEY_PREFIX}${to(_e()).toString(16)}`;await this._secretStorageService.set(l,s==="apiKey"?a.trim():a),a=this.encodeSecretKey(l)}r[s]=a}return{name:t,vendor:e,...r}}async _deleteSecretsInConfiguration(t,e){if(!e)return;let{vendor:n,name:o,range:r,modelsRange:s,...a}=t;for(let l in a){let d=t[l];if(e.properties?.[l]?.secret){let c=this.decodeSecretKey(d);c&&await this._secretStorageService.delete(c)}}}async migrateLanguageModelsProviderGroup(t){let{vendor:e,name:n,...o}=t;if(!this._vendors.get(e))throw new Error(`Vendor ${e} not found.`);await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${e}`);let r=this._providers.get(e);if(!r)throw new Error(`Chat model provider for vendor ${e} is not registered.`);await r.provideLanguageModelChatInfo({group:n,silent:!1,configuration:o},pe.None),await this.addLanguageModelsProviderGroup(n,e,o)}_readRecentlyUsedModels(){return this._storageService.getObject(I4,0,[])}_saveRecentlyUsedModels(){this._storageService.store(I4,this._recentlyUsedModelIds,0,0)}getRecentlyUsedModelIds(){return this._recentlyUsedModelIds.filter(t=>this._modelCache.has(t)&&t!==bm).slice(0,4)}addToRecentlyUsedList(t){if(t===bm)return;let e=this._recentlyUsedModelIds.indexOf(t);e!==-1&&this._recentlyUsedModelIds.splice(e,1),this._recentlyUsedModelIds.unshift(t),this._recentlyUsedModelIds.length>20&&(this._recentlyUsedModelIds.length=20),this._saveRecentlyUsedModels()}clearRecentlyUsedList(){this._recentlyUsedModelIds=[],this._saveRecentlyUsedModels()}_readPinnedModels(){return this._storageService.getObject(x4,0,[])}_savePinnedModels(){this._storageService.store(x4,this._pinnedModelIds,0,0)}getPinnedModelIds(){return this._pinnedModelIds.filter(t=>t!==bm&&this._modelCache.has(t))}pinModel(t){t===bm||this._pinnedModelIds.includes(t)||(this._pinnedModelIds.push(t),this._savePinnedModels(),this._onDidChangePinnedModels.fire())}unpinModel(t){let e=this._pinnedModelIds.indexOf(t);e!==-1&&(this._pinnedModelIds.splice(e,1),this._savePinnedModels(),this._onDidChangePinnedModels.fire())}isModelPinned(t){return t!==bm&&this._pinnedModelIds.includes(t)}_getGroupNameForVendor(t){return this._vendors.get(t)?.displayName??t}_getModelIdsInGroup(t,e){let n=this._modelsGroups.get(t);if(!n)return[];let o=[],r=this._getGroupNameForVendor(t);for(let s of n)if((s.group?.name??r)===e)for(let l of s.modelIdentifiers)f1(l,this._modelCache.get(l))&&o.push(l);return o}_readVisibility(){let t=this._storageService.getObject(S4,0,{});this._hiddenModelIds=new Set(Array.isArray(t?.hiddenModels)?t.hiddenModels:[])}_saveVisibility(){this._storageService.store(S4,{hiddenModels:Array.from(this._hiddenModelIds)},0,0)}isGroupHidden(t,e){let n=this._getModelIdsInGroup(t,e);return n.length>0&&n.every(o=>this._hiddenModelIds.has(o))}isModelHidden(t){return this._hiddenModelIds.has(t)?f1(t,this._modelCache.get(t)):!1}setGroupHidden(t,e,n){this.setModelsHidden(this._getModelIdsInGroup(t,e),n)}setModelHidden(t,e){this.setModelsHidden([t],e)}setModelsHidden(t,e){let n=!1;for(let o of t)if(e){if(!f1(o,this._modelCache.get(o)))continue;this._hiddenModelIds.has(o)||(this._hiddenModelIds.add(o),n=!0)}else this._hiddenModelIds.delete(o)&&(n=!0);n&&(this._saveVisibility(),this._onDidChangeModelVisibility.fire())}getHiddenModelIds(){return Array.from(this._hiddenModelIds)}getModelsControlManifest(){return this._modelsControlManifest}_setModelsControlManifest(t){this._modelsControlRawResponse=t,this._refreshModelsControlManifest()}_refreshModelsControlManifest(){let t=this._modelsControlRawResponse,e={},n={};if(t?.free){let o=Array.isArray(t.free)?t.free:Object.values(t.free);for(let r of o)!r||!st(r)||(e[r.id]={label:r.label,featured:r.featured,exists:this._modelCache.has(`copilot/${r.id}`)})}if(t?.paid){let o=Array.isArray(t.paid)?t.paid:Object.values(t.paid);for(let r of o)!r||!st(r)||(n[r.id]={label:r.label,featured:r.featured,minVSCodeVersion:r.minVSCodeVersion,exists:this._modelCache.has(`copilot/${r.id}`)})}this._modelsControlManifest={free:e,paid:n},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let t=this._storageService.get(h1,-1);try{this._restrictedChatParticipants.set(JSON.parse(t??"{}"),void 0)}catch{this._storageService.remove(h1,-1)}let e=this._storageService.get(v1,-1);try{let n=JSON.parse(e??"{}");st(n)&&this._setModelsControlManifest(n)}catch{this._storageService.remove(v1,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(t=>this._logService.warn("Failed to fetch chat control data",t)).then(()=>Vt(300*1e3)).then(()=>this._refreshChatControlData())}async _fetchChatControlData(){this._logService.trace("[LM] Fetching chat control data from",this._chatControlUrl);let t;try{t=await this._requestService.request({type:"GET",url:this._chatControlUrl,callSite:"languageModels.fetchChatControlData"},pe.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",ds(o));return}if(t.res.statusCode!==200){this._logService.warn(`[LM] Chat control data request failed with status ${t.res.statusCode}`);return}let e;try{e=await DB(t)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",ds(o));return}if(this._logService.trace("[LM] Received chat control response",e?Object.keys(e):"null"),!e||e.version!==1){this._logService.warn("[LM] Unexpected chat control response version",e?.version);return}let n=e.restrictedChatParticipants;this._restrictedChatParticipants.set(n,void 0),this._storageService.store(h1,JSON.stringify(n),-1,1),e.models&&(this._logService.trace("[LM] Updating models control manifest",{freeCount:Object.keys(e.models.free??{}).length,paidCount:Object.keys(e.models.paid??{}).length}),this._setModelsControlManifest(e.models),this._storageService.store(v1,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};pu=_([S(0,CC),S(1,te),S(2,yo),S(3,Ir),S(4,y4),S(5,o4),S(6,i4),S(7,Es),S(8,sC),S(9,ZW),S(10,pC),S(11,ui)],pu);var Ij="code/chat/",C4=new Map,_y={RequestStart:"request/start",RequestUiUpdated:"request/uiUpdated",WillCollectInstructions:"request/willCollectInstructions",DidCollectInstructions:"request/didCollectInstructions",FirstToken:"request/firstToken",RequestComplete:"request/complete",AgentWillInvoke:"agent/willInvoke",AgentDidInvoke:"agent/didInvoke"};function Ry(i,t){let e=sd(i),n=`${Ij}${e}/${t}`,o=C4.get(e);o||(o=new Set,C4.set(e,o)),o.add(n),Bt(n)}var _C=A("chatAgentService"),wC=class extends N{constructor(e,n){super();this.contextKeyService=e;this.configurationService=n;this._agents=new Map;this._onDidChangeAgents=this._register(new T);this.onDidChangeAgents=this._onDidChangeAgents.event;this._onWillInvokeAgent=this._register(new T);this.onWillInvokeAgent=this._onWillInvokeAgent.event;this._agentsContextKeys=new Set;this._hasToolsAgent=!1;this._chatParticipantDetectionProviders=new Map;this._agentCompletionProviders=new Map;this._hasDefaultAgent=Pr.enabled.bindTo(this.contextKeyService),this._extensionAgentRegistered=Pr.extensionParticipantRegistered.bindTo(this.contextKeyService),this._defaultAgentRegistered=Pr.panelParticipantRegistered.bindTo(this.contextKeyService),this._register(e.onDidChangeContext(o=>{o.affectsSome(this._agentsContextKeys)&&this._updateContextKeys()}))}static{this.AGENT_LEADER="@"}registerAgent(e,n){if(this.getAgent(e))throw new Error(`Agent already registered: ${JSON.stringify(e)}`);let r=this,s=n.slashCommands;n={...n,get slashCommands(){return s.filter(l=>!l.when||r.contextKeyService.contextMatchesRules(lt.deserialize(l.when)))}};let a={data:n};return this._agents.set(e,a),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0),q(()=>{this._agents.delete(e),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0)})}_updateAgentsContextKeys(){this._agentsContextKeys.clear();for(let e of this._agents.values())if(e.data.when){let n=lt.deserialize(e.data.when);for(let o of n?.keys()||[])this._agentsContextKeys.add(o)}}_updateContextKeys(){let e=!1,n=!1,o=!1;for(let r of this.getAgents())r.isDefault&&(r.isCore||(e=!0),r.id==="chat.setup"||r.id==="github.copilot.editsAgent"?o=!0:n=!0);this._defaultAgentRegistered.set(n),this._extensionAgentRegistered.set(e),o!==this._hasToolsAgent&&(this._hasToolsAgent=o,this._onDidChangeAgents.fire(this.getDefaultAgent("panel","agent")))}registerAgentImplementation(e,n){let o=this._agents.get(e);if(!o)throw new Error(`Unknown agent: ${JSON.stringify(e)}`);if(o.impl)throw new Error(`Agent already has implementation: ${JSON.stringify(e)}`);return o.data.isDefault&&this._hasDefaultAgent.set(!0),o.impl=n,this._onDidChangeAgents.fire(new xm(o.data,n)),q(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(Mt.some(this._agents.values(),r=>r.data.isDefault&&!!r.impl))})}registerDynamicAgent(e,n){e.isDynamic=!0;let o={data:e,impl:n};return this._agents.set(e.id,o),this._onDidChangeAgents.fire(new xm(e,n)),q(()=>{this._agents.delete(e.id),this._onDidChangeAgents.fire(void 0)})}registerAgentCompletionProvider(e,n){return this._agentCompletionProviders.set(e,n),{dispose:()=>{this._agentCompletionProviders.delete(e)}}}async getAgentCompletionItems(e,n,o){return await this._agentCompletionProviders.get(e)?.(n,o)??[]}updateAgent(e,n){let o=this._agents.get(e);if(!o?.impl)throw new Error(`No activated agent with id ${JSON.stringify(e)} registered`);o.data.metadata={...o.data.metadata,...n},this._onDidChangeAgents.fire(new xm(o.data,o.impl))}getDefaultAgent(e,n="ask"){return this._preferExtensionAgent(this.getActivatedAgents().filter(o=>n&&!o.modes.includes(n)?!1:!!o.isDefault&&o.locations.includes(e)))}get hasToolsAgent(){return!!this.configurationService.getValue("chat.agent.enabled")}getContributedDefaultAgent(e){return this._preferExtensionAgent(this.getAgents().filter(n=>!!n.isDefault&&n.locations.includes(e)))}_preferExtensionAgent(e){return pH(e,n=>!n.isCore)??e.at(-1)}getAgent(e,n=!1){if(!(!this._agentIsEnabled(e)&&!n))return this._agents.get(e)?.data}_agentIsEnabled(e){let n=typeof e=="string"?this._agents.get(e):e;return!n?.data.when||this.contextKeyService.contextMatchesRules(lt.deserialize(n.data.when))}getAgentByFullyQualifiedId(e){let n=Mt.find(this._agents.values(),o=>y1(o.data)===e)?.data;if(!(n&&!this._agentIsEnabled(n.id)))return n}getAgents(){return Array.from(this._agents.values()).map(e=>e.data).filter(e=>this._agentIsEnabled(e.id))}getActivatedAgents(){return Array.from(this._agents.values()).filter(e=>!!e.impl).filter(e=>this._agentIsEnabled(e.data.id)).map(e=>new xm(e.data,e.impl))}getAgentsByName(e){return this._preferExtensionAgents(this.getAgents().filter(n=>n.name===e))}_preferExtensionAgents(e){let n=e.filter(o=>!o.isCore);return n.length>0?n:e}agentHasDupeName(e){let n=this.getAgent(e);return n?this.getAgentsByName(n.name).filter(o=>o.extensionId.value!==n.extensionId.value).length>0:!1}async invokeAgent(e,n,o,r,s){Ry(n.sessionResource,_y.AgentWillInvoke);let a=this._agents.get(e);if(!a?.impl)throw new Error(`No activated agent with id "${e}"`);this._onWillInvokeAgent.fire({agentId:e,request:n});let l=await a.impl.invoke(n,o,r,s);return Ry(n.sessionResource,_y.AgentDidInvoke),l}setRequestTools(e,n,o){let r=this._agents.get(e);r?.impl&&r.impl.setRequestTools?.(n,o)}setYieldRequested(e,n,o){let r=this._agents.get(e);r?.impl&&r.impl.setYieldRequested?.(n,o)}async getFollowups(e,n,o,r,s){let a=this._agents.get(e);return a?.impl?.provideFollowups?a.impl.provideFollowups(n,o,r,s):[]}async getChatTitle(e,n,o){let r=this._agents.get(e);if(r?.impl?.provideChatTitle)return r.impl.provideChatTitle(n,o)}async getChatSummary(e,n,o){let r=this._agents.get(e);if(r?.impl?.provideChatSummary)return r.impl.provideChatSummary(n,o)}registerChatParticipantDetectionProvider(e,n){return this._chatParticipantDetectionProviders.set(e,n),q(()=>{this._chatParticipantDetectionProviders.delete(e)})}hasChatParticipantDetectionProviders(){return this._chatParticipantDetectionProviders.size>0}async detectAgentOrCommand(e,n,o,r){let s=Mt.first(this._chatParticipantDetectionProviders.values());if(!s)return;let a=this.getAgents().reduce((u,m)=>{if(m.locations.includes(o.location)){u.push({participant:m.id,disambiguation:m.disambiguation??[]});for(let g of m.slashCommands)u.push({participant:m.id,command:g.name,disambiguation:g.disambiguation??[]})}return u},[]),l=await s.provideParticipantDetection(e,n,{...o,participants:a},r);if(!l)return;let d=this.getAgent(l.participant);if(!d)return;if(!l.command)return{agent:d};let c=d?.slashCommands.find(u=>u.name===l.command);if(c)return{agent:d,command:c}}};wC=_([S(0,Ir),S(1,$t)],wC);var xm=class{constructor(t,e){this.data=t;this.impl=e}get id(){return this.data.id}get name(){return this.data.name??""}get fullName(){return this.data.fullName??""}get description(){return this.data.description??""}get extensionId(){return this.data.extensionId}get extensionVersion(){return this.data.extensionVersion}get extensionPublisherId(){return this.data.extensionPublisherId}get extensionPublisherDisplayName(){return this.data.publisherDisplayName}get extensionDisplayName(){return this.data.extensionDisplayName}get isDefault(){return this.data.isDefault}get isCore(){return this.data.isCore}get metadata(){return this.data.metadata}get slashCommands(){return this.data.slashCommands}get locations(){return this.data.locations}get modes(){return this.data.modes}get disambiguation(){return this.data.disambiguation}async invoke(t,e,n,o){return this.impl.invoke(t,e,n,o)}setRequestTools(t,e){this.impl.setRequestTools?.(t,e)}setYieldRequested(t,e){this.impl.setYieldRequested?.(t,e)}async provideFollowups(t,e,n,o){return this.impl.provideFollowups?this.impl.provideFollowups(t,e,n,o):[]}toJSON(){return this.data}},T4=A("chatAgentNameService"),kC=class{constructor(t){this.languageModelsService=t}getAgentNameRestriction(t){if(t.isCore)return!0;let e=this.checkAgentNameRestriction(t.name,t).get(),n=!t.fullName||this.checkAgentNameRestriction(t.fullName.replace(/\s/g,""),t).get();return e&&n}checkAgentNameRestriction(t,e){return this.languageModelsService.restrictedChatParticipants.map(o=>o[t.toLowerCase()]).map(o=>o?o.some(r=>wn(r,r.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};kC=_([S(0,EC)],kC);function y1(i){return`${i.extensionId.value}.${i.id}`}function xj(i){return i.name!==void 0}function RC(i){let t=xj(i)?i:{...i,name:i.id};return t.extensionPublisherId||(t.extensionPublisherId=i.extensionPublisher??""),t.extensionDisplayName||(t.extensionDisplayName=""),t.extensionId||(t.extensionId=new xe("")),Tt(t)}var Sj=250,Cj=500,Tj=250,Ej=1e3,b1=10,wj=2,Sm=class{constructor(t){this.logService=t;let e=Date.now();this._data={totalTime:0,lastUpdateTime:e,impliedWordLoadRate:0,lastWordCount:0,firstMarkdownTime:void 0,bootstrapActive:!0,wordCountAtBootstrapExit:void 0,updatesWithNewWords:0},this._publicData={impliedWordLoadRate:0,lastWordCount:0}}get data(){return this._publicData}get internalData(){return this._data}update(t){let{totalWordCount:e}=t;if(e===this._data.lastWordCount){this.trace("Update- no new words");return}let n=Date.now(),o=e-this._data.lastWordCount,r=this._data.lastWordCount===0,s=this._data.firstMarkdownTime,a=this._data.wordCountAtBootstrapExit;typeof s!="number"&&e>0&&(s=n);let l=this._data.updatesWithNewWords+1;r&&(this._data.lastUpdateTime=n);let d=o>b1?Ej:Tj,c=Math.min(n-this._data.lastUpdateTime,d),u=this._data.totalTime+c,m=r&&e>b1?Cj:Sj,g=this._data.bootstrapActive;if(g){let w=s;typeof w=="number"&&l>=wj&&e>=b1?(g=!1,u=Math.max(n-w,c),a=this._data.lastWordCount,this.trace("Has stable data")):u=Math.max(u,m)}let h=typeof a=="number"?Math.max(e-a,0):e,f=u,I=g?e:h,x=f>0?I/(f/1e3):0;this._data={totalTime:u,lastUpdateTime:n,impliedWordLoadRate:x,lastWordCount:e,firstMarkdownTime:s,bootstrapActive:g,wordCountAtBootstrapExit:a,updatesWithNewWords:l},this._publicData={impliedWordLoadRate:x,lastWordCount:e};let E=g?e:h;return this.trace(`Update- got ${E} words over last ${u}ms = ${x} words/s`),this._data}trace(t){this.logService.trace(`ChatStreamStatsTracker#update: ${t}`)}};Sm=_([S(0,te)],Sm);var I1=/(?<![a-zA-Z0-9])(?<dollars>\${1,2})(?!\.|\(["'])((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\k<dollars>(?![a-zA-Z0-9])/,kj="vscode-katex-container",Pj="data-latex",_j=new RegExp("^"+I1.source),Rj;(r=>{let i=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function t(s,a={}){return{extensions:[n(a,e(s,a,!1)),o(a,e(s,a,!0))]}}r.extension=t;function e(s,a,l){return d=>{let c;try{let u=s.renderToString(d.text,{...a,throwOnError:!0,displayMode:d.displayMode});c=`<span class="${kj}" ${Pj}="${yx(d.text)}">${u}</span>`}catch{c=d.raw}return c+(l?`
`:"")}}function n(s,a){let l=_j;return{name:"inlineKatex",level:"inline",start(d){let c,u=d;for(;u;){if(c=u.indexOf("$"),c===-1)return;if(u.substring(c).match(l))return c;u=u.substring(c+1).replace(/^\$+/,"")}},tokenizer(d,c){let u=d.match(l);if(u)return{type:"inlineKatex",raw:u[0],text:u[2].trim(),displayMode:u[1].length===2}},renderer:a}}function o(s,a){return{name:"blockKatex",level:"block",start(l){return l.match(new RegExp(i.source,"m"))?.index},tokenizer(l,d){let c=l.match(i);if(c)return{type:"blockKatex",raw:c[0],text:c[2].trim(),displayMode:c[1].length===2}},renderer:a}}})(Rj||={});var Go=String.raw,Aj=Go`(?<!\\)`+Go`(!?\[`+Go`(?:`+Go`[^\[\]\\]|`+Go`\\.|`+Go`\[[^\[\]]*\]`+Go`)*`+Go`\])`+Go`(\(\s*)`+Go`(`+Go`[^\s\(\)<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|`+Go`<(?:\\[<>]|[^<>])+>`+Go`)`+Go`\s*(?:"[^"]*"|'[^']*'|\([^\(\)]*\))?\s*`+Go`\)`;function Mj(i,t){let n=new RegExp("(?:"+Aj+")|(?:"+I1.source+Go`)|\p{sc=Han}|=+|\++|-+|[^\s\|\p{sc=Han}|=|\+|\-|${"`"}]+`,"gu"),o=Array.from(i.matchAll(n)),r=o.slice(0,t),s=t>=o.length?i.length:r.length?r.at(-1).index+r.at(-1)[0].length:0,a=i.substring(0,s);return{value:a,returnedWordCount:r.length===0?a.length?1:0:r.length,isFullString:s>=i.length,totalWordCount:o.length}}function E4(i){return Mj(i,Number.MAX_SAFE_INTEGER).returnedWordCount}function w4(i){return!!i&&typeof i=="object"&&"message"in i}function Oj(i){return!!i&&typeof i.setVote<"u"}var DC=class extends N{constructor(e,n,o){super();this._model=e;this._options=n;this.instantiationService=o;this._onDidDisposeModel=this._register(new T);this.onDidDisposeModel=this._onDidDisposeModel.event;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._items=[];this._inputPlaceholder=void 0;this._editing=void 0;e.getRequests().forEach((r,s)=>{let a=this.instantiationService.createInstance(Cm,r);this._items.push(a),r.response&&this.onAddResponse(r.response)}),this._register(e.onDidDispose(()=>this._onDidDisposeModel.fire())),this._register(e.onDidChangePendingRequests(()=>this._onDidChange.fire(null))),this._register(e.onDidChange(r=>{if(r.kind==="addRequest"){let a=this.instantiationService.createInstance(Cm,r.request);this._items.push(a),r.request.response&&this.onAddResponse(r.request.response)}else if(r.kind==="addResponse")this.onAddResponse(r.response);else if(r.kind==="removeRequest"){let a=this._items.findIndex(d=>w4(d)&&d.id===r.requestId);a>=0&&this._items.splice(a,1);let l=r.responseId&&this._items.findIndex(d=>Oj(d)&&d.id===r.responseId);if(typeof l=="number"&&l>=0){let c=this._items.splice(l,1)[0];c instanceof mu&&c.dispose()}}let s=r.kind==="addRequest"?{kind:"addRequest"}:r.kind==="initialize"?{kind:"initialize"}:r.kind==="setHidden"?{kind:"setHidden"}:null;this._onDidChange.fire(s)}))}get inputPlaceholder(){return this._inputPlaceholder}get model(){return this._model}setInputPlaceholder(e){this._inputPlaceholder=e,this._onDidChange.fire({kind:"changePlaceholder"})}resetInputPlaceholder(){this._inputPlaceholder=void 0,this._onDidChange.fire({kind:"changePlaceholder"})}get sessionResource(){return this._model.sessionResource}onAddResponse(e){let n=this.instantiationService.createInstance(mu,e,this);this._register(n.onDidChange(()=>this._onDidChange.fire(null))),this._items.push(n)}getItems(){let e=this._items.filter(o=>!(o.isHiddenFromTranscript||o.shouldBeRemovedOnSend&&!o.shouldBeRemovedOnSend.afterUndoStop));this._options?.maxVisibleItems!==void 0&&e.length>this._options.maxVisibleItems&&(e=e.slice(-this._options.maxVisibleItems));let n=this._model.getPendingRequests().filter(o=>!o.request.isHiddenFromTranscript);if(n.length>0){let o=n.filter(s=>s.kind==="steering"),r=n.filter(s=>s.kind==="queued");if(o.length>0){let s=o.every(a=>a.request.isSystemInitiated);e.push({kind:"pendingDivider",id:"pending-divider-steering",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"steering",isSystemInitiated:s,currentRenderedHeight:void 0});for(let a of o){let l=this.instantiationService.createInstance(Cm,a.request,a.kind);e.push(l)}}if(r.length>0){e.push({kind:"pendingDivider",id:"pending-divider-queued",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"queued",currentRenderedHeight:void 0});for(let s of r){let a=this.instantiationService.createInstance(Cm,s.request,s.kind);e.push(a)}}}return e}get editing(){return this._editing}setEditing(e){this.editing&&e&&this.editing.id===e.id||(this._editing=e)}dispose(){super.dispose(),In(this._items.filter(e=>e instanceof mu)),this._items.length=0}};DC=_([S(2,Dn)],DC);var Cm=class{constructor(t,e){this._model=t;this._pendingKind=e}get id(){return this._model.id}get dataId(){return`${this.id}_${this._model.version+(this._model.response?.isComplete?1:0)}`}get sessionResource(){return this._model.session.sessionResource}get username(){return"User"}get avatarIcon(){return de.account}get message(){return this._model.message}get messageText(){return this.message.text}get attempt(){return this._model.attempt}get variables(){return this._model.variableData.variables}get contentReferences(){return this._model.response?.contentReferences}get confirmation(){return this._model.confirmation}get isComplete(){return this._model.response?.isComplete??!1}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get isTerminalCommand(){return this._model.isTerminalCommand}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get isHiddenFromTranscript(){return this._model.isHiddenFromTranscript}get shouldBeBlocked(){return this._model.shouldBeBlocked}get slashCommand(){return this._model.response?.slashCommand}get agentOrSlashCommandDetected(){return this._model.response?.agentOrSlashCommandDetected??!1}get attachedContext(){return this._model.attachedContext}get modelId(){return this._model.modelId}get resolvedModelId(){let t=this._model.response?.result?.metadata?.resolvedModel;return typeof t=="string"?t:void 0}get timestamp(){return this._model.timestamp}get requestTimestamp(){return this._model.requestTimestamp}get origin(){return this._model.origin}get pendingKind(){return this._pendingKind}get isSystemInitiated(){return this._model.isSystemInitiated}get systemInitiatedLabel(){return this._model.systemInitiatedLabel}},mu=class extends N{constructor(e,n,o,r){super();this._model=e;this.session=n;this.instantiationService=o;this.chatAgentNameService=r;this._modelChangeCount=0;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.renderData=void 0;this._vulnerabilitiesListExpanded=!1;e.isComplete||(this.liveUpdateTracker=this.instantiationService.createInstance(Sm));let s=this.liveUpdateTracker?this._register(new Pn(()=>{let a=E4(e.entireResponse.getMarkdown());this.liveUpdateTracker.update({totalWordCount:a})},0)):void 0;this._register(e.onDidChange(()=>{s?.schedule(),this._modelChangeCount++,this._onDidChange.fire()}))}get model(){return this._model}get id(){return this._model.id}get dataId(){return this._model.id+`_${this._modelChangeCount}`+(this.isLast?"_last":"")}get sessionResource(){return this._model.session.sessionResource}get username(){return this.agent?this.chatAgentNameService.getAgentNameRestriction(this.agent)?this.agent.fullName||this.agent.name:y1(this.agent):this._model.username}get agent(){return this._model.agent}get slashCommand(){return this._model.slashCommand}get agentOrSlashCommandDetected(){return this._model.agentOrSlashCommandDetected}get response(){return this._model.response}get usedContext(){return this._model.usedContext}get contentReferences(){return this._model.contentReferences}get codeCitations(){return this._model.codeCitations}get progressMessages(){return this._model.progressMessages}get isComplete(){return this._model.isComplete}get isCanceled(){return this._model.isCanceled}get shouldBeBlocked(){return this._model.shouldBeBlocked}get shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}get isHiddenFromTranscript(){return this._model.isHiddenFromTranscript}get isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}get isTerminalCommand(){return this._model.request?.isTerminalCommand??!1}get replyFollowups(){return this._model.followups?.filter(e=>e.kind==="reply")}get result(){return this._model.result}get errorDetails(){return this.result?.errorDetails}get vote(){return this._model.vote}get requestId(){return this._model.requestId}get isStale(){return this._model.isStale}get isLast(){return this.session.getItems().at(-1)===this}get usedReferencesExpanded(){if(typeof this._usedReferencesExpanded=="boolean")return this._usedReferencesExpanded}set usedReferencesExpanded(e){this._usedReferencesExpanded=e}get vulnerabilitiesListExpanded(){return this._vulnerabilitiesListExpanded}set vulnerabilitiesListExpanded(e){this._vulnerabilitiesListExpanded=e}get contentUpdateTimings(){return this.liveUpdateTracker?.data}get confirmationAdjustedTimestamp(){return this._model.confirmationAdjustedTimestamp}get usageObs(){return this._model.usageObs}get completionTokenCountObs(){return this._model.completionTokenCountObs}setVote(e){this._modelChangeCount++,this._model.setVote(e)}setEditApplied(e,n){this._modelChangeCount++,this._model.setEditApplied(e,n)}};mu=_([S(2,Dn),S(3,T4)],mu);var ko=class i{constructor(t,e){this.start=t;this.endExclusive=e;if(t>e)throw new At(`Invalid range: ${this.toString()}`)}static fromTo(t,e){return new i(t,e)}static equals(t,e){return t.start===e.start&&t.endExclusive===e.endExclusive}static addRange(t,e){let n=0;for(;n<e.length&&e[n].endExclusive<t.start;)n++;let o=n;for(;o<e.length&&e[o].start<=t.endExclusive;)o++;if(n===o)e.splice(n,0,t);else{let r=Math.min(t.start,e[n].start),s=Math.max(t.endExclusive,e[o-1].endExclusive);e.splice(n,o-n,new i(r,s))}}static tryCreate(t,e){if(!(t>e))return new i(t,e)}static ofLength(t){return new i(0,t)}static ofStartAndLength(t,e){return new i(t,t+e)}static emptyAt(t){return new i(t,t)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new i(this.start+t,this.endExclusive+t)}deltaStart(t){return new i(this.start+t,this.endExclusive)}deltaEnd(t){return new i(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(t){return this.start===t.start&&this.endExclusive===t.endExclusive}containsRange(t){return this.start<=t.start&&t.endExclusive<=this.endExclusive}contains(t){return this.start<=t&&t<this.endExclusive}join(t){return new i(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);if(e<=n)return new i(e,n)}intersectionLength(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return Math.max(0,n-e)}intersects(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return e<n}intersectsOrTouches(t){let e=Math.max(this.start,t.start),n=Math.min(this.endExclusive,t.endExclusive);return e<=n}isBefore(t){return this.endExclusive<=t.start}isAfter(t){return this.start>=t.endExclusive}slice(t){return t.slice(this.start,this.endExclusive)}substring(t){return t.substring(this.start,this.endExclusive)}clip(t){if(this.isEmpty)throw new At(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,t))}clipCyclic(t){if(this.isEmpty)throw new At(`Invalid clipping range: ${this.toString()}`);return t<this.start?this.endExclusive-(this.start-t)%this.length:t>=this.endExclusive?this.start+(t-this.start)%this.length:t}map(t){let e=[];for(let n=this.start;n<this.endExclusive;n++)e.push(t(n));return e}forEach(t){for(let e=this.start;e<this.endExclusive;e++)t(e)}joinRightTouching(t){if(this.endExclusive!==t.start)throw new At(`Invalid join: ${this.toString()} and ${t.toString()}`);return new i(this.start,t.endExclusive)}withMargin(t,e){return e===void 0&&(e=t),new i(this.start-t,this.endExclusive+e)}};function S1(){return Object.create(null)}var Va="**",LC="/",AC="[/\\\\]",MC="[^/\\\\]",Nj=/\//g;function k4(i,t){switch(i){case 0:return"";case 1:return`${MC}*?`;default:return`(?:${AC}|${MC}+${AC}${t?`|${AC}${MC}+`:""})*?`}}function Ba(i,t){if(!i)return[];let e=[],n=!1,o=!1,r="";for(let s of i){switch(s){case t:if(!n&&!o){e.push(r),r="";continue}break;case"{":n=!0;break;case"}":n=!1;break;case"[":o=!0;break;case"]":o=!1;break}r+=s}return r&&e.push(r),e}function A4(i){if(!i)return"";let t="",e=Ba(i,LC);if(e.every(n=>n===Va))t=".*";else{let n=!1;e.forEach((o,r)=>{if(o===Va){if(n)return;t+=k4(2,r===e.length-1)}else{let s=!1,a="",l=!1,d="";for(let c of o){if(c!=="}"&&s){a+=c;continue}if(l&&(c!=="]"||!d)){let u;c==="-"?u=c:(c==="^"||c==="!")&&!d?u="^":c===LC?u="":u=nr(c),d+=u;continue}switch(c){case"{":s=!0;continue;case"[":l=!0;continue;case"}":{let m=`(?:${Ba(a,",").map(g=>A4(g)).join("|")})`;t+=m,s=!1,a="";break}case"]":{t+="["+d+"]",l=!1,d="";break}case"?":t+=MC;continue;case"*":t+=k4(1);continue;default:t+=nr(c)}}r<e.length-1&&(e[r+1]!==Va||r+2<e.length)&&(t+=AC)}n=o===Va})}return t}var Uj=/^\*\*\/\*\.[\w\.-]+$/,Fj=/^\*\*\/([\w\.-]+)\/?$/,Hj=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,Wj=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,Vj=/^\*\*((\/[\w\.-]+)+)\/?$/,Bj=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,P4=new Xr(1e4),_4=function(){return!1},_s=function(){return null};function C1(i,t,e){if(!i)return _s;let n;typeof i!="string"?n=i.pattern:n=i,n=n.trim();let o=t.ignoreCase??!1,r={...t,equals:o?wn:(d,c)=>d===c,endsWith:o?u2:(d,c)=>d.endsWith(c),isEqualOrParent:(d,c)=>Or(d,c,t.ignoreCase??!Xe)},s=`${e===void 0?`default:${o?n.toLowerCase():n}`:`custom:${e}`}_${!!t.trimForExclusions}_${o}`,a=P4.get(s);if(a)return R4(a,i,r);let l;return Uj.test(n)?a=$j(n.substring(4),n,r):(l=Fj.exec(x1(n,r)))?a=zj(l[1],n,r):(t.trimForExclusions?Wj:Hj).test(n)?a=qj(n,r):(l=Vj.exec(x1(n,r)))?a=D4(l[1].substring(1),n,!0,r):(l=Bj.exec(x1(n,r)))?a=D4(l[1],n,!1,r):a=Kj(n,r),P4.set(s,a),R4(a,i,r)}function R4(i,t,e){if(typeof t=="string")return i;let n=function(o,r){return e.isEqualOrParent(o,t.base)?i(HR(o.substring(t.base.length),Dt),r):null};return n.allBasenames=i.allBasenames,n.allPaths=i.allPaths,n.basenames=i.basenames,n.patterns=i.patterns,n}function x1(i,t){return t.trimForExclusions&&i.endsWith("/**")?i.substring(0,i.length-2):i}function $j(i,t,e){return function(n,o){return typeof n=="string"&&e.endsWith(n,i)?t:null}}function zj(i,t,e){let n=`/${i}`,o=`\\${i}`,r=function(a,l){return typeof a!="string"?null:l?e.equals(l,i)?t:null:e.equals(a,i)||e.endsWith(a,n)||e.endsWith(a,o)?t:null},s=[i];return r.basenames=s,r.patterns=[t],r.allBasenames=s,r}function qj(i,t){let e=L4(i.slice(1,-1).split(",").map(a=>C1(a,t)).filter(a=>a!==_s),i,t.ignoreCase),n=e.length;if(!n)return _s;if(n===1)return e[0];let o=function(a,l){for(let d=0,c=e.length;d<c;d++)if(e[d](a,l))return i;return null},r=e.find(a=>!!a.allBasenames);r&&(o.allBasenames=r.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(o.allPaths=s),o}function D4(i,t,e,n){let o=Dt===qe.sep,r=o?i:i.replace(Nj,Dt),s=Dt+r,a=qe.sep+i,l;return e?l=function(d,c){return typeof d=="string"&&(n.equals(d,r)||n.endsWith(d,s)||!o&&(n.equals(d,i)||n.endsWith(d,a)))?t:null}:l=function(d,c){return typeof d=="string"&&(n.equals(d,r)||!o&&n.equals(d,i))?t:null},l.allPaths=[(e?"*/":"./")+i],l}function Kj(i,t){try{let e=new RegExp(`^${A4(i)}$`,t.ignoreCase?"i":void 0);return function(n){return e.lastIndex=0,typeof n=="string"&&e.test(n)?i:null}}catch{return _s}}function _r(i,t,e){return!i||typeof t!="string"?!1:Po(i,e)(t)}function Po(i,t={}){if(!i)return _4;if(typeof i=="string"||M4(i)){let e=C1(i,t);if(e===_s)return _4;let n=function(o,r){return!!e(o,r)};return e.allBasenames&&(n.allBasenames=e.allBasenames),e.allPaths&&(n.allPaths=e.allPaths),n}return jj(i,t)}function M4(i){let t=i;return t?typeof t.base=="string"&&typeof t.pattern=="string":!1}function T1(i){return i.allBasenames||[]}function E1(i){return i.allPaths||[]}function jj(i,t){let e=L4(Object.getOwnPropertyNames(i).map(a=>Gj(a,i[a],t)).filter(a=>a!==_s),void 0,t.ignoreCase),n=e.length;if(!n)return _s;if(!e.some(a=>!!a.requiresSiblings)){if(n===1)return e[0];let a=function(c,u){let m;for(let g=0,h=e.length;g<h;g++){let f=e[g](c,u);if(typeof f=="string")return f;oi(f)&&(m||(m=[]),m.push(f))}return m?(async()=>{for(let g of m){let h=await g;if(typeof h=="string")return h}return null})():null},l=e.find(c=>!!c.allBasenames);l&&(a.allBasenames=l.allBasenames);let d=e.reduce((c,u)=>u.allPaths?c.concat(u.allPaths):c,[]);return d.length&&(a.allPaths=d),a}let o=function(a,l,d){let c,u;for(let m=0,g=e.length;m<g;m++){let h=e[m];h.requiresSiblings&&d&&(l||(l=ot(a)),c||(c=l.substring(0,l.length-zl(a).length)));let f=h(a,l,c,d);if(typeof f=="string")return f;oi(f)&&(u||(u=[]),u.push(f))}return u?(async()=>{for(let m of u){let g=await m;if(typeof g=="string")return g}return null})():null},r=e.find(a=>!!a.allBasenames);r&&(o.allBasenames=r.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(o.allPaths=s),o}function Gj(i,t,e){if(t===!1)return _s;let n=C1(i,e,i);if(n===_s)return _s;if(typeof t=="boolean")return n;if(t){let o=t.when;if(typeof o=="string"){let r=(s,a,l,d)=>{if(!d||!n(s,a))return null;let c=o.replace("$(basename)",()=>l),u=d(c);return oi(u)?u.then(m=>m?i:null):u?i:null};return r.requiresSiblings=!0,r}}return n}function L4(i,t,e){let n=i.filter(l=>!!l.basenames);if(n.length<2)return i;let o=n.reduce((l,d)=>{let c=d.basenames;return c?l.concat(c):l},[]),r;if(t){r=[];for(let l=0,d=o.length;l<d;l++)r.push(t)}else r=n.reduce((l,d)=>{let c=d.patterns;return c?l.concat(c):l},[]);let s=function(l,d){if(typeof l!="string")return null;if(!d){let u;for(u=l.length;u>0;u--){let m=l.charCodeAt(u-1);if(m===47||m===92)break}d=l.substring(u)}let c=e?o.findIndex(u=>wn(u,d)):o.indexOf(d);return c!==-1?r[c]:null};s.basenames=o,s.patterns=r,s.allBasenames=o;let a=i.filter(l=>!l.basenames);return a.push(s),a}function w1(i,t){return dn(i,t,(e,n)=>typeof e=="string"&&typeof n=="string"?e===n:typeof e!="string"&&typeof n!="string"?e.base===n.base&&e.pattern===n.pattern:!1)}var Qj=A("notebookDocumentService"),k1=["W","X","Y","Z","a","b","c","d","e","f"],Jj=new RegExp(`^[${k1.join("")}]+`),O4=7;function OC(i){if(i.scheme!==B.vscodeNotebookCell)return;let t=i.fragment.indexOf("s");if(t<0)return;let e=parseInt(i.fragment.substring(0,t).replace(Jj,""),O4),n=fo(i.fragment.substring(t+1)).toString();if(!isNaN(e))return{handle:e,notebook:i.with({scheme:n,fragment:null})}}function N4(i,t){let e=t.toString(O4),o=`${e.length<k1.length?k1[e.length-1]:"z"}${e}s${eo(H.fromString(i.scheme),!0,!0)}`;return i.with({scheme:B.vscodeNotebookCell,fragment:o})}function U4(i){if(i.scheme!==B.vscodeNotebookMetadata)return;let t=fo(i.fragment).toString();return i.with({scheme:t,fragment:null})}function F4(i){let t=`${eo(H.fromString(i.scheme),!0,!0)}`;return i.with({scheme:B.vscodeNotebookMetadata,fragment:t})}function _1(i){if(i.scheme!==B.vscodeNotebookCellOutput)return;let t=new URLSearchParams(i.query),e=t.get("openIn");if(!e)return;let n=t.get("outputId")??void 0,o=OC(i.with({scheme:B.vscodeNotebookCell,query:null})),r=t.get("outputIndex")?parseInt(t.get("outputIndex")||"",10):void 0,s=o?o.notebook:i.with({scheme:t.get("notebookScheme")||B.file,fragment:null,query:null}),a=t.get("cellIndex")?parseInt(t.get("cellIndex")||"",10):void 0;return{notebook:s,openIn:e,outputId:n,outputIndex:r,cellHandle:o?.handle,cellFragment:i.fragment,cellIndex:a}}var P1=class{constructor(){this._documents=new Ve}getNotebook(t){if(t.scheme===B.vscodeNotebookCell){let e=OC(t);if(e){let n=this._documents.get(e.notebook);if(n)return n}}if(t.scheme===B.vscodeNotebookCellOutput){let e=_1(t);if(e){let n=this._documents.get(e.notebook);if(n)return n}}return this._documents.get(t)}addNotebookDocument(t){this._documents.set(t.uri,t)}removeNotebookDocument(t){this._documents.delete(t.uri)}};Ue(Qj,P1,1);var uPe=["application/json","application/javascript","text/html","image/svg+xml",Tr.latex,Tr.markdown,"image/png","image/jpeg",Tr.text],pPe=[Tr.latex,Tr.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",Tr.text];var Yj;(n=>{n.scheme=B.vscodeNotebookMetadata;function t(o){return F4(o)}n.generate=t;function e(o){return U4(o)}n.parse=e})(Yj||={});var Dy;(d=>{d.scheme=B.vscodeNotebookCell;function t(c,u){return N4(c,u)}d.generate=t;function e(c){return OC(c)}d.parse=e;function n(c,u){return c.with({scheme:B.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:u??"",notebookScheme:c.scheme!==B.file?c.scheme:""}).toString()})}d.generateCellOutputUriWithId=n;function o(c,u,m){return c.with({scheme:B.vscodeNotebookCellOutput,fragment:u.fragment,query:new URLSearchParams({openIn:"notebook",outputIndex:String(m)}).toString()})}d.generateCellOutputUriWithIndex=o;function r(c,u,m,g,h){return c.with({scheme:B.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"notebookOutputEditor",notebook:c.toString(),cellIndex:String(m),outputId:g,outputIndex:String(h)}).toString()})}d.generateOutputEditorUri=r;function s(c){return _1(c)}d.parseCellOutputUri=s;function a(c,u,m){return d.generate(c,u).with({scheme:m})}d.generateCellPropertyUri=a;function l(c,u){if(c.scheme===u)return d.parse(c.with({scheme:d.scheme}))}d.parseCellPropertyUri=l})(Dy||={});var mPe=new k("notebookEditorCursorAtBoundary","none"),gPe=new k("notebookEditorCursorAtLineBoundary","none");var H4=class i{static{this._prefix="notebook/"}static create(t,e){return`${i._prefix}${t}/${e??t}`}static parse(t){if(t.startsWith(i._prefix)){let e=t.substring(i._prefix.length).split("/");if(e.length===2)return{notebookType:e[0],viewType:e[1]}}}},Xj=new TextDecoder;function W4(i){let t=[],e=!1;for(let s of i)(t.length===0||e)&&(t.push(s),e=!0);let n=eG(t),o=H.concat(t.map(s=>H.wrap(s))),r=iG(o);return n=n||r.byteLength!==o.byteLength,{data:r,didCompression:n}}var NC="\x1B[A",R1=NC.split("").map(i=>i.charCodeAt(0)),Zj=10;function eG(i){let t=!1;return i.forEach((e,n)=>{if(n===0||e.length<NC.length)return;let o=i[n-1],r=e.subarray(0,NC.length);if(r[0]===R1[0]&&r[1]===R1[1]&&r[2]===R1[2]){let s=o.lastIndexOf(Zj);if(s===-1)return;t=!0,i[n-1]=o.subarray(0,s),i[n]=e.subarray(NC.length)}}),t}function tG(i){let t=i;do i=t,t=i.replace(/[^\n]\x08/gm,"");while(t.length<i.length);return i}function nG(i){for(i=i.replace(/\r+\n/gm,`
`);i.search(/\r[^$]/g)>-1;){let t=i.match(/^(.*)\r+/m)[1],e=i.match(/\r+(.*)$/m)[1];e=e+t.slice(e.length,t.length),i=i.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,e)}return i}var oG=8,rG=13;function iG(i){return!i.buffer.includes(oG)&&!i.buffer.includes(rG)?i:H.fromString(nG(tG(Xj.decode(i.buffer))))}var B4=A("chatEditingService");var EPe=new k("chatEditingWidgetFileState",void 0,p(13064,null)),wPe=new k("chatEditingAgentSupportsReadonlyReferences",void 0,p(13063,null)),kPe=new k("decidedChatEditingResource",[]),PPe=new k("chatEditingResource",void 0),_Pe=new k("inChatEditingSession",void 0),RPe=new k("hasUndecidedChatEditingResource",!1),DPe=new k("hasAppliedChatEdits",!1),APe=new k("applyingChatEditsFailed",!1);function D1(i){return gB(i)&&(i={kind:"terminal",commandLine:{original:i.command,toolEdited:void 0,userEdited:void 0},language:i.language}),i}function $4(i){return{kind:i.kind,sourceSessionResource:i.sourceSessionResource.toJSON(),...i.delegationScope?{delegationScope:i.delegationScope}:{}}}function z4(i){if(i?.kind!=="delegation")return;let t=y.revive(i.sourceSessionResource);return t?{kind:i.kind,sourceSessionResource:t,...i.delegationScope?{delegationScope:i.delegationScope}:{}}:void 0}var zPe=A("chatRequestOriginService");var pn;(r=>{r.Internal={type:"internal",label:"Built-In"},r.External={type:"external",label:"External"};function e(s){switch(s.type){case"extension":return`extension:${s.extensionId.value}`;case"mcp":return`mcp:${s.collectionId}:${s.definitionId}`;case"user":return`user:${s.file.toString()}`;case"internal":return"internal";case"external":return"external"}}r.toKey=e;function n(s,a){return e(s)===e(a)}r.equals=n;function o(s){return s.type==="internal"?{ordinal:1,label:p(13594,null)}:s.type==="mcp"?{ordinal:2,label:s.serverLabel||s.label}:s.type==="user"?{ordinal:0,label:p(13596,null)}:{ordinal:3,label:s.label}}r.classify=o})(pn||={});function q4(i){return i!==null&&typeof i=="object"&&y.isUri(i.sessionResource)}function A1(i){return typeof i=="object"&&typeof i?.input=="string"&&(typeof i?.output=="string"||Array.isArray(i?.output))}function M1(i){return typeof i=="object"&&typeof i?.output=="object"&&typeof i?.output?.mimeType=="string"&&i?.output?.type==="data"}function K4(i){return!!i&&i.getTools!==void 0}var Em=A("ILanguageModelToolsService");var sG;(a=>(a.execute="execute",a.edit="edit",a.search="search",a.agent="agent",a.read="read",a.web="web",a.todo="todo"))(sG||={});var Ay;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(Ay||={});var My=class i{constructor(t,e,n,o,r,s={},a){this.toolCallId=n;this.kind="toolInvocation";this.isAttachedToThinking=!1;this._toolSpecificDataKind=An(this,void 0);this.toolSpecificDataKind=this._toolSpecificDataKind;this._progress=An(this,{progress:0});this._partialInput=An(this,void 0);this._streamingMessage=An(this,void 0);let l="";s.startInStreaming?l=e.displayName:s.startInCancelled&&(l=s.cancelReasonMessage??p(13109,null,e.displayName)),this.invocationMessage=t?.invocationMessage??l,this.pastTenseMessage=t?.pastTenseMessage,this.originMessage=t?.originMessage,this.confirmationMessages=t?.confirmationMessages,this.presentation=t?.presentation,this.toolSpecificData=t?.toolSpecificData,this.toolId=e.id,this.icon=t?.icon??(e.icon&&ct.isThemeIcon(e.icon)?e.icon:void 0),this.source=e.source,this.subAgentInvocationId=o,this.parameters=r,this.chatRequestId=a,s.startInCancelled?this._state=An(this,{type:Fe.StateKind.Cancelled,reason:s.cancelReason??0,reasonMessage:s.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):s.startInStreaming?this._state=An(this,{type:Fe.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=An(this,{type:Fe.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:d=>this._confirm(d)}):this._state=An(this,{type:Fe.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages})}get toolSpecificData(){return this._toolSpecificData}set toolSpecificData(t){this._toolSpecificData=t,this._toolSpecificDataKind.set(t?.kind,void 0)}get state(){return this._state}static createStreaming(t){return new i(void 0,t.toolData,t.toolCallId,t.subagentInvocationId,void 0,{startInStreaming:!0},t.chatRequestId)}static createCancelled(t,e,n,o){return new i(void 0,t.toolData,t.toolCallId,t.subagentInvocationId,e,{startInCancelled:!0,cancelReason:n,cancelReasonMessage:o},t.chatRequestId)}_confirm(t){t.type===0||t.type===5?this._state.set({type:Fe.StateKind.Cancelled,reason:t.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:Fe.StateKind.Executing,confirmed:t,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}updatePartialInput(t){this._state.get().type===Fe.StateKind.Streaming&&this._partialInput.set(t,void 0)}updateStreamingMessage(t){this._state.get().type===Fe.StateKind.Streaming&&this._streamingMessage.set(t,void 0)}notifyToolSpecificDataChanged(){let t=this._state.get();this._state.set({...t},void 0)}updateConfirmationMessages(t){let e=this._state.get();e.type===Fe.StateKind.WaitingForConfirmation&&(this.confirmationMessages=t,this._state.set({...e,confirmationMessages:t},void 0))}cancelFromStreaming(t,e){return this._state.get().type!==Fe.StateKind.Streaming?!1:(this._state.set({type:Fe.StateKind.Cancelled,reason:t,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(t,e,n){if(this._state.get().type!==Fe.StateKind.Streaming)return;let r=this._streamingMessage.get();r&&!t?.invocationMessage&&(this.invocationMessage=r),this._updatePreparedInvocation(t,e),n?this._confirm(n):this.confirmationMessages?.title?this._state.set({type:Fe.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:s=>this._confirm(s)},void 0):this._state.set({type:Fe.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}updatePreparedInvocation(t,e){let n=this._state.get();return n.type===Fe.StateKind.Streaming||n.type===Fe.StateKind.Completed||n.type===Fe.StateKind.Cancelled?!1:(this._updatePreparedInvocation(t,e),this._state.set({...n,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}_updatePreparedInvocation(t,e){this.parameters=e,t&&(t.invocationMessage&&(this.invocationMessage=t.invocationMessage),this.pastTenseMessage=t.pastTenseMessage,this.confirmationMessages=t.confirmationMessages,this.presentation=t.presentation,this.toolSpecificData=t.toolSpecificData)}requestConfirmation(t){let e=this._state.get().type;if(e===Fe.StateKind.Streaming){this.transitionFromStreaming(t,this.parameters,void 0);return}e===Fe.StateKind.Completed||e===Fe.StateKind.Cancelled||e===Fe.StateKind.WaitingForConfirmation||(t.invocationMessage&&(this.invocationMessage=t.invocationMessage),this.pastTenseMessage=t.pastTenseMessage,this.confirmationMessages=t.confirmationMessages,this.presentation=t.presentation,this.toolSpecificData=t.toolSpecificData,this.confirmationMessages?.title&&this._state.set({type:Fe.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:n=>this._confirm(n)},void 0))}_setCompleted(t,e){if(e&&(e.type===0||e.type===5)){this._state.set({type:Fe.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:Fe.StateKind.Completed,confirmed:Fe.executionConfirmedOrDenied(this)||{type:1},resultDetails:t?.toolResultDetails,postConfirmed:e,contentForModel:t?.content||[],parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}async didExecuteTool(t,e,n){let o=this._state.get();if(o.type===Fe.StateKind.Completed||o.type===Fe.StateKind.Cancelled)return o;if(t?.toolSpecificData&&(this.toolSpecificData=t.toolSpecificData),t?.toolResultMessage?this.pastTenseMessage=t.toolResultMessage:this._progress.get().message&&(this.pastTenseMessage=this._progress.get().message),this.confirmationMessages?.confirmResults&&!t?.toolResultError&&t?.confirmResults!==!1&&!e){let r=await n?.();r?this._setCompleted(t,r):this._state.set({type:Fe.StateKind.WaitingForPostApproval,confirmed:Fe.executionConfirmedOrDenied(this)||{type:1},resultDetails:t?.toolResultDetails,contentForModel:t?.content||[],confirm:s=>this._setCompleted(t,s),parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}else this._setCompleted(t);return this._state.get()}setAuthenticationRequired(t,e=()=>{}){let n=this._state.get();n.type!==Fe.StateKind.Executing&&n.type!==Fe.StateKind.WaitingForAuthentication||this._state.set({type:Fe.StateKind.WaitingForAuthentication,server:t,cancel:n.type===Fe.StateKind.WaitingForAuthentication?n.cancel:e,confirmed:n.confirmed,parameters:n.parameters,confirmationMessages:n.confirmationMessages},void 0)}setAuthenticationResolved(){let t=this._state.get();t.type===Fe.StateKind.WaitingForAuthentication&&this._state.set({type:Fe.StateKind.Executing,confirmed:t.confirmed,progress:this._progress,parameters:t.parameters,confirmationMessages:t.confirmationMessages},void 0)}acceptProgress(t){let e=this._progress.get();this._progress.set({progress:t.progress||e.progress||0,message:t.message},void 0)}toJSON(){let t=this.state.get().type===Fe.StateKind.WaitingForPostApproval,e=t?void 0:Fe.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:t?{type:5}:Fe.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:M1(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:eo(e.output.value)}}:e,toolSpecificData:this.toolSpecificData?.kind==="automationConfiguration"?void 0:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var wm=class{constructor(t,e,n,o,r,s,a,l,d,c){this.title=t;this.content=e;this.actions=n;this.canProvideFeedback=o;this.planUri=r;this.resolveId=s;this.data=a;this.isUsed=l;this.source=d;this.isOutdated=c;this.kind="planReview";this.completion=new jt;this._onDidDismiss=new T;this.onDidDismiss=this._onDidDismiss.event}dismiss(){this.isUsed||(this.isUsed=!0,this.draftFeedback=void 0,this.draftCollapsed=void 0,this.completion.complete(void 0),this._onDidDismiss.fire())}toJSON(){return{kind:this.kind,title:this.title,content:this.content,actions:this.actions,canProvideFeedback:this.canProvideFeedback,planUri:this.planUri,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed,isOutdated:this.isOutdated,source:this.source}}};var km=class{constructor(t,e,n,o,r,s,a,l,d){this.questions=t;this.allowSkip=e;this.resolveId=n;this.data=o;this.isUsed=r;this.message=s;this.source=a;this.terminalId=l;this.answerPresentation=d;this.kind="questionCarousel";this.completion=new jt}dismiss(t){this.isUsed||(this.data=t??{},this.isUsed=!0,this.draftAnswers=void 0,this.draftCurrentIndex=void 0,this.draftCollapsed=void 0,this.completion.complete({answers:t}))}toJSON(){return{kind:this.kind,questions:this.questions,allowSkip:this.allowSkip,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed,answeredExternally:this.answeredExternally,autoReply:this.autoReply,message:this.message,source:this.source,terminalId:this.terminalId,answerPresentation:this.answerPresentation}}};var lG;(t=>{function i(e,n){return e.text===n.text&&LM(e.parts,n.parts,(o,r)=>o.kind===r.kind&&ko.equals(o.range,r.range)&&ze.equalsRange(o.editorRange,r.editorRange)&&o.text===r.text)}t.equals=i})(lG||={});var Pm=class i{constructor(t,e,n){this.range=t;this.editorRange=e;this.text=n;this.kind=i.Kind}static{this.Kind="text"}get promptText(){return this.text}},qC="#",dG="@",Ly="/",UC=class i{constructor(t,e,n,o,r){this.range=t;this.editorRange=e;this.variableName=n;this.variableArg=o;this.variableId=r;this.kind=i.Kind}static{this.Kind="var"}get text(){let t=this.variableArg?`:${this.variableArg}`:"";return`${qC}${this.variableName}${t}`}get promptText(){return this.text}},FC=class i{constructor(t,e,n,o,r,s){this.range=t;this.editorRange=e;this.toolName=n;this.toolId=o;this.displayName=r;this.icon=s;this.kind=i.Kind}static{this.Kind="tool"}get text(){return`${qC}${this.toolName}`}get promptText(){return this.text}toVariableEntry(){return{kind:"tool",id:this.toolId,name:this.toolName,range:this.range,value:void 0,icon:ct.isThemeIcon(this.icon)?this.icon:void 0,fullName:this.displayName}}},HC=class i{constructor(t,e,n,o,r,s){this.range=t;this.editorRange=e;this.id=n;this.name=o;this.icon=r;this.tools=s;this.kind=i.Kind}static{this.Kind="toolset"}get text(){return`${qC}${this.name}`}get promptText(){return this.text}toVariableEntry(){return{kind:"toolset",id:this.id,name:this.name,range:this.range,icon:this.icon,value:this.tools}}},WC=class i{constructor(t,e,n){this.range=t;this.editorRange=e;this.agent=n;this.kind=i.Kind}static{this.Kind="agent"}get text(){return`${dG}${this.agent.name}`}get promptText(){return""}},VC=class i{constructor(t,e,n){this.range=t;this.editorRange=e;this.command=n;this.kind=i.Kind}static{this.Kind="subcommand"}get text(){return`${Ly}${this.command.name}`}get promptText(){return""}},BC=class i{constructor(t,e,n){this.range=t;this.editorRange=e;this.slashCommand=n;this.kind=i.Kind}static{this.Kind="slash"}get text(){return`${Ly}${this.slashCommand.command}`}get promptText(){return`${Ly}${this.slashCommand.command}`}},$C=class i{constructor(t,e,n,o){this.range=t;this.editorRange=e;this.name=n;this.kind=i.Kind;o!==void 0&&(this.displayText=o)}static{this.Kind="prompt"}get text(){return this.displayText??`${Ly}${this.name}`}get promptText(){return this.displayText??`${Ly}${this.name}`}},zC=class i{constructor(t,e,n,o,r,s,a,l,d,c,u,m){this.range=t;this.editorRange=e;this.text=n;this.id=o;this.modelDescription=r;this.data=s;this.fullName=a;this.icon=l;this.isFile=d;this.isDirectory=c;this._meta=u;this.isAttachmentReference=m;this.kind=i.Kind}static{this.Kind="dynamic"}get referenceText(){return this.text.replace(qC,"")}get promptText(){return this.text}toVariableEntry(){if(this.id==="vscode.problems")return ly.toEntry(this.data.filter);if(HV(this.data)){let t=WV(this.data,this.id,this.fullName??this.referenceText,this.range,this._meta);if(t)return t}return{kind:this.isDirectory?"directory":this.isFile?"file":"generic",id:this.id,name:this.referenceText,range:this.range,value:this.data,fullName:this.fullName,icon:this.icon,_meta:this._meta}}};function j4(i){return{text:i.text,parts:i.parts.map(t=>{if(t.kind===Pm.Kind)return new Pm(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.text);if(t.kind===UC.Kind)return new UC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.variableName,t.variableArg,t.variableId||"");if(t.kind===FC.Kind)return new FC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.toolName,t.toolId,t.displayName,t.icon);if(t.kind===HC.Kind)return new HC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.id,t.name,t.icon,t.tools??[]);if(t.kind===WC.Kind){let e=t.agent;return e=RC(e),new WC(new ko(t.range.start,t.range.endExclusive),t.editorRange,e)}else{if(t.kind===VC.Kind)return new VC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.command);if(t.kind===BC.Kind)return new BC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.slashCommand);if(t.kind===$C.Kind)return new $C(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.name,t.displayText);if(t.kind===zC.Kind)return new zC(new ko(t.range.start,t.range.endExclusive),t.editorRange,t.text,t.id,t.modelDescription,Tt(t.data),t.fullName,t.icon,t.isFile,t.isDirectory,t._meta,t.isAttachmentReference);throw new Error(`Unknown chat request part: ${t.kind}`)}})}}var J4;(t=>{function i(e){return{variables:e.variables.map(ad.toExport)}}t.toExport=i})(J4||={});var pi={reason:"other"},KC=class{constructor(t){this._shouldBeBlocked=An(this,!1);this._version=0;this._session=t.session,this.message=t.message,this._variableData=t.variableData,this.requestTimestamp=t.timestamp,this.timestamp=t.timestamp??t.fallbackTimestamp??Date.now(),this._attempt=t.attempt??0,this.modeInfo=t.modeInfo,this._confirmation=t.confirmation,this._locationData=t.locationData,this._attachedContext=t.attachedContext,this.isCompleteAddedRequest=t.isCompleteAddedRequest??!1,this.modelId=t.modelId,this.id=t.restoredId??"request_"+_e(),this._editedFileEvents=t.editedFileEvents,this.userSelectedTools=t.userSelectedTools,this.isSystemInitiated=t.isSystemInitiated,this.isHiddenFromTranscript=t.isHiddenFromTranscript??!1,this.systemInitiatedLabel=t.systemInitiatedLabel,this.terminalExecutionId=t.terminalExecutionId,this.isTerminalCommand=t.isTerminalCommand??!1,this.origin=t.origin}get shouldBeBlocked(){return this._shouldBeBlocked}setShouldBeBlocked(t){this._shouldBeBlocked.set(t,void 0)}get session(){return this._session}get attempt(){return this._attempt}get variableData(){return this._variableData}set variableData(t){this._version++,this._variableData=t}get confirmation(){return this._confirmation}get locationData(){return this._locationData}get attachedContext(){return this._attachedContext}get editedFileEvents(){return this._editedFileEvents}get version(){return this._version}adoptTo(t){this._session=t}},jC=class{get value(){return this._responseParts}constructor(t){this._responseParts=t}toString(){return this._responseRepr===void 0&&(this._responseRepr=this.computeRepr()),this._responseRepr}getMarkdown(){return this._markdownContent===void 0&&(this._markdownContent=this.computeMarkdownContent()),this._markdownContent}getFinalResponse(){let t=this._responseParts,e=t.length-1;for(;e>=0;){let s=t[e];if(s.kind==="markdownContent"||s.kind==="markdownVuln"){if(s.content.value.length>0)break}else if(s.kind==="inlineReference")break;e--}if(e<0)return"";let n=e;for(;e>=0;){let s=t[e];if(s.kind==="markdownContent"||s.kind==="markdownVuln"||s.kind==="inlineReference")e--;else break}let o=e+1,r=[];for(let s=o;s<=n;s++){let a=t[s];a.kind==="inlineReference"?r.push(this.inlineRefToRepr(a)):(a.kind==="markdownContent"||a.kind==="markdownVuln")&&a.content.value.length>0&&r.push(a.content.value)}return r.join("")}_invalidateRepr(){this._responseRepr=void 0,this._markdownContent=void 0}computeMarkdownContent(){let t=[];for(let e of this._responseParts)e.kind==="inlineReference"?t.push(this.inlineRefToRepr(e)):(e.kind==="markdownContent"||e.kind==="markdownVuln")&&e.content.value.length>0&&t.push(e.content.value);return t.join("")}computeRepr(){return this.partsToRepr(this._responseParts)}partsToRepr(t){let e=[],n=[],o=!1;for(let r of t){let s;switch(r.kind){case"clearToPreviousToolInvocation":n=[],e.length=0,o=!1;continue;case"treeData":case"progressMessage":case"codeblockUri":case"extensions":case"pullRequest":case"undoStop":case"workspaceEdit":case"externalEdit":case"elicitation2":case"elicitationSerialized":case"thinking":case"hook":case"voiceProgress":case"multiDiffData":case"mcpServersStarting":case"mcpAuthenticationRequired":case"mcpServersStartingSlow":case"questionCarousel":case"planReview":case"disabledClaudeHooks":case"autoModeResolution":continue;case"systemNotification":s={text:r.content.value,isBlock:!0};break;case"toolInvocation":case"toolInvocationSerialized":s=this.getToolInvocationText(r);break;case"inlineReference":s={text:this.inlineRefToRepr(r)};break;case"command":s={text:r.command.title,isBlock:!0};break;case"textEditGroup":case"notebookEditGroup":o=!0;continue;case"confirmation":if(r.message instanceof _t){s={text:`${r.title}
${r.message.value}`,isBlock:!0};break}s={text:`${r.title}
${r.message}`,isBlock:!0};break;case"markdownContent":case"markdownVuln":case"progressTask":case"progressTaskSerialized":case"warning":case"info":s={text:r.content.value};break;default:continue}s.isBlock?(n.length&&(e.push(n.join("")),n=[]),e.push(s.text)):n.push(s.text)}return n.length&&e.push(n.join("")),o&&e.push(p(13103,null)),e.join(`

`)}inlineRefToRepr(t){return"uri"in t.inlineReference?this.uriToRepr(t.inlineReference.uri,t.inlineReference.range):"name"in t.inlineReference?iM(t.inlineReference.name):this.uriToRepr(t.inlineReference)}getToolInvocationText(t){let e=s=>s.presentationOverrides?.commandLine??s.commandLine.forDisplay??s.commandLine.userEdited??s.commandLine.toolEdited??s.commandLine.original,n="",o="";if(t.pastTenseMessage?n=typeof t.pastTenseMessage=="string"?t.pastTenseMessage:t.pastTenseMessage.value:n=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value,t.toolSpecificData&&t.toolSpecificData.kind==="terminal"){n="Ran terminal command";let s=D1(t.toolSpecificData);o=e(s)}let r=n;if(o&&(r+=`: ${o}`),t.kind==="toolInvocationSerialized"||t.kind==="toolInvocation"&&Fe.isComplete(t)){let s=Fe.resultDetails(t);if(s&&"input"in s){let a=t.kind==="toolInvocationSerialized"||Fe.isComplete(t)?"Completed":"Errored",l=t.toolSpecificData?.kind==="terminal"?e(D1(t.toolSpecificData)):s.input;r+=`
${a} with input: ${l}`}}return{text:r,isBlock:!0}}uriToRepr(t,e){if(t.scheme===B.http||t.scheme===B.https)return t.toString(!1);let n=e?e.startLineNumber===e.endLineNumber?`:${e.startLineNumber}`:`:${e.startLineNumber}-${e.endLineNumber}`:"";return iM(Ze(t)+n)}},L1=class extends jC{constructor(e,n){let o=e.value.findIndex(r=>r.kind==="undoStop"&&r.id===n);e.value[o+1]?.kind==="codeblockUri"&&e.value[o-1]?.kind==="markdownContent"&&o--;super(o===-1?e.value.slice():e.value.slice(0,o));this.undoStop=n}},O1=class extends jC{constructor(e){super(On(e).map(n=>"kind"in n?n:qo(n)?{content:n,kind:"markdownContent"}:{kind:"treeData",treeData:n}));this._store=new $;this._onDidChangeValue=this._store.add(new T);this._citations=[]}get onDidChangeValue(){return this._onDidChangeValue.event}dispose(){this._store.dispose()}clear(){this.finalizeReasoningDuration(),this._responseParts=[],this._contentChanged(!0)}clearToPreviousToolInvocation(e){this.finalizeReasoningDuration();let n=-1;for(let o=this._responseParts.length-1;o>=0;o--){let r=this._responseParts[o];if(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized"){n=o;break}}n!==-1?this._responseParts=this._responseParts.slice(0,n+1):this._responseParts=[],e&&this._responseParts.push({kind:"warning",content:new _t(e)}),this._contentChanged(!0)}updateContent(e,n){if(e.kind!=="thinking"&&this.finalizeReasoningDuration(),e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(p(13102,null)):e.reason===1?this.clearToPreviousToolInvocation(p(13104,null)):this.clearToPreviousToolInvocation();return}else if(e.kind==="markdownContent"){let o=this._responseParts.filter(r=>r.kind!=="textEditGroup"&&!mG(r)).at(-1);if(!o||o.kind!=="markdownContent"||!G4(o.content,e.content))this._responseParts.push(e);else{let r=this._responseParts.indexOf(o);this._responseParts[r]={...o,content:Q4(o.content,e.content)}}this._contentChanged(n)}else if(e.kind==="systemNotification"){let o=this._responseParts.at(-1);o?.kind==="toolInvocation"&&Fe.isStreaming(o)&&!Fe.isEffectivelyHidden(o)?this._responseParts.splice(this._responseParts.length-1,0,e):this._responseParts.push(e),this._contentChanged(n)}else if(e.kind==="thinking"){let o=this._responseParts.filter(l=>l.kind!=="textEditGroup").at(-1),r=o&&o.kind==="thinking"?Array.isArray(o.value)?o.value.join(""):o.value||"":"",s=Array.isArray(e.value)?e.value.join(""):e.value||"",a=l=>l.length===0;if(a(s)?this.finalizeReasoningDuration():this._activeReasoning||(this._activeReasoning={part:e,startedAt:Date.now()}),!o||o.kind!=="thinking"||a(s)||a(r)||!G4(new _t(r),new _t(s)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o),d={...o,value:Q4(new _t(r),new _t(s)).value};this._responseParts[l]=d,this._activeReasoning?.part===o&&(this._activeReasoning.part=d)}this._contentChanged(n)}else if(e.kind==="textEdit"||e.kind==="notebookEdit"){let o=Dy.parse(e.uri)?.notebook,r=o??e.uri,s=e.isExternalEdit;if(e.kind==="textEdit"&&!o)this._mergeOrPushTextEditGroup(r,e.edits,e.done,s);else if(e.kind==="textEdit"){let a=e.edits.map(l=>({uri:e.uri,edit:l}));this._mergeOrPushNotebookEditGroup(r,a,e.done,s)}else this._mergeOrPushNotebookEditGroup(r,e.edits,e.done,s);this._contentChanged(n)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._contentChanged(n);let r=e.onDidAddProgress(()=>{this._contentChanged(!1)});e.task?.().then(s=>{r.dispose(),typeof s=="string"&&(this._responseParts[o].content=new _t(s)),this._contentChanged(!1)})}else if(e.kind==="toolInvocation")BM(this._store,o=>{e.state.read(o),this._contentChanged(!1),Fe.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._contentChanged(n);else if(e.kind==="externalToolInvocationUpdate")this._handleExternalToolInvocationUpdate(e),this._contentChanged(n);else if(e.kind==="progressMessage"&&e.id!==void 0){let o=this._responseParts.findIndex(r=>r.kind==="progressMessage"&&r.id===e.id);o===-1?this._responseParts.push(e):this._responseParts[o]=e,this._contentChanged(n)}else if(e.kind==="autoModeResolution"){let o=this._responseParts.findIndex(r=>r.kind==="autoModeResolution"&&!r.resolved);o===-1?this._responseParts.push(e):this._responseParts[o]=e,this._contentChanged(n)}else this._responseParts.push(e),this._contentChanged(n)}finalizeReasoningDuration(){this._activeReasoning&&(this._activeReasoning.part.reasoningDurationMs=Math.max(0,Date.now()-this._activeReasoning.startedAt),this._activeReasoning=void 0)}addCitation(e){this._citations.push(e),this._contentChanged()}resolveInlineReference(e,n){for(let o=0;o<this._responseParts.length;o++){let r=this._responseParts[o];if(!(r.kind!=="inlineReference"||r.resolveId!==e))return this._responseParts[o]={...r,inlineReference:n.inlineReference,name:n.name??r.name},this._contentChanged(),!0}return!1}_mergeOrPushTextEditGroup(e,n,o,r){for(let s of this._responseParts)if(s.kind==="textEditGroup"&&!s.done&&Sn(s.uri,e)){s.edits.push(n),s.done=o;return}this._responseParts.push({kind:"textEditGroup",uri:e,edits:[n],done:o,isExternalEdit:r})}_mergeOrPushNotebookEditGroup(e,n,o,r){for(let s of this._responseParts)if(s.kind==="notebookEditGroup"&&!s.done&&Sn(s.uri,e)){s.edits.push(n),s.done=o;return}this._responseParts.push({kind:"notebookEditGroup",uri:e,edits:[n],done:o,isExternalEdit:r})}_handleExternalToolInvocationUpdate(e){let n=this._responseParts.findLast(s=>s.kind==="toolInvocation"&&s.toolCallId===e.toolCallId);if(n){e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData),e.isComplete&&n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails});return}let o={id:e.toolName,source:pn.External,displayName:e.toolName,modelDescription:e.toolName},r=new My({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(e.toolSpecificData!==void 0&&(r.toolSpecificData=e.toolSpecificData),r.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails})),this._responseParts.push(r)}computeRepr(){let e=super.computeRepr();return this._citations.length&&(e+=`

`+gG(this._citations)),e}_contentChanged(e){this._invalidateRepr(),e||this._onDidChangeValue.fire()}};function cG(i){return i?.reduce((t,e)=>t+e.outputTokens,0)}var _m=class extends N{constructor(e){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._modelState=An(this,{value:0});this._usageObs=An(this,void 0);this._subagentCopilotCredits=new Map;this._completionTokenCountObs=An(this,void 0);this._shouldBeBlocked=An(this,!1);this._timingChanged=VS(this);this._contentReferences=[];this._codeCitations=[];this._progressMessages=[];this._isStale=!1;this._session=e.session,this._agent=e.agent,this._slashCommand=e.slashCommand,this.requestId=e.requestId,this._timestamp=e.timestamp||Date.now(),e.modelState&&this._modelState.set(e.modelState,void 0),this._completionTimestamp=e.completionTimestamp===null?void 0:e.completionTimestamp??(e.modelState&&"completedAt"in e.modelState?e.modelState.completedAt:void 0),this._timeSpentWaitingAccumulator=e.timeSpentWaiting||0,this._elapsedMs=e.elapsedMs,this._vote=e.vote,this._result=e.result,this._followups=e.followups?[...e.followups]:void 0,this.isCompleteAddedRequest=e.isCompleteAddedRequest??!1,this._shouldBeRemovedOnSend=e.shouldBeRemovedOnSend,this._shouldBeBlocked.set(e.shouldBeBlocked??!1,void 0),this._isStale=Array.isArray(e.responseContent)&&(e.responseContent.length!==0||qo(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new O1(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let n=gy(this,this.onDidChange),o=n.map((a,l)=>{n.read(l);for(let d of this._response.value){if(d.kind==="toolInvocation"){let c=d.state.read(l);if(c.type===Fe.StateKind.WaitingForConfirmation){let u=c.confirmationMessages?.title;return u?qo(u)?u.value:u:void 0}if(c.type===Fe.StateKind.WaitingForPostApproval)return p(13106,null);if(c.type===Fe.StateKind.WaitingForAuthentication)return p(13107,null,c.server.name)}if(d.kind==="confirmation"&&!d.isUsed)return d.title;if(d.kind==="questionCarousel"&&!d.isUsed)return p(13105,null);if(d.kind==="planReview"&&!d.isUsed)return p(13108,null);if(d.kind==="elicitation2"&&d.state.read(l)==="pending"){let c=d.title;return qo(c)?c.value:c}}}),r=o.map(a=>!!a).map(a=>a?Date.now():void 0);this.isPendingConfirmation=r.map((a,l)=>a?{startedWaitingAt:a,detail:o.read(l)}:void 0),this.isInProgress=n.map((a,l)=>(n.read(l),!o.read(l)&&!this.shouldBeRemovedOnSend&&(this._modelState.read(l).value===0||this._modelState.read(l).value===4))),this.isIncomplete=this._modelState.map(a=>a.value===0||a.value===4),this._register(this._response.onDidChangeValue(()=>this._onDidChange.fire(pi))),this.id=e.restoredId??"response_"+_e();let s;this.confirmationAdjustedTimestamp=Ha(a=>{this._timingChanged.read(a);let l=this.isPendingConfirmation.read(a);return l?(this._modelState.set({value:4},void 0),s||(s=l.startedWaitingAt)):s&&(this._modelState.read(a).value===4&&this._modelState.set({value:0},void 0),this._timeSpentWaitingAccumulator+=Date.now()-s,s=void 0),this._timestamp+this._timeSpentWaitingAccumulator}).recomputeInitiallyAndOnChange(this._store)}get shouldBeBlocked(){return this._shouldBeBlocked}get request(){return this.session.getRequests().find(e=>e.id===this.requestId)}get session(){return this._session}get shouldBeRemovedOnSend(){return this._shouldBeRemovedOnSend}get isHiddenFromTranscript(){return this.request?.isHiddenFromTranscript??!1}get isComplete(){return this._modelState.get().value!==0&&this._modelState.get().value!==4}get timestamp(){return this._timestamp}set shouldBeRemovedOnSend(e){this._shouldBeRemovedOnSend!==e&&(this._shouldBeRemovedOnSend=e,this._onDidChange.fire(pi))}get isCanceled(){return this._modelState.get().value===2}get completedAt(){let e=this._modelState.get();if(e.value===1||e.value===2||e.value===3)return e.completedAt}get completionTimestamp(){return this._completionTimestamp}get state(){let e=this._modelState.get().value;return e===1&&this._result?.errorDetails&&this.result?.errorDetails?.code!=="canceled"?3:e}get stateT(){return this._modelState.get()}get vote(){return this._vote}get followups(){return this._followups}get entireResponse(){return this._finalizedResponse||this._response}get result(){return this._result}get usage(){return this._usageObs.get()}get usageObs(){return this._usageObs}get completionTokenCount(){return this._completionTokenCountObs.get()}get completionTokenCountObs(){return this._completionTokenCountObs}get elapsedMs(){return this._elapsedMs}get username(){return this.session.responderUsername}get agent(){return this._agent}get slashCommand(){return this._slashCommand}get agentOrSlashCommandDetected(){return this._agentOrSlashCommandDetected??!1}get usedContext(){return this._usedContext}get contentReferences(){return Array.from(this._contentReferences)}get codeCitations(){return this._codeCitations}get progressMessages(){return this._progressMessages}get isStale(){return this._isStale}get response(){let e=this._shouldBeRemovedOnSend?.afterUndoStop;return e?(this._responseView?.undoStop!==e&&(this._responseView=new L1(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new At("Code block infos have already been initialized");this._codeBlockInfos=[...e]}setBlockedState(e){this._shouldBeBlocked.set(e,void 0)}updateContent(e,n){this._response.updateContent(e,n)}resolveInlineReference(e,n){return this._response.resolveInlineReference(e,n)}addUndoStop(e){this._onDidChange.fire({reason:"undoStop",id:e.id}),this._response.updateContent(e,!0)}applyReference(e){e.kind==="usedContext"?this._usedContext=e:e.kind==="reference"&&(this._contentReferences.push(e),this._onDidChange.fire(pi))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(pi)}setAgent(e,n){this._agent=e,this._slashCommand=n,this._agentOrSlashCommandDetected=!e.isDefault||!!n,this._onDidChange.fire(pi)}setResult(e){if(this.isCanceled&&e.errorDetails){let{errorDetails:n,...o}=e;this._result=o}else this._result=e;this._onDidChange.fire(pi)}setUsage(e){this._parentUsage=e,this._setUsage(this._withSubagentCopilotCredits(e),!0)}setSubagentCopilotCredits(e,n){let o=this._subagentCopilotCredits.get(e);if(!Number.isFinite(n)||n<0||o!==void 0&&n<=o)return;this._subagentCopilotCredits.set(e,n);let r=this._parentUsage??{kind:"usage",promptTokens:0,completionTokens:0};this._setUsage(this._withSubagentCopilotCredits(r),!1)}_withSubagentCopilotCredits(e){let n=0;for(let o of this._subagentCopilotCredits.values())n+=o;return n===0?e:{...e,copilotCredits:(e.copilotCredits??0)+n}}_setUsage(e,n){let o=this._usageObs.get();if(o&&this.isSameUsage(o,e))return;let r=!o||o.promptTokens!==e.promptTokens||o.completionTokens!==e.completionTokens||o.outputBuffer!==e.outputBuffer;this._usageObs.set(e,void 0);let s=cG(e.modelTotals);if(s!==void 0)this._completionTokenCountObs.set(s,void 0);else if(n&&r){let a=this._completionTokenCountObs.get()??0;this._completionTokenCountObs.set(a+e.completionTokens,void 0)}this._onDidChange.fire(pi)}setElapsedMs(e){this._elapsedMs=Math.max(0,e)}isSameUsage(e,n){return e.promptTokens===n.promptTokens&&e.completionTokens===n.completionTokens&&e.outputBuffer===n.outputBuffer&&e.copilotCredits===n.copilotCredits&&e.sessionCopilotCredits===n.sessionCopilotCredits&&Et(e.promptTokenDetails,n.promptTokenDetails)&&Et(e.modelTotals,n.modelTotals)}complete(e=Date.now()){this._complete(e,e)}completeWithoutTimestamp(){this._complete(Date.now(),void 0)}reopen(){if(this.isComplete){if(this._response.clear(),this._result?.errorDetails){let{errorDetails:e,...n}=this._result;this._result=n}this.completedAt!==void 0&&(this._timeSpentWaitingAccumulator+=Math.max(0,Date.now()-this.completedAt),this._timingChanged.trigger(void 0)),this._completionTimestamp=void 0,this._elapsedMs=void 0,this._modelState.set({value:0},void 0),this._onDidChange.fire(pi)}}_complete(e,n){if(this.isComplete)return;this._result?.errorDetails?.responseIsRedacted&&this._response.clear(),this._response.finalizeReasoningDuration(),this._elapsedMs??=Math.max(0,e-this.confirmationAdjustedTimestamp.get());let o=this._result?.errorDetails&&this._result.errorDetails.code!=="canceled"?3:1;this._completionTimestamp=n,this._modelState.set({value:o,completedAt:e},void 0),this._onDidChange.fire({reason:"completedRequest"})}cancel(){this._response.finalizeReasoningDuration();for(let n of this._response.value)n.kind==="toolInvocation"&&n instanceof My?n.cancelFromStreaming(5):n instanceof wm?n.dismiss():n instanceof km&&n.dismiss(void 0);let e=Date.now();this._elapsedMs??=Math.max(0,e-this.confirmationAdjustedTimestamp.get()),this._completionTimestamp=e,this._modelState.set({value:2,completedAt:e},void 0),this._onDidChange.fire({reason:"completedRequest"})}setFollowups(e){this._followups=e,this._onDidChange.fire(pi)}setVote(e){this._vote=e,this._onDidChange.fire(pi)}setEditApplied(e,n){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=n,this._onDidChange.fire(pi),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(pi)}finalizeUndoState(){this._finalizedResponse=this.response,this._responseView=void 0,this._shouldBeRemovedOnSend=void 0}dispose(){super.dispose(),this._response.clear(),this._codeBlockInfos&&(this._codeBlockInfos.length=0)}toJSON(){let e=this._modelState.get(),n=this.isPendingConfirmation.get();return{responseId:this.id,result:this.result,responseMarkdownInfo:this.codeBlockInfos?.map(o=>({suggestionId:o.suggestionId})),followups:this.followups,modelState:e.value===0||e.value===4?{value:2,completedAt:Date.now()}:e,vote:this.vote,slashCommand:this.slashCommand,usedContext:this.usedContext,contentReferences:this.contentReferences,codeCitations:this.codeCitations,responseTimestamp:this._timestamp,timeSpentWaiting:(n?Date.now()-n.startedWaitingAt:0)+this._timeSpentWaitingAccumulator,promptTokens:this.usage?.promptTokens,completionTokens:this.completionTokenCount,outputBuffer:this.usage?.outputBuffer,promptTokenDetails:this.usage?.promptTokenDetails,copilotCredits:this.usage?.copilotCredits,modelTotals:this.usage?.modelTotals,sessionCopilotCredits:this.usage?.sessionCopilotCredits,elapsedMs:this.elapsedMs??(this.completedAt?Math.max(0,this.completedAt-this.confirmationAdjustedTimestamp.get()):void 0)}}};function uG(i){return{attachments:(i.attachments??[]).map(ad.fromExport),mode:i.mode,selectedModel:i.selectedModel&&{identifier:i.selectedModel.identifier,metadata:i.selectedModel.metadata},modelConfiguration:i.selectedModel?i.selectedModel.modelConfiguration??i.modelConfiguration:void 0,contrib:i.contrib,inputText:i.inputText,selections:i.selections,permissionLevel:i.permissionLevel}}function Y4(i){return!!i&&Array.isArray(i.requests)&&typeof i.responderUsername=="string"}function pG(i){let t=i;return Y4(i)&&typeof t.creationDate=="number"&&typeof t.sessionId=="string"&&i.requests.every(e=>!e.usedContext||mB(e.usedContext))}var N1=class{constructor(t,e,n){this.logger=e;this.sessionId=n;this._state=Ua({debugName:"inputModelState",equalsFn:Et},t),this.state=this._state}get intendedModel(){return this._intendedModel}setIntendedModel(t){this._intendedModel=t}setState(t){let e=this._state.get();fG(t,e,this.logger,this.sessionId),this._state.set({attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,inputText:"",selections:[],contrib:{},...e,...t,origin:t.origin},void 0)}clearState(){this._state.set(void 0,void 0)}toJSON(){let t=this.state.get();if(!t)return;let e=t.attachments.filter(n=>!(BV(n)||VV(n)&&zV(n.value)));return{contrib:t.contrib,attachments:e.map(ad.toExport),mode:t.mode,selectedModel:t.selectedModel?{identifier:t.selectedModel.identifier,metadata:t.selectedModel.metadata,modelConfiguration:t.modelConfiguration}:void 0,inputText:t.inputText,selections:t.selections,permissionLevel:t.permissionLevel}}},Rm=class extends N{constructor(e,n,o,r,s,a){super();this.logService=o;this.chatAgentService=r;this.chatEditingService=s;this.chatService=a;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._pendingRequests=[];this._onDidChangePendingRequests=this._register(new T);this.onDidChangePendingRequests=this._onDidChangePendingRequests.event;this._isImported=!1;this._isDeleted=!1;this._canUseTools=!0;this.currentEditedFileEvents=new Ve;this._checkpoint=void 0;let l=e?.value,d=Y4(l),c=d&&pG(l);l&&!d&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&d&&!c,n.resource?(this._sessionId=sd(n.resource),this._sessionResource=n.resource):c?(this._sessionId=l.sessionId,this._sessionResource=Hr.forSession(l.sessionId)):(this._sessionId=_e(),this._sessionResource=Hr.forSession(this._sessionId)),this._disableBackgroundKeepAlive=n.disableBackgroundKeepAlive??!1,this._timestamp=c&&l.creationDate||Date.now(),this._requests=l?this._deserialize(l):[],this._customTitle=c?l.customTitle:void 0;let u=n.inputState||(c&&l.inputState?l.inputState:void 0);if(this.inputModel=new N1(u&&uG(u),this.logService,this._sessionId),this.dataSerializer=e?.serializer,this._initialResponderUsername=l?.responderUsername,this._repoData=c&&l.repoData?l.repoData:void 0,this._workingDirectory=c&&l.workingDirectory?y.parse(l.workingDirectory):void 0,c&&l.pendingRequests&&(this._pendingRequests=this._deserializePendingRequests(l.pendingRequests)),this._initialLocation=l?.initialLocation??n.initialLocation,this.sessionTypeSelectionReason=n.sessionTypeSelectionReason,this._canUseTools=n.canUseTools,this.isReadOnly=n.isReadOnly??$S(!1),this.lastRequestObs=wo(this,this.onDidChange,()=>this._requests.at(-1)),this._register(Eo(m=>{let g=this.lastRequestObs.read(m);g?.response&&m.store.add(g.response.onDidChange(async h=>{!this._editingSession||h.reason!=="completedRequest"||this._onDidChange.fire({kind:"completedRequest",request:g})}))})),this.requestInProgress=this.lastRequestObs.map((m,g)=>m?.response?.isInProgress.read(g)??!1),this.hasActiveRequest=this.lastRequestObs.map((m,g)=>m?.response?.isIncomplete.read(g)??!1),this.requestNeedsInput=this.lastRequestObs.map((m,g)=>{let h=m?.response?.isPendingConfirmation.read(g);if(h)return{title:this.title,detail:h.detail}}),this.initialLocation==="panel"&&!n.disableBackgroundKeepAlive){let m=this._register(new tn);this._register(Eo(g=>{let h=this.requestInProgress.read(g),f=this.requestNeedsInput.read(g),I=h||!!f;I&&!m.value?m.value=a.acquireExistingSession(this._sessionResource,"ChatModel#requestInProgressKeepAlive"):!I&&m.value&&m.clear()}))}}static getDefaultTitle(e){let n=e.at(0)?.message??"";return(typeof n=="string"?n:n.text).split(`
`)[0].substring(0,200)}get repoData(){return this._repoData}setRepoData(e){this._repoData=e}get workingDirectory(){return this._workingDirectory}setWorkingDirectory(e){this._workingDirectory=e}getPendingRequests(){return this._pendingRequests}setPendingRequests(e){let n=new Map(this._pendingRequests.map(r=>[r.request.id,r])),o=[];for(let{requestId:r,kind:s}of e){let a=n.get(r);a&&o.push(a.kind===s?a:{request:a.request,kind:s,sendOptions:a.sendOptions})}this._pendingRequests.length=0,this._pendingRequests.push(...o),this._onDidChangePendingRequests.fire()}replacePendingRequests(e){this._pendingRequests.length===e.length&&e.every((n,o)=>this._pendingRequests[o]===n)||(this._pendingRequests.length=0,this._pendingRequests.push(...e),this._onDidChangePendingRequests.fire())}addPendingRequest(e,n,o){let r={request:e,kind:n,sendOptions:o};if(n==="steering"){let s=0;for(let a=0;a<this._pendingRequests.length&&this._pendingRequests[a].kind==="steering";a++)s=a+1;this._pendingRequests.splice(s,0,r)}else this._pendingRequests.push(r);return this._onDidChangePendingRequests.fire(),r}removePendingRequest(e){let n=this._pendingRequests.findIndex(o=>o.request.id===e);n!==-1&&(this._pendingRequests.splice(n,1),this._onDidChangePendingRequests.fire())}dequeuePendingRequest(){let e=this._pendingRequests.shift();return e&&this._onDidChangePendingRequests.fire(),e}dequeueAllSteeringRequests(){let e=[];for(;this._pendingRequests.at(0)?.kind==="steering";)e.push(this._pendingRequests.shift());return e.length>0&&this._onDidChangePendingRequests.fire(),e}clearPendingRequests(){this._pendingRequests.length>0&&(this._pendingRequests.length=0,this._onDidChangePendingRequests.fire())}get sessionId(){return this._sessionId}get sessionResource(){return this._sessionResource}get hasRequests(){return this._requests.length>0}get lastRequest(){return this._requests.at(-1)}get sessionCost(){let e=0,n=0;for(let o of this._requests){let r=o.response?.usage;typeof r?.copilotCredits=="number"&&(e+=r.copilotCredits),typeof r?.sessionCopilotCredits=="number"&&(n=Math.max(n,r.sessionCopilotCredits))}return Math.max(e,n)}get timestamp(){return this._timestamp}get timing(){let e=this._requests.at(-1),n=e?.response,o=e?.timestamp,r=n?.completedAt??n?.timestamp;return{created:this._timestamp,lastRequestStarted:o,lastRequestEnded:r}}get lastMessageDate(){return this._requests.at(-1)?.timestamp??this._timestamp}get _defaultAgent(){return this.chatAgentService.getDefaultAgent("panel","ask")}get responderUsername(){return this._defaultAgent?.fullName??this._initialResponderUsername??""}get isImported(){return this._isImported}get isDeleted(){return this._isDeleted}markDeleted(){this._isDeleted=!0}get customTitle(){return this._customTitle}get title(){return this._customTitle||Rm.getDefaultTitle(this._requests)}get hasCustomTitle(){return this._customTitle!==void 0}get editingSession(){return this._editingSession}get initialLocation(){return this._initialLocation}get canUseTools(){return this._canUseTools}get willKeepAlive(){return!this._disableBackgroundKeepAlive}startEditingSession(e,n){let o=this._editingSession??=this._register(n?this.chatEditingService.transferEditingSession(this,n):e?this.chatEditingService.startOrContinueGlobalEditingSession(this):this.chatEditingService.createEditingSession(this));if(!this._disableBackgroundKeepAlive){let r=this._register(new tn);this._register(Eo(s=>{let a=o.entries.read(s).some(l=>l.state.read(s)===0);a&&!r.value?r.value=this.chatService.acquireExistingSession(this._sessionResource,"ChatModel#modifiedEditsKeepAlive"):!a&&r.value&&r.clear()}))}this._register(Eo(r=>{this._setDisabledRequests(o.requestDisablement.read(r))}))}notifyEditingAction(e){let n=e.outcome==="accepted"?1:e.outcome==="rejected"?2:e.outcome==="userModified"?3:null;n!==null&&(!this.currentEditedFileEvents.has(e.uri)||this.currentEditedFileEvents.get(e.uri)?.eventKind===1)&&this.currentEditedFileEvents.set(e.uri,{eventKind:n,uri:e.uri})}_deserialize(e){let n=Gn(e,{serializer:!0})?e.value.requests:e.requests;if(!Array.isArray(n))return this.logService.error(`Ignoring malformed session data: ${JSON.stringify(e)}`),[];try{return n.map(o=>this._deserializeRequest(o))}catch(o){return this.logService.error("Failed to parse chat data",o),[]}}_deserializeRequest(e){let n=typeof e.message=="string"?this.getParsedRequestFromString(e.message):j4(e.message),o=this.reviveVariableData(e.variableData),r=typeof e.timestamp=="number"&&e.timestamp>0?e.timestamp:void 0,s=new KC({session:this,message:n,variableData:o,timestamp:r,fallbackTimestamp:this._timestamp,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo,isSystemInitiated:e.isSystemInitiated,isHiddenFromTranscript:e.hiddenFromTranscript,systemInitiatedLabel:e.systemInitiatedLabel,terminalExecutionId:e.terminalExecutionId,origin:z4(e.origin)});if(s.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let a=e.agent&&"metadata"in e.agent?RC(e.agent):void 0,l="responseErrorDetails"in e?{errorDetails:e.responseErrorDetails}:e.result,d=e.modelState||{value:e.isCanceled?2:1,completedAt:Date.now()};if((d.value===0||d.value===4)&&(d={value:2,completedAt:Date.now()}),e.response)for(let c of e.response)Gn(c,{kind:!0})&&(c.kind==="questionCarousel"||c.kind==="planReview")&&(c.isUsed=!0);s.response=new _m({responseContent:e.response??[new _t(e.response)],session:this,agent:a,slashCommand:e.slashCommand,requestId:s.id,modelState:d,completionTimestamp:e.modelState&&"completedAt"in e.modelState&&Number.isFinite(e.modelState.completedAt)&&e.modelState.completedAt>0?e.modelState.completedAt:null,vote:e.vote,timestamp:typeof e.responseTimestamp=="number"&&e.responseTimestamp>0?e.responseTimestamp:r,result:l,followups:e.followups,restoredId:e.responseId,timeSpentWaiting:e.timeSpentWaiting,elapsedMs:e.elapsedMs,shouldBeBlocked:s.shouldBeBlocked.get(),codeBlockInfos:e.responseMarkdownInfo?.map(c=>({suggestionId:c.suggestionId}))}),s.response.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,(typeof e.completionTokens=="number"||typeof e.promptTokens=="number"||typeof e.copilotCredits=="number"||typeof e.sessionCopilotCredits=="number")&&s.response.setUsage({kind:"usage",promptTokens:e.promptTokens??0,completionTokens:e.completionTokens??0,outputBuffer:e.outputBuffer,promptTokenDetails:e.promptTokenDetails,copilotCredits:e.copilotCredits,modelTotals:e.modelTotals,sessionCopilotCredits:e.sessionCopilotCredits}),e.usedContext&&s.response.applyReference(Tt(e.usedContext)),e.contentReferences?.forEach(c=>s.response.applyReference(Tt(c))),e.codeCitations?.forEach(c=>s.response.applyCodeCitation(Tt(c)))}return s}reviveVariableData(e){let n=e&&Array.isArray(e.variables)?e:{variables:[]};return n.variables=n.variables.map(ad.fromExport),n}getParsedRequestFromString(e){let n=[new Pm(new ko(0,e.length),{startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1},e)];return{text:e,parts:n}}_deserializePendingRequests(e){try{return e.map(n=>({id:n.id,request:this._deserializeRequest(n.request),kind:n.kind,sendOptions:{...n.sendOptions,userSelectedTools:n.sendOptions.userSelectedTools?$S(n.sendOptions.userSelectedTools):void 0}}))}catch(n){return this.logService.error("Failed to parse pending chat requests",n),[]}}getRequests(){return this._requests}resetCheckpoint(){for(let e of this._requests)e.setShouldBeBlocked(!1),e.response&&e.response.setBlockedState(!1)}setCheckpoint(e){let n,o=-1;if(!(e!==void 0&&(this._requests.forEach((r,s)=>{r.id===e&&(o=s,n=r,r.setShouldBeBlocked(!0))}),!n))){for(let r=this._requests.length-1;r>=0;r-=1){let s=this._requests[r];this._checkpoint&&!n?(s.setShouldBeBlocked(!1),s.response&&s.response.setBlockedState(!1)):n&&r>=o?(s.setShouldBeBlocked(!0),s.response&&s.response.setBlockedState(!0)):n&&r<o&&(s.setShouldBeBlocked(!1),s.response&&s.response.setBlockedState(!1))}this._checkpoint=n}}get checkpoint(){return this._checkpoint}_setDisabledRequests(e){this._requests.forEach(n=>{let o=e.find(r=>r.requestId===n.id);n.shouldBeRemovedOnSend=o,n.response&&(n.response.shouldBeRemovedOnSend=o)}),this._onDidChange.fire({kind:"setHidden"})}addRequest(e,n,o,r,s,a,l,d,c,u,m,g,h,f,I,x,E,w,R,L){let U=[...this.currentEditedFileEvents.values()];this.currentEditedFileEvents.clear();let z=w===void 0?Date.now():typeof w=="number"&&Number.isFinite(w)&&w>0?w:void 0,Y=new KC({restoredId:h,session:this,message:e,variableData:n,timestamp:z,fallbackTimestamp:this._timestamp,attempt:o,modeInfo:r,confirmation:l,locationData:d,attachedContext:c,isCompleteAddedRequest:u,modelId:m,editedFileEvents:U.length?U:void 0,userSelectedTools:g,isSystemInitiated:f,isHiddenFromTranscript:R,systemInitiatedLabel:I,terminalExecutionId:x,isTerminalCommand:E,origin:L});return Y.response=new _m({responseContent:[],session:this,agent:s,slashCommand:a,requestId:Y.id,isCompleteAddedRequest:u,codeBlockInfos:void 0}),this._requests.push(Y),Ry(this.sessionResource,_y.RequestUiUpdated),this._onDidChange.fire({kind:"addRequest",request:Y}),Y}setCustomTitle(e){this._customTitle=e,this._onDidChange.fire({kind:"setCustomTitle",title:e})}updateRequest(e,n){e.variableData=n,this._onDidChange.fire({kind:"changedRequest",request:e})}adoptRequest(e){let n=e.session,o=n._requests.findIndex(r=>r.id===e.id);o!==-1&&(n._requests.splice(o,1),e.adoptTo(this),e.response?.adoptTo(this),this._requests.push(e),n._onDidChange.fire({kind:"removeRequest",requestId:e.id,responseId:e.response?.id,reason:2}),this._onDidChange.fire({kind:"addRequest",request:e}))}acceptResponseProgress(e,n,o){if(e.response||(e.response=new _m({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");n.kind==="usage"?e.response.setUsage(n):n.kind==="usedContext"||n.kind==="reference"?e.response.applyReference(n):n.kind==="codeCitation"?e.response.applyCodeCitation(n):n.kind==="move"?this._onDidChange.fire({kind:"move",target:n.uri,range:n.range}):n.kind==="codeblockUri"&&n.isEdit?(e.response.addUndoStop({id:n.undoStopId??_e(),kind:"undoStop"}),e.response.updateContent(n,o)):n.kind==="progressTaskResult"?this.logService.error(`Couldn't handle progress: ${JSON.stringify(n)}`):e.response.updateContent(n,o)}removeRequest(e,n=0){let o=this._requests.findIndex(s=>s.id===e),r=this._requests[o];o!==-1&&(this._onDidChange.fire({kind:"removeRequest",requestId:r.id,responseId:r.response?.id,reason:n}),this._requests.splice(o,1),r.response?.dispose())}cancelRequest(e){e.response&&e.response.cancel()}setResponse(e,n){e.response||(e.response=new _m({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.setResult(n)}setFollowups(e,n){e.response&&e.response.setFollowups(n)}setResponseModel(e,n){e.response=n,this._onDidChange.fire({kind:"addResponse",response:n})}toExport(){return{responderUsername:this.responderUsername,initialLocation:this.initialLocation,requests:this._requests.map(e=>{let n={...e.message,parts:e.message.parts.map(s=>s&&"toJSON"in s?s.toJSON():s)},o=e.response?.agent,r=o&&"toJSON"in o?o.toJSON():o?{...o}:void 0;return{requestId:e.id,message:n,variableData:J4.toExport(e.variableData),response:e.response?e.response.entireResponse.value.filter(s=>s.kind!=="voiceProgress").map(s=>s.kind==="treeData"?s.treeData:s.kind==="markdownContent"?s.content:s):void 0,shouldBeRemovedOnSend:e.shouldBeRemovedOnSend,agent:r,timestamp:e.requestTimestamp,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo,isSystemInitiated:e.isSystemInitiated||void 0,hiddenFromTranscript:e.isHiddenFromTranscript||void 0,systemInitiatedLabel:e.systemInitiatedLabel,terminalExecutionId:e.terminalExecutionId,origin:e.origin?$4(e.origin):void 0,...e.response?.toJSON()}})}}toJSON(){return{version:3,...this.toExport(),sessionId:this.sessionId,creationDate:this._timestamp,customTitle:this._customTitle,inputState:this.inputModel.toJSON(),workingDirectory:this._workingDirectory?.toString()}}dispose(){this._requests.forEach(e=>e.response?.dispose()),this._onDidDispose.fire(),super.dispose(),this._requests.length=0,this.dataSerializer=void 0,this._editingSession=void 0}};Rm=_([S(2,te),S(3,_C),S(4,B4),S(5,wr)],Rm);function G4(i,t){if(i.baseUri&&t.baseUri){if(!(i.baseUri.scheme===t.baseUri.scheme&&i.baseUri.authority===t.baseUri.authority&&i.baseUri.path===t.baseUri.path&&i.baseUri.query===t.baseUri.query&&i.baseUri.fragment===t.baseUri.fragment))return!1}else if(i.baseUri||t.baseUri)return!1;return Et(i.isTrusted,t.isTrusted)&&i.supportHtml===t.supportHtml&&i.supportThemeIcons===t.supportThemeIcons}function mG(i){return"subAgentInvocationId"in i&&!!i.subAgentInvocationId}function Q4(i,t){let e=typeof t=="string"?t:t.value;return{value:i.value+e,isTrusted:i.isTrusted,supportThemeIcons:i.supportThemeIcons,supportHtml:i.supportHtml,baseUri:i.baseUri}}function gG(i){if(i.length===0)return"";let t=i.reduce((n,o)=>n.add(o.license),new Set);return t.size===1?p(13100,null,t.size):p(13101,null,t.size)}var Oy;(n=>{n.scheme=B.vscodeChatResponseResource;function t(o,r,s,a){return y.from({scheme:n.scheme,authority:Yl(H.fromString(o.toString())),path:`/tool/${r}/${s}`+(a?`/${a}`:"")})}n.createUri=t;function e(o){if(o.scheme!==n.scheme)return;let r=o.path.split("/");if(r.length<4)return;let[,s,a,l]=r;if(s!=="tool")return;let d;try{d=y.parse(Rv(o.authority).toString())}catch(c){if(c instanceof SyntaxError)d=Hr.forSession(o.authority);else throw c}return{sessionResource:d,toolCallId:a,index:Number(l)}}n.parseUri=e})(Oy||={});function fG(i,t,e,n){if(!om(e.getLevel(),2)||i?.selectedModel?.identifier===t?.selectedModel?.identifier)return;let o=new Error().stack,r=`[ChatModelChanged] ChatModel Input State model changed: ${i?.selectedModel?.identifier} (was: ${t?.selectedModel?.identifier}) in session ${n} ${o}`;e.debug(r)}function X4(i){if(i instanceof Uint8Array)return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(!i||typeof i!="object"||Array.isArray(i))return;let t=i,e=Object.keys(t).sort((o,r)=>Number(o)-Number(r));if(e.length===0)return;let n=new Uint8Array(e.length);for(let o=0;o<e.length;o++){let r=t[e[o]];if(e[o]!==String(o)||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)return;n[o]=r}return n}function Dm(i,t=Te){return Px(i,t)?i.charAt(0).toUpperCase()+i.slice(1):i}function gu(i,t){return i.replace(/^~($|\/|\\)/,`${t}$1`)}var F1;(t=>t.DEFAULT={allowTrailingComma:!0})(F1||={});function hG(i,t=!1){let e=0,n=i.length,o="",r=0,s=16,a=0;function l(f){let I=0,x=0;for(;I<f;){let E=i.charCodeAt(e);if(E>=48&&E<=57)x=x*16+E-48;else if(E>=65&&E<=70)x=x*16+E-65+10;else if(E>=97&&E<=102)x=x*16+E-97+10;else break;e++,I++}return I<f&&(x=-1),x}function d(f){e=f,o="",r=0,s=16,a=0}function c(){let f=e;if(i.charCodeAt(e)===48)e++;else for(e++;e<i.length&&Am(i.charCodeAt(e));)e++;if(e<i.length&&i.charCodeAt(e)===46)if(e++,e<i.length&&Am(i.charCodeAt(e)))for(e++;e<i.length&&Am(i.charCodeAt(e));)e++;else return a=3,i.substring(f,e);let I=e;if(e<i.length&&(i.charCodeAt(e)===69||i.charCodeAt(e)===101))if(e++,(e<i.length&&i.charCodeAt(e)===43||i.charCodeAt(e)===45)&&e++,e<i.length&&Am(i.charCodeAt(e))){for(e++;e<i.length&&Am(i.charCodeAt(e));)e++;I=e}else a=3;return i.substring(f,I)}function u(){let f="",I=e;for(;;){if(e>=n){f+=i.substring(I,e),a=2;break}let x=i.charCodeAt(e);if(x===34){f+=i.substring(I,e),e++;break}if(x===92){if(f+=i.substring(I,e),e++,e>=n){a=2;break}switch(i.charCodeAt(e++)){case 34:f+='"';break;case 92:f+="\\";break;case 47:f+="/";break;case 98:f+="\b";break;case 102:f+="\f";break;case 110:f+=`
`;break;case 114:f+="\r";break;case 116:f+="	";break;case 117:{let w=l(4);w>=0?f+=String.fromCharCode(w):a=4;break}default:a=5}I=e;continue}if(x>=0&&x<=31)if(GC(x)){f+=i.substring(I,e),a=2;break}else a=6;e++}return f}function m(){if(o="",a=0,r=e,e>=n)return r=n,s=17;let f=i.charCodeAt(e);if(U1(f)){do e++,o+=String.fromCharCode(f),f=i.charCodeAt(e);while(U1(f));return s=15}if(GC(f))return e++,o+=String.fromCharCode(f),f===13&&i.charCodeAt(e)===10&&(e++,o+=`
`),s=14;switch(f){case 123:return e++,s=1;case 125:return e++,s=2;case 91:return e++,s=3;case 93:return e++,s=4;case 58:return e++,s=6;case 44:return e++,s=5;case 34:return e++,o=u(),s=10;case 47:{let I=e-1;if(i.charCodeAt(e+1)===47){for(e+=2;e<n&&!GC(i.charCodeAt(e));)e++;return o=i.substring(I,e),s=12}if(i.charCodeAt(e+1)===42){e+=2;let x=n-1,E=!1;for(;e<x;){if(i.charCodeAt(e)===42&&i.charCodeAt(e+1)===47){e+=2,E=!0;break}e++}return E||(e++,a=1),o=i.substring(I,e),s=13}return o+=String.fromCharCode(f),e++,s=16}case 45:if(o+=String.fromCharCode(f),e++,e===n||!Am(i.charCodeAt(e)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=c(),s=11;default:for(;e<n&&g(f);)e++,f=i.charCodeAt(e);if(r!==e){switch(o=i.substring(r,e),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(f),e++,s=16}}function g(f){if(U1(f)||GC(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function h(){let f;do f=m();while(f>=12&&f<=15);return f}return{setPosition:d,getPosition:()=>e,scan:t?h:m,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>r,getTokenLength:()=>e-r,getTokenError:()=>a}}function U1(i){return i===32||i===9||i===11||i===12||i===160||i===5760||i>=8192&&i<=8203||i===8239||i===8287||i===12288||i===65279}function GC(i){return i===10||i===13||i===8232||i===8233}function Am(i){return i>=48&&i<=57}function Ny(i,t=[],e=F1.DEFAULT){let n=null,o=[],r=[];function s(l){Array.isArray(o)?o.push(l):n!==null&&(o[n]=l)}return H1(i,{onObjectBegin:()=>{let l={};s(l),r.push(o),o=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{o=r.pop()},onArrayBegin:()=>{let l=[];s(l),r.push(o),o=l,n=null},onArrayEnd:()=>{o=r.pop()},onLiteralValue:s,onError:(l,d,c)=>{t.push({error:l,offset:d,length:c})}},e),o[0]}function H1(i,t,e=F1.DEFAULT){let n=hG(i,!1);function o(j){return j?()=>j(n.getTokenOffset(),n.getTokenLength()):()=>!0}function r(j){return j?Q=>j(Q,n.getTokenOffset(),n.getTokenLength()):()=>!0}let s=o(t.onObjectBegin),a=r(t.onObjectProperty),l=o(t.onObjectEnd),d=o(t.onArrayBegin),c=o(t.onArrayEnd),u=r(t.onLiteralValue),m=r(t.onSeparator),g=o(t.onComment),h=r(t.onError),f=e&&e.disallowComments,I=e&&e.allowTrailingComma;function x(){for(;;){let j=n.scan();switch(n.getTokenError()){case 4:E(14);break;case 5:E(15);break;case 3:E(13);break;case 1:f||E(11);break;case 2:E(12);break;case 6:E(16);break}switch(j){case 12:case 13:f?E(10):g();break;case 16:E(1);break;case 15:case 14:break;default:return j}}}function E(j,Q=[],Z=[]){if(h(j),Q.length+Z.length>0){let me=n.getToken();for(;me!==17;){if(Q.indexOf(me)!==-1){x();break}else if(Z.indexOf(me)!==-1)break;me=x()}}}function w(j){let Q=n.getTokenValue();return j?u(Q):a(Q),x(),!0}function R(){switch(n.getToken()){case 11:{let j=0;try{j=JSON.parse(n.getTokenValue()),typeof j!="number"&&(E(2),j=0)}catch{E(2)}u(j);break}case 7:u(null);break;case 8:u(!0);break;case 9:u(!1);break;default:return!1}return x(),!0}function L(){return n.getToken()!==10?(E(3,[],[2,5]),!1):(w(!1),n.getToken()===6?(m(":"),x(),Y()||E(4,[],[2,5])):E(5,[],[2,5]),!0)}function U(){s(),x();let j=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(j||E(4,[],[]),m(","),x(),n.getToken()===2&&I)break}else j&&E(6,[],[]);L()||E(4,[],[2,5]),j=!0}return l(),n.getToken()!==2?E(7,[2],[]):x(),!0}function z(){d(),x();let j=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(j||E(4,[],[]),m(","),x(),n.getToken()===4&&I)break}else j&&E(6,[],[]);Y()||E(4,[],[4,5]),j=!0}return c(),n.getToken()!==4?E(8,[4],[]):x(),!0}function Y(){switch(n.getToken()){case 3:return z();case 1:return U();case 10:return w(!0);default:return R()}}return x(),n.getToken()===17?e.allowEmptyContent?!0:(E(4,[],[]),!1):Y()?(n.getToken()!==17&&E(9,[],[]),!0):(E(4,[],[]),!1)}function t$(i,t){return t?`${i.replace(/#/g,"%23")}#range=${t.start.line}:${t.start.character}-${t.end.line}:${t.end.character}`:i}var EG="subagent",m1e=`/${EG}/`;var V1;(t=>{function i(e,n){return e===n?!0:!e||!n?!1:e.command===n.command&&e.windows===n.windows&&e.linux===n.linux&&e.osx===n.osx&&Sn(e.cwd,n.cwd)&&Et(e.env,n.env)&&e.timeout===n.timeout&&Sn(e.sourceUri,n.sourceUri)}t.isEquals=i})(V1||={});var Mm="com.github.copilot",B1e={format:3,manifestPath:"plugin.json",hookConfigPath:`${Mm}/hooks/hooks.json`,componentPaths:{commands:`${Mm}/commands`,skills:"skills",agents:`${Mm}/agents`,rules:`${Mm}/rules`,hooks:`${Mm}/hooks/hooks.json`,mcpServers:"mcp.json"},manifestExtensionNamespace:Mm,requiresManifest:!0,pluginRootTokens:[],pluginRootEnvVars:[],parseHooks(i,t,e,n,o){return DG(i,t,n,o)}};function wG(i,t){let e=t$(i.toString());return t?`${e.replace(/#/g,"%23")}#${t}`:e}function kG(i){return{type:"hook",id:wG(i),uri:i.toString(),name:Ze(i)}}var PG={SessionStart:"SessionStart",SessionEnd:"SessionEnd",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop",ErrorOccurred:"ErrorOccurred",sessionStart:"SessionStart",sessionEnd:"SessionEnd",userPromptSubmitted:"UserPromptSubmit",preToolUse:"PreToolUse",postToolUse:"PostToolUse",agentStop:"Stop",subagentStop:"SubagentStop",errorOccurred:"ErrorOccurred"};function _G(i){if(i.type!==void 0&&i.type!=="command")return;let t=typeof i.command=="string"&&i.command.length>0,e=typeof i.bash=="string"&&i.bash.length>0,n=typeof i.powershell=="string"&&i.powershell.length>0,o=typeof i.windows=="string"&&i.windows.length>0,r=typeof i.linux=="string"&&i.linux.length>0,s=typeof i.osx=="string"&&i.osx.length>0;if(!t&&!e&&!n&&!o&&!r&&!s)return;let a=o?i.windows:n?i.powershell:void 0,l=r?i.linux:e?i.bash:void 0,d=s?i.osx:e?i.bash:void 0,c=typeof i.timeout=="number"?i.timeout:typeof i.timeoutSec=="number"?i.timeoutSec:void 0;return{...t&&{command:i.command},...a&&{windows:a},...l&&{linux:l},...d&&{osx:d},...typeof i.env=="object"&&i.env!==null&&{env:i.env},...c!==void 0&&{timeout:c}}}function n$(i,t,e){let n=_G(i);if(!n)return;let o,r=typeof i.cwd=="string"?i.cwd:void 0;return r?r.startsWith("~/")?o=y.joinPath(e,r.substring(2)):cn(r)?o=y.file(r):t&&(o=gt(t,r)):o=t,{...n,cwd:o}}function RG(i,t,e){if(!i||typeof i!="object")return[];let n=i,o=[],r=n.hooks;if(r!==void 0&&Array.isArray(r))for(let s of r){if(!s||typeof s!="object")continue;let a=n$(s,t,e);a&&o.push(a)}else{let s=n$(n,t,e);s&&o.push(s)}return o}function DG(i,t,e,n){if(!t||typeof t!="object")return[];let o=t;if(o.disableAllHooks===!0)return[];let r=o.hooks,s=r&&typeof r=="object"&&!Array.isArray(r)?r:o,a=[],l=kG(i);for(let d of Object.keys(s)){let c=PG[d];if(!c)continue;let u=s[d];if(!Array.isArray(u))continue;let m=[];for(let g of u)m.push(...RG(g,e,n));m.length>0&&a.push({type:c,commands:m,uri:i,originalId:d,customization:l})}return a}var o$="github.copilot.chat.agentDebugLog.fileLogging.enabled";var r$="troubleshoot/SKILL.md";var Lm=(c=>(c.SessionStart="SessionStart",c.SessionEnd="SessionEnd",c.UserPromptSubmit="UserPromptSubmit",c.PreToolUse="PreToolUse",c.PostToolUse="PostToolUse",c.PreCompact="PreCompact",c.SubagentStart="SubagentStart",c.SubagentStop="SubagentStop",c.Stop="Stop",c.ErrorOccurred="ErrorOccurred",c))(Lm||{}),i$={vscode:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},"github-copilot":{sessionStart:"SessionStart",sessionEnd:"SessionEnd",userPromptSubmitted:"UserPromptSubmit",preToolUse:"PreToolUse",postToolUse:"PostToolUse",agentStop:"Stop",subagentStop:"SubagentStop",errorOccurred:"ErrorOccurred"},claude:{SessionStart:"SessionStart",UserPromptSubmit:"UserPromptSubmit",PreToolUse:"PreToolUse",PostToolUse:"PostToolUse",PreCompact:"PreCompact",SubagentStart:"SubagentStart",SubagentStop:"SubagentStop",Stop:"Stop"},undefined:Object.fromEntries(Object.values(Lm).map(i=>[i,i]))},s$={SessionStart:{label:p(13191,null),description:p(13190,null)},UserPromptSubmit:{label:p(13199,null),description:p(13198,null)},PreToolUse:{label:p(13187,null),description:p(13186,null)},PostToolUse:{label:p(13183,null),description:p(13182,null)},PreCompact:{label:p(13185,null),description:p(13184,null)},SubagentStart:{label:p(13195,null),description:p(13194,null)},SubagentStop:{label:p(13197,null),description:p(13196,null)},Stop:{label:p(13193,null),description:p(13192,null)},SessionEnd:{label:p(13189,null),description:p(13188,null)},ErrorOccurred:{label:p(13181,null),description:p(13180,null)}};var MG;(t=>{function i(e,n){if(e===n)return!0;if(!e||!n)return!1;for(let o of Object.values(Lm)){let r=e[o],s=n[o];if(r?.length!==s?.length)return!1;if(r&&s){for(let a=0;a<r.length;a++)if(!V1.isEquals(r[a],s[a]))return!1}}return!0}t.isEquals=i})(MG||={});function a$(i,t){if(!i)return t;let e={...i};for(let n of Object.values(Lm)){let o=i[n],r=t[n];r&&r.length>0&&(e[n]=o?[...o,...r]:r)}return e}var Rr={type:p(13173,null),command:p(13164,null),windows:p(13174,null),linux:p(13168,null),osx:p(13169,null),bash:p(13162,null),powershell:p(13170,null),cwd:p(13166,null),env:p(13167,null),timeout:p(13171,null),timeoutSec:p(13172,null)},LG={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:p(13165,null),properties:{type:{type:"string",enum:["command"],description:Rr.type},command:{type:"string",description:Rr.command},windows:{type:"string",description:Rr.windows},linux:{type:"string",description:Rr.linux},osx:{type:"string",description:Rr.osx},cwd:{type:"string",description:Rr.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Rr.env},timeout:{type:"number",default:30,description:Rr.timeout}}},OG={type:"array",items:LG};function l$(i,t){return Object.fromEntries(Object.entries(i$[i]).map(([e,n])=>[e,{...t,description:s$[n]?.description}]))}var NG=l$("vscode",OG),UG={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:p(13163,null),properties:{type:{type:"string",enum:["command"],description:Rr.type},bash:{type:"string",description:Rr.bash},powershell:{type:"string",description:Rr.powershell},cwd:{type:"string",description:Rr.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Rr.env},timeoutSec:{type:"number",default:10,description:Rr.timeoutSec}}},FG={type:"array",items:UG},HG=l$("github-copilot",FG),n0e={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:p(13175,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:p(13176,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:p(13179,null)},hooks:{properties:HG}}},else:{properties:{hooks:{properties:NG}}},defaultSnippets:[{label:p(13177,null),description:p(13178,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]};function d$(i,t){return t===1&&i.windows?i.windows:t===2&&i.osx?i.osx:t===3&&i.linux?i.linux:i.command}var d0e=new k("debugType",void 0,{type:"string",description:p(14871,null)}),c0e=new k("debugConfigurationType",void 0,{type:"string",description:p(14862,null)}),u0e=new k("debugState","inactive",{type:"string",description:p(14870,null)}),WG="debugUx",p0e=new k(WG,"default",{type:"string",description:p(14872,null)}),m0e=new k("hasDebugged",!1,{type:"boolean",description:p(14880,null)}),g0e=new k("inDebugMode",!1,{type:"boolean",description:p(14882,null)}),f0e=new k("inDebugRepl",!1,{type:"boolean",description:p(14883,null)}),h0e=new k("breakpointWidgetVisible",!1,{type:"boolean",description:p(14852,null)}),v0e=new k("inBreakpointWidget",!1,{type:"boolean",description:p(14881,null)}),y0e=new k("breakpointsFocused",!0,{type:"boolean",description:p(14850,null)}),b0e=new k("watchExpressionsFocused",!0,{type:"boolean",description:p(14908,null)}),I0e=new k("watchExpressionsExist",!1,{type:"boolean",description:p(14907,null)}),x0e=new k("variablesFocused",!0,{type:"boolean",description:p(14904,null)}),S0e=new k("expressionSelected",!1,{type:"boolean",description:p(14876,null)}),C0e=new k("breakpointInputFocused",!1,{type:"boolean",description:p(14846,null)}),T0e=new k("callStackItemType",void 0,{type:"string",description:p(14858,null)}),E0e=new k("callStackSessionIsAttach",!1,{type:"boolean",description:p(14860,null)}),w0e=new k("callStackItemStopped",!1,{type:"boolean",description:p(14857,null)}),k0e=new k("callStackSessionHasOneThread",!1,{type:"boolean",description:p(14859,null)}),P0e=new k("callStackFocused",!0,{type:"boolean",description:p(14856,null)}),_0e=new k("watchItemType",void 0,{type:"string",description:p(14909,null)}),R0e=new k("canViewMemory",void 0,{type:"boolean",description:p(14861,null)}),D0e=new k("breakpointItemType",void 0,{type:"string",description:p(14848,null)}),A0e=new k("breakpointItemBytes",void 0,{type:"boolean",description:p(14847,null)}),M0e=new k("breakpointHasModes",!1,{type:"boolean",description:p(14845,null)}),L0e=new k("breakpointSupportsCondition",!1,{type:"boolean",description:p(14851,null)}),O0e=new k("loadedScriptsSupported",!1,{type:"boolean",description:p(14888,null)}),N0e=new k("loadedScriptsItemType",void 0,{type:"string",description:p(14887,null)}),U0e=new k("focusedSessionIsAttach",!1,{type:"boolean",description:p(14877,null)}),F0e=new k("focusedSessionIsNoDebug",!1,{type:"boolean",description:p(14878,null)}),H0e=new k("stepBackSupported",!1,{type:"boolean",description:p(14893,null)}),W0e=new k("restartFrameSupported",!1,{type:"boolean",description:p(14891,null)}),V0e=new k("stackFrameSupportsRestart",!1,{type:"boolean",description:p(14892,null)}),B0e=new k("jumpToCursorSupported",!1,{type:"boolean",description:p(14885,null)}),$0e=new k("stepIntoTargetsSupported",!1,{type:"boolean",description:p(14894,null)}),z0e=new k("breakpointsExist",!1,{type:"boolean",description:p(14849,null)}),q0e=new k("debuggersAvailable",!1,{type:"boolean",description:p(14865,null)}),K0e=new k("debugExtensionAvailable",!0,{type:"boolean",description:p(14863,null)}),j0e=new k("debugProtocolVariableMenuContext",void 0,{type:"string",description:p(14866,null)}),G0e=new k("debugSetVariableSupported",!1,{type:"boolean",description:p(14869,null)}),Q0e=new k("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:p(14867,null)}),J0e=new k("debugSetExpressionSupported",!1,{type:"boolean",description:p(14868,null)}),Y0e=new k("breakWhenValueChangesSupported",!1,{type:"boolean",description:p(14853,null)}),X0e=new k("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:p(14854,null)}),Z0e=new k("breakWhenValueIsReadSupported",!1,{type:"boolean",description:p(14855,null)}),eLe=new k("terminateDebuggeeSupported",!1,{type:"boolean",description:p(14896,null)}),tLe=new k("suspendDebuggeeSupported",!1,{type:"boolean",description:p(14895,null)}),nLe=new k("terminateThreadsSupported",!1,{type:"boolean",description:p(14897,null)}),oLe=new k("variableEvaluateNamePresent",!1,{type:"boolean",description:p(14898,null)}),rLe=new k("variableIsReadonly",!1,{type:"boolean",description:p(14901,null)}),iLe=new k("variableValue",!1,{type:"string",description:p(14906,null)}),sLe=new k("variableType",!1,{type:"string",description:p(14905,null)}),aLe=new k("variableInterfaces",!1,{type:"array",description:p(14900,null)}),lLe=new k("variableName",!1,{type:"string",description:p(14903,null)}),dLe=new k("variableLanguage",!1,{type:"string",description:p(14902,null)}),cLe=new k("variableExtensionId",!1,{type:"string",description:p(14899,null)}),uLe=new k("exceptionWidgetVisible",!1,{type:"boolean",description:p(14875,null)}),pLe=new k("multiSessionRepl",!1,{type:"boolean",description:p(14890,null)}),mLe=new k("multiSessionDebug",!1,{type:"boolean",description:p(14889,null)}),gLe=new k("disassembleRequestSupported",!1,{type:"boolean",description:p(14873,null)}),fLe=new k("disassemblyViewFocus",!1,{type:"boolean",description:p(14874,null)}),hLe=new k("languageSupportsDisassembleRequest",!1,{type:"boolean",description:p(14886,null)}),vLe=new k("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:p(14879,null)});var yLe={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:p(14884,null)};var B1=(e=>(e[e.Initial=1]="Initial",e[e.Dynamic=2]="Dynamic",e))(B1||{});var bLe=A("debugService");var VG;(e=>(e.deserialize=n=>n,e.serialize=n=>n))(VG||={});var BG;(e=>(e.deserialize=n=>({id:n.id,name:n.name,iconPath:n.iconPath&&{light:y.revive(n.iconPath.light),dark:y.revive(n.iconPath.dark)},iconClass:n.iconClass,visualization:n.visualization}),e.serialize=n=>n))(BG||={});var SLe=A("IMcpGalleryManifestService");var Uy=A("IMcpGalleryService"),c$=A("IMcpManagementService"),Vi=A("IAllowedMcpServersService");var $G={IconContribution:"base.contributions.icons"},zG;(t=>{function i(e,n){let o=e.defaults;for(;ct.isThemeIcon(o);){let r=Om.getIcon(o.id);if(!r)return;o=r.defaults}return o}t.getDefinition=i})(zG||={});var qG;(e=>{function i(n){return{weight:n.weight,style:n.style,src:n.src.map(o=>({format:o.format,location:o.location.toString()}))}}e.toJSONObject=i;function t(n){let o=r=>Pe(r)?r:void 0;if(n&&Array.isArray(n.src)&&n.src.every(r=>Pe(r.format)&&Pe(r.location)))return{weight:o(n.weight),style:o(n.style),src:n.src.map(r=>({format:r.format,location:y.parse(r.location)}))}}e.fromJSONObject=t})(qG||={});var KG=/^([\w_-]+)$/;var jG=p(3564,null),$1=class extends N{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:p(3561,null),pattern:KG.source,patternErrorMessage:jG},fontCharacter:{type:"string",description:p(3560,null)}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}};this.iconReferenceSchema={type:"string",pattern:`^${ct.iconNameExpression}$`,enum:[],enumDescriptions:[]};this.iconsById={},this.iconFontsById={}}registerIcon(e,n,o,r){let s=this.iconsById[e];if(s){if(o&&!s.description){s.description=o,this.iconSchema.properties[e].markdownDescription=`${o} $(${e})`;let d=this.iconReferenceSchema.enum.indexOf(e);d!==-1&&(this.iconReferenceSchema.enumDescriptions[d]=o),this._onDidChange.fire()}return s}let a={id:e,description:o,defaults:n,deprecationMessage:r};this.iconsById[e]=a;let l={$ref:"#/definitions/icons"};return r&&(l.deprecationMessage=r),o&&(l.markdownDescription=`${o}: $(${e})`),this.iconSchema.properties[e]=l,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(o||""),this._onDidChange.fire(),{id:e}}deregisterIcon(e){delete this.iconsById[e],delete this.iconSchema.properties[e];let n=this.iconReferenceSchema.enum.indexOf(e);n!==-1&&(this.iconReferenceSchema.enum.splice(n,1),this.iconReferenceSchema.enumDescriptions.splice(n,1)),this._onDidChange.fire()}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}getIconReferenceSchema(){return this.iconReferenceSchema}registerIconFont(e,n){let o=this.iconFontsById[e];return o||(this.iconFontsById[e]=n,this._onDidChange.fire(),n)}deregisterIconFont(e){delete this.iconFontsById[e]}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(s,a)=>s.id.localeCompare(a.id),n=s=>{for(;ct.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},o=[];o.push("| preview     | identifier                        | default codicon ID                | description"),o.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let r=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(let s of r.filter(a=>!!a.description).sort(e))o.push(`|<i class="${n(s)}"></i>|${s.id}|${ct.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);o.push("| preview     | identifier                        "),o.push("| ----------- | --------------------------------- |");for(let s of r.filter(a=>!ct.isThemeIcon(a.defaults)).sort(e))o.push(`|<i class="${n(s)}"></i>|${s.id}|`);return o.join(`
`)}},Om=new $1;wt.add($G.IconContribution,Om);function za(i,t,e,n){return Om.registerIcon(i,t,e,n)}function GG(){let i=pV();for(let t in i){let e="\\"+i[t].toString(16);Om.registerIcon(t,{fontCharacter:e})}}GG();var p$="vscode://schemas/icons",m$=wt.as(lu.JSONContribution);m$.registerSchema(p$,Om.getIconSchema());var u$=new Pn(()=>m$.notifySchemaChanged(p$),200);Om.onDidChange(()=>{u$.isScheduled()||u$.schedule()});var HLe=za("widget-close",de.close,p(3565,null)),WLe=za("goto-previous-location",de.arrowUp,p(3563,null)),VLe=za("goto-next-location",de.arrowDown,p(3562,null)),BLe=ct.modify(de.sync,"spin"),$Le=ct.modify(de.loading,"spin");var QC=A("IUserDataProfileService"),XLe=A("IUserDataProfileManagementService");var ZLe=A("IUserDataProfileImportExportService"),eOe=za("defaultProfile-icon",de.settings,p(23760,null)),QG=xa(23762,"Profiles"),tOe={...QG},JG="code-profile",nOe=[{name:p(23761,null),extensions:[JG]}],oOe=new k("currentProfile",""),rOe=new k("hasProfiles",!1);function z1(i){switch(i){case 1:return p(123,null);case 2:return p(122,null);case 3:return p(124,null);case 4:return p(125,null);case 5:return p(119,null);case 6:return p(120,null);case 7:return p(117,null);case 8:return p(118,null);case 9:return p(121,null);default:return""}}var Nm=A("IMcpResourceScannerService"),Fy=class extends N{constructor(e,n){super();this.fileService=e;this.uriIdentityService=n;this.resourcesAccessQueueMap=new Ve}async scanMcpServers(e,n){return this.withProfileMcpServers(e,n)}async addMcpServers(e,n,o){await this.withProfileMcpServers(n,o,r=>{let s=r.inputs??[],a=r.servers??{};for(let{name:l,config:d,inputs:c}of e)if(a[l]=d,c){let u=new Set(s.map(g=>g.id)),m=c.filter(g=>!u.has(g.id));s=[...s,...m]}return{servers:a,inputs:s,sandbox:r.sandbox}})}async updateSandboxConfig(e,n,o){await this.withProfileMcpServers(n,o,e)}async removeMcpServers(e,n,o){await this.withProfileMcpServers(n,o,r=>{for(let s of e)r.servers?.[s]&&delete r.servers[s];return r})}async withProfileMcpServers(e,n,o){return this.getResourceAccessQueue(e).queue(async()=>{n=n??2;let r={};try{let s=await this.fileService.readFile(e),a=[],l=Ny(s.value.toString(),a,{allowTrailingComma:!0,allowEmptyContent:!0})||{};if(a.length>0)throw new Error("Failed to parse scanned MCP servers: "+a.map(d=>`[${d.offset}, ${d.length}] ${z1(d.error)}`).join(", "));if(n===2)r=this.fromUserMcpServers(l);else if(n===6)r=this.fromWorkspaceFolderMcpServers(l);else if(n===5){let d=l;d.settings?.mcp&&(r=this.fromWorkspaceFolderMcpServers(d.settings?.mcp))}}catch(s){if(Xc(s)!==1)throw s}return o&&(r=o(r??{}),n===2?await this.writeScannedMcpServers(e,r):n===6?await this.writeScannedMcpServersToWorkspaceFolder(e,r):n===5?await this.writeScannedMcpServersToWorkspace(e,r):Hl(n,`Invalid Target: ${fB(n)}`)),r})}async writeScannedMcpServers(e,n){n.servers&&Object.keys(n.servers).length>0||n.inputs&&n.inputs.length>0||n.sandbox!==void 0?await this.fileService.writeFile(e,H.fromString(JSON.stringify(n,null,"	"))):await this.fileService.del(e)}async writeScannedMcpServersToWorkspaceFolder(e,n){await this.fileService.writeFile(e,H.fromString(JSON.stringify(n,null,"	")))}async writeScannedMcpServersToWorkspace(e,n){let o;try{let r=await this.fileService.readFile(e),s=[];if(o=Ny(r.value.toString(),s,{allowTrailingComma:!0,allowEmptyContent:!0}),s.length>0)throw new Error("Failed to parse scanned MCP servers: "+s.map(a=>`[${a.offset}, ${a.length}] ${z1(a.error)}`).join(", "))}catch(r){if(Xc(r)!==1)throw r;o={settings:{}}}o.settings||(o.settings={}),o.settings.mcp=n,await this.fileService.writeFile(e,H.fromString(JSON.stringify(o,null,"	")))}fromUserMcpServers(e){let n={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){n.servers={};for(let[r,s]of o)n.servers[r]=this.sanitizeServer(s)}return n}fromWorkspaceFolderMcpServers(e){let n={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){n.servers={};for(let[r,s]of o){let a=this.sanitizeServer(s);n.servers[r]=a}}return n}sanitizeServer(e){let n;if(e.config){let o=e;n={...o.config,version:o.version,gallery:o.gallery}}else n=e;return(n.type===void 0||n.type!=="http"&&n.type!=="stdio")&&(n.type=n.command?"stdio":"http"),n}getResourceAccessQueue(e){let n=this.resourcesAccessQueueMap.get(e);return n||(n=new Sv,this.resourcesAccessQueueMap.set(e,n)),n}};Fy=_([S(0,zo),S(1,Vr)],Fy);Ue(Nm,Fy,1);var YC=".vscode",YG="settings",LOe=`${YC}/${YG}.json`;var OOe=[1,3],NOe=[2,4,5,6,7],XG=[4,5,6],UOe=[1,...XG],FOe=[2,3,4,5,6,7],HOe=[4,5,6,7],WOe=[5,6,7],JC="tasks",g$="launch",Rs="mcp",qa=Object.create(null);qa[JC]=`${YC}/${JC}.json`;qa[g$]=`${YC}/${g$}.json`;qa[Rs]=`${YC}/${Rs}.json`;var f$=Object.create(null);f$[JC]=`${JC}.json`;f$[Rs]=`${Rs}.json`;var VOe=$t;var Ds=A("remoteAgentService"),qOe=new class{constructor(){this.maxSampleCount=5;this.sampleDelay=2e3;this.initial=[];this.maxInitialCount=3;this.average=[];this.maxAverageCount=100;this.highLatencyMultiple=2;this.highLatencyMinThreshold=500;this.highLatencyMaxThreshold=1500;this.lastMeasurement=void 0}get latency(){return this.lastMeasurement}async measure(i){let t=1/0;for(let n=0;n<this.maxSampleCount;n++){let o=await i.getRoundTripTime();if(o===void 0)return;t=Math.min(t,o/2),await Vt(this.sampleDelay)}this.average.push(t),this.average.length>this.maxAverageCount&&this.average.shift();let e;return this.initial.length<this.maxInitialCount?this.initial.push(t):e=this.initial.reduce((n,o)=>n+o,0)/this.initial.length,this.lastMeasurement={initial:e,current:t,average:this.average.reduce((n,o)=>n+o,0)/this.average.length,high:typeof e>"u"?!1:t>this.highLatencyMaxThreshold||t>this.highLatencyMinThreshold&&t>e*this.highLatencyMultiple},this.lastMeasurement}};var Um=class extends N{constructor(e){super();this.logService=e}getMcpServerConfigurationFromManifest(e,n){if(n==="remote"&&e.remotes?.length){let d=e.remotes[0].url,c=e.remotes[0].headers??[],{inputs:u,variables:m}=this.processKeyValueInputs(d.startsWith("https://api.githubcopilot.com/mcp")?c.filter(g=>g.name.toLowerCase()!=="authorization"):c);return{mcpServerConfiguration:{config:{type:"http",url:e.remotes[0].url,headers:Object.keys(u).length?u:void 0},inputs:m.length?m:void 0},notices:[]}}let o=e.packages?.find(d=>d.registryType===n)??e.packages?.[0];if(!o)throw new Error("No server package found");let r=[],s=[],a={},l=[];if(o.registryType==="oci"&&(r.push("run"),r.push("-i"),r.push("--rm")),o.runtimeArguments?.length){let d=this.processArguments(o.runtimeArguments??[]);r.push(...d.args),s.push(...d.variables),l.push(...d.notices)}if(o.environmentVariables?.length){let{inputs:d,variables:c,notices:u}=this.processKeyValueInputs(o.environmentVariables??[]);s.push(...c),l.push(...u);for(let[m,g]of Object.entries(d))a[m]=g,o.registryType==="oci"&&(r.push("-e"),r.push(m))}switch(o.registryType){case"npm":o.registryBaseUrl&&r.push("--registry",o.registryBaseUrl),r.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"pypi":o.registryBaseUrl&&r.push("--index-url",o.registryBaseUrl),r.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"oci":{let d=o.registryBaseUrl?`${o.registryBaseUrl}/${o.identifier}`:o.identifier;r.push(o.version?`${d}:${o.version}`:d);break}case"nuget":r.push(o.version?`${o.identifier}@${o.version}`:o.identifier),r.push("--yes"),o.registryBaseUrl&&r.push("--source",o.registryBaseUrl),o.packageArguments?.length&&r.push("--");break}if(o.packageArguments?.length){let d=this.processArguments(o.packageArguments);r.push(...d.args),s.push(...d.variables),l.push(...d.notices)}return{notices:l,mcpServerConfiguration:{config:{type:"stdio",command:this.getCommandName(o.registryType),args:r.length?r:void 0,env:Object.keys(a).length?a:void 0},inputs:s.length?s:void 0}}}getCommandName(e){switch(e){case"npm":return"npx";case"oci":return"docker";case"pypi":return"uvx";case"nuget":return"dnx"}return e}getVariables(e){let n=[];for(let[o,r]of Object.entries(e))n.push({id:o,type:r.choices?"pickString":"promptString",description:r.description??"",password:!!r.isSecret,default:r.default,options:r.choices});return n}processKeyValueInputs(e){let n=[],o={},r=[];for(let s of e){let a=s.variables?this.getVariables(s.variables):[],l=s.value||"";if(a.length){for(let d of a)l=l.replace(`{${d.id}}`,`\${input:${d.id}}`);r.push(...a)}else!l&&(s.description||s.choices||s.default!==void 0)&&(r.push({id:s.name,type:s.choices?"pickString":"promptString",description:s.description??"",password:!!s.isSecret,default:s.default,options:s.choices}),l=`\${input:${s.name}}`);o[s.name]=l}return{inputs:o,variables:r,notices:n}}processArguments(e){let n=[],o=[],r=[];for(let s of e){let a=s.variables?this.getVariables(s.variables):[];if(s.type==="positional"){let l=s.value;if(l){for(let d of a)l=l.replace(`{${d.id}}`,`\${input:${d.id}}`);n.push(l),a.length&&o.push(...a)}else s.valueHint&&(s.description||s.default!==void 0)?(o.push({id:s.valueHint,type:"promptString",description:s.description??"",password:!1,default:s.default}),n.push(`\${input:${s.valueHint}}`)):n.push(s.valueHint??"")}else if(s.type==="named"){if(!s.name){r.push(`Named argument is missing a name. ${JSON.stringify(s)}`);continue}if(n.push(s.name),s.value){let l=s.value;for(let d of a)l=l.replace(`{${d.id}}`,`\${input:${d.id}}`);n.push(l),a.length&&o.push(...a)}else if(s.description||s.default!==void 0){let l=s.name.replace(/^--?/,"");o.push({id:l,type:"promptString",description:s.description??"",password:!1,default:s.default}),n.push(`\${input:${l}}`)}}}return{args:n,variables:o,notices:r}}};Um=_([S(0,te)],Um);var hu=class extends Um{constructor(e,n,o,r,s,a,l,d){super(a);this.mcpResource=e;this.target=n;this.mcpGalleryService=o;this.fileService=r;this.uriIdentityService=s;this.mcpResourceScannerService=l;this.allowedMcpServersService=d;this.local=new Map;this._onInstallMcpServer=this._register(new T);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new T);this._onDidUpdateMcpServers=this._register(new T);this._onUninstallMcpServer=this._register(new T);this._onDidUninstallMcpServer=this._register(new T);this.reloadConfigurationScheduler=this._register(new Pn(()=>this.updateLocal(),50))}get onDidInstallMcpServers(){return this._onDidInstallMcpServers.event}get onDidUpdateMcpServers(){return this._onDidUpdateMcpServers.event}get onUninstallMcpServer(){return this._onUninstallMcpServer.event}get onDidUninstallMcpServer(){return this._onDidUninstallMcpServer.event}ensureServerAllowed(e){let n=this.allowedMcpServersService.isAllowed(e);if(n!==!0)throw new Error(n.value)}initialize(){return this.initializePromise||(this.initializePromise=(async()=>{try{this.local=await this.populateLocalServers()}finally{this.startWatching()}})()),this.initializePromise}async populateLocalServers(){this.logService.trace("AbstractMcpResourceManagementService#populateLocalServers",this.mcpResource.toString());let e=new Map;try{let n=await this.mcpResourceScannerService.scanMcpServers(this.mcpResource,this.target);n.servers&&await Promise.allSettled(Object.entries(n.servers).map(async([o,r])=>{let s=await this.scanLocalServer(o,r,n.sandbox);e.set(o,s)}))}catch(n){throw this.logService.debug("Could not read user MCP servers:",n),n}return e}startWatching(){this._register(this.fileService.watch(this.mcpResource)),this._register(this.fileService.onDidFilesChange(e=>{e.affects(this.mcpResource)&&this.reloadConfigurationScheduler.schedule()}))}async updateLocal(e){try{let n=await this.populateLocalServers(),o=[],r=[],s=[...this.local.keys()].filter(a=>!n.has(a));for(let a of s)this.local.delete(a);for(let[a,l]of n){let d=this.local.get(a);d?Et(d,l)||(r.push(l),this.local.set(a,l)):(o.push(l),this.local.set(a,l))}for(let a of s)this.local.delete(a),this._onDidUninstallMcpServer.fire({name:a,mcpResource:this.mcpResource});r.length&&this._onDidUpdateMcpServers.fire(r.map(a=>({name:a.name,local:a,source:e?.name===a.name?e:void 0,mcpResource:this.mcpResource}))),o.length&&this._onDidInstallMcpServers.fire(o.map(a=>({name:a.name,local:a,source:e?.name===a.name?e:void 0,mcpResource:this.mcpResource})))}catch(n){this.logService.error("Failed to load installed MCP servers:",n)}}async getInstalled(){return await this.initialize(),Array.from(this.local.values())}async scanLocalServer(e,n,o){let r=await this.getLocalServerInfo(e,n);return r||(r={name:e,version:n.version,galleryUrl:Pe(n.gallery)?n.gallery:void 0}),{name:e,config:n,rootSandbox:o,mcpResource:this.mcpResource,version:r.version,location:r.location,displayName:r.displayName,description:r.description,publisher:r.publisher,publisherDisplayName:r.publisherDisplayName,galleryUrl:r.galleryUrl,galleryId:r.galleryId,repositoryUrl:r.repositoryUrl,readmeUrl:r.readmeUrl,icon:r.icon,codicon:r.codicon,manifest:r.manifest,source:n.gallery?"gallery":"local"}}async install(e,n){this.logService.trace("MCP Management Service: install",e.name),this.ensureServerAllowed(e),this._onInstallMcpServer.fire({name:e.name,mcpResource:this.mcpResource});try{await this.mcpResourceScannerService.addMcpServers([e],this.mcpResource,this.target),await this.updateLocal();let o=this.local.get(e.name);if(!o)throw new Error(`Failed to install MCP server: ${e.name}`);return o}catch(o){throw this._onDidInstallMcpServers.fire([{name:e.name,error:o,mcpResource:this.mcpResource}]),o}}async uninstall(e,n){this.logService.trace("MCP Management Service: uninstall",e.name),this._onUninstallMcpServer.fire({name:e.name,mcpResource:this.mcpResource});try{if(!(await this.mcpResourceScannerService.scanMcpServers(this.mcpResource,this.target)).servers)return;await this.mcpResourceScannerService.removeMcpServers([e.name],this.mcpResource,this.target),e.location&&await this.fileService.del(y.revive(e.location),{recursive:!0}),await this.updateLocal()}catch(o){throw this._onDidUninstallMcpServer.fire({name:e.name,error:o,mcpResource:this.mcpResource}),o}}};hu=_([S(2,Uy),S(3,zo),S(4,Vr),S(5,te),S(6,Nm),S(7,Vi)],hu);var Hy=class extends hu{constructor(t,e,n,o,r,s,a,l){super(t,2,e,n,o,r,s,a),this.mcpLocation=o.extUri.joinPath(l.userRoamingDataHome,"mcp")}async installFromGallery(t,e){throw new Error("Not supported")}async updateMetadata(t,e){await this.updateMetadataFromGallery(e),await this.updateLocal(e);let n=(await this.getInstalled()).find(o=>o.name===t.name);if(!n)throw new Error(`Failed to find MCP server: ${t.name}`);return n}async updateMetadataFromGallery(t){let e=t.configuration,n=this.getLocation(t.name,t.version),o=this.uriIdentityService.extUri.joinPath(n,"manifest.json"),r={galleryUrl:t.galleryUrl,galleryId:t.id,name:t.name,displayName:t.displayName,description:t.description,version:t.version,publisher:t.publisher,publisherDisplayName:t.publisherDisplayName,repositoryUrl:t.repositoryUrl,licenseUrl:t.license,icon:t.icon,codicon:t.codicon,manifest:e};if(await this.fileService.writeFile(o,H.fromString(JSON.stringify(r))),t.readmeUrl||t.readme){let s=t.readme?t.readme:await this.mcpGalleryService.getReadme(t,pe.None);await this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(n,"README.md"),H.fromString(s))}return e}async getLocalServerInfo(t,e){let n,o,r;if(e.gallery){o=this.getLocation(t,e.version);let s=this.uriIdentityService.extUri.joinPath(o,"manifest.json");try{let a=await this.fileService.readFile(s);n=JSON.parse(a.value.toString()),n.galleryUrl?.includes("/v0/")&&(n.galleryUrl=n.galleryUrl.substring(0,n.galleryUrl.indexOf("/v0/")),await this.fileService.writeFile(s,H.fromString(JSON.stringify(n)))),n.location=o,r=this.uriIdentityService.extUri.joinPath(o,"README.md"),await this.fileService.exists(r)||(r=void 0),n.readmeUrl=r}catch(a){Xc(a)===1?this.logService.trace("MCP Management Service: manifest not found",s.toString()):this.logService.error("MCP Management Service: failed to read manifest",o.toString(),a)}}return n}getLocation(t,e){return t=t.replace("/","."),this.uriIdentityService.extUri.joinPath(this.mcpLocation,e?`${t}-${e}`:t)}installFromUri(t,e){throw new Error("Method not supported.")}canInstall(){throw new Error("Not supported")}};Hy=_([S(1,Uy),S(2,zo),S(3,Vr),S(4,te),S(5,Nm),S(6,Vi),S(7,uu)],Hy);var As=class extends Um{constructor(e,n){super(n);this.allowedMcpServersService=e}canInstall(e){let n=this.allowedMcpServersService.isAllowed(e);return n!==!0?new _t(p(3118,null,n.value)):!0}};As=_([S(0,Vi),S(1,te)],As);var XC=class extends As{constructor(e,n,o,r){super(e,n);this.userDataProfilesService=o;this.instantiationService=r;this._onInstallMcpServer=this._register(new T);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new T);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new T);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new T);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new T);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this.mcpResourceManagementServices=new Ve}getMcpResourceManagementService(e){let n=this.mcpResourceManagementServices.get(e);if(!n){let o=new $,r=o.add(this.createMcpResourceManagementService(e));o.add(r.onInstallMcpServer(s=>this._onInstallMcpServer.fire(s))),o.add(r.onDidInstallMcpServers(s=>this._onDidInstallMcpServers.fire(s))),o.add(r.onDidUpdateMcpServers(s=>this._onDidUpdateMcpServers.fire(s))),o.add(r.onUninstallMcpServer(s=>this._onUninstallMcpServer.fire(s))),o.add(r.onDidUninstallMcpServer(s=>this._onDidUninstallMcpServer.fire(s))),this.mcpResourceManagementServices.set(e,n={service:r,dispose:()=>o.dispose()})}return n.service}async getInstalled(e){let n=e||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(n).getInstalled()}async install(e,n){let o=n?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).install(e,n)}async uninstall(e,n){let o=n?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).uninstall(e,n)}async installFromGallery(e,n){let o=n?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).installFromGallery(e,n)}async updateMetadata(e,n,o){return this.getMcpResourceManagementService(o||this.userDataProfilesService.defaultProfile.mcpResource).updateMetadata(e,n)}dispose(){this.mcpResourceManagementServices.forEach(e=>e.dispose()),this.mcpResourceManagementServices.clear(),super.dispose()}createMcpResourceManagementService(e){return this.instantiationService.createInstance(Hy,e)}};XC=_([S(0,Vi),S(1,te),S(2,pd),S(3,Dn)],XC);function Wy(i,t){return i?y.revive(t?t.transformIncoming(i):i):void 0}function Fm(i,t){t=t||LW;let e=i.manifest;return{...OW({...i,manifest:void 0},t),manifest:e}}var Hm=class extends As{constructor(e,n,o){super(n,o);this.channel=e;this._onInstallMcpServer=this._register(new T);this._onDidInstallMcpServers=this._register(new T);this._onUninstallMcpServer=this._register(new T);this._onDidUninstallMcpServer=this._register(new T);this._onDidUpdateMcpServers=this._register(new T);this._register(this.channel.listen("onInstallMcpServer")(r=>this._onInstallMcpServer.fire({...r,mcpResource:Wy(r.mcpResource,null)}))),this._register(this.channel.listen("onDidInstallMcpServers")(r=>this._onDidInstallMcpServers.fire(r.map(s=>({...s,local:s.local?Fm(s.local,null):s.local,mcpResource:Wy(s.mcpResource,null)}))))),this._register(this.channel.listen("onDidUpdateMcpServers")(r=>this._onDidUpdateMcpServers.fire(r.map(s=>({...s,local:s.local?Fm(s.local,null):s.local,mcpResource:Wy(s.mcpResource,null)}))))),this._register(this.channel.listen("onUninstallMcpServer")(r=>this._onUninstallMcpServer.fire({...r,mcpResource:Wy(r.mcpResource,null)}))),this._register(this.channel.listen("onDidUninstallMcpServer")(r=>this._onDidUninstallMcpServer.fire({...r,mcpResource:Wy(r.mcpResource,null)})))}get onInstallMcpServer(){return this._onInstallMcpServer.event}get onDidInstallMcpServers(){return this._onDidInstallMcpServers.event}get onUninstallMcpServer(){return this._onUninstallMcpServer.event}get onDidUninstallMcpServer(){return this._onDidUninstallMcpServer.event}get onDidUpdateMcpServers(){return this._onDidUpdateMcpServers.event}install(e,n){return Promise.resolve(this.channel.call("install",[e,n])).then(o=>Fm(o,null))}installFromGallery(e,n){return Promise.resolve(this.channel.call("installFromGallery",[e,n])).then(o=>Fm(o,null))}uninstall(e,n){return Promise.resolve(this.channel.call("uninstall",[e,n]))}getInstalled(e){return Promise.resolve(this.channel.call("getInstalled",[e])).then(n=>n.map(o=>Fm(o,null)))}updateMetadata(e,n,o){return Promise.resolve(this.channel.call("updateMetadata",[e,n,o])).then(r=>Fm(r,null))}};Hm=_([S(1,Vi),S(2,te)],Hm);var ZC=class extends N{constructor(e,n,o){super();this.profilesHome=n;this.channel=o;this._profiles=[];this._onDidChangeProfiles=this._register(new T);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._profiles=e.map(r=>ws(r,this.profilesHome.scheme)),this._register(this.channel.listen("onDidChangeProfiles")(r=>{let s=r.added.map(d=>ws(d,this.profilesHome.scheme)),a=r.removed.map(d=>ws(d,this.profilesHome.scheme)),l=r.updated.map(d=>ws(d,this.profilesHome.scheme));this._profiles=r.all.map(d=>ws(d,this.profilesHome.scheme)),this._onDidChangeProfiles.fire({added:s,removed:a,updated:l,all:this.profiles})})),this.onDidResetWorkspaces=this.channel.listen("onDidResetWorkspaces")}get defaultProfile(){return this.profiles[0]}get profiles(){return this._profiles}async createNamedProfile(e,n,o){let r=await this.channel.call("createNamedProfile",[e,n,o]);return ws(r,this.profilesHome.scheme)}async createProfile(e,n,o,r){let s=await this.channel.call("createProfile",[e,n,o,r]);return ws(s,this.profilesHome.scheme)}async createTransientProfile(e){let n=await this.channel.call("createTransientProfile",[e]);return ws(n,this.profilesHome.scheme)}async setProfileForWorkspace(e,n){await this.channel.call("setProfileForWorkspace",[e,n])}removeProfile(e){return this.channel.call("removeProfile",[e])}async updateProfile(e,n){let o=await this.channel.call("updateProfile",[e,n]);return ws(o,this.profilesHome.scheme)}resetWorkspaces(){return this.channel.call("resetWorkspaces")}cleanUp(){return this.channel.call("cleanUp")}cleanUpTransientProfiles(){return this.channel.call("cleanUpTransientProfiles")}};var q1="associatedRemoteProfiles",K1=A("IRemoteUserDataProfilesService"),Vy=class extends N{constructor(e,n,o,r,s,a){super();this.environmentService=e;this.remoteAgentService=n;this.userDataProfilesService=o;this.userDataProfileService=r;this.storageService=s;this.logService=a;this.initPromise=this.init()}async init(){let e=this.remoteAgentService.getConnection();if(!e)return;let n=await this.remoteAgentService.getEnvironment();if(!n)return;this.remoteUserDataProfilesService=new ZC(n.profiles.all,n.profiles.home,e.getChannel("userDataProfiles")),this._register(this.userDataProfilesService.onDidChangeProfiles(r=>this.onDidChangeLocalProfiles(r)));let o=await this.getAssociatedRemoteProfile(this.userDataProfileService.currentProfile,this.remoteUserDataProfilesService);o.isDefault||this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),o.id]),this.cleanUp()}async onDidChangeLocalProfiles(e){for(let n of e.removed){let o=this.remoteUserDataProfilesService?.profiles.find(r=>r.id===n.id);o&&await this.remoteUserDataProfilesService?.removeProfile(o)}}async getRemoteProfiles(){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new Ln("Remote profiles service not available in the current window");return this.remoteUserDataProfilesService.profiles}async getRemoteProfile(e){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new Ln("Remote profiles service not available in the current window");return this.getAssociatedRemoteProfile(e,this.remoteUserDataProfilesService)}async getAssociatedRemoteProfile(e,n){if(e.isDefault)return n.defaultProfile;let o=n.profiles.find(r=>r.id===e.id);return o||(o=await n.createProfile(e.id,e.name,{transient:e.isTransient,useDefaultFlags:e.useDefaultFlags}),this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(),this.userDataProfileService.currentProfile.id])),o}getAssociatedRemoteProfiles(){return this.environmentService.remoteAuthority?this.parseAssociatedRemoteProfiles()[this.environmentService.remoteAuthority]??[]:[]}setAssociatedRemoteProfiles(e){if(this.environmentService.remoteAuthority){let n=this.parseAssociatedRemoteProfiles();e=er(e),e.length?n[this.environmentService.remoteAuthority]=e:delete n[this.environmentService.remoteAuthority],Object.keys(n).length?this.storageService.store(q1,JSON.stringify(n),-1,1):this.storageService.remove(q1,-1)}}parseAssociatedRemoteProfiles(){if(this.environmentService.remoteAuthority){let e=this.storageService.get(q1,-1);try{return e?JSON.parse(e):{}}catch(n){this.logService.error(n)}}return{}}async cleanUp(){let e=[];for(let n of this.getAssociatedRemoteProfiles()){let o=this.remoteUserDataProfilesService?.profiles.find(s=>s.id===n);if(!o)continue;let r=this.userDataProfilesService.profiles.find(s=>s.id===n);if(r){r.name!==o.name&&await this.remoteUserDataProfilesService?.updateProfile(o,{name:r.name}),e.push(n);continue}o&&await this.remoteUserDataProfilesService?.removeProfile(o)}this.setAssociatedRemoteProfiles(e)}};Vy=_([S(0,md),S(1,Ds),S(2,pd),S(3,QC),S(4,yo),S(5,te)],Vy);Ue(K1,Vy,1);var eQ="usrlocal",tQ="usrremote",nQ="workspace",j1="ws";var gFe=c$,eT=class extends As{constructor(e,n,o,r,s,a,l,d,c,u){super(n,o);this.mcpManagementService=e;this.userDataProfileService=r;this.uriIdentityService=s;this.workspaceContextService=a;this.userDataProfilesService=d;this.remoteUserDataProfilesService=c;this._onInstallMcpServer=this._register(new T);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new T);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new T);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new T);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new T);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this._onInstallMcpServerInCurrentProfile=this._register(new T);this.onInstallMcpServerInCurrentProfile=this._onInstallMcpServerInCurrentProfile.event;this._onDidInstallMcpServersInCurrentProfile=this._register(new T);this.onDidInstallMcpServersInCurrentProfile=this._onDidInstallMcpServersInCurrentProfile.event;this._onDidUpdateMcpServersInCurrentProfile=this._register(new T);this.onDidUpdateMcpServersInCurrentProfile=this._onDidUpdateMcpServersInCurrentProfile.event;this._onUninstallMcpServerInCurrentProfile=this._register(new T);this.onUninstallMcpServerInCurrentProfile=this._onUninstallMcpServerInCurrentProfile.event;this._onDidUninstallMcpServerInCurrentProfile=this._register(new T);this.onDidUninstallMcpServerInCurrentProfile=this._onDidUninstallMcpServerInCurrentProfile.event;this._onDidChangeProfile=this._register(new T);this.onDidChangeProfile=this._onDidChangeProfile.event;this.workspaceMcpManagementService=this._register(u.createInstance($y));let m=l.getConnection();m&&(this.remoteMcpManagementService=this._register(u.createInstance(Hm,m.getChannel("mcpManagement")))),this._register(this.mcpManagementService.onInstallMcpServer(g=>{this._onInstallMcpServer.fire(g),s.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidInstallMcpServers(g=>{let{mcpServerInstallResult:h,mcpServerInstallResultInCurrentProfile:f}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidInstallMcpServers.fire(h),f.length&&this._onDidInstallMcpServersInCurrentProfile.fire(f)})),this._register(this.mcpManagementService.onDidUpdateMcpServers(g=>{let{mcpServerInstallResult:h,mcpServerInstallResultInCurrentProfile:f}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidUpdateMcpServers.fire(h),f.length&&this._onDidUpdateMcpServersInCurrentProfile.fire(f)})),this._register(this.mcpManagementService.onUninstallMcpServer(g=>{this._onUninstallMcpServer.fire(g),s.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidUninstallMcpServer(g=>{this._onDidUninstallMcpServer.fire(g),s.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.workspaceMcpManagementService.onInstallMcpServer(async g=>{this._onInstallMcpServer.fire(g),this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidInstallMcpServers(async g=>{let{mcpServerInstallResult:h}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidInstallMcpServers.fire(h),this._onDidInstallMcpServersInCurrentProfile.fire(h)})),this._register(this.workspaceMcpManagementService.onUninstallMcpServer(async g=>{this._onUninstallMcpServer.fire(g),this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidUninstallMcpServer(async g=>{this._onDidUninstallMcpServer.fire(g),this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"workspace"})})),this._register(this.workspaceMcpManagementService.onDidUpdateMcpServers(g=>{let{mcpServerInstallResult:h}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidUpdateMcpServers.fire(h),this._onDidUpdateMcpServersInCurrentProfile.fire(h)})),this.remoteMcpManagementService&&(this._register(this.remoteMcpManagementService.onInstallMcpServer(async g=>{this._onInstallMcpServer.fire(g);let h=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(h?s.extUri.isEqual(g.mcpResource,h):this.userDataProfileService.currentProfile.isDefault)&&this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})})),this._register(this.remoteMcpManagementService.onDidInstallMcpServers(g=>this.handleRemoteInstallMcpServerResultsFromEvent(g,this._onDidInstallMcpServers,this._onDidInstallMcpServersInCurrentProfile))),this._register(this.remoteMcpManagementService.onDidUpdateMcpServers(g=>this.handleRemoteInstallMcpServerResultsFromEvent(g,this._onDidInstallMcpServers,this._onDidInstallMcpServersInCurrentProfile))),this._register(this.remoteMcpManagementService.onUninstallMcpServer(async g=>{this._onUninstallMcpServer.fire(g);let h=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(h?s.extUri.isEqual(g.mcpResource,h):this.userDataProfileService.currentProfile.isDefault)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})})),this._register(this.remoteMcpManagementService.onDidUninstallMcpServer(async g=>{this._onDidUninstallMcpServer.fire(g);let h=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(h?s.extUri.isEqual(g.mcpResource,h):this.userDataProfileService.currentProfile.isDefault)&&this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})}))),this._register(r.onDidChangeCurrentProfile(g=>{this.uriIdentityService.extUri.isEqual(g.previous.mcpResource,g.profile.mcpResource)||this._onDidChangeProfile.fire()}))}createInstallMcpServerResultsFromEvent(e,n){let o=[],r=[];for(let s of e){let a={...s,local:s.local?this.toWorkspaceMcpServer(s.local,n):void 0};o.push(a),this.uriIdentityService.extUri.isEqual(s.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&r.push(a)}return{mcpServerInstallResult:o,mcpServerInstallResultInCurrentProfile:r}}async handleRemoteInstallMcpServerResultsFromEvent(e,n,o){let r=[],s=[],a=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);for(let l of e){let d={...l,local:l.local?this.toWorkspaceMcpServer(l.local,"remoteUser"):void 0};r.push(d),(a?this.uriIdentityService.extUri.isEqual(l.mcpResource,a):this.userDataProfileService.currentProfile.isDefault)&&s.push(d)}n.fire(r),s.length&&o.fire(s)}async getInstalled(){let e=[],[n,o,r]=await Promise.all([this.mcpManagementService.getInstalled(this.userDataProfileService.currentProfile.mcpResource),this.remoteMcpManagementService?.getInstalled(await this.getRemoteMcpResource())??Promise.resolve([]),this.workspaceMcpManagementService?.getInstalled()??Promise.resolve([])]);for(let s of n)e.push(this.toWorkspaceMcpServer(s,"user"));for(let s of o)e.push(this.toWorkspaceMcpServer(s,"remoteUser"));for(let s of r)e.push(this.toWorkspaceMcpServer(s,"workspace"));return e}toWorkspaceMcpServer(e,n){return{...e,id:`mcp.config.${this.getConfigId(e,n)}.${e.name}`,scope:n}}getConfigId(e,n){if(n==="user")return eQ;if(n==="remoteUser")return tQ;if(n==="workspace"){let o=this.workspaceContextService.getWorkspace();if(o.configuration&&this.uriIdentityService.extUri.isEqual(o.configuration,e.mcpResource))return nQ;let r=o.folders;for(let s=0;s<r.length;s++){let a=r[s];if(this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.joinPath(a.uri,qa[Rs]),e.mcpResource))return`${j1}${s}`}}return"unknown"}async install(e,n){if(n=n??{},n.target===5||YA(n.target)){let r=n.target===5?this.workspaceContextService.getWorkspace().configuration:n.target.toResource(qa[Rs]);if(!r)throw new Error(`Illegal target: ${n.target}`);n.mcpResource=r;let s=await this.workspaceMcpManagementService.install(e,n);return this.toWorkspaceMcpServer(s,"workspace")}if(n.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${n.target}`);n.mcpResource=await this.getRemoteMcpResource(n.mcpResource);let r=await this.remoteMcpManagementService.install(e,n);return this.toWorkspaceMcpServer(r,"remoteUser")}if(n.target&&n.target!==2&&n.target!==3)throw new Error(`Illegal target: ${n.target}`);n.mcpResource=this.userDataProfileService.currentProfile.mcpResource;let o=await this.mcpManagementService.install(e,n);return this.toWorkspaceMcpServer(o,"user")}async installFromGallery(e,n){if(n=n??{},n.target===5||YA(n.target)){let r=n.target===5?this.workspaceContextService.getWorkspace().configuration:n.target.toResource(qa[Rs]);if(!r)throw new Error(`Illegal target: ${n.target}`);n.mcpResource=r;let s=await this.workspaceMcpManagementService.installFromGallery(e,n);return this.toWorkspaceMcpServer(s,"workspace")}if(n.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${n.target}`);n.mcpResource=await this.getRemoteMcpResource(n.mcpResource);let r=await this.remoteMcpManagementService.installFromGallery(e,n);return this.toWorkspaceMcpServer(r,"remoteUser")}if(n.target&&n.target!==2&&n.target!==3)throw new Error(`Illegal target: ${n.target}`);n.mcpResource||(n.mcpResource=this.userDataProfileService.currentProfile.mcpResource);let o=await this.mcpManagementService.installFromGallery(e,n);return this.toWorkspaceMcpServer(o,"user")}async updateMetadata(e,n,o){if(e.scope==="workspace"){let s=await this.workspaceMcpManagementService.updateMetadata(e,n,o);return this.toWorkspaceMcpServer(s,"workspace")}if(e.scope==="remoteUser"){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${e.scope}`);let s=await this.remoteMcpManagementService.updateMetadata(e,n,o);return this.toWorkspaceMcpServer(s,"remoteUser")}let r=await this.mcpManagementService.updateMetadata(e,n,o);return this.toWorkspaceMcpServer(r,"user")}async uninstall(e){if(e.scope==="workspace")return this.workspaceMcpManagementService.uninstall(e);if(e.scope==="remoteUser"){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${e.scope}`);return this.remoteMcpManagementService.uninstall(e)}return this.mcpManagementService.uninstall(e,{mcpResource:this.userDataProfileService.currentProfile.mcpResource})}async getRemoteMcpResource(e){if(!e&&this.userDataProfileService.currentProfile.isDefault)return;e=e??this.userDataProfileService.currentProfile.mcpResource;let n=this.userDataProfilesService.profiles.find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e));return n?n=await this.remoteUserDataProfilesService.getRemoteProfile(n):n=(await this.remoteUserDataProfilesService.getRemoteProfiles()).find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e)),n?.mcpResource}};eT=_([S(1,Vi),S(2,te),S(3,QC),S(4,Vr),S(5,Cr),S(6,Ds),S(7,pd),S(8,K1),S(9,Dn)],eT);var By=class extends hu{constructor(t,e,n,o,r,s,a,l){super(t,e,n,o,r,s,a,l)}async installFromGallery(t,e){this.logService.trace("MCP Management Service: installGallery",t.name,t.galleryUrl),this._onInstallMcpServer.fire({name:t.name,mcpResource:this.mcpResource});try{let n=e?.packageType??t.configuration.packages?.[0]?.registryType??"remote",{mcpServerConfiguration:o,notices:r}=this.getMcpServerConfigurationFromManifest(t.configuration,n);r.length>0&&this.logService.warn(`MCP Management Service: Warnings while installing ${t.name}`,r);let s={name:t.name,config:{...o.config,gallery:t.galleryUrl??!0,version:t.version},inputs:o.inputs};this.ensureServerAllowed(s),await this.mcpResourceScannerService.addMcpServers([s],this.mcpResource,this.target),await this.updateLocal(t);let a=(await this.getInstalled()).find(l=>l.name===t.name);if(!a)throw new Error(`Failed to install MCP server: ${t.name}`);return a}catch(n){throw this._onDidInstallMcpServers.fire([{name:t.name,source:t,error:n,mcpResource:this.mcpResource}]),n}}updateMetadata(){throw new Error("Not supported")}installFromUri(){throw new Error("Not supported")}async getLocalServerInfo(t,e){if(!e.gallery)return;let[n]=await this.mcpGalleryService.getMcpServersFromGallery([{name:t}]);if(n)return{name:n.name,version:e.version,displayName:n.displayName,description:n.description,galleryUrl:n.galleryUrl,manifest:n.configuration,publisher:n.publisher,publisherDisplayName:n.publisherDisplayName,repositoryUrl:n.repositoryUrl,icon:n.icon}}canInstall(t){throw new Error("Not supported")}};By=_([S(2,Uy),S(3,zo),S(4,Vr),S(5,te),S(6,Nm),S(7,Vi)],By);var $y=class extends As{constructor(e,n,o,r,s){super(e,o);this.uriIdentityService=n;this.workspaceContextService=r;this.instantiationService=s;this._onInstallMcpServer=this._register(new T);this.onInstallMcpServer=this._onInstallMcpServer.event;this._onDidInstallMcpServers=this._register(new T);this.onDidInstallMcpServers=this._onDidInstallMcpServers.event;this._onDidUpdateMcpServers=this._register(new T);this.onDidUpdateMcpServers=this._onDidUpdateMcpServers.event;this._onUninstallMcpServer=this._register(new T);this.onUninstallMcpServer=this._onUninstallMcpServer.event;this._onDidUninstallMcpServer=this._register(new T);this.onDidUninstallMcpServer=this._onDidUninstallMcpServer.event;this.allMcpServers=[];this.workspaceMcpManagementServices=new Ve;this.initialize()}async initialize(){try{await this.onDidChangeWorkbenchState(),await this.onDidChangeWorkspaceFolders({added:this.workspaceContextService.getWorkspace().folders,removed:[],changed:[]}),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.workspaceContextService.onDidChangeWorkbenchState(e=>this.onDidChangeWorkbenchState()))}catch(e){this.logService.error("Failed to initialize workspace folders",e)}}async onDidChangeWorkbenchState(){this.workspaceConfiguration&&await this.removeWorkspaceService(this.workspaceConfiguration),this.workspaceConfiguration=this.workspaceContextService.getWorkspace().configuration,this.workspaceConfiguration&&await this.addWorkspaceService(this.workspaceConfiguration,5)}async onDidChangeWorkspaceFolders(e){try{await Promise.allSettled(e.removed.map(n=>this.removeWorkspaceService(n.toResource(qa[Rs]))))}catch(n){this.logService.error(n)}try{await Promise.allSettled(e.added.map(n=>this.addWorkspaceService(n.toResource(qa[Rs]),6)))}catch(n){this.logService.error(n)}}async addWorkspaceService(e,n){if(this.workspaceMcpManagementServices.has(e))return;let o=new $,r=o.add(this.instantiationService.createInstance(By,e,n));try{let s=await r.getInstalled();if(this.allMcpServers.push(...s),s.length>0){let a=s.map(l=>({name:l.name,local:l,mcpResource:l.mcpResource}));this._onDidInstallMcpServers.fire(a)}}catch(s){this.logService.warn("Failed to get installed servers from",e.toString(),s)}o.add(r.onInstallMcpServer(s=>this._onInstallMcpServer.fire(s))),o.add(r.onDidInstallMcpServers(s=>{for(let{local:a}of s)a&&this.allMcpServers.push(a);this._onDidInstallMcpServers.fire(s)})),o.add(r.onDidUpdateMcpServers(s=>{for(let{local:a,mcpResource:l}of s)if(a){let d=this.allMcpServers.findIndex(c=>this.uriIdentityService.extUri.isEqual(c.mcpResource,l)&&c.name===a.name);d!==-1&&this.allMcpServers.splice(d,1,a)}this._onDidUpdateMcpServers.fire(s)})),o.add(r.onUninstallMcpServer(s=>this._onUninstallMcpServer.fire(s))),o.add(r.onDidUninstallMcpServer(s=>{let a=this.allMcpServers.findIndex(l=>this.uriIdentityService.extUri.isEqual(l.mcpResource,s.mcpResource)&&l.name===s.name);a!==-1&&(this.allMcpServers.splice(a,1),this._onDidUninstallMcpServer.fire(s))})),this.workspaceMcpManagementServices.set(e,{service:r,dispose:()=>o.dispose()})}async removeWorkspaceService(e){let n=this.workspaceMcpManagementServices.get(e);if(n){try{let o=await n.service.getInstalled();this.allMcpServers=this.allMcpServers.filter(r=>!o.some(s=>this.uriIdentityService.extUri.isEqual(s.mcpResource,r.mcpResource)));for(let r of o)this._onDidUninstallMcpServer.fire({name:r.name,mcpResource:r.mcpResource})}catch(o){this.logService.warn("Failed to get installed servers from",e.toString(),o)}this.workspaceMcpManagementServices.delete(e),n.dispose()}}async getInstalled(){return this.allMcpServers}async install(e,n){if(!n?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(n?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${n?.mcpResource.toString()}`);return o.service.install(e,n)}async uninstall(e,n){let o=e.mcpResource,r=this.workspaceMcpManagementServices.get(o);if(!r)throw new Error(`No MCP management service found for resource: ${o.toString()}`);return r.service.uninstall(e,n)}installFromGallery(e,n){if(!n?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(n?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${n?.mcpResource.toString()}`);return o.service.installFromGallery(e,n)}updateMetadata(){throw new Error("Not supported")}dispose(){this.workspaceMcpManagementServices.forEach(e=>e.dispose()),this.workspaceMcpManagementServices.clear(),super.dispose()}};$y=_([S(0,Vi),S(1,Vr),S(2,te),S(3,Cr),S(4,Dn)],$y);var zy;(l=>(l.LATEST_PROTOCOL_VERSION="2025-11-25",l.JSONRPC_VERSION="2.0",l.PARSE_ERROR=-32700,l.INVALID_REQUEST=-32600,l.METHOD_NOT_FOUND=-32601,l.INVALID_PARAMS=-32602,l.INTERNAL_ERROR=-32603,l.URL_ELICITATION_REQUIRED=-32042))(zy||={});var oQ="mcp.config.";function h$(i,t){return xe.toKey(i)+"/"+t}var rQ;(n=>{function i(o,r){return o.id===r.id&&o.remoteAuthority===r.remoteAuthority&&o.label===r.label&&o.provenance===r.provenance&&o.discoverySource===r.discoverySource&&o.trustBehavior===r.trustBehavior&&Et(o.sandbox,r.sandbox)}n.equals=i;function t(o){return o.configTarget===5||o.configTarget===6}n.isWorkspaceDiscovered=t;function e(o){return o.id.startsWith(`${oQ}${j1}`)}n.isVscodeMcpJson=e})(rQ||={});var iQ;(n=>{function i(o){return o}n.toSerialized=i;function t(o){return{id:o.id,label:o.label,cacheNonce:o.cacheNonce,staticMetadata:o.staticMetadata,launch:vu.fromSerialized(o.launch),defaultCwd:o.defaultCwd?y.revive(o.defaultCwd):void 0,sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?v$.fromSerialized(o.variableReplacement):void 0}}n.fromSerialized=t;function e(o,r){return o.id===r.id&&o.label===r.label&&o.cacheNonce===r.cacheNonce&&Sn(o.defaultCwd,r.defaultCwd)&&dn(o.roots,r.roots,(s,a)=>s.toString()===a.toString())&&Et(o.launch,r.launch)&&Et(o.presentation,r.presentation)&&Et(o.variableReplacement,r.variableReplacement)&&Et(o.devMode,r.devMode)&&o.sandboxEnabled===r.sandboxEnabled}n.equals=e})(iQ||={});var v$;(e=>{function i(n){return n}e.toSerialized=i;function t(n){return{section:n.section,folder:n.folder?{...n.folder,uri:y.revive(n.folder.uri)}:void 0,target:n.target}}e.fromSerialized=t})(v$||={});var sQ;(t=>t.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(sQ||={});var KFe=A("IMcpService");var aQ;(t=>{let i;(s=>(s[s.Trusted=0]="Trusted",s[s.TrustedOnNonce=1]="TrustedOnNonce",s[s.Untrusted=2]="Untrusted",s[s.Unknown=3]="Unknown"))(i=t.Kind||={})})(aQ||={});var vu;(o=>{function i(r){return r}o.toSerialized=i;function t(r){switch(r.type){case 2:return{type:r.type,uri:y.revive(r.uri),headers:r.headers,oauth:r.oauth,authentication:r.authentication};case 1:return{type:r.type,cwd:r.cwd,command:r.command,args:r.args,env:r.env,envFile:r.envFile,sandbox:r.sandbox}}}o.fromSerialized=t;function e(r,s){if(r.type==="stdio")return{type:1,command:r.command,args:r.args?[...r.args]:[],env:r.env?{...r.env}:{},envFile:r.envFile,cwd:r.cwd,sandbox:s};try{return{type:2,uri:y.parse(r.url),headers:Object.entries(r.headers??{}),oauth:r.oauth}}catch{return}}o.fromServerConfiguration=e;async function n(r){let s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(r)));return Yl(H.wrap(new Uint8Array(s)))}o.hash=n})(vu||={});var _o;(r=>{let i;(c=>(c[c.Stopped=0]="Stopped",c[c.Starting=1]="Starting",c[c.Running=2]="Running",c[c.Error=3]="Error"))(i=r.Kind||={}),r.toString=s=>{switch(s.state){case 0:return p(17322,null);case 1:return p(17321,null);case 2:return p(17320,null);case 3:return p(17319,null,s.message);default:Hl(s)}},r.toKindString=s=>{switch(s){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:Hl(s)}},r.canBeStarted=s=>s===3||s===0,r.isRunning=s=>!(0,r.canBeStarted)(s.state)})(_o||={});var qy=class i extends Error{constructor(e){super(`${i.prefix}${e}`);this.reason=e}static{this.prefix="User interaction required: "}static is(e){return e.message.startsWith(this.prefix)}};var lQ=A("IMcpWorkbenchService"),tT=class extends N{constructor(e,n){super();this.containers=e;this._register(n.onChange(this.update,this))}set mcpServer(e){this.containers.forEach(n=>n.mcpServer=e)}update(e){for(let n of this.containers)e&&n.mcpServer?e.id===n.mcpServer.id&&(n.mcpServer=e):n.update()}};tT=_([S(1,lQ)],tT);var jFe=new k("mcpServersGalleryStatus","unavailable"),GFe=new k("hasInstalledMcpServers",!0);var dQ;(o=>{o.scheme="mcp-resource";let t="dylo78gyp";function e(r,s){return typeof s=="string"&&(s=y.parse(s)),s.with({scheme:o.scheme,authority:Yl(H.fromString(r.id)),path:["",s.scheme,s.authority||t].join("/")+s.path})}o.fromServer=e;function n(r){if(typeof r=="string"&&(r=y.parse(r)),r.scheme!==o.scheme)throw new Error(`Invalid MCP resource URI: ${r.toString()}`);let s=r.path.split("/");if(s.length<3)throw new Error(`Invalid MCP resource URI: ${r.toString()}`);let[,a,l,...d]=s,c=new URL(`${a}://${l.toLowerCase()===t?"":l}`);return c.pathname=d.length?"/"+d.join("/"):"",c.search=r.query,c.hash=r.fragment,{definitionId:Rv(r.authority).toString(),resourceURL:c}}o.toServer=n})(dQ||={});var QFe=A("IMcpServerSampling");var JFe=A("IMcpElicitationService");var eHe=A("scm");var tHe=A("scmView");var et=class i{constructor(t,e=t.length){this.path=t;this.viewEnd=e;if(t.length===0||e<1)throw new Error("cannot create test with empty path")}static fromExtHostTestItem(t,e,n=t.parent){if(t._isRoot)return new i([e]);let o=[t.id];for(let r=n;r&&r.id!==e;r=r.parent)o.push(r.id);return o.push(e),new i(o.reverse())}static isRoot(t){return!t.includes("\0")}static root(t){let e=t.indexOf("\0");return e===-1?t:t.slice(0,e)}static fromString(t){return new i(t.split("\0"))}static join(t,e){return new i([...t.path,e])}static split(t){return t.split("\0")}static joinToString(t,e){return t.toString()+"\0"+e}static parentId(t){let e=t.lastIndexOf("\0");return e===-1?void 0:t.slice(0,e)}static localId(t){let e=t.lastIndexOf("\0");return e===-1?t:t.slice(e+1)}static isChild(t,e){return e[t.length]==="\0"&&e.startsWith(t)}static compare(t,e){return t===e?0:i.isChild(t,e)?2:i.isChild(e,t)?3:1}static getLengthOfCommonPrefix(t,e){if(t===0)return 0;let n=0;for(;n<t-1;){for(let o=1;o<t;o++){let r=e(o-1),s=e(o);if(r.path[n]!==s.path[n])return n}n++}return n}get rootId(){return new i(this.path,1)}get parentId(){return this.viewEnd>1?new i(this.path,this.viewEnd-1):void 0}get localId(){return this.path[this.viewEnd-1]}get controllerId(){return this.path[0]}get isRoot(){return this.viewEnd===1}*idsFromRoot(){for(let t=1;t<=this.viewEnd;t++)yield new i(this.path,t)}*idsToRoot(){for(let t=this.viewEnd;t>0;t--)yield new i(this.path,t)}compare(t){if(typeof t=="string")return i.compare(this.toString(),t);for(let e=0;e<t.viewEnd&&e<this.viewEnd;e++)if(t.path[e]!==this.path[e])return 1;return t.viewEnd>this.viewEnd?2:t.viewEnd<this.viewEnd?3:0}toJSON(){return this.toString()}toString(){if(!this.stringifed){this.stringifed=this.path[0];for(let t=1;t<this.viewEnd;t++)this.stringifed+="\0",this.stringifed+=this.path[t]}return this.stringifed}};var pHe={2:p(21485,null),4:p(21484,null),8:p(21483,null)};var y$=i=>"runId"in i,Ky;(e=>(e.serialize=n=>({range:n.range.toJSON(),uri:n.uri.toJSON()}),e.deserialize=(n,o)=>({range:ze.lift(o.range),uri:n.asCanonicalUri(y.revive(o.uri))})))(Ky||={});var G1;(e=>(e.serialize=n=>({label:n.label,uri:n.uri?.toJSON(),position:n.position?.toJSON()}),e.deserialize=(n,o)=>({label:o.label,uri:o.uri?n.asCanonicalUri(y.revive(o.uri)):void 0,position:o.position?Un.lift(o.position):void 0})))(G1||={});var Q1;(e=>(e.serialize=n=>({message:n.message,type:0,expected:n.expected,actual:n.actual,contextValue:n.contextValue,location:n.location&&Ky.serialize(n.location),stackTrace:n.stackTrace?.map(G1.serialize)}),e.deserialize=(n,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&Ky.deserialize(n,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(r=>G1.deserialize(n,r))})))(Q1||={});var J1;(e=>(e.serialize=n=>({message:n.message,type:1,offset:n.offset,length:n.length,location:n.location&&Ky.serialize(n.location)}),e.deserialize=(n,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&Ky.deserialize(n,o.location)})))(J1||={});var Y1;(n=>(n.serialize=o=>o.type===0?Q1.serialize(o):J1.serialize(o),n.deserialize=(o,r)=>r.type===0?Q1.deserialize(o,r):J1.deserialize(o,r),n.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))(Y1||={});var nT;(n=>(n.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),n.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map(Y1.serialize)}),n.deserialize=(o,r)=>({state:r.state,duration:r.duration,messages:r.messages.map(s=>Y1.deserialize(o,s))})))(nT||={});var b$="\0",Wm=(i,t)=>i+b$+t,iT=i=>{let t=i.indexOf(b$);return{ctrlId:i.slice(0,t),tagId:i.slice(t+1)}},X1;(e=>(e.serialize=n=>({extId:n.extId,label:n.label,tags:n.tags,busy:n.busy,children:void 0,uri:n.uri?.toJSON(),range:n.range?.toJSON()||null,description:n.description,error:n.error,sortText:n.sortText}),e.deserialize=(n,o)=>({extId:o.extId,label:o.label,tags:o.tags,busy:o.busy,children:void 0,uri:o.uri?n.asCanonicalUri(y.revive(o.uri)):void 0,range:o.range?ze.lift(o.range):null,description:o.description,error:o.error,sortText:o.sortText})))(X1||={});var yu;(e=>(e.serialize=n=>({expand:n.expand,item:X1.serialize(n.item)}),e.deserialize=(n,o)=>({controllerId:et.root(o.item.extId),expand:o.expand,item:X1.deserialize(n,o.item)})))(yu||={});var oT;(e=>(e.serialize=n=>{let o;return n.item&&(o={},n.item.label!==void 0&&(o.label=n.item.label),n.item.tags!==void 0&&(o.tags=n.item.tags),n.item.busy!==void 0&&(o.busy=n.item.busy),n.item.uri!==void 0&&(o.uri=n.item.uri?.toJSON()),n.item.range!==void 0&&(o.range=n.item.range?.toJSON()),n.item.description!==void 0&&(o.description=n.item.description),n.item.error!==void 0&&(o.error=n.item.error),n.item.sortText!==void 0&&(o.sortText=n.item.sortText)),{extId:n.extId,expand:n.expand,item:o}},e.deserialize=n=>{let o;return n.item&&(o={},n.item.label!==void 0&&(o.label=n.item.label),n.item.tags!==void 0&&(o.tags=n.item.tags),n.item.busy!==void 0&&(o.busy=n.item.busy),n.item.range!==void 0&&(o.range=n.item.range?ze.lift(n.item.range):null),n.item.description!==void 0&&(o.description=n.item.description),n.item.error!==void 0&&(o.error=n.item.error),n.item.sortText!==void 0&&(o.sortText=n.item.sortText)),{extId:n.extId,expand:n.expand,item:o}}))(oT||={});var sT=(i,t)=>{t.expand!==void 0&&(i.expand=t.expand),t.item!==void 0&&(i.item=i.item?Object.assign(i.item,t.item):t.item)},cQ;(n=>(n.serializeWithoutMessages=o=>({...yu.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(nT.serializeWithoutMessages)}),n.serialize=o=>({...yu.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(nT.serialize)}),n.deserialize=(o,r)=>({...yu.deserialize(o,r),ownComputedState:r.ownComputedState,computedState:r.computedState,tasks:r.tasks.map(s=>nT.deserialize(o,s)),retired:!0})))(cQ||={});var I$;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(n,o)=>{n.covered+=o.covered,n.total+=o.total}))(I$||={});var uQ;(n=>(n.serialize=o=>({id:o.id,statement:o.statement,branch:o.branch,declaration:o.declaration,testIds:o.testIds,uri:o.uri.toJSON()}),n.deserialize=(o,r)=>({id:r.id,statement:r.statement,branch:r.branch,declaration:r.declaration,testIds:r.testIds,uri:o.asCanonicalUri(y.revive(r.uri))}),n.empty=(o,r)=>({id:o,uri:r,statement:I$.empty()})))(uQ||={});function n0(i){return{...i,location:i.location?.toJSON()}}function o0(i){return i.location=i.location?Un.isIPosition(i.location)?Un.lift(i.location):ze.lift(i.location):void 0,i}var pQ;(e=>(e.serialize=n=>n.type===0?e0.serialize(n):t0.serialize(n),e.deserialize=n=>n.type===0?e0.deserialize(n):t0.deserialize(n)))(pQ||={});var Z1;(e=>(e.serialize=n0,e.deserialize=o0))(Z1||={});var e0;(e=>(e.serialize=n0,e.deserialize=o0))(e0||={});var t0;(e=>(e.serialize=n=>({...n0(n),branches:n.branches?.map(Z1.serialize)}),e.deserialize=n=>({...o0(n),branches:n.branches?.map(Z1.deserialize)})))(t0||={});var aT;(e=>(e.deserialize=(n,o)=>o.op===0?{op:o.op,item:yu.deserialize(n,o.item)}:o.op===1?{op:o.op,item:oT.deserialize(o.item)}:o.op===2?{op:o.op,uri:n.asCanonicalUri(y.revive(o.uri)),docv:o.docv}:o,e.serialize=n=>n.op===0?{op:n.op,item:yu.serialize(n.item)}:n.op===1?{op:n.op,item:oT.serialize(n.item)}:n))(aT||={});var rT=class{constructor(t){this.uriIdentity=t;this._tags=new Map;this.items=new Map;this.roots=new Set;this.busyControllerCount=0;this.pendingRootCount=0;this.tags=this._tags}apply(t){let e=this.createChangeCollector();for(let n of t)switch(n.op){case 0:this.add(yu.deserialize(this.uriIdentity,n.item),e);break;case 1:this.update(oT.deserialize(n.item),e);break;case 3:this.remove(n.itemId,e);break;case 5:this.retireTest(n.itemId);break;case 4:this.updatePendingRoots(n.amount);break;case 6:this._tags.set(n.tag.id,n.tag);break;case 7:this._tags.delete(n.id);break}e.complete?.()}add(t,e){let n=et.parentId(t.item.extId)?.toString(),o;if(!n)o=this.createItem(t),this.roots.add(o),this.items.set(t.item.extId,o);else if(this.items.has(n)){let r=this.items.get(n);r.children.add(t.item.extId),o=this.createItem(t,r),this.items.set(t.item.extId,o)}else{console.error(`Test with unknown parent ID: ${JSON.stringify(t)}`);return}return e.add?.(o),t.expand===2&&this.busyControllerCount++,o}update(t,e){let n=this.items.get(t.extId);if(n)return t.expand!==void 0&&(n.expand===2&&this.busyControllerCount--,t.expand===2&&this.busyControllerCount++),sT(n,t),e.update?.(n),n}remove(t,e){let n=this.items.get(t);if(!n)return;let o=et.parentId(n.item.extId)?.toString();o?this.items.get(o).children.delete(n.item.extId):this.roots.delete(n);let r=[[t]];for(;r.length;)for(let s of r.pop()){let a=this.items.get(s);a&&(r.push(a.children),this.items.delete(s),e.remove?.(a,a!==n),a.expand===2&&this.busyControllerCount--)}}retireTest(t){}updatePendingRoots(t){this.pendingRootCount+=t}createChangeCollector(){return{}}};var fHe=A("IAiSettingsSearchService");var x$=A("editorGroupsService");var BHe=A("editorService"),S$=-1,C$=-2;var jy=(i,t)=>i===t,mQ={range:(i,t)=>i===t?!0:!i||!t?!1:i.equalsRange(t),busy:jy,label:jy,description:jy,error:jy,sortText:jy,tags:(i,t)=>!(i.length!==t.length||i.some(e=>!t.includes(e)))},gQ=Object.entries(mQ),fQ=(i,t)=>{let e;for(let[n,o]of gQ)o(i[n],t[n])||(e?e[n]=t[n]:e={[n]:t[n]});return e},lT=class extends N{constructor(e){super();this.options=e;this.debounceSendDiff=this._register(new Pn(()=>this.flushDiff(),200));this.diffOpEmitter=this._register(new T);this.tree=new Map;this.tags=new Map;this.diff=[];this.onDidGenerateDiff=this.diffOpEmitter.event;this.root.canResolveChildren=!0,this.upsertItem(this.root,void 0)}get root(){return this.options.root}set resolveHandler(e){this._resolveHandler=e;for(let n of this.tree.values())this.updateExpandability(n)}get resolveHandler(){return this._resolveHandler}collectDiff(){let e=this.diff;return this.diff=[],e}pushDiff(e){switch(e.op){case 2:{for(let n of this.diff)if(n.op===2&&n.uri===e.uri){n.docv=e.docv;return}break}case 1:{let n=this.diff[this.diff.length-1];if(n){if(n.op===1&&n.item.extId===e.item.extId){sT(n.item,e.item);return}if(n.op===0&&n.item.item.extId===e.item.extId){sT(n.item,e.item);return}}break}}this.diff.push(e),this.debounceSendDiff.isScheduled()||this.debounceSendDiff.schedule()}expand(e,n){let o=this.tree.get(e);if(o){if((o.expandLevels===void 0||n>o.expandLevels)&&(o.expandLevels=n),o.expand===1){let r=this.resolveChildren(o);return r.isOpen()?this.expandChildren(o,n-1):r.wait().then(()=>this.expandChildren(o,n-1))}else if(o.expand===3)return o.resolveBarrier?.isOpen()===!1?o.resolveBarrier.wait().then(()=>this.expandChildren(o,n-1)):this.expandChildren(o,n-1)}}dispose(){for(let e of this.tree.values())this.options.getApiFor(e.actual).listener=void 0;this.tree.clear(),this.diff=[],super.dispose()}onTestItemEvent(e,n){switch(n.op){case 3:this.removeItem(et.joinToString(e.fullId,n.id));break;case 0:this.upsertItem(n.item,e);break;case 5:for(let o of n.ops)this.onTestItemEvent(e,o);break;case 1:this.diffTagRefs(n.new,n.old,e.fullId.toString());break;case 2:this.updateExpandability(e);break;case 4:this.pushDiff({op:1,item:{extId:e.fullId.toString(),item:n.update}});break;case 6:this.documentSynced(e.actual.uri);break;default:Hl(n)}}documentSynced(e){e&&this.pushDiff({op:2,uri:e,docv:this.options.getDocumentVersion(e)})}upsertItem(e,n){let o=et.fromExtHostTestItem(e,this.root.id,n?.actual),r=this.options.getApiFor(e);r.parent&&r.parent!==n?.actual&&this.options.getChildren(r.parent).delete(e.id);let s=this.tree.get(o.toString());if(!s){s={fullId:o,actual:e,expandLevels:n?.expandLevels?n.expandLevels-1:void 0,expand:0},e.tags.forEach(this.incrementTagRefs,this),this.tree.set(s.fullId.toString(),s),this.setItemParent(e,n),this.pushDiff({op:0,item:{controllerId:this.options.controllerId,expand:s.expand,item:this.options.toITestItem(e)}}),this.connectItemAndChildren(e,s,n);return}if(s.actual===e){this.connectItem(e,s,n);return}if(s.actual.uri?.toString()!==e.uri?.toString())return this.removeItem(o.toString()),this.upsertItem(e,n);let a=this.options.getChildren(s.actual),l=s.actual,d=fQ(this.options.toITestItem(l),this.options.toITestItem(e));this.options.getApiFor(l).listener=void 0,s.actual=e,s.resolveBarrier=void 0,s.expand=0,d&&(d.hasOwnProperty("tags")&&(this.diffTagRefs(e.tags,l.tags,o.toString()),delete d.tags),this.onTestItemEvent(s,{op:4,update:d})),this.connectItemAndChildren(e,s,n);for(let[u,m]of a)this.options.getChildren(e).get(m.id)||this.removeItem(et.joinToString(o,m.id));let c=s.expandLevels;c!==void 0&&queueMicrotask(()=>{s.expand===1&&(s.expandLevels=void 0,this.expand(o.toString(),c))}),this.documentSynced(s.actual.uri)}diffTagRefs(e,n,o){let r=new Set(n.map(s=>s.id));for(let s of e)r.delete(s.id)||this.incrementTagRefs(s);this.pushDiff({op:1,item:{extId:o,item:{tags:e.map(s=>Wm(this.options.controllerId,s.id))}}}),r.forEach(this.decrementTagRefs,this)}incrementTagRefs(e){let n=this.tags.get(e.id);n?n.refCount++:(this.tags.set(e.id,{refCount:1}),this.pushDiff({op:6,tag:{id:Wm(this.options.controllerId,e.id)}}))}decrementTagRefs(e){let n=this.tags.get(e);n&&!--n.refCount&&(this.tags.delete(e),this.pushDiff({op:7,id:Wm(this.options.controllerId,e)}))}setItemParent(e,n){this.options.getApiFor(e).parent=n&&n.actual!==this.root?n.actual:void 0}connectItem(e,n,o){this.setItemParent(e,o);let r=this.options.getApiFor(e);r.parent=o?.actual,r.listener=s=>this.onTestItemEvent(n,s),this.updateExpandability(n)}connectItemAndChildren(e,n,o){this.connectItem(e,n,o);for(let[r,s]of this.options.getChildren(e))this.upsertItem(s,n)}updateExpandability(e){let n;this._resolveHandler?e.resolveBarrier?n=e.resolveBarrier.isOpen()?3:2:n=e.actual.canResolveChildren?1:0:n=0,n!==e.expand&&(e.expand=n,this.pushDiff({op:1,item:{extId:e.fullId.toString(),expand:n}}),n===1&&e.expandLevels!==void 0&&this.resolveChildren(e))}expandChildren(e,n){if(n<0)return;let o=[];for(let[r,s]of this.options.getChildren(e.actual)){let a=this.expand(et.joinToString(e.fullId,s.id),n);oi(a)&&o.push(a)}if(o.length)return Promise.all(o).then(()=>{})}resolveChildren(e){if(e.resolveBarrier)return e.resolveBarrier;if(!this._resolveHandler){let s=new kn;return s.open(),s}e.expand=2,this.pushExpandStateUpdate(e);let n=e.resolveBarrier=new kn,o=s=>{console.error(`Unhandled error in resolveHandler of test controller "${this.options.controllerId}"`,s)},r;try{r=this._resolveHandler(e.actual===this.root?void 0:e.actual)}catch(s){o(s)}return oi(r)?r.catch(o).then(()=>{n.open(),this.updateExpandability(e)}):(n.open(),this.updateExpandability(e)),e.resolveBarrier}pushExpandStateUpdate(e){this.pushDiff({op:1,item:{extId:e.fullId.toString(),expand:e.expand}})}removeItem(e){let n=this.tree.get(e);if(!n)throw new Error("attempting to remove non-existent child");this.pushDiff({op:3,itemId:e});let o=[n];for(;o.length;){let r=o.pop();if(r){this.options.getApiFor(r.actual).listener=void 0;for(let s of r.actual.tags)this.decrementTagRefs(s.id);this.tree.delete(r.fullId.toString());for(let[s,a]of this.options.getChildren(r.actual))o.push(this.tree.get(et.joinToString(r.fullId,a.id)))}}}flushDiff(){let e=this.collectDiff();e.length&&this.diffOpEmitter.fire(e)}},r0=class extends Error{constructor(t){super(`Attempted to insert a duplicate test item ID ${t}`)}},hd=class extends Error{constructor(t){super(`TestItem with ID "${t}" is invalid. Make sure to create it from the createTestItem method.`)}},i0=class extends Error{constructor(t,e,n){super(`TestItem with ID "${t}" is from controller "${e}" and cannot be added as a child of an item from controller "${n}".`)}},T$=(i,t,e)=>{let n=new Map;return{get size(){return n.size},forEach(o,r){for(let s of n.values())o.call(r,s,this)},[Symbol.iterator](){return n.entries()},replace(o){let r=new Map,s=new Set(n.keys()),a={op:5,ops:[]};for(let l of o){if(!(l instanceof e))throw new hd(l.id);let d=t(l).controllerId;if(d!==i.controllerId)throw new i0(l.id,d,i.controllerId);if(r.has(l.id))throw new r0(l.id);r.set(l.id,l),s.delete(l.id),a.ops.push({op:0,item:l})}for(let l of s.keys())a.ops.push({op:3,id:l});i.listener?.(a),n=r},add(o){if(!(o instanceof e))throw new hd(o.id);n.set(o.id,o),i.listener?.({op:0,item:o})},delete(o){n.delete(o)&&i.listener?.({op:3,id:o})},get(o){return n.get(o)},toJSON(){return Array.from(n.values())}}};var E$=new WeakMap,w$=(i,t)=>{let e={controllerId:t};return E$.set(i,e),e},Vm=i=>{let t=E$.get(i);if(!t)throw new hd(i?.id||"<unknown>");return t};var k$=A("remoteAuthorityResolverService");var Bm=class{constructor(t){this.id=t;this.type=1}toString(){return`Managed(${this.id})`}},dT=class{constructor(t,e){this.host=t;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var $m=class i extends Ln{static isNotAvailable(t){return t instanceof i&&t._code==="NotAvailable"}static isTemporarilyNotAvailable(t){return t instanceof i&&t._code==="TemporarilyNotAvailable"}static isNoResolverFound(t){return t instanceof i&&t._code==="NoResolverFound"}static isInvalidAuthority(t){return t instanceof i&&t._code==="InvalidAuthority"}static isHandled(t){return t instanceof i&&t.isHandled}constructor(t,e="Unknown",n){super(t),this._message=t,this._code=e,this._detail=n,this.isHandled=e==="NotAvailable"&&n===!0,Object.setPrototypeOf(this,i.prototype)}};function s0(i){let t=i.indexOf("+");return t===-1?i:i.substring(0,t)}function he(i){return Object.assign(i,{apply:function(...e){if(e.length===0)return Reflect.construct(i,[]);{let n=e.length===1?[]:e[1];return Reflect.construct(i,n,e[0].constructor)}},call:function(...e){if(e.length===0)return Reflect.construct(i,[]);{let[n,...o]=e;return Reflect.construct(i,o,n.constructor)}}})}var co,en=class{constructor(t,e=!1){Rp(this,co);nv(this,co,new _t(t,{supportThemeIcons:e}))}static isMarkdownString(t){return t instanceof en?!0:!t||typeof t!="object"?!1:t.appendCodeblock&&t.appendMarkdown&&t.appendText&&t.value!==void 0}get value(){return yn(this,co).value}set value(t){yn(this,co).value=t}get isTrusted(){return yn(this,co).isTrusted}set isTrusted(t){yn(this,co).isTrusted=t}get supportThemeIcons(){return yn(this,co).supportThemeIcons}set supportThemeIcons(t){yn(this,co).supportThemeIcons=t}get supportHtml(){return yn(this,co).supportHtml}set supportHtml(t){yn(this,co).supportHtml=t}get supportAlertSyntax(){return yn(this,co).supportAlertSyntax}set supportAlertSyntax(t){yn(this,co).supportAlertSyntax=t}get baseUri(){return yn(this,co).baseUri}set baseUri(t){yn(this,co).baseUri=t}appendText(t){return yn(this,co).appendText(t),this}appendMarkdown(t){return yn(this,co).appendMarkdown(t),this}appendCodeblock(t,e){return yn(this,co).appendCodeblock(e??"",t),this}};co=new WeakMap,en=_([he],en);var De=class{static Min(...t){if(t.length===0)throw new TypeError;let e=t[0];for(let n=1;n<t.length;n++){let o=t[n];o.isBefore(e)&&(e=o)}return e}static Max(...t){if(t.length===0)throw new TypeError;let e=t[0];for(let n=1;n<t.length;n++){let o=t[n];o.isAfter(e)&&(e=o)}return e}static isPosition(t){if(!t)return!1;if(t instanceof De)return!0;let{line:e,character:n}=t;return typeof e=="number"&&typeof n=="number"}static of(t){if(t instanceof De)return t;if(this.isPosition(t))return new De(t.line,t.character);throw new Error("Invalid argument, is NOT a position-like object")}get line(){return this._line}get character(){return this._character}constructor(t,e){if(t<0)throw $e("line must be non-negative");if(e<0)throw $e("character must be non-negative");this._line=t,this._character=e}isBefore(t){return this._line<t._line?!0:t._line<this._line?!1:this._character<t._character}isBeforeOrEqual(t){return this._line<t._line?!0:t._line<this._line?!1:this._character<=t._character}isAfter(t){return!this.isBeforeOrEqual(t)}isAfterOrEqual(t){return!this.isBefore(t)}isEqual(t){return this._line===t._line&&this._character===t._character}compareTo(t){return this._line<t._line?-1:this._line>t.line?1:this._character<t._character?-1:this._character>t._character?1:0}translate(t,e=0){if(t===null||e===null)throw $e();let n;return typeof t>"u"?n=0:typeof t=="number"?n=t:(n=typeof t.lineDelta=="number"?t.lineDelta:0,e=typeof t.characterDelta=="number"?t.characterDelta:0),n===0&&e===0?this:new De(this.line+n,this.character+e)}with(t,e=this.character){if(t===null||e===null)throw $e();let n;return typeof t>"u"?n=this.line:typeof t=="number"?n=t:(n=typeof t.line=="number"?t.line:this.line,e=typeof t.character=="number"?t.character:this.character),n===this.line&&e===this.character?this:new De(n,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};De=_([he],De);var ve=class{static isRange(t){return t instanceof ve?!0:!t||typeof t!="object"?!1:De.isPosition(t.start)&&De.isPosition(t.end)}static of(t){if(t instanceof ve)return t;if(this.isRange(t))return new ve(t.start,t.end);throw new Error("Invalid argument, is NOT a range-like object")}get start(){return this._start}get end(){return this._end}constructor(t,e,n,o){let r,s;if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"?(r=new De(t,e),s=new De(n,o)):De.isPosition(t)&&De.isPosition(e)&&(r=De.of(t),s=De.of(e)),!r||!s)throw new Error("Invalid arguments");r.isBefore(s)?(this._start=r,this._end=s):(this._start=s,this._end=r)}contains(t){return ve.isRange(t)?this.contains(t.start)&&this.contains(t.end):De.isPosition(t)?!(De.of(t).isBefore(this._start)||this._end.isBefore(t)):!1}isEqual(t){return this._start.isEqual(t._start)&&this._end.isEqual(t._end)}intersection(t){let e=De.Max(t.start,this._start),n=De.Min(t.end,this._end);if(!e.isAfter(n))return new ve(e,n)}union(t){if(this.contains(t))return this;if(t.contains(this))return t;let e=De.Min(t.start,this._start),n=De.Max(t.end,this.end);return new ve(e,n)}get isEmpty(){return this._start.isEqual(this._end)}get isSingleLine(){return this._start.line===this._end.line}with(t,e=this.end){if(t===null||e===null)throw $e();let n;return t?De.isPosition(t)?n=t:(n=t.start||this.start,e=t.end||this.end):n=this.start,n.isEqual(this._start)&&e.isEqual(this.end)?this:new ve(n,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return a0(this)}};ve=_([he],ve);function a0(i){return i.isEmpty?`[${i.start.line}:${i.start.character})`:`[${i.start.line}:${i.start.character} -> ${i.end.line}:${i.end.character})`}var Rt=class{constructor(t){this.value=t}append(t){return new Rt(this.value?this.value+Rt.sep+t:t)}intersects(t){return this.contains(t)||t.contains(this)}contains(t){return this.value===t.value||t.value.startsWith(this.value+Rt.sep)}};Rt.sep=".",Rt=_([he],Rt);Rt.Empty=new Rt("");Rt.QuickFix=Rt.Empty.append("quickfix");Rt.Refactor=Rt.Empty.append("refactor");Rt.RefactorExtract=Rt.Refactor.append("extract");Rt.RefactorInline=Rt.Refactor.append("inline");Rt.RefactorMove=Rt.Refactor.append("move");Rt.RefactorRewrite=Rt.Refactor.append("rewrite");Rt.Source=Rt.Empty.append("source");Rt.SourceOrganizeImports=Rt.Source.append("organizeImports");Rt.SourceFixAll=Rt.Source.append("fixAll");Rt.Notebook=Rt.Empty.append("notebook");var Gy=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(Gy||{}),bu=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(bu||{}),Ms=class{static is(t){return t?typeof t.message=="string"&&t.location&&ve.isRange(t.location.range)&&y.isUri(t.location.uri):!1}constructor(t,e){this.location=t,this.message=e}static isEqual(t,e){return t===e?!0:!t||!e?!1:t.message===e.message&&t.location.range.isEqual(e.location.range)&&t.location.uri.toString()===e.location.uri.toString()}};Ms=_([he],Ms);var Ka=class{constructor(t,e,n=0){if(!ve.isRange(t))throw new TypeError("range must be set");if(!e)throw new TypeError("message must be set");this.range=t,this.message=e,this.severity=n}toJSON(){return{severity:bu[this.severity],message:this.message,range:this.range,source:this.source,code:this.code}}static isEqual(t,e){return t===e?!0:!t||!e?!1:t.message===e.message&&t.severity===e.severity&&t.code===e.code&&t.severity===e.severity&&t.source===e.source&&t.range.isEqual(e.range)&&dn(t.tags,e.tags)&&dn(t.relatedInformation,e.relatedInformation,Ms.isEqual)}};Ka=_([he],Ka);var rn=class{static isLocation(t){return t instanceof rn?!0:t?ve.isRange(t.range)&&y.isUri(t.uri):!1}constructor(t,e){if(this.uri=t,e)if(ve.isRange(e))this.range=ve.of(e);else if(De.isPosition(e))this.range=new ve(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};rn=_([he],rn);var Qy=(e=>(e[e.Markup=1]="Markup",e[e.Code=2]="Code",e))(Qy||{}),uo=class i{static isNotebookRange(t){return t instanceof i?!0:t?typeof t.start=="number"&&typeof t.end=="number":!1}get start(){return this._start}get end(){return this._end}get isEmpty(){return this._start===this._end}constructor(t,e){if(t<0)throw $e("start must be positive");if(e<0)throw $e("end must be positive");t<=e?(this._start=t,this._end=e):(this._start=e,this._end=t)}with(t){let e=this._start,n=this._end;return t.start!==void 0&&(e=t.start),t.end!==void 0&&(n=t.end),e===this._start&&n===this._end?this:new i(e,n)}},Ls=class i{static validate(t){if(typeof t.kind!="number")throw new Error("NotebookCellData MUST have 'kind' property");if(typeof t.value!="string")throw new Error("NotebookCellData MUST have 'value' property");if(typeof t.languageId!="string")throw new Error("NotebookCellData MUST have 'languageId' property")}static isNotebookCellDataArray(t){return Array.isArray(t)&&t.every(e=>i.isNotebookCellData(e))}static isNotebookCellData(t){return!0}constructor(t,e,n,o,r,s,a){this.kind=t,this.value=e,this.languageId=n,this.mime=o,this.outputs=r??[],this.metadata=s,this.executionSummary=a,i.validate(this)}},Iu=class{constructor(t){this.cells=t}},Qo=class{static isNotebookCellEdit(t){return t instanceof Qo?!0:t?uo.isNotebookRange(t)&&Array.isArray(t.newCells):!1}static replaceCells(t,e){return new Qo(t,e)}static insertCells(t,e){return new Qo(new uo(t,t),e)}static deleteCells(t){return new Qo(t,[])}static updateCellMetadata(t,e){let n=new Qo(new uo(t,t),[]);return n.newCellMetadata=e,n}static updateNotebookMetadata(t){let e=new Qo(new uo(0,0),[]);return e.newNotebookMetadata=t,e}constructor(t,e){this.range=t,this.newCells=e}};Qo=_([he],Qo);var xu=class i{constructor(t,e){this.data=t;this.mime=e;let n=gM(e,!0);if(!n)throw new Error(`INVALID mime type: ${e}. Must be in the format "type/subtype[;optionalparameter]"`);this.mime=n}static isNotebookCellOutputItem(t){return t instanceof i?!0:t?typeof t.mime=="string"&&t.data instanceof Uint8Array:!1}static error(t){let e={name:t.name,message:t.message,stack:t.stack};return i.json(e,"application/vnd.code.notebook.error")}static stdout(t){return i.text(t,"application/vnd.code.notebook.stdout")}static stderr(t){return i.text(t,"application/vnd.code.notebook.stderr")}static bytes(t,e="application/octet-stream"){return new i(t,e)}static#e=new TextEncoder;static text(t,e=Tr.text){let n=i.#e.encode(String(t));return new i(n,e)}static json(t,e="text/x-json"){let n=JSON.stringify(t,void 0,"	");return i.text(n,e)}},Os=class i{static isNotebookCellOutput(t){return t instanceof i?!0:!t||typeof t!="object"?!1:typeof t.id=="string"&&Array.isArray(t.items)}static ensureUniqueMimeTypes(t,e=!1){let n=new Set,o=new Set;for(let r=0;r<t.length;r++){let s=t[r],a=gM(s.mime);if(!n.has(a)||PS(a)){n.add(a);continue}o.add(r),e&&console.warn(`DUPLICATED mime type '${s.mime}' will be dropped`)}return o.size===0?t:t.filter((r,s)=>!o.has(s))}constructor(t,e,n){this.items=i.ensureUniqueMimeTypes(t,!0),typeof e=="string"?(this.id=e,this.metadata=n):(this.id=_e(),this.metadata=e??n)}};var oo=class extends ve{static isSelection(t){return t instanceof oo?!0:!t||typeof t!="object"?!1:ve.isRange(t)&&De.isPosition(t.anchor)&&De.isPosition(t.active)&&typeof t.isReversed=="boolean"}get anchor(){return this._anchor}get active(){return this._active}constructor(t,e,n,o){let r,s;if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"?(r=new De(t,e),s=new De(n,o)):De.isPosition(t)&&De.isPosition(e)&&(r=De.of(t),s=De.of(e)),!r||!s)throw new Error("Invalid arguments");super(r,s),this._anchor=r,this._active=s}get isReversed(){return this._anchor===this._end}toJSON(){return{start:this.start,end:this.end,active:this.active,anchor:this.anchor}}[Symbol.for("debug.description")](){return hQ(this)}};oo=_([he],oo);function hQ(i){let t=a0(i);return i.isEmpty||(i.active.isEqual(i.start)?t=`|${t}`:t=`${t}|`),t}var ro=class{constructor(t){this._tabstop=1;this.value=t||""}static isSnippetString(t){return t instanceof ro?!0:!t||typeof t!="object"?!1:typeof t.value=="string"}static _escape(t){return t.replace(/\$|}|\\/g,"\\$&")}appendText(t){return this.value+=ro._escape(t),this}appendTabstop(t=this._tabstop++){return this.value+="$",this.value+=t,this}appendPlaceholder(t,e=this._tabstop++){if(typeof t=="function"){let n=new ro;n._tabstop=this._tabstop,t(n),this._tabstop=n._tabstop,t=n.value}else t=ro._escape(t);return this.value+="${",this.value+=e,this.value+=":",this.value+=t,this.value+="}",this}appendChoice(t,e=this._tabstop++){let n=t.map(o=>o.replaceAll(/[|\\,]/g,"\\$&")).join(",");return this.value+="${",this.value+=e,this.value+="|",this.value+=n,this.value+="|}",this}appendVariable(t,e){if(typeof e=="function"){let n=new ro;n._tabstop=this._tabstop,e(n),this._tabstop=n._tabstop,e=n.value}else typeof e=="string"&&(e=e.replace(/\$|}/g,"\\$&"));return this.value+="${",this.value+=t,e&&(this.value+=":",this.value+=e),this.value+="}",this}};ro=_([he],ro);var ja=class i{static isSnippetTextEdit(t){return t instanceof i?!0:t?ve.isRange(t.range)&&ro.isSnippetString(t.snippet):!1}static replace(t,e){return new i(t,e)}static insert(t,e){return i.replace(new ve(t,t),e)}constructor(t,e){this.range=t,this.snippet=e}};var zm=(Q=>(Q[Q.File=0]="File",Q[Q.Module=1]="Module",Q[Q.Namespace=2]="Namespace",Q[Q.Package=3]="Package",Q[Q.Class=4]="Class",Q[Q.Method=5]="Method",Q[Q.Property=6]="Property",Q[Q.Field=7]="Field",Q[Q.Constructor=8]="Constructor",Q[Q.Enum=9]="Enum",Q[Q.Interface=10]="Interface",Q[Q.Function=11]="Function",Q[Q.Variable=12]="Variable",Q[Q.Constant=13]="Constant",Q[Q.String=14]="String",Q[Q.Number=15]="Number",Q[Q.Boolean=16]="Boolean",Q[Q.Array=17]="Array",Q[Q.Object=18]="Object",Q[Q.Key=19]="Key",Q[Q.Null=20]="Null",Q[Q.EnumMember=21]="EnumMember",Q[Q.Struct=22]="Struct",Q[Q.Event=23]="Event",Q[Q.Operator=24]="Operator",Q[Q.TypeParameter=25]="TypeParameter",Q))(zm||{}),Jy=(t=>(t[t.Deprecated=1]="Deprecated",t))(Jy||{}),Br=class{static validate(t){if(!t.name)throw new Error("name must not be falsy")}constructor(t,e,n,o,r){this.name=t,this.kind=e,this.containerName=r,typeof n=="string"&&(this.containerName=n),o instanceof rn?this.location=o:n instanceof ve&&(this.location=new rn(o,n)),Br.validate(this)}toJSON(){return{name:this.name,kind:zm[this.kind],location:this.location,containerName:this.containerName}}};Br=_([he],Br);var Su=(e=>(e[e.LF=1]="LF",e[e.CRLF=2]="CRLF",e))(Su||{}),Qn=class{static isTextEdit(t){return t instanceof Qn?!0:!t||typeof t!="object"?!1:ve.isRange(t)&&typeof t.newText=="string"}static replace(t,e){return new Qn(t,e)}static insert(t,e){return Qn.replace(new ve(t,t),e)}static delete(t){return Qn.replace(t,"")}static setEndOfLine(t){let e=new Qn(new ve(new De(0,0),new De(0,0)),"");return e.newEol=t,e}get range(){return this._range}set range(t){if(t&&!ve.isRange(t))throw $e("range");this._range=t}get newText(){return this._newText||""}set newText(t){if(t&&typeof t!="string")throw $e("newText");this._newText=t}get newEol(){return this._newEol}set newEol(t){if(t&&typeof t!="number")throw $e("newEol");this._newEol=t}constructor(t,e){this._range=t,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};Qn=_([he],Qn);var Dr=class{constructor(){this._edits=[]}_allEntries(){return this._edits}renameFile(t,e,n,o){this._edits.push({_type:1,from:t,to:e,options:n,metadata:o})}createFile(t,e,n){this._edits.push({_type:1,from:void 0,to:t,options:e,metadata:n})}deleteFile(t,e,n){this._edits.push({_type:1,from:t,to:void 0,options:e,metadata:n})}replaceNotebookMetadata(t,e,n){this._edits.push({_type:3,metadata:n,uri:t,edit:{editType:5,metadata:e}})}replaceNotebookCells(t,e,n,o){let r=e.start,s=e.end;(r!==s||n.length>0)&&this._edits.push({_type:5,uri:t,index:r,count:s-r,cells:n,metadata:o})}replaceNotebookCellMetadata(t,e,n,o){this._edits.push({_type:3,metadata:o,uri:t,edit:{editType:3,index:e,metadata:n}})}replace(t,e,n,o){this._edits.push({_type:2,uri:t,edit:new Qn(e,n),metadata:o})}insert(t,e,n,o){this.replace(t,new ve(e,e),n,o)}delete(t,e,n){this.replace(t,e,"",n)}has(t){return this._edits.some(e=>e._type===2&&e.uri.toString()===t.toString())}set(t,e){if(e)for(let n of e){if(!n)continue;let o,r;Array.isArray(n)?(o=n[0],r=n[1]):o=n,Qo.isNotebookCellEdit(o)?o.newCellMetadata?this.replaceNotebookCellMetadata(t,o.range.start,o.newCellMetadata,r):o.newNotebookMetadata?this.replaceNotebookMetadata(t,o.newNotebookMetadata,r):this.replaceNotebookCells(t,o.range,o.newCells,r):ja.isSnippetTextEdit(o)?this._edits.push({_type:6,uri:t,range:o.range,edit:o.snippet,metadata:r,keepWhitespace:o.keepWhitespace}):this._edits.push({_type:2,uri:t,edit:o,metadata:r})}else{for(let n=0;n<this._edits.length;n++){let o=this._edits[n];switch(o._type){case 2:case 6:case 3:case 5:o.uri.toString()===t.toString()&&(this._edits[n]=void 0);break}}bH(this._edits)}}get(t){let e=[];for(let n of this._edits)n._type===2&&n.uri.toString()===t.toString()&&e.push(n.edit);return e}entries(){let t=new Ve;for(let e of this._edits)if(e._type===2){let n=t.get(e.uri);n||(n=[e.uri,[]],t.set(e.uri,n)),n[1].push(e.edit)}return[...t.values()]}get size(){return this.entries().length}toJSON(){return this.entries()}};Dr=_([he],Dr);var l0=(e=>(e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e))(l0||{});var ku,Se=class{constructor(t){Rp(this,ku);nv(this,ku,t)}static from(...t){let e=t;return new Se(function(){if(e){for(let n of e)n&&typeof n.dispose=="function"&&n.dispose();e=void 0}})}dispose(){typeof yn(this,ku)=="function"&&(yn(this,ku).call(this),nv(this,ku,void 0))}};ku=new WeakMap,Se=_([he],Se);var _$=i=>{if(typeof i!="string"||i.length===0||!/^[0-9A-Za-z_\-]+$/.test(i))throw $e("connectionToken")},cT=class{static isResolvedAuthority(t){return t&&typeof t=="object"&&typeof t.host=="string"&&typeof t.port=="number"&&(t.connectionToken===void 0||typeof t.connectionToken=="string")}constructor(t,e,n){if(typeof t!="string"||t.length===0)throw $e("host");if(typeof e!="number"||e===0||Math.round(e)!==e)throw $e("port");typeof n<"u"&&_$(n),this.host=t,this.port=Math.round(e),this.connectionToken=n}},Ad=class{constructor(t,e){this.makeConnection=t;this.connectionToken=e;typeof e<"u"&&_$(e)}static isManagedResolvedAuthority(t){return t&&typeof t=="object"&&typeof t.makeConnection=="function"&&(t.connectionToken===void 0||typeof t.connectionToken=="string")}},zs=class i extends Error{static NotAvailable(t,e){return new i(t,"NotAvailable",e)}static TemporarilyNotAvailable(t){return new i(t,"TemporarilyNotAvailable")}constructor(t,e="Unknown",n){super(t),this._message=t,this._code=e,this._detail=n,Object.setPrototypeOf(this,i.prototype)}},VT=(n=>(n[n.Replace=1]="Replace",n[n.Append=2]="Append",n[n.Prepend=3]="Prepend",n))(VT||{}),Cu=class{constructor(t,e){if(!t)throw new Error("Illegal argument, contents must be defined");Array.isArray(t)?this.contents=t:this.contents=[t],this.range=e}};Cu=_([he],Cu);var vd=class extends Cu{constructor(t,e,n,o){super(t,e),this.canIncreaseVerbosity=n,this.canDecreaseVerbosity=o}};vd=_([he],vd);var d0=(e=>(e[e.Increase=0]="Increase",e[e.Decrease=1]="Decrease",e))(d0||{}),BT=(n=>(n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write",n))(BT||{}),yd=class{constructor(t,e=0){this.range=t,this.kind=e}toJSON(){return{range:this.range,kind:BT[this.kind]}}};yd=_([he],yd);var bd=class{constructor(t,e){this.uri=t,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(t=>t.toJSON())}}};bd=_([he],bd);var $r=class{static validate(t){if(!t.name)throw new Error("name must not be falsy");if(!t.range.contains(t.selectionRange))throw new Error("selectionRange must be contained in fullRange");t.children?.forEach($r.validate)}constructor(t,e,n,o,r){this.name=t,this.detail=e,this.kind=n,this.range=o,this.selectionRange=r,this.children=[],$r.validate(this)}};$r=_([he],$r);var $T=(e=>(e[e.Invoke=1]="Invoke",e[e.Automatic=2]="Automatic",e))($T||{}),Us=class{constructor(t,e){this.title=t,this.kind=e}};Us=_([he],Us);var Fs=class{constructor(t,e){if(this.range=t,this.parent=e,e&&!e.range.contains(this.range))throw new Error("Invalid argument: parent must contain this range")}};Fs=_([he],Fs);var Md=class{constructor(t,e,n,o,r,s){this.kind=t,this.name=e,this.detail=n,this.uri=o,this.range=r,this.selectionRange=s}},eg=class{constructor(t,e){this.fromRanges=e,this.from=t}},tg=class{constructor(t,e){this.fromRanges=e,this.to=t}},zT=(n=>(n[n.Information=0]="Information",n[n.Warning=1]="Warning",n[n.Error=2]="Error",n))(zT||{}),Id=class{constructor(t,e){this.range=t,this.command=e}get isResolved(){return!!this.command}};Id=_([he],Id);var qm=class{constructor(t,e){this.label=t,this.documentation=e}};qm=_([he],qm);var Km=class{constructor(t,e){this.label=t,this.documentation=e,this.parameters=[]}};Km=_([he],Km);var jm=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};jm=_([he],jm);var c0=(n=>(n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange",n))(c0||{}),u0=(e=>(e[e.Type=1]="Type",e[e.Parameter=2]="Parameter",e))(u0||{}),xd=class{constructor(t){this.value=t}};xd=_([he],xd);var Sd=class{constructor(t,e,n){this.position=t,this.label=e,this.kind=n}};Sd=_([he],Sd);var qT=(n=>(n[n.Invoke=0]="Invoke",n[n.TriggerCharacter=1]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions",n))(qT||{}),Xy=(Z=>(Z[Z.Text=0]="Text",Z[Z.Method=1]="Method",Z[Z.Function=2]="Function",Z[Z.Constructor=3]="Constructor",Z[Z.Field=4]="Field",Z[Z.Variable=5]="Variable",Z[Z.Class=6]="Class",Z[Z.Interface=7]="Interface",Z[Z.Module=8]="Module",Z[Z.Property=9]="Property",Z[Z.Unit=10]="Unit",Z[Z.Value=11]="Value",Z[Z.Enum=12]="Enum",Z[Z.Keyword=13]="Keyword",Z[Z.Snippet=14]="Snippet",Z[Z.Color=15]="Color",Z[Z.File=16]="File",Z[Z.Reference=17]="Reference",Z[Z.Folder=18]="Folder",Z[Z.EnumMember=19]="EnumMember",Z[Z.Constant=20]="Constant",Z[Z.Struct=21]="Struct",Z[Z.Event=22]="Event",Z[Z.Operator=23]="Operator",Z[Z.TypeParameter=24]="TypeParameter",Z[Z.User=25]="User",Z[Z.Issue=26]="Issue",Z))(Xy||{}),KT=(t=>(t[t.Deprecated=1]="Deprecated",t))(KT||{}),Cd=class{constructor(t,e){this.label=t,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&Xy[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};Cd=_([he],Cd);var Bi=class{constructor(t=[],e=!1){this.items=t,this.isIncomplete=e}};Bi=_([he],Bi);var Gm=class{constructor(t,e,n){this.insertText=t,this.range=e,this.command=n}};Gm=_([he],Gm);var Qm=class{constructor(t){this.commands=void 0;this.suppressSuggestions=void 0;this.items=t}};Qm=_([he],Qm);var jT=(o=>(o[o.Unknown=0]="Unknown",o[o.Word=1]="Word",o[o.Line=2]="Line",o[o.Suggest=3]="Suggest",o))(jT||{}),GT=(n=>(n[n.Accepted=0]="Accepted",n[n.Rejected=1]="Rejected",n[n.Ignored=2]="Ignored",n))(GT||{}),QT=(e=>(e[e.Code=1]="Code",e[e.Label=2]="Label",e))(QT||{}),JT=(u=>(u[u.Active=-1]="Active",u[u.Beside=-2]="Beside",u[u.One=1]="One",u[u.Two=2]="Two",u[u.Three=3]="Three",u[u.Four=4]="Four",u[u.Five=5]="Five",u[u.Six=6]="Six",u[u.Seven=7]="Seven",u[u.Eight=8]="Eight",u[u.Nine=9]="Nine",u))(JT||{}),YT=(e=>(e[e.Left=1]="Left",e[e.Right=2]="Right",e))(YT||{});function R$(i,t){return`${xe.toKey(i)}.${t}`}var XT=(o=>(o[o.Off=0]="Off",o[o.On=1]="On",o[o.Relative=2]="Relative",o[o.Interval=3]="Interval",o))(XT||{}),ZT=(n=>(n[n.Manual=1]="Manual",n[n.AfterDelay=2]="AfterDelay",n[n.FocusOut=3]="FocusOut",n))(ZT||{}),eE=(o=>(o[o.Default=0]="Default",o[o.InCenter=1]="InCenter",o[o.InCenterIfOutsideViewport=2]="InCenterIfOutsideViewport",o[o.AtTop=3]="AtTop",o))(eE||{}),Vu=(n=>(n[n.Keyboard=1]="Keyboard",n[n.Mouse=2]="Mouse",n[n.Command=3]="Command",n))(Vu||{}),Zy=(n=>(n[n.Addition=1]="Addition",n[n.Deletion=2]="Deletion",n[n.Modification=3]="Modification",n))(Zy||{}),tE=(e=>(e[e.Undo=1]="Undo",e[e.Redo=2]="Redo",e))(tE||{}),nE=(o=>(o[o.OpenOpen=0]="OpenOpen",o[o.ClosedClosed=1]="ClosedClosed",o[o.OpenClosed=2]="OpenClosed",o[o.ClosedOpen=3]="ClosedOpen",o))(nE||{});(t=>{function i(e){switch(e){case"keyboard":return 1;case"mouse":return 2;case"api":case"code.jump":case"code.navigation":return 3}}t.fromValue=i})(Vu||={});var Bu=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(Bu||{});(t=>{function i(e){switch(e){case 0:return"other";case 1:return"comment";case 2:return"string";case 3:return"regex"}return"other"}t.toString=i})(Bu||={});var Td=class{constructor(t,e){if(e&&!y.isUri(e))throw $e("target");if(!ve.isRange(t)||t.isEmpty)throw $e("range");this.range=t,this.target=e}};Td=_([he],Td);var $i=class{constructor(t,e,n,o){this.red=t,this.green=e,this.blue=n,this.alpha=o}};$i=_([he],$i);var Ed=class{constructor(t,e){if(e&&!(e instanceof $i))throw $e("color");if(!ve.isRange(t)||t.isEmpty)throw $e("range");this.range=t,this.color=e}};Ed=_([he],Ed);var wd=class{constructor(t){if(!t||typeof t!="string")throw $e("label");this.label=t}};wd=_([he],wd);var oE=(n=>(n[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Information=2]="Information",n))(oE||{}),p0=(r=>(r[r.Unknown=0]="Unknown",r[r.Shutdown=1]="Shutdown",r[r.Process=2]="Process",r[r.User=3]="User",r[r.Extension=4]="Extension",r))(p0||{}),rE=(n=>(n[n.Low=0]="Low",n[n.Medium=1]="Medium",n[n.High=2]="High",n))(rE||{}),m0=(h=>(h[h.Sh=1]="Sh",h[h.Bash=2]="Bash",h[h.Fish=3]="Fish",h[h.Csh=4]="Csh",h[h.Ksh=5]="Ksh",h[h.Zsh=6]="Zsh",h[h.CommandPrompt=7]="CommandPrompt",h[h.GitBash=8]="GitBash",h[h.PowerShell=9]="PowerShell",h[h.Python=10]="Python",h[h.Julia=11]="Julia",h[h.NuShell=12]="NuShell",h[h.Node=13]="Node",h[h.Xonsh=14]="Xonsh",h))(m0||{}),uT=class{constructor(t,e,n){this.startIndex=t;this.length=e;this.tooltip=n;if(typeof t!="number"||t<0)throw $e("startIndex");if(typeof e!="number"||e<1)throw $e("length");if(n!==void 0&&typeof n!="string")throw $e("tooltip")}},pT=class{constructor(t){this.uri=t}},mT=class{constructor(t){this.terminalCommand=t}},g0=(e=>(e[e.Panel=1]="Panel",e[e.Editor=2]="Editor",e))(g0||{}),gT=class{constructor(t){this.options=t;if(typeof t!="object")throw $e("options")}},f0=(x=>(x[x.File=0]="File",x[x.Folder=1]="Folder",x[x.Method=2]="Method",x[x.Alias=3]="Alias",x[x.Argument=4]="Argument",x[x.Option=5]="Option",x[x.OptionValue=6]="OptionValue",x[x.Flag=7]="Flag",x[x.SymbolicLinkFile=8]="SymbolicLinkFile",x[x.SymbolicLinkFolder=9]="SymbolicLinkFolder",x[x.ScmCommit=10]="ScmCommit",x[x.ScmBranch=11]="ScmBranch",x[x.ScmTag=12]="ScmTag",x[x.ScmStash=13]="ScmStash",x[x.ScmRemote=14]="ScmRemote",x[x.PullRequest=15]="PullRequest",x[x.PullRequestDone=16]="PullRequestDone",x))(f0||{}),fT=class{constructor(t,e,n,o,r,s,a,l){this.label=t,this.replacementRange=e,this.kind=n,this.detail=o,this.documentation=r,this.isFile=s,this.isDirectory=a,this.isKeyword=l}},hT=class{constructor(t,e){this.items=t??[],this.resourceOptions=e}},h0=(n=>(n[n.Always=1]="Always",n[n.Silent=2]="Silent",n[n.Never=3]="Never",n))(h0||{}),v0=(g=>(g.Changed="changed",g.ProcessStarted="processStarted",g.ProcessEnded="processEnded",g.Terminated="terminated",g.Start="start",g.AcquiredInput="acquiredInput",g.DependsOnStarted="dependsOnStarted",g.Active="active",g.Inactive="inactive",g.End="end",g.ProblemMatcherStarted="problemMatcherStarted",g.ProblemMatcherEnded="problemMatcherEnded",g.ProblemMatcherFoundErrors="problemMatcherFoundErrors",g))(v0||{}),y0=(n=>(n[n.Shared=1]="Shared",n[n.Dedicated=2]="Dedicated",n[n.New=3]="New",n))(y0||{}),Hn=class{constructor(t,e){this.label=e;if(typeof t!="string")throw $e("name");if(typeof e!="string")throw $e("name");this._id=t}static from(t){switch(t){case"clean":return Hn.Clean;case"build":return Hn.Build;case"rebuild":return Hn.Rebuild;case"test":return Hn.Test;default:return}}get id(){return this._id}};Hn.Clean=new Hn("clean","Clean"),Hn.Build=new Hn("build","Build"),Hn.Rebuild=new Hn("rebuild","Rebuild"),Hn.Test=new Hn("test","Test"),Hn=_([he],Hn);function D$(i){let t="";for(let e=0;e<i.length;e++)t+=i[e].replace(/,/g,",,")+",";return t}var Hs=class{constructor(t,e,n){if(typeof t!="string")throw $e("process");this._args=[],this._process=t,e!==void 0&&(Array.isArray(e)?(this._args=e,this._options=n):this._options=e)}get process(){return this._process}set process(t){if(typeof t!="string")throw $e("process");this._process=t}get args(){return this._args}set args(t){Array.isArray(t)||(t=[]),this._args=t}get options(){return this._options}set options(t){this._options=t}computeId(){let t=[];if(t.push("process"),this._process!==void 0&&t.push(this._process),this._args&&this._args.length>0)for(let e of this._args)t.push(e);return D$(t)}};Hs=_([he],Hs);var zi=class{constructor(t,e,n){this._args=[];if(Array.isArray(e)){if(!t)throw $e("command can't be undefined or null");if(typeof t!="string"&&typeof t.value!="string")throw $e("command");this._command=t,e&&(this._args=e),this._options=n}else{if(typeof t!="string")throw $e("commandLine");this._commandLine=t,this._options=e}}get commandLine(){return this._commandLine}set commandLine(t){if(typeof t!="string")throw $e("commandLine");this._commandLine=t}get command(){return this._command?this._command:""}set command(t){if(typeof t!="string"&&typeof t.value!="string")throw $e("command");this._command=t}get args(){return this._args}set args(t){this._args=t||[]}get options(){return this._options}set options(t){this._options=t}computeId(){let t=[];if(t.push("shell"),this._commandLine!==void 0&&t.push(this._commandLine),this._command!==void 0&&t.push(typeof this._command=="string"?this._command:this._command.value),this._args&&this._args.length>0)for(let e of this._args)t.push(typeof e=="string"?e:e.value);return D$(t)}};zi=_([he],zi);var b0=(n=>(n[n.Escape=1]="Escape",n[n.Strong=2]="Strong",n[n.Weak=3]="Weak",n))(b0||{}),iE=(e=>(e[e.Global=1]="Global",e[e.Workspace=2]="Workspace",e))(iE||{}),I0=(n=>(n[n.Default=1]="Default",n[n.FolderOpen=2]="FolderOpen",n[n.WorktreeCreated=3]="WorktreeCreated",n))(I0||{}),Ru=class{constructor(t){this._callback=t}computeId(){return"customExecution"+_e()}set callback(t){this._callback=t}get callback(){return this._callback}},Jn=class{constructor(t,e,n,o,r,s){this.__deprecated=!1;this._definition=this.definition=t;let a;typeof e=="string"?(this._name=this.name=e,this._source=this.source=n,this.execution=o,a=r,this.__deprecated=!0):e===1||e===2?(this.target=e,this._name=this.name=n,this._source=this.source=o,this.execution=r,a=s):(this.target=e,this._name=this.name=n,this._source=this.source=o,this.execution=r,a=s),typeof a=="string"?(this._problemMatchers=[a],this._hasDefinedMatchers=!0):Array.isArray(a)?(this._problemMatchers=a,this._hasDefinedMatchers=!0):(this._problemMatchers=[],this._hasDefinedMatchers=!1),this._isBackground=!1,this._presentationOptions=Object.create(null),this._runOptions=Object.create(null)}get _id(){return this.__id}set _id(t){this.__id=t}get _deprecated(){return this.__deprecated}clear(){this.__id!==void 0&&(this.__id=void 0,this._scope=void 0,this.computeDefinitionBasedOnExecution())}computeDefinitionBasedOnExecution(){this._execution instanceof Hs?this._definition={type:Jn.ProcessType,id:this._execution.computeId()}:this._execution instanceof zi?this._definition={type:Jn.ShellType,id:this._execution.computeId()}:this._execution instanceof Ru?this._definition={type:Jn.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:Jn.EmptyType,id:_e()}}get definition(){return this._definition}set definition(t){if(t==null)throw $e("Kind can't be undefined or null");this.clear(),this._definition=t}get scope(){return this._scope}set target(t){this.clear(),this._scope=t}get name(){return this._name}set name(t){if(typeof t!="string")throw $e("name");this.clear(),this._name=t}get execution(){return this._execution}set execution(t){t===null&&(t=void 0),this.clear(),this._execution=t;let e=this._definition.type;(Jn.EmptyType===e||Jn.ProcessType===e||Jn.ShellType===e||Jn.ExtensionCallbackType===e)&&this.computeDefinitionBasedOnExecution()}get problemMatchers(){return this._problemMatchers}set problemMatchers(t){if(Array.isArray(t))this.clear(),this._problemMatchers=t,this._hasDefinedMatchers=!0;else{this.clear(),this._problemMatchers=[],this._hasDefinedMatchers=!1;return}}get hasDefinedMatchers(){return this._hasDefinedMatchers}get isBackground(){return this._isBackground}set isBackground(t){t!==!0&&t!==!1&&(t=!1),this.clear(),this._isBackground=t}get source(){return this._source}set source(t){if(typeof t!="string"||t.length===0)throw $e("source must be a string of length > 0");this.clear(),this._source=t}get group(){return this._group}set group(t){t===null&&(t=void 0),this.clear(),this._group=t}get detail(){return this._detail}set detail(t){t===null&&(t=void 0),this._detail=t}get presentationOptions(){return this._presentationOptions}set presentationOptions(t){t==null&&(t=Object.create(null)),this.clear(),this._presentationOptions=t}get runOptions(){return this._runOptions}set runOptions(t){t==null&&(t=Object.create(null)),this.clear(),this._runOptions=t}};Jn.ExtensionCallbackType="customExecution",Jn.ProcessType="process",Jn.ShellType="shell",Jn.EmptyType="$empty",Jn=_([he],Jn);var eb=(n=>(n[n.SourceControl=1]="SourceControl",n[n.Window=10]="Window",n[n.Notification=15]="Notification",n))(eb||{}),x0;(t=>{function i(e){let n=e;return jn(n.value)?n.tooltip&&!Pe(n.tooltip)?(console.log("INVALID view badge, invalid tooltip",n.tooltip),!1):!0:(console.log("INVALID view badge, invalid value",n.value),!1)}t.isViewBadge=i})(x0||={});var Ws=class{constructor(t,e=0){this.collapsibleState=e;y.isUri(t)?this.resourceUri=t:this.label=t}static isTreeItem(t,e){let n=t;if(n.checkboxState!==void 0){let o=jn(n.checkboxState)?n.checkboxState:st(n.checkboxState)&&jn(n.checkboxState.state)?n.checkboxState.state:void 0,r=!jn(n.checkboxState)&&st(n.checkboxState)?n.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||r!==void 0&&!Pe(r))return console.log("INVALID tree item, invalid checkboxState",n.checkboxState),!1}if(t instanceof Ws)return!0;if(n.label!==void 0&&!Pe(n.label)&&!n.label?.label)return console.log("INVALID tree item, invalid label",n.label),!1;if(n.id!==void 0&&!Pe(n.id))return console.log("INVALID tree item, invalid id",n.id),!1;if(n.iconPath!==void 0&&!Pe(n.iconPath)&&!y.isUri(n.iconPath)&&(!n.iconPath||!Pe(n.iconPath.id))){let o=n.iconPath;if(!o||!Pe(o.light)&&!y.isUri(o.light)&&!Pe(o.dark)&&!y.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",n.iconPath),!1}return n.description!==void 0&&!Pe(n.description)&&typeof n.description!="boolean"?(console.log("INVALID tree item, invalid description",n.description),!1):n.resourceUri!==void 0&&!y.isUri(n.resourceUri)?(console.log("INVALID tree item, invalid resourceUri",n.resourceUri),!1):n.tooltip!==void 0&&!Pe(n.tooltip)&&!(n.tooltip instanceof en)?(console.log("INVALID tree item, invalid tooltip",n.tooltip),!1):n.command!==void 0&&!n.command.command?(console.log("INVALID tree item, invalid command",n.command),!1):n.collapsibleState!==void 0&&n.collapsibleState<0&&n.collapsibleState>2?(console.log("INVALID tree item, invalid collapsibleState",n.collapsibleState),!1):n.contextValue!==void 0&&!Pe(n.contextValue)?(console.log("INVALID tree item, invalid contextValue",n.contextValue),!1):n.accessibilityInformation!==void 0&&!n.accessibilityInformation?.label?(console.log("INVALID tree item, invalid accessibilityInformation",n.accessibilityInformation),!1):!0}};Ws=_([he],Ws);var sE=(n=>(n[n.None=0]="None",n[n.Collapsed=1]="Collapsed",n[n.Expanded=2]="Expanded",n))(sE||{}),aE=(e=>(e[e.Unchecked=0]="Unchecked",e[e.Checked=1]="Checked",e))(aE||{}),Tu=class{constructor(t){this.value=t}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};Tu=_([he],Tu);var Ld=class extends Tu{},vT=class extends Ld{#e;constructor(t){super(""),this.#e=t}asFile(){return this.#e}},yT=class{constructor(t,e,n,o){this.name=t,this.uri=e,this._itemId=n,this._getData=o}data(){return this._getData()}},Ga,Pu,Yy,mi=class{constructor(t){Rp(this,Pu);Rp(this,Ga,new Map);for(let[e,n]of t??[]){let o=yn(this,Ga).get(ov(this,Pu,Yy).call(this,e));o?o.push(n):yn(this,Ga).set(ov(this,Pu,Yy).call(this,e),[n])}}get(t){return yn(this,Ga).get(ov(this,Pu,Yy).call(this,t))?.[0]}set(t,e){yn(this,Ga).set(ov(this,Pu,Yy).call(this,t),[e])}forEach(t,e){for(let[n,o]of yn(this,Ga))for(let r of o)t.call(e,r,n,this)}*[Symbol.iterator](){for(let[t,e]of yn(this,Ga))for(let n of e)yield[t,n]}};Ga=new WeakMap,Pu=new WeakSet,Yy=function(t){return t.toLowerCase()},mi=_([he],mi);var Jm=class{constructor(t,e,n){this.insertText=t,this.title=e,this.kind=n}};Jm=_([he],Jm);var S0=(e=>(e[e.Automatic=0]="Automatic",e[e.PasteAs=1]="PasteAs",e))(S0||{}),gi=class i{constructor(t){this.value=t}static{this.sep="."}append(...t){return new i((this.value?[this.value,...t]:t).join(i.sep))}intersects(t){return this.contains(t)||t.contains(this)}contains(t){return this.value===t.value||t.value.startsWith(this.value+i.sep)}};gi.Empty=new gi("");gi.Text=new gi("text");gi.TextUpdateImports=gi.Text.append("updateImports");var bT=class{constructor(t,e,n){this.title=e,this.insertText=t,this.kind=n}},fn=class{constructor(t,e){this.id=t,this.color=e}static isThemeIcon(t){return typeof t.id!="string"?(console.log("INVALID ThemeIcon, invalid id",t.id),!1):!0}};fn=_([he],fn);fn.File=new fn("file");fn.Folder=new fn("folder");var Qa=class{constructor(t){this.id=t}};Qa=_([he],Qa);var lE=(n=>(n[n.Global=1]="Global",n[n.Workspace=2]="Workspace",n[n.WorkspaceFolder=3]="WorkspaceFolder",n))(lE||{}),Vs=class{get base(){return this._base}set base(t){this._base=t,this._baseUri=y.file(t)}get baseUri(){return this._baseUri}set baseUri(t){this._baseUri=t,this._base=t.fsPath}constructor(t,e){if(typeof t!="string"&&(!t||!y.isUri(t)&&!y.isUri(t.uri)))throw $e("base");if(typeof e!="string")throw $e("pattern");typeof t=="string"?this.baseUri=y.file(t):y.isUri(t)?this.baseUri=t:this.baseUri=t.uri,this.pattern=e}toJSON(){return{pattern:this.pattern,base:this.base,baseUri:this.baseUri.toJSON()}}};Vs=_([he],Vs);var A$=new WeakMap;function M$(i,t){A$.set(i,t)}var Ja=class{constructor(t,e,n,o,r){this.enabled=typeof t=="boolean"?t:!0,typeof e=="string"&&(this.condition=e),typeof n=="string"&&(this.hitCondition=n),typeof o=="string"&&(this.logMessage=o),typeof r=="string"&&(this.mode=r)}get id(){return this._id||(this._id=A$.get(this)??_e()),this._id}};Ja=_([he],Ja);var qi=class extends Ja{constructor(t,e,n,o,r,s){if(super(e,n,o,r,s),t===null)throw $e("location");this.location=t}};qi=_([he],qi);var Ki=class extends Ja{constructor(t,e,n,o,r,s){super(e,n,o,r,s),this.functionName=t}};Ki=_([he],Ki);var Eu=class extends Ja{constructor(t,e,n,o,r,s,a,l){if(super(o,r,s,a,l),!e)throw $e("dataId");this.label=t,this.dataId=e,this.canPersist=n}};Eu=_([he],Eu);var ji=class{constructor(t,e,n){this.command=t,this.args=e||[],this.options=n}};ji=_([he],ji);var Gi=class{constructor(t,e){this.port=t,this.host=e}};Gi=_([he],Gi);var Bs=class{constructor(t){this.path=t}};Bs=_([he],Bs);var Ya=class{constructor(t){this.implementation=t}};Ya=_([he],Ya);var ng=class{constructor(t,e,n){this.session=t;this.threadId=e;this.frameId=n}},og=class{constructor(t,e){this.session=t;this.threadId=e}},kd=class{constructor(t,e){this.range=t,this.expression=e}};kd=_([he],kd);var dE=(e=>(e[e.Invoke=0]="Invoke",e[e.Automatic=1]="Automatic",e))(dE||{}),cE=(r=>(r[r.Other=0]="Other",r[r.Empty=1]="Empty",r[r.TokenCancellation=2]="TokenCancellation",r[r.LostRace=3]="LostRace",r[r.NotTaken=4]="NotTaken",r))(cE||{}),Pd=class{constructor(t,e){this.range=t,this.text=e}};Pd=_([he],Pd);var _d=class{constructor(t,e,n=!0){this.range=t,this.variableName=e,this.caseSensitiveLookup=n}};_d=_([he],_d);var Rd=class{constructor(t,e){this.range=t,this.expression=e}};Rd=_([he],Rd);var Ym=class{constructor(t,e){this.frameId=t,this.stoppedLocation=e}};Ym=_([he],Ym);var C0=(t=>(t[t.AIGenerated=1]="AIGenerated",t))(C0||{}),uE=(e=>(e[e.Invoke=0]="Invoke",e[e.Automatic=1]="Automatic",e))(uE||{}),IT=class{constructor(t,e){this.newSymbolName=t,this.tags=e}},pE=(n=>(n[n.Changed=1]="Changed",n[n.Created=2]="Created",n[n.Deleted=3]="Deleted",n))(pE||{}),kt=class extends Error{static FileExists(t){return new kt(t,"EntryExists",kt.FileExists)}static FileNotFound(t){return new kt(t,"EntryNotFound",kt.FileNotFound)}static FileNotADirectory(t){return new kt(t,"EntryNotADirectory",kt.FileNotADirectory)}static FileIsADirectory(t){return new kt(t,"EntryIsADirectory",kt.FileIsADirectory)}static NoPermissions(t){return new kt(t,"NoPermissions",kt.NoPermissions)}static Unavailable(t){return new kt(t,"Unavailable",kt.Unavailable)}constructor(t,e="Unknown",n){super(y.isUri(t)?t.toString(!0):t),this.code=n?.name??"Unknown",QA(this,e),Object.setPrototypeOf(this,kt.prototype),typeof Error.captureStackTrace=="function"&&typeof n=="function"&&Error.captureStackTrace(this,n)}};kt=_([he],kt);var Xm=class{constructor(t,e,n){this.start=t,this.end=e,this.kind=n}};Xm=_([he],Xm);var mE=(n=>(n[n.Comment=1]="Comment",n[n.Imports=2]="Imports",n[n.Region=3]="Region",n))(mE||{}),gE=(e=>(e[e.Collapsed=0]="Collapsed",e[e.Expanded=1]="Expanded",e))(gE||{}),T0=(e=>(e[e.Editing=0]="Editing",e[e.Preview=1]="Preview",e))(T0||{}),E0=(e=>(e[e.Published=0]="Published",e[e.Draft=1]="Draft",e))(E0||{}),fE=(e=>(e[e.Unresolved=0]="Unresolved",e[e.Resolved=1]="Resolved",e))(fE||{}),hE=(e=>(e[e.Current=0]="Current",e[e.Outdated=1]="Outdated",e))(hE||{}),vE=(e=>(e[e.Reply=1]="Reply",e[e.Comment=2]="Comment",e))(vE||{}),Du=class{constructor(t,e=[]){this.tokenTypes=t,this.tokenModifiers=e}};function bQ(i){return typeof i>"u"||kH(i)}var xT=class i{constructor(t){if(this._prevLine=0,this._prevChar=0,this._dataIsSortedAndDeltaEncoded=!0,this._data=[],this._dataLen=0,this._tokenTypeStrToInt=new Map,this._tokenModifierStrToInt=new Map,this._hasLegend=!1,t){this._hasLegend=!0;for(let e=0,n=t.tokenTypes.length;e<n;e++)this._tokenTypeStrToInt.set(t.tokenTypes[e],e);for(let e=0,n=t.tokenModifiers.length;e<n;e++)this._tokenModifierStrToInt.set(t.tokenModifiers[e],e)}}push(t,e,n,o,r){if(typeof t=="number"&&typeof e=="number"&&typeof n=="number"&&typeof o=="number"&&(typeof r=="number"||typeof r>"u"))return typeof r>"u"&&(r=0),this._pushEncoded(t,e,n,o,r);if(ve.isRange(t)&&typeof e=="string"&&bQ(n))return this._push(t,e,n);throw $e()}_push(t,e,n){if(!this._hasLegend)throw new Error("Legend must be provided in constructor");if(t.start.line!==t.end.line)throw new Error("`range` cannot span multiple lines");if(!this._tokenTypeStrToInt.has(e))throw new Error("`tokenType` is not in the provided legend");let o=t.start.line,r=t.start.character,s=t.end.character-t.start.character,a=this._tokenTypeStrToInt.get(e),l=0;if(n)for(let d of n){if(!this._tokenModifierStrToInt.has(d))throw new Error("`tokenModifier` is not in the provided legend");let c=this._tokenModifierStrToInt.get(d);l|=1<<c>>>0}this._pushEncoded(o,r,s,a,l)}_pushEncoded(t,e,n,o,r){if(this._dataIsSortedAndDeltaEncoded&&(t<this._prevLine||t===this._prevLine&&e<this._prevChar)){this._dataIsSortedAndDeltaEncoded=!1;let l=this._data.length/5|0,d=0,c=0;for(let u=0;u<l;u++){let m=this._data[5*u],g=this._data[5*u+1];m===0?(m=d,g+=c):m+=d,this._data[5*u]=m,this._data[5*u+1]=g,d=m,c=g}}let s=t,a=e;this._dataIsSortedAndDeltaEncoded&&this._dataLen>0&&(s-=this._prevLine,s===0&&(a-=this._prevChar)),this._data[this._dataLen++]=s,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=o,this._data[this._dataLen++]=r,this._prevLine=t,this._prevChar=e}static _sortAndDeltaEncode(t){let e=[],n=t.length/5|0;for(let a=0;a<n;a++)e[a]=a;e.sort((a,l)=>{let d=t[5*a],c=t[5*l];if(d===c){let u=t[5*a+1],m=t[5*l+1];return u-m}return d-c});let o=new Uint32Array(t.length),r=0,s=0;for(let a=0;a<n;a++){let l=5*e[a],d=t[l+0],c=t[l+1],u=t[l+2],m=t[l+3],g=t[l+4],h=d-r,f=h===0?c-s:c,I=5*a;o[I+0]=h,o[I+1]=f,o[I+2]=u,o[I+3]=m,o[I+4]=g,r=d,s=c}return o}build(t){return this._dataIsSortedAndDeltaEncoded?new Qi(new Uint32Array(this._data),t):new Qi(i._sortAndDeltaEncode(this._data),t)}},Qi=class{constructor(t,e){this.resultId=e,this.data=t}},rg=class{constructor(t,e,n){this.start=t,this.deleteCount=e,this.data=n}},Od=class{constructor(t,e){this.resultId=e,this.edits=t}},yE=(e=>(e[e.Separate=0]="Separate",e[e.MergeWithParent=1]="MergeWithParent",e))(yE||{}),ST=class{constructor(t){this.name=t}},w0=(n=>(n[n.Title=1]="Title",n[n.Inline=2]="Inline",n[n.Input=3]="Input",n))(w0||{}),Ns=class{constructor(){}};Ns.Back={iconPath:new fn("arrow-left")},Ns=_([he],Ns);var bE=(e=>(e[e.Separator=-1]="Separator",e[e.Default=0]="Default",e))(bE||{}),IE=(n=>(n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error",n))(IE||{}),xE=(e=>(e[e.UI=1]="UI",e[e.Workspace=2]="Workspace",e))(xE||{}),Au=class{static validate(t){if(typeof t.badge=="string"){let e=BR(t.badge,0);if(e<t.badge.length&&(e+=BR(t.badge,e)),t.badge.length>e)throw new Error("The 'badge'-property must be undefined or a short character")}else if(t.badge&&!fn.isThemeIcon(t.badge))throw new Error("The 'badge'-property is not a valid ThemeIcon");if(!t.color&&!t.badge&&!t.tooltip)throw new Error("The decoration is empty");return!0}constructor(t,e,n){this.badge=t,this.tooltip=e,this.color=n}},wu=class{constructor(t){this.kind=t}};wu=_([he],wu);var SE=(o=>(o[o.Light=1]="Light",o[o.Dark=2]="Dark",o[o.HighContrast=3]="HighContrast",o[o.HighContrastLight=4]="HighContrastLight",o))(SE||{}),CT=class{constructor(t,e,n){this.label=t;this.uri=e;this.position=n}},k0=(n=>(n[n.Idle=1]="Idle",n[n.Pending=2]="Pending",n[n.Executing=3]="Executing",n))(k0||{}),CE=(e=>(e[e.Left=1]="Left",e[e.Right=2]="Right",e))(CE||{}),TE=(o=>(o[o.Default=0]="Default",o[o.InCenter=1]="InCenter",o[o.InCenterIfOutsideViewport=2]="InCenterIfOutsideViewport",o[o.AtTop=3]="AtTop",o))(TE||{}),TT=class{constructor(t,e){this.text=t;this.alignment=e}},P0=(e=>(e[e.Default=1]="Default",e[e.Preferred=2]="Preferred",e))(P0||{}),EE=(n=>(n[n.Default=1]="Default",n[n.Preferred=2]="Preferred",n[n.Hidden=-1]="Hidden",n))(EE||{}),ig=class{constructor(t,e=[]){this.uri=t;this.provides=On(e)}},ET=class{constructor(t){this.label=t}},wE=(e=>(e[e.Named=1]="Named",e[e.Indexed=2]="Indexed",e))(wE||{}),Zm=class{constructor(t,e){this.label=t;this.timestamp=e}};Zm=_([he],Zm);var kE=(n=>(n[n.Production=1]="Production",n[n.Development=2]="Development",n[n.Test=3]="Test",n))(kE||{}),PE=(e=>(e[e.Node=1]="Node",e[e.Webworker=2]="Webworker",e))(PE||{}),tb=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(tb||{}),_0=(r=>(r[r.None=0]="None",r[r.Italic=1]="Italic",r[r.Bold=2]="Bold",r[r.Underline=4]="Underline",r[r.Strikethrough=8]="Strikethrough",r))(_0||{}),wT=class{constructor(t,e){this.ranges=t;this.wordPattern=e}},kT=class{constructor(t){this._autoForwardAction=t}get autoForwardAction(){return this._autoForwardAction}},R0=(s=>(s[s.Queued=1]="Queued",s[s.Running=2]="Running",s[s.Passed=3]="Passed",s[s.Failed=4]="Failed",s[s.Skipped=5]="Skipped",s[s.Errored=6]="Errored",s))(R0||{}),_E=(n=>(n[n.Run=1]="Run",n[n.Debug=2]="Debug",n[n.Coverage=3]="Coverage",n))(_E||{}),sg=class{constructor(t,e,n){this.controllerId=t;this.profileId=e;this.kind=n}},Dd=class{constructor(t=void 0,e=void 0,n=void 0,o=!1,r=!0){this.include=t;this.exclude=e;this.profile=n;this.continuous=o;this.preserveFocus=r}};Dd=_([he],Dd);var $s=class{constructor(t){this.message=t}static diff(t,e,n){let o=new $s(t);return o.expectedOutput=e,o.actualOutput=n,o}};$s=_([he],$s);var Xa=class{constructor(t){this.id=t}};Xa=_([he],Xa);var PT=class{constructor(t,e,n){this.label=t;this.uri=e;this.position=n}},_u=class{constructor(t,e){this.covered=t;this.total=e;nb(this)}};function nb(i){if(i){if(i.covered>i.total)throw new Error(`The total number of covered items (${i.covered}) cannot be greater than the total (${i.total})`);if(i.total<0)throw new Error(`The number of covered items (${i.total}) cannot be negative`)}}var Za=class i{constructor(t,e,n,o,r=[]){this.uri=t;this.statementCoverage=e;this.branchCoverage=n;this.declarationCoverage=o;this.includesTests=r}static fromDetails(t,e){let n=new _u(0,0),o=new _u(0,0),r=new _u(0,0);for(let a of e)if("branches"in a){n.total+=1,n.covered+=a.executed?1:0;for(let l of a.branches)o.total+=1,o.covered+=l.executed?1:0}else r.total+=1,r.covered+=a.executed?1:0;let s=new i(t,n,o.total>0?o:void 0,r.total>0?r:void 0);return s.detailedCoverage=e,s}},ag=class{constructor(t,e,n=[]){this.executed=t;this.location=e;this.branches=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},lg=class{constructor(t,e,n){this.executed=t;this.location=e;this.label=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},dg=class{constructor(t,e,n){this.name=t;this.executed=e;this.location=n}get executionCount(){return+this.executed}set executionCount(t){this.executed=t}},D0=(o=>(o[o.None=0]="None",o[o.Option=1]="Option",o[o.Default=2]="Default",o[o.Preferred=3]="Preferred",o))(D0||{}),A0=(n=>(n[n.Untrusted=0]="Untrusted",n[n.Trusted=1]="Trusted",n[n.Unspecified=2]="Unspecified",n))(A0||{}),M0=(s=>(s[s.Notify=1]="Notify",s[s.OpenBrowser=2]="OpenBrowser",s[s.OpenPreview=3]="OpenPreview",s[s.Silent=4]="Silent",s[s.Ignore=5]="Ignore",s[s.OpenBrowserOnce=6]="OpenBrowserOnce",s))(M0||{}),Nd=class{constructor(t,e,n,o,r,s){this.kind=t,this.name=e,this.detail=n,this.uri=o,this.range=r,this.selectionRange=s}},Ud=class{constructor(t){this.uri=t}},el=class{constructor(t,e){this.original=t;this.modified=e}},cg=class{constructor(t,e,n,o){this.base=t;this.input1=e;this.input2=n;this.result=o}},Fd=class{constructor(t,e){this.uri=t;this.viewType=e}},ug=class{constructor(t){this.viewType=t}},Hd=class{constructor(t,e){this.uri=t;this.notebookType=e}},Wd=class{constructor(t,e,n){this.original=t;this.modified=e;this.notebookType=n}},pg=class{constructor(){}},mg=class{constructor(t,e){this.uri=t;this.inputBoxUri=e}},gg=class{constructor(){}},fg=class{constructor(t){this.textDiffs=t}},L0=(e=>(e[e.Down=0]="Down",e[e.Up=1]="Up",e))(L0||{}),O0=(e=>(e[e.Action=1]="Action",e[e.Toolbar=2]="Toolbar",e))(O0||{}),N0=(n=>(n[n.Short=1]="Short",n[n.Medium=2]="Medium",n[n.Full=3]="Full",n))(N0||{}),_T=class{constructor(t,e,n){this.id=t,this.label=e,this.values=n}},RE=(n=>(n[n.Accepted=1]="Accepted",n[n.Rejected=2]="Rejected",n[n.Saved=3]="Saved",n))(RE||{}),U0=(n=>(n[n.Keep=1]="Keep",n[n.Undo=2]="Undo",n[n.UserModification=3]="UserModification",n))(U0||{}),F0=(r=>(r[r.Unhelpful=0]="Unhelpful",r[r.Helpful=1]="Helpful",r[r.Undone=2]="Undone",r[r.Accepted=3]="Accepted",r[r.Bug=4]="Bug",r))(F0||{}),DE=(e=>(e[e.Unhelpful=0]="Unhelpful",e[e.Helpful=1]="Helpful",e))(DE||{}),tl=class{constructor(t){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new en(t):t}},qs=class{constructor(t,e){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new en(t):t,this.vulnerabilities=e}},nl=class{constructor(t,e,n,o){this.title=t,this.message=e,this.data=n,this.buttons=o}},ol=class{constructor(t,e){this.value=t,this.baseUri=e}},Mu=class{constructor(t,e,n){this.value=t,this.title=e,this.readOnly=n}},RT=class{constructor(t,e){this.data=t,this.mimeType=e}},hg=class{constructor(t,e,n,o){this.description=t,this.agentName=e,this.prompt=n,this.result=o}},Lu=class{constructor(t,e){this.uris=t;this.callback=e;this.applied=new Promise(n=>{this.didGetApplied=n})}},Ks=class{constructor(t,e){this.value=t,this.value2=t,this.title=e}},Ou=class{constructor(t){this.value=t}},Vd=class{constructor(t,e){this.value=t,this.task=e}},Ji=class{constructor(t,e,n){this.value=t,this.id=e,this.metadata=n}},rl=class{constructor(t,e,n,o){this.hookType=t,this.stopReason=e,this.systemMessage=n,this.metadata=o}},Bd=class{constructor(t,e){this.id=t,this.value=e}},js=class{constructor(t){this.resolvedModel=t}},Gs=class{constructor(t){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new en(t):t}},il=class{constructor(t){if(typeof t!="string"&&t.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof t=="string"?new en(t):t}},sl=class{constructor(t){this.value=t}},fi=class{constructor(t,e,n){this.value=t,this.iconPath=e,this.options=n}},al=class{constructor(t,e,n){this.value=t,this.isEdit=e,this.undoStopId=n}},ll=class{constructor(t,e,n){this.value=t,this.license=e,this.snippet=n}},dl=class{constructor(t,e){this.uri=t;this.range=e}},$d=class{constructor(t){this.extensions=t}},zd=class{constructor(t,e,n,o,r){this.title=e;this.description=n;this.author=o;this.linkTag=r;jl(t)?(this.uri=t,this.command={title:"Open Pull Request",command:"vscode.open",arguments:[t]}):this.command=t}toJSON(){return{$mid:26,uri:this.uri,title:this.title,description:this.description,author:this.author}}},AE=(n=>(n[n.Text=1]="Text",n[n.SingleSelect=2]="SingleSelect",n[n.MultiSelect=3]="MultiSelect",n))(AE||{}),vg=class{constructor(t,e,n,o){this.id=t,this.type=e,this.title=n,this.message=o?.message,this.options=o?.options,this.defaultValue=o?.defaultValue,this.allowFreeformInput=o?.allowFreeformInput}},Qs=class{constructor(t,e=!0){this.questions=t,this.allowSkip=e}},Js=class{constructor(t,e){this.uri=t,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},cl=class{constructor(t,e){this.uri=t,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},qd=class{constructor(t){this.edits=t}},ME=(n=>(n[n.NotStarted=1]="NotStarted",n[n.InProgress=2]="InProgress",n[n.Completed=3]="Completed",n))(ME||{}),LE=(n=>(n[n.Running=0]="Running",n[n.Completed=1]="Completed",n[n.Failed=2]="Failed",n))(LE||{}),Nu=class{constructor(t,e,n){this.toolName=t,this.toolCallId=e,this.errorMessage=n}},Ys=class{constructor(t,e,n,o,r,s,a,l,d){this.prompt=t;this.command=e;this.references=n;this.participant=o;this.toolReferences=r;this.editedFileEvents=s;this.id=a;this.modelId=l;this.modeInstructions2=d}},yg=class{constructor(t,e,n,o){this.response=t;this.result=e;this.participant=n;this.command=o}},DT=class{constructor(t,e,n,o){this.response=t;this.result=e;this.participant=n;this.command=o}},OE=(o=>(o[o.Panel=1]="Panel",o[o.Terminal=2]="Terminal",o[o.Notebook=3]="Notebook",o[o.Editor=4]="Editor",o))(OE||{}),H0=(o=>(o[o.Failed=0]="Failed",o[o.Completed=1]="Completed",o[o.InProgress=2]="InProgress",o[o.NeedsInput=3]="NeedsInput",o))(H0||{}),hi=class i{constructor(t){this.id=t}static{this.Agent=new i("agent")}static{this.Skill=new i("skill")}static{this.Instructions=new i("instructions")}static{this.Prompt=new i("prompt")}static{this.Hook=new i("hook")}static{this.Plugins=new i("plugins")}},W0=(o=>(o[o.Trace=0]="Trace",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(W0||{}),NE=(e=>(e[e.Success=0]="Success",e[e.Error=1]="Error",e))(NE||{}),UE=(n=>(n[n.Success=0]="Success",n[n.Error=1]="Error",n[n.NonBlockingError=2]="NonBlockingError",n))(UE||{}),bg=class{constructor(t,e){this._kind="toolCall";this.toolName=t,this.created=e}},Ig=class{constructor(t){this._kind="modelTurn";this.created=t}},xg=class{constructor(t,e,n){this._kind="generic";this.name=t,this.level=e,this.created=n}},Sg=class{constructor(t,e){this._kind="subagentInvocation";this.agentName=t,this.created=e}},Uu=class{constructor(t,e){this.name=t,this.content=e}},Cg=class{constructor(t,e){this._kind="userMessage";this.message=t,this.created=e,this.sections=[]}},Tg=class{constructor(t,e){this._kind="agentResponse";this.message=t,this.created=e,this.sections=[]}},AT=class{constructor(t){this._kind="text";this.value=t}},FE=(e=>(e[e.User=0]="User",e[e.Agent=1]="Agent",e))(FE||{}),MT=class{constructor(t,e,n){this._kind="messageContent";this.type=t,this.message=e,this.sections=n}},LT=class{constructor(t){this._kind="toolCallContent";this.toolName=t}},OT=class{constructor(t){this._kind="modelTurnContent";this.requestName=t}},NT=class{constructor(t){this._kind="hookContent";this.hookType=t}},UT=class{constructor(t,e,n,o,r){this.uri=t;this.originalUri=e;this.modifiedUri=n;this.insertions=o;this.deletions=r}},V0=(n=>(n[n.Complete=1]="Complete",n[n.Partial=2]="Partial",n[n.Omitted=3]="Omitted",n))(V0||{}),B0=(n=>(n[n.NoReason=0]="NoReason",n[n.FilteredContentRetry=1]="FilteredContentRetry",n[n.CopyrightContentRetry=2]="CopyrightContentRetry",n))(B0||{}),Eg=class{constructor(t,e,n,o){this.editor=t;this.document=e;this.selection=n;this.wholeRange=o}},wg=class{constructor(t){this.cell=t}},Fu=class{constructor(t,e,n,o,r){this.mimeType=t,this.data=e,this.reference=n,this.isPasted=o,this.isURL=r}},Kd=class{constructor(t){this.diagnostics=t}},ob=(n=>(n[n.User=1]="User",n[n.Assistant=2]="Assistant",n[n.System=3]="System",n))(ob||{}),Xs=class{constructor(t,e,n){this.callId=t,this.content=e,this.isError=n??!1}},$0=(n=>(n[n.Info=0]="Info",n[n.Warning=1]="Warning",n[n.Error=2]="Error",n))($0||{}),z0=(n=>(n[n.Info=0]="Info",n[n.Warning=1]="Warning",n[n.Error=2]="Error",n))(z0||{}),kg=class i{constructor(t,e,n){this._content=[];this.role=t,this.content=e,this.name=n}static User(t,e){return new i(1,t,e)}static Assistant(t,e){return new i(2,t,e)}set content(t){typeof t=="string"?this._content=[new sn(t)]:this._content=t}get content(){return this._content}},Pg=class i{constructor(t,e,n){this._content=[];this.role=t,this.content=e,this.name=n}static User(t,e){return new i(1,t,e)}static Assistant(t,e){return new i(2,t,e)}set content(t){typeof t=="string"?this._content=[new sn(t)]:this._content=t}get content(){return this._content}set content2(t){t&&(this.content=t.map(e=>typeof e=="string"?new sn(e):e))}get content2(){return this.content.map(t=>t instanceof sn?t.value:t)}},vi=class{constructor(t,e,n){this.callId=t,this.name=e,this.input=n}},HE=(n=>(n[n.Assistant=0]="Assistant",n[n.User=1]="User",n[n.Extension=2]="Extension",n))(HE||{}),sn=class{constructor(t,e){this.value=t,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},Wn=class i{constructor(t,e,n){this.mimeType=e,this.data=t,this.audience=n}static image(t,e){return new i(t,e)}static json(t,e="text/x-json"){let n=JSON.stringify(t,void 0,"	");return new i(H.fromString(n).buffer,e)}static text(t,e=Tr.text){return new i(H.fromString(t).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:eo(H.wrap(this.data)),audience:this.audience}}},q0=(r=>(r.PNG="image/png",r.JPEG="image/jpeg",r.GIF="image/gif",r.WEBP="image/webp",r.BMP="image/bmp",r))(q0||{}),Yi=class{constructor(t,e,n){this.value=t,this.id=e,this.metadata=n}toJSON(){return{$mid:22,value:this.value,id:this.id,metadata:this.metadata}}},yi=class{constructor(t){this.value=t}toJSON(){return{$mid:23,value:this.value}}};var Ar=class i extends Error{static#e="LanguageModelError";static NotFound(t){return new i(t,i.NotFound.name)}static NoPermissions(t){return new i(t,i.NoPermissions.name)}static Blocked(t){return new i(t,i.Blocked.name)}static tryDeserialize(t){if(t.name===i.#e)return new i(t.message,t.code,t.cause)}constructor(t,e,n){super(t,{cause:n}),this.name=i.#e,this.code=e??""}},jd=class{constructor(t){this.content=t}toJSON(){return{$mid:20,content:this.content}}},FT=class{constructor(t){this.content=t}toJSON(){return{$mid:20,content:this.content}}},HT=class extends jd{},WE=(e=>(e[e.Auto=1]="Auto",e[e.Required=2]="Required",e))(WE||{}),_g=class{constructor(t,e){this.id=t;this.label=e}},Rg=class{constructor(t,e,n){this.label=t;this.name=e;this.instructions=n}},K0=(o=>(o[o.SymbolInformation=1]="SymbolInformation",o[o.CommandInformation=2]="CommandInformation",o[o.SearchInformation=3]="SearchInformation",o[o.SettingInformation=4]="SettingInformation",o))(K0||{}),j0=(n=>(n[n.EMBEDDED=1]="EMBEDDED",n[n.LLM_RANKED=2]="LLM_RANKED",n[n.CANCELED=3]="CANCELED",n))(j0||{}),G0=(r=>(r[r.Started=1]="Started",r[r.Recognizing=2]="Recognizing",r[r.Recognized=3]="Recognized",r[r.Stopped=4]="Stopped",r[r.Error=5]="Error",r))(G0||{}),Q0=(n=>(n[n.Started=1]="Started",n[n.Stopped=2]="Stopped",n[n.Error=3]="Error",n))(Q0||{}),J0=(e=>(e[e.Recognized=1]="Recognized",e[e.Stopped=2]="Stopped",e))(J0||{}),VE=(e=>(e[e.Initial=0]="Initial",e[e.Dynamic=1]="Dynamic",e))(VE||{}),Hu=class{constructor(t,e,n,o={},r,s){this.label=t;this.command=e;this.args=n;this.env=o;this.version=r;this.metadata=s}},Wu=class{constructor(t,e,n={},o,r,s){this.label=t;this.uri=e;this.headers=n;this.version=o;this.metadata=r;this.authentication=s}};var Do;(e=>{function i(n){let{selectionStartLineNumber:o,selectionStartColumn:r,positionLineNumber:s,positionColumn:a}=n,l=new De(o-1,r-1),d=new De(s-1,a-1);return new oo(l,d)}e.to=i;function t(n){let{anchor:o,active:r}=n;return{selectionStartLineNumber:o.line+1,selectionStartColumn:o.character+1,positionLineNumber:r.line+1,positionColumn:r.character+1}}e.from=t})(Do||={});var K;(e=>{function i(n){if(!n)return;let{start:o,end:r}=n;return{startLineNumber:o.line+1,startColumn:o.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}e.from=i;function t(n){if(!n)return;let{startLineNumber:o,startColumn:r,endLineNumber:s,endColumn:a}=n;return new ve(o-1,r-1,s-1,a-1)}e.to=t})(K||={});var bi;(e=>{function i(n){return{uri:n.uri,range:K.from(n.range)}}e.from=i;function t(n){return new rn(y.revive(n.uri),K.to(n.range))}e.to=t})(bi||={});var rL;(t=>{function i(e){switch(e){case 1:return 1;case 0:return 0;case 3:return 3;case 2:return 2}}t.to=i})(rL||={});var ht;(e=>{function i(n){return new De(n.lineNumber-1,n.column-1)}e.to=i;function t(n){return{lineNumber:n.line+1,column:n.character+1}}e.from=t})(ht||={});var Zs;(n=>{function i(o,r,s){return nt(On(o).map(a=>t(a,r,s)))}n.from=i;function t(o,r,s){if(typeof o=="string")return{$serialized:!0,language:o,isBuiltin:s?.isBuiltin};if(o)return{$serialized:!0,language:o.language,scheme:e(o.scheme,r),pattern:Jo.from(o.pattern)??void 0,exclusive:o.exclusive,notebookType:o.notebookType,isBuiltin:s?.isBuiltin}}function e(o,r){return r&&typeof o=="string"?r.transformOutgoingScheme(o):o}})(Zs||={});var iL;(e=>{function i(n){return n.viewType!==void 0}function t(n,o,r){return i(n)?{viewType:n.viewType}:{uri:Zs.from(n.uri,o,r)}}e.from=t})(iL||={});var Y0;(e=>{function i(n){switch(n){case 1:return 1;case 2:return 2}}e.from=i;function t(n){switch(n){case 1:return 1;case 2:return 2;default:return}}e.to=t})(Y0||={});var ml;(e=>{function i(n){let o;return n.code&&(Pe(n.code)||jn(n.code)?o=String(n.code):o={value:String(n.code.value),target:n.code.target}),{...K.from(n.range),message:n.message,source:n.source,code:o,severity:BE.from(n.severity),relatedInformation:n.relatedInformation&&n.relatedInformation.map(X0.from),tags:Array.isArray(n.tags)?nt(n.tags.map(Y0.from)):void 0}}e.from=i;function t(n){let o=new Ka(K.to(n),n.message,BE.to(n.severity));return o.source=n.source,o.code=Pe(n.code)?n.code:n.code?.value,o.relatedInformation=n.relatedInformation&&n.relatedInformation.map(X0.to),o.tags=n.tags&&nt(n.tags.map(Y0.to)),o}e.to=t})(ml||={});var X0;(e=>{function i(n){return{...K.from(n.location.range),message:n.message,resource:n.location.uri}}e.from=i;function t(n){return new Ms(new rn(n.resource,K.to(n)),n.message)}e.to=t})(X0||={});var BE;(e=>{function i(n){switch(n){case 0:return 8;case 1:return 4;case 2:return 2;case 3:return 1}return 8}e.from=i;function t(n){switch(n){case 2:return 2;case 4:return 1;case 8:return 0;case 1:return 3;default:return 0}}e.to=t})(BE||={});var zt;(e=>{function i(n){return typeof n=="number"&&n>=1?n-1:n===-2?C$:S$}e.from=i;function t(n){if(typeof n=="number"&&n>=0)return n+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=t})(zt||={});function EQ(i){return typeof i.range<"u"}function sL(i){return i.length===0?!0:!!EQ(i[0])}var fe;(s=>{function i(a){return a.map(s.from)}s.fromMany=i;function t(a){return a&&typeof a=="object"&&typeof a.language=="string"&&typeof a.value=="string"}function e(a){let l;if(t(a)){let{language:u,value:m}=a;l={value:"```"+u+`
`+m+"\n```\n"}}else en.isMarkdownString(a)?l={value:a.value,isTrusted:a.isTrusted,supportThemeIcons:a.supportThemeIcons,supportHtml:a.supportHtml,supportAlertSyntax:a.supportAlertSyntax,baseUri:a.baseUri}:typeof a=="string"?l={value:a}:l={value:""};let d=Object.create(null);l.uris=d;let c=({href:u})=>{try{let m=y.parse(u,!0);m=m.with({query:n(m.query,d)}),d[u]=m}catch{}return""};return Qt.walkTokens(Qt.lexer(l.value),u=>{u.type==="link"?c({href:u.href}):u.type==="image"&&typeof u.href=="string"&&c(fV(u.href))}),l}s.from=e;function n(a,l){if(!a)return a;let d;try{d=Vx(a)}catch{}if(!d)return a;let c=!1;return d=Mi(d,u=>{if(y.isUri(u)){let m=`__uri_${Math.random().toString(16).slice(2,8)}`;return l[m]=u,c=!0,m}else return}),c?JSON.stringify(d):a}function o(a){let l=new en(a.value,a.supportThemeIcons);return l.isTrusted=a.isTrusted,l.supportHtml=a.supportHtml,l.supportAlertSyntax=a.supportAlertSyntax,l.baseUri=a.baseUri?y.from(a.baseUri):void 0,l}s.to=o;function r(a){if(a)return typeof a=="string"?a:s.from(a)}s.fromStrict=r})(fe||={});function O$(i){return sL(i)?i.map(t=>({range:K.from(t.range),hoverMessage:Array.isArray(t.hoverMessage)?fe.fromMany(t.hoverMessage):t.hoverMessage?fe.from(t.hoverMessage):void 0,renderOptions:t.renderOptions})):i.map(t=>({range:K.from(t)}))}function ub(i){return typeof i>"u"?i:typeof i=="string"?y.file(i):i}var rb;(t=>{function i(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?ub(e.contentIconPath):void 0,border:e.border,borderColor:e.borderColor,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,color:e.color,backgroundColor:e.backgroundColor,margin:e.margin,width:e.width,height:e.height}}t.from=i})(rb||={});var Z0;(t=>{function i(e){return typeof e>"u"?e:{backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?ub(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?rb.from(e.before):void 0,after:e.after?rb.from(e.after):void 0}}t.from=i})(Z0||={});var N$;(t=>{function i(e){if(typeof e>"u")return e;switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}t.from=i})(N$||={});var aL;(t=>{function i(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?N$.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?Z0.from(e.light):void 0,dark:e.dark?Z0.from(e.dark):void 0,backgroundColor:e.backgroundColor,outline:e.outline,outlineColor:e.outlineColor,outlineStyle:e.outlineStyle,outlineWidth:e.outlineWidth,border:e.border,borderColor:e.borderColor,borderRadius:e.borderRadius,borderSpacing:e.borderSpacing,borderStyle:e.borderStyle,borderWidth:e.borderWidth,fontStyle:e.fontStyle,fontWeight:e.fontWeight,textDecoration:e.textDecoration,cursor:e.cursor,color:e.color,opacity:e.opacity,letterSpacing:e.letterSpacing,gutterIconPath:e.gutterIconPath?ub(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?rb.from(e.before):void 0,after:e.after?rb.from(e.after):void 0}}t.from=i})(aL||={});var Mn;(e=>{function i(n){return{text:n.newText,eol:n.newEol&&qu.from(n.newEol),range:K.from(n.range)}}e.from=i;function t(n){let o=new Qn(K.to(n.range),n.text);return o.newEol=typeof n.eol>"u"?void 0:qu.to(n.eol),o}e.to=t})(Mn||={});var Io;(e=>{function i(n,o){let r={edits:[]};if(n instanceof Dr){let s=new Lr;for(let a of n._allEntries())a._type===1&&y.isUri(a.to)&&a.from===void 0&&s.add(a.to);for(let a of n._allEntries())if(a._type===1){let l;a.options?.contents&&(ArrayBuffer.isView(a.options.contents)?l={type:"base64",value:eo(H.wrap(a.options.contents))}:l={type:"dataTransferItem",id:a.options.contents._itemId}),r.edits.push({oldResource:a.from,newResource:a.to,options:{...a.options,contents:l},metadata:a.metadata})}else a._type===2?r.edits.push({resource:a.uri,textEdit:Mn.from(a.edit),versionId:s.has(a.uri)?void 0:o?.getTextDocumentVersion(a.uri),metadata:a.metadata}):a._type===6?r.edits.push({resource:a.uri,textEdit:{range:K.from(a.range),text:a.edit.value,insertAsSnippet:!0,keepWhitespace:a.keepWhitespace},versionId:s.has(a.uri)?void 0:o?.getTextDocumentVersion(a.uri),metadata:a.metadata}):a._type===3?r.edits.push({metadata:a.metadata,resource:a.uri,cellEdit:a.edit,notebookVersionId:o?.getNotebookDocumentVersion(a.uri)}):a._type===5&&r.edits.push({metadata:a.metadata,resource:a.uri,notebookVersionId:o?.getNotebookDocumentVersion(a.uri),cellEdit:{editType:1,index:a.index,count:a.count,cells:a.cells.map(sb.from)}})}return r}e.from=i;function t(n){let o=new Dr,r=new Ve;for(let s of n.edits)if(s.textEdit){let a=s,l=y.revive(a.resource),d=K.to(a.textEdit.range),c=a.textEdit.text,u=a.textEdit.insertAsSnippet,m;u?m=ja.replace(d,new ro(c)):m=Qn.replace(d,c);let g=r.get(l);g?g.push(m):r.set(l,[m])}else o.renameFile(y.revive(s.oldResource),y.revive(s.newResource),s.options);for(let[s,a]of r)o.set(s,a);return o}e.to=t})(Io||={});var zr;(n=>{let i=Object.create(null);i[0]=0,i[1]=1,i[2]=2,i[3]=3,i[4]=4,i[5]=5,i[6]=6,i[7]=7,i[8]=8,i[9]=9,i[10]=10,i[11]=11,i[12]=12,i[13]=13,i[14]=14,i[15]=15,i[16]=16,i[17]=17,i[18]=18,i[19]=19,i[20]=20,i[21]=21,i[22]=22,i[23]=23,i[24]=24,i[25]=25;function t(o){return typeof i[o]=="number"?i[o]:6}n.from=t;function e(o){for(let r in i)if(i[r]===o)return Number(r);return 6}n.to=e})(zr||={});var ul;(e=>{function i(n){if(n===1)return 1}e.from=i;function t(n){if(n===1)return 1}e.to=t})(ul||={});var Gd;(e=>{function i(n){return{name:n.name,kind:zr.from(n.kind),tags:n.tags&&n.tags.map(ul.from),containerName:n.containerName,location:bo.from(n.location)}}e.from=i;function t(n){let o=new Br(n.name,zr.to(n.kind),n.containerName,bo.to(n.location));return o.tags=n.tags&&n.tags.map(ul.to),o}e.to=t})(Gd||={});var lL;(e=>{function i(n){let o={name:n.name||"!!MISSING: name!!",detail:n.detail,range:K.from(n.range),selectionRange:K.from(n.selectionRange),kind:zr.from(n.kind),tags:n.tags?.map(ul.from)??[]};return n.children&&(o.children=n.children.map(i)),o}e.from=i;function t(n){let o=new $r(n.name,n.detail,zr.to(n.kind),K.to(n.range),K.to(n.selectionRange));return Ul(n.tags)&&(o.tags=n.tags.map(ul.to)),n.children&&(o.children=n.children.map(t)),o}e.to=t})(lL||={});var gl;(e=>{function i(n){let o=new Md(zr.to(n.kind),n.name,n.detail||"",y.revive(n.uri),K.to(n.range),K.to(n.selectionRange));return o._sessionId=n._sessionId,o._itemId=n._itemId,o}e.to=i;function t(n,o,r){if(o=o??n._sessionId,r=r??n._itemId,o===void 0||r===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:r,name:n.name,detail:n.detail,kind:zr.from(n.kind),uri:n.uri,range:K.from(n.range),selectionRange:K.from(n.selectionRange),tags:n.tags?.map(ul.from)}}e.from=t})(gl||={});var dL;(t=>{function i(e){return new eg(gl.to(e.from),e.fromRanges.map(n=>K.to(n)))}t.to=i})(dL||={});var cL;(t=>{function i(e){return new tg(gl.to(e.to),e.fromRanges.map(n=>K.to(n)))}t.to=i})(cL||={});var bo;(e=>{function i(n){return{range:n.range&&K.from(n.range),uri:n.uri}}e.from=i;function t(n){return new rn(y.revive(n.uri),K.to(n.range))}e.to=t})(bo||={});var Lg;(e=>{function i(n){let o=n,r=n;return{originSelectionRange:o.originSelectionRange?K.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:r.uri,range:K.from(o.targetRange?o.targetRange:r.range),targetSelectionRange:o.targetSelectionRange?K.from(o.targetSelectionRange):void 0}}e.from=i;function t(n){return{targetUri:y.revive(n.uri),targetRange:K.to(n.range),targetSelectionRange:n.targetSelectionRange?K.to(n.targetSelectionRange):void 0,originSelectionRange:n.originSelectionRange?K.to(n.originSelectionRange):void 0}}e.to=t})(Lg||={});var Og;(e=>{function i(n){return{range:K.from(n.range),contents:fe.fromMany(n.contents),canIncreaseVerbosity:n.canIncreaseVerbosity,canDecreaseVerbosity:n.canDecreaseVerbosity}}e.from=i;function t(n){let o=n.contents.map(fe.to),r=K.to(n.range),s=n.canIncreaseVerbosity,a=n.canDecreaseVerbosity;return new vd(o,r,s,a)}e.to=t})(Og||={});var uL;(e=>{function i(n){return{range:K.from(n.range),expression:n.expression}}e.from=i;function t(n){return new kd(K.to(n.range),n.expression)}e.to=t})(uL||={});var pb;(e=>{function i(n){if(n instanceof Pd)return{type:"text",range:K.from(n.range),text:n.text};if(n instanceof _d)return{type:"variable",range:K.from(n.range),variableName:n.variableName,caseSensitiveLookup:n.caseSensitiveLookup};if(n instanceof Rd)return{type:"expression",range:K.from(n.range),expression:n.expression};throw new Error("Unknown 'InlineValue' type")}e.from=i;function t(n){switch(n.type){case"text":return{range:K.to(n.range),text:n.text};case"variable":return{range:K.to(n.range),variableName:n.variableName,caseSensitiveLookup:n.caseSensitiveLookup};case"expression":return{range:K.to(n.range),expression:n.expression}}}e.to=t})(pb||={});var mb;(e=>{function i(n){return{frameId:n.frameId,stoppedLocation:K.from(n.stoppedLocation)}}e.from=i;function t(n){return new Ym(n.frameId,K.to(n.stoppedLocation))}e.to=t})(mb||={});var zu;(e=>{function i(n){return{range:K.from(n.range),kind:n.kind}}e.from=i;function t(n){return new yd(K.to(n.range),n.kind)}e.to=t})(zu||={});var pL;(e=>{function i(n){return{uri:n.uri,highlights:n.highlights.map(zu.from)}}e.from=i;function t(n){return new bd(y.revive(n.uri),n.highlights.map(zu.to))}e.to=t})(pL||={});var U$;(t=>{function i(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}t.to=i})(U$||={});var mL;(t=>{function i(e){return{triggerKind:U$.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}t.to=i})(mL||={});var $E;(e=>{function i(n){if(n===1)return 1}e.from=i;function t(n){if(n===1)return 1}e.to=t})($E||={});var gL;(t=>{function i(e,n,o){return"icon"in e&&"command"in e?{command:n.toInternal(e.command,o),icon:Xi.fromThemeIcon(e.icon)}:{command:n.toInternal(e,o)}}t.from=i})(gL||={});var zE;(o=>{let i=new Map([[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,7],[21,6],[8,8],[9,9],[10,12],[11,13],[20,14],[12,15],[19,16],[13,17],[14,28],[0,18],[15,19],[16,20],[17,21],[18,23],[22,10],[23,11],[24,24],[26,26],[25,25]]);function t(r){return i.get(r)??9}o.from=t;let e=new Map([[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[7,7],[6,21],[8,8],[9,9],[12,10],[13,11],[14,20],[15,12],[16,19],[17,13],[28,14],[18,0],[19,15],[20,16],[21,17],[23,18],[10,22],[11,23],[24,24],[25,25],[26,26]]);function n(r){return e.get(r)??9}o.to=n})(zE||={});var fL;(t=>{function i(e,n){let o=new Cd(e.label);return o.insertText=e.insertText,o.kind=zE.to(e.kind),o.tags=e.tags?.map($E.to),o.detail=e.detail,o.documentation=qo(e.documentation)?fe.to(e.documentation):e.documentation,o.sortText=e.sortText,o.filterText=e.filterText,o.preselect=e.preselect,o.commitCharacters=e.commitCharacters,ze.isIRange(e.range)?o.range=K.to(e.range):typeof e.range=="object"&&(o.range={inserting:K.to(e.range.insert),replacing:K.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new ro(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof ve?new Qn(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(r=>Mn.to(r))),o.command=n&&e.command?n.fromInternal(e.command):void 0,o}t.to=i})(fL||={});var eL;(e=>{function i(n){if(typeof n.label!="string"&&!Array.isArray(n.label))throw new TypeError("Invalid label");return{label:n.label,documentation:fe.fromStrict(n.documentation)}}e.from=i;function t(n){return{label:n.label,documentation:qo(n.documentation)?fe.to(n.documentation):n.documentation}}e.to=t})(eL||={});var tL;(e=>{function i(n){return{label:n.label,documentation:fe.fromStrict(n.documentation),parameters:Array.isArray(n.parameters)?n.parameters.map(eL.from):[],activeParameter:n.activeParameter}}e.from=i;function t(n){return{label:n.label,documentation:qo(n.documentation)?fe.to(n.documentation):n.documentation,parameters:Array.isArray(n.parameters)?n.parameters.map(eL.to):[],activeParameter:n.activeParameter}}e.to=t})(tL||={});var Ng;(e=>{function i(n){return{activeSignature:n.activeSignature,activeParameter:n.activeParameter,signatures:Array.isArray(n.signatures)?n.signatures.map(tL.from):[]}}e.from=i;function t(n){return{activeSignature:n.activeSignature,activeParameter:n.activeParameter,signatures:Array.isArray(n.signatures)?n.signatures.map(tL.to):[]}}e.to=t})(Ng||={});var hL;(t=>{function i(e,n){let o=new Sd(ht.to(n.position),typeof n.label=="string"?n.label:n.label.map(F$.to.bind(void 0,e)),n.kind&&qE.to(n.kind));return o.textEdits=n.textEdits&&n.textEdits.map(Mn.to),o.tooltip=qo(n.tooltip)?fe.to(n.tooltip):n.tooltip,o.paddingLeft=n.paddingLeft,o.paddingRight=n.paddingRight,o}t.to=i})(hL||={});var F$;(t=>{function i(e,n){let o=new xd(n.label);return o.tooltip=qo(n.tooltip)?fe.to(n.tooltip):n.tooltip,yM.is(n.command)&&(o.command=e.fromInternal(n.command)),n.location&&(o.location=bo.to(n.location)),o}t.to=i})(F$||={});var qE;(e=>{function i(n){return n}e.from=i;function t(n){return n}e.to=t})(qE||={});var fl;(e=>{function i(n){return{range:K.from(n.range),url:n.target,tooltip:n.tooltip}}e.from=i;function t(n){let o;if(n.url)try{o=typeof n.url=="string"?y.parse(n.url,!0):y.revive(n.url)}catch{}let r=new Td(K.to(n.range),o);return r.tooltip=n.tooltip,r}e.to=t})(fl||={});var gb;(e=>{function i(n){let o=new wd(n.label);return n.textEdit&&(o.textEdit=Mn.to(n.textEdit)),n.additionalTextEdits&&(o.additionalTextEdits=n.additionalTextEdits.map(r=>Mn.to(r))),o}e.to=i;function t(n){return{label:n.label,textEdit:n.textEdit?Mn.from(n.textEdit):void 0,additionalTextEdits:n.additionalTextEdits?n.additionalTextEdits.map(o=>Mn.from(o)):void 0}}e.from=t})(gb||={});var Qu;(e=>{function i(n){return new $i(n[0],n[1],n[2],n[3])}e.to=i;function t(n){return[n.red,n.green,n.blue,n.alpha]}e.from=t})(Qu||={});var vL;(e=>{function i(n){return{range:K.from(n.range)}}e.from=i;function t(n){return new Fs(K.to(n.range))}e.to=t})(vL||={});var fb;(t=>{function i(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}t.to=i})(fb||={});var Ju;(e=>{function i(n){switch(n){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.from=i;function t(n){switch(n){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.to=t})(Ju||={});var qu;(e=>{function i(n){if(n===2)return 1;if(n===1)return 0}e.from=i;function t(n){if(n===1)return 2;if(n===0)return 1}e.to=t})(qu||={});var KE;(t=>{function i(e){if(typeof e=="object")return e.viewId;switch(e){case 1:return 3;case 10:return 10;case 15:return 15}throw new Error("Unknown 'ProgressLocation'")}t.from=i})(KE||={});var hb;(e=>{function i(n){let o={start:n.start+1,end:n.end+1};return n.kind&&(o.kind=nL.from(n.kind)),o}e.from=i;function t(n){let o={start:n.start-1,end:n.end-1};return n.kind&&(o.kind=nL.to(n.kind)),o}e.to=t})(hb||={});var nL;(e=>{function i(n){if(n)switch(n){case 1:return La.Comment;case 2:return La.Imports;case 3:return La.Region}}e.from=i;function t(n){if(n)switch(n.value){case La.Comment.value:return 1;case La.Imports.value:return 2;case La.Region.value:return 3}}e.to=t})(nL||={});var vb;(t=>{function i(e){if(e)return{pinned:typeof e.preview=="boolean"?!e.preview:void 0,inactive:e.background,preserveFocus:e.preserveFocus,selection:typeof e.selection=="object"?K.from(e.selection):void 0,override:typeof e.override=="boolean"?PM.id:void 0}}t.from=i})(vb||={});var Jo;(o=>{function i(r){return r instanceof Vs?r.toJSON():typeof r=="string"?r:t(r)||e(r)?new Vs(r.baseUri??r.base,r.pattern).toJSON():r}o.from=i;function t(r){let s=r;return s?y.isUri(s.baseUri)&&typeof s.pattern=="string":!1}function e(r){let s=r;return s?typeof s.base=="string"&&typeof s.pattern=="string":!1}function n(r){return typeof r=="string"?r:new Vs(y.revive(r.baseUri),r.pattern)}o.to=n})(Jo||={});var yL;(t=>{function i(e){if(e){if(Array.isArray(e))return e.map(i);if(typeof e=="string")return e;{let n=e;return{language:n.language,scheme:n.scheme,pattern:Jo.from(n.pattern)??void 0,exclusive:n.exclusive,notebookType:n.notebookType}}}else return}t.from=i})(yL||={});var qr;(e=>{function i(n){return{start:n.start,end:n.end}}e.from=i;function t(n){return new uo(n.start,n.end)}e.to=t})(qr||={});var Dg;(e=>{function i(n){return{timing:typeof n.runStartTime=="number"&&typeof n.runEndTime=="number"?{startTime:n.runStartTime,endTime:n.runEndTime}:void 0,executionOrder:n.executionOrder,success:n.lastRunSuccess}}e.to=i;function t(n){return{lastRunSuccess:n.success,runStartTime:n.timing?.startTime,runEndTime:n.timing?.endTime,executionOrder:n.executionOrder}}e.from=t})(Dg||={});var ib;(e=>{function i(n){switch(n){case 1:return 1;case 2:default:return 2}}e.from=i;function t(n){switch(n){case 1:return 1;case 2:default:return 2}}e.to=t})(ib||={});var Qd;(e=>{function i(n){let o={metadata:n.metadata??Object.create(null),cells:[]};for(let r of n.cells)Ls.validate(r),o.cells.push(sb.from(r));return o}e.from=i;function t(n){let o=new Iu(n.cells.map(sb.to));return Wl(n.metadata)||(o.metadata=n.metadata),o}e.to=t})(Qd||={});var sb;(e=>{function i(n){return{cellKind:ib.from(n.kind),language:n.languageId,mime:n.mime,source:n.value,metadata:n.metadata,internalMetadata:Dg.from(n.executionSummary??{}),outputs:n.outputs?n.outputs.map(pl.from):[]}}e.from=i;function t(n){return new Ls(ib.to(n.cellKind),n.source,n.language,n.mime,n.outputs?n.outputs.map(pl.to):void 0,n.metadata,n.internalMetadata?Dg.to(n.internalMetadata):void 0)}e.to=t})(sb||={});var Ku;(e=>{function i(n){return{mime:n.mime,valueBytes:H.wrap(n.data)}}e.from=i;function t(n){return new xu(n.valueBytes.buffer,n.mime)}e.to=t})(Ku||={});var pl;(e=>{function i(n){return{outputId:n.id,items:n.items.map(Ku.from),metadata:n.metadata}}e.from=i;function t(n){let o=n.items.map(Ku.to);return new Os(o,n.outputId,n.metadata)}e.to=t})(pl||={});var yb;(n=>{function i(o){return e(o)?{include:Jo.from(o.include)??void 0,exclude:Jo.from(o.exclude)??void 0}:Jo.from(o)??void 0}n.from=i;function t(o){return e(o)?{include:Jo.to(o.include),exclude:Jo.to(o.exclude)}:Jo.to(o)}n.to=t;function e(o){let r=o;return r?!Wt(r.include)&&!Wt(r.exclude):!1}})(yb||={});var bL;(t=>{function i(e,n,o){let r=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{alignment:e.alignment===1?1:2,command:n.toInternal(r,o),text:e.text,tooltip:e.tooltip,accessibilityInformation:e.accessibilityInformation,priority:e.priority}}t.from=i})(bL||={});var IL;(t=>{function i(e,n,o){let r=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{command:n.toInternal(r,o),label:e.label,description:e.description,detail:e.detail,documentation:e.documentation}}t.from=i})(IL||={});var xL;(t=>{function i(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}t.from=i})(xL||={});var jE;(e=>{function i(n){return{uri:n.uri,provides:n.provides}}e.from=i;function t(n){return new ig(y.revive(n.uri),n.provides)}e.to=t})(jE||={});var Ug;(e=>{function i(n){return{message:fe.fromStrict(n.message)||"",type:0,expected:n.expectedOutput,actual:n.actualOutput,contextValue:n.contextValue,location:n.location&&{range:K.from(n.location.range),uri:n.location.uri},stackTrace:n.stackTrace?.map(o=>({label:o.label,position:o.position&&ht.from(o.position),uri:o.uri&&y.revive(o.uri).toJSON()}))}}e.from=i;function t(n){let o=new $s(typeof n.message=="string"?n.message:fe.to(n.message));return o.actualOutput=n.actual,o.expectedOutput=n.expected,o.contextValue=n.contextValue,o.location=n.location?bo.to(n.location):void 0,o}e.to=t})(Ug||={});var Ii;(e=>(e.namespace=Wm,e.denamespace=iT))(Ii||={});var SL;(t=>{function i(e){return{controllerId:e.controllerId,profileId:e.profileId,group:Fg.from(e.kind)}}t.from=i})(SL||={});var Fg;(e=>{let i={3:8,2:4,1:2};function t(n){return i.hasOwnProperty(n)?i[n]:2}e.from=t})(Fg||={});var ea;(e=>{function i(n){let o=Vm(n).controllerId;return{extId:et.fromExtHostTestItem(n,o).toString(),label:n.label,uri:y.revive(n.uri),busy:n.busy,tags:n.tags.map(r=>Ii.namespace(o,r.id)),range:ze.lift(K.from(n.range)),description:n.description||null,sortText:n.sortText||null,error:n.error&&fe.fromStrict(n.error)||null}}e.from=i;function t(n){return{parent:void 0,error:void 0,id:et.fromString(n.extId).localId,label:n.label,uri:y.revive(n.uri),tags:(n.tags||[]).map(o=>{let{tagId:r}=Ii.denamespace(o);return new Xa(r)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:K.to(n.range||void 0),canResolveChildren:!1,busy:n.busy,description:n.description||void 0,sortText:n.sortText||void 0}}e.toPlain=t})(ea||={});(e=>{function i(n){return{id:n.id}}e.from=i;function t(n){return new Xa(n.id)}e.to=t})(Ii||={});var CL;(e=>{let i=(n,o)=>{let r=n.value;if(!r)return;let s={...ea.toPlain(r.item),parent:o,taskStates:r.tasks.map(a=>({state:a.state,duration:a.duration,messages:a.messages.filter(l=>l.type===0).map(Ug.to)})),children:[]};if(n.children)for(let a of n.children.values()){let l=i(a,s);l&&s.children.push(l)}return s};function t(n){let o=new _S;for(let a of n.items)o.insert(et.fromString(a.item.extId).path,a);let r=[o.nodes],s=[];for(;r.length;)for(let a of r.pop())a.value?s.push(a):a.children&&r.push(a.children.values());return{completedAt:n.completedAt,results:s.map(a=>i(a)).filter(Uo)}}e.to=t})(CL||={});var bb;(s=>{function i(a){return{covered:a.covered,total:a.total}}function t(a){return"line"in a?ht.from(a):K.from(a)}function e(a){if(a)return"endLineNumber"in a?K.to(a):ht.to(a)}function n(a){if(a.type===1){let l=[];if(a.branches)for(let d of a.branches)l.push({executed:d.count,location:e(d.location),label:d.label});return new ag(a.count,e(a.location),a.branches?.map(d=>new lg(d.count,e(d.location),d.label)))}else return new dg(a.name,a.count,e(a.location))}s.to=n;function o(a){if(typeof a.executed=="number"&&a.executed<0)throw new Error(`Invalid coverage count ${a.executed}`);return"branches"in a?{count:a.executed,location:t(a.location),type:1,branches:a.branches.length?a.branches.map(l=>({count:l.executed,location:l.location&&t(l.location),label:l.label})):void 0}:{type:0,name:a.name,count:a.executed,location:t(a.location)}}s.fromDetails=o;function r(a,l,d){return nb(d.statementCoverage),nb(d.branchCoverage),nb(d.declarationCoverage),{id:l,uri:d.uri,statement:i(d.statementCoverage),branch:d.branchCoverage&&i(d.branchCoverage),declaration:d.declarationCoverage&&i(d.declarationCoverage),testIds:d instanceof Za&&d.includesTests.length?d.includesTests.map(c=>et.fromExtHostTestItem(c,a).toString()):void 0}}s.fromFile=r})(bb||={});var TL;(t=>{function i(e){switch(e){case 1:return 1;case 2:return 2}}t.to=i})(TL||={});var hl;(e=>{function i(n){let o=new Nd(zr.to(n.kind),n.name,n.detail||"",y.revive(n.uri),K.to(n.range),K.to(n.selectionRange));return o._sessionId=n._sessionId,o._itemId=n._itemId,o}e.to=i;function t(n,o,r){if(o=o??n._sessionId,r=r??n._itemId,o===void 0||r===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:r,kind:zr.from(n.kind),name:n.name,detail:n.detail??"",uri:n.uri,range:K.from(n.range),selectionRange:K.from(n.selectionRange),tags:n.tags?.map(ul.from)}}e.from=t})(hl||={});var Ib;(t=>{function i(e){if(e)return{value:e.value,tooltip:e.tooltip}}t.from=i})(Ib||={});var $u;(o=>{function i(r,s,a){let l=s.fileData;return l?new vT(new yT(l.name,y.revive(l.uri),l.id,Nl(()=>a(l.id)))):r===Tr.uriList&&s.uriListData?new Ld(n(s.uriListData)):new Ld(s.asString)}o.to=i;async function t(r,s,a=_e()){let l=await s.asString();if(r===Tr.uriList)return{id:a,asString:l,fileData:void 0,uriListData:e(l)};let d=s.asFile();return{id:a,asString:l,fileData:d?{name:d.name,uri:d.uri,id:d._itemId??d.id}:void 0}}o.from=t;function e(r){return xS.split(r).map(s=>{if(s.startsWith("#"))return s;try{return y.parse(s)}catch{}return s})}function n(r){return xS.create(r.map(s=>typeof s=="string"?s:y.revive(s)))}})($u||={});var Yu;(n=>{function i(o,r){let s=o.items.map(([a,l])=>[a,$u.to(a,l,r)]);return new mi(s)}n.toDataTransfer=i;async function t(o){return{items:await Promise.all(Array.from(o,async([s,a])=>[s,await $u.from(s,a)]))}}n.from=t;async function e(o){return{items:await Promise.all(Array.from(o,async([s,a])=>[s,await $u.from(s,a,a.id)]))}}n.fromList=e})(Yu||={});var GE;(e=>{function i(n,o){return{kind:"reply",agentId:n.participant??o?.agentId??"",subCommand:n.command??o?.command,message:n.prompt,title:n.label}}e.from=i;function t(n){return{prompt:n.message,label:n.title,participant:n.agentId,command:n.subCommand}}e.to=t})(GE||={});var ab;(e=>{function i(n){switch(n){case 0:return 3;case 1:return 1;case 2:return 2}}e.to=i;function t(n){switch(n){case 3:return 0;case 1:return 1;case 2:return 2}return 1}e.from=t})(ab||={});var wQ;(e=>{function i(n){let o=n.content.map(a=>{if(a.type==="text")return new sn(a.value,a.audience);if(a.type==="tool_result"){let l=nt(a.value.map(d=>d.type==="text"?new sn(d.value,d.audience):d.type==="data"?new Wn(d.data.buffer,d.mimeType):d.type==="prompt_tsx"?new yi(d.value):void 0));return new Xs(a.toolCallId,l,a.isError)}else{if(a.type==="image_url")return new Wn(a.value.data.buffer,a.value.mimeType);if(a.type==="data")return new Wn(a.data.buffer,a.mimeType);if(a.type==="tool_use")return new vi(a.toolCallId,a.name,a.parameters)}}).filter(a=>a!==void 0),r=ab.to(n.role);return new kg(r,o,n.name)}e.to=i;function t(n){let o=ab.from(n.role),r=n.name,s=n.content;typeof s=="string"&&(s=[new sn(s)]);let a=s.map(l=>{if(l instanceof Xs)return{type:"tool_result",toolCallId:l.callId,value:nt(l.content.map(d=>d instanceof sn?{type:"text",value:d.value,audience:d.audience}:d instanceof yi?{type:"prompt_tsx",value:d.value}:d instanceof Wn?{type:"data",mimeType:d.mimeType,data:H.wrap(d.data),audience:d.audience}:void 0)),isError:l.isError};if(l instanceof Wn)return H$(l)?{type:"image_url",value:{mimeType:l.mimeType,data:H.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:H.wrap(l.data),audience:l.audience};if(l instanceof vi)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof sn)return{type:"text",value:l.value};if(typeof l!="string")throw new Error("Unexpected chat message content type");return{type:"text",value:l}});return{role:o,name:r,content:a}}e.from=t})(wQ||={});var QE;(e=>{function i(n){let o=n.content.map(a=>{if(a.type==="text")return new sn(a.value,a.audience);if(a.type==="tool_result"){let l=a.value.map(d=>d.type==="text"?new sn(d.value,d.audience):d.type==="data"?new Wn(d.data.buffer,d.mimeType):new yi(d.value));return new Xs(a.toolCallId,l,a.isError)}else return a.type==="image_url"?new Wn(a.value.data.buffer,a.value.mimeType):a.type==="data"?new Wn(a.data.buffer,a.mimeType):a.type==="thinking"?new Yi(a.value,a.id,a.metadata):new vi(a.toolCallId,a.name,a.parameters)}),r=ab.to(n.role);return new Pg(r,o,n.name)}e.to=i;function t(n){let o=ab.from(n.role),r=n.name,s=n.content;typeof s=="string"&&(s=[new sn(s)]);let a=s.map(l=>{if(l instanceof Xs)return{type:"tool_result",toolCallId:l.callId,value:nt(l.content.map(d=>d instanceof sn?{type:"text",value:d.value,audience:d.audience}:d instanceof yi?{type:"prompt_tsx",value:d.value}:d instanceof Wn?{type:"data",mimeType:d.mimeType,data:H.wrap(d.data),audience:d.audience}:void 0)),isError:l.isError};if(l instanceof Wn)return H$(l)?{type:"image_url",value:{mimeType:l.mimeType,data:H.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:H.wrap(l.data),audience:l.audience};if(l instanceof vi)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof sn)return{type:"text",value:l.value};if(l instanceof Yi)return{type:"thinking",value:l.value,id:l.id,metadata:l.metadata};if(typeof l!="string")throw new Error("Unexpected chat message content type llm 2");return{type:"text",value:l}});return{role:o,name:r,content:a}}e.from=t})(QE||={});function H$(i){switch(typeof i.mimeType=="string"?i.mimeType.toLowerCase():""){case"image/png":case"image/jpeg":case"image/jpg":case"image/gif":case"image/webp":case"image/bmp":return!0;default:return!1}}var lb;(e=>{function i(n){return{kind:"markdownContent",content:fe.from(n.value)}}e.from=i;function t(n){return new tl(fe.to(n.content))}e.to=t})(lb||={});var JE;(e=>{function i(n){return{kind:"codeblockUri",uri:n.value,isEdit:n.isEdit,undoStopId:n.undoStopId}}e.from=i;function t(n){return new al(y.revive(n.uri),n.isEdit,n.undoStopId)}e.to=t})(JE||={});var YE;(e=>{function i(n){return{kind:"markdownVuln",content:fe.from(n.value),vulnerabilities:n.vulnerabilities}}e.from=i;function t(n){return new qs(fe.to(n.content),n.vulnerabilities)}e.to=t})(YE||={});var XE;(t=>{function i(e){return{kind:"confirmation",title:e.title,message:fe.from(e.message),data:e.data,buttons:e.buttons}}t.from=i})(XE||={});var ZE;(o=>{function i(r){switch(r){case 1:return"text";case 2:return"singleSelect";case 3:return"multiSelect";default:return"text"}}function t(r){switch(r){case"text":return 1;case"singleSelect":return 2;case"multiSelect":return 3;default:return 1}}function e(r){return{kind:"questionCarousel",questions:r.questions.map(s=>({id:s.id,type:i(s.type),title:s.title,message:s.message?fe.from(s.message):void 0,options:s.options?.map(a=>({id:a.id,label:a.label,value:String(a.value)})),defaultValue:s.defaultValue,allowFreeformInput:s.allowFreeformInput})),allowSkip:r.allowSkip}}o.from=e;function n(r){let s=r.questions.map(a=>new vg(a.id,t(a.type),a.title,{message:a.message?typeof a.message=="string"?new en(a.message):fe.to(a.message):void 0,options:a.options?.map(l=>({id:l.id,label:l.label,value:l.value})),defaultValue:a.defaultValue,allowFreeformInput:a.allowFreeformInput}));return new Qs(s,r.allowSkip)}o.to=n})(ZE||={});var db;(e=>{function i(n){let{value:o,baseUri:r}=n;function s(a,l){return a.map(d=>{let c=y.joinPath(l,d.name);return{label:d.name,uri:c,children:d.children&&s(d.children,c)}})}return{kind:"treeData",treeData:{label:Ze(r),uri:r,children:s(o,r)}}}e.from=i;function t(n){let o=Tt(n.treeData);function r(l){return l.map(d=>({name:d.label,children:d.children&&r(d.children)}))}let s=o.uri,a=o.children?r(o.children):[];return new ol(a,s)}e.to=t})(db||={});var W$;(e=>{function i(n){return{kind:"multiDiffData",multiDiffData:{title:n.title,resources:n.value.map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri,goToFileUri:o.goToFileUri,added:o.added,removed:o.removed}))},readOnly:n.readOnly}}e.from=i;function t(n){let o=n.multiDiffData.resources.map(r=>({originalUri:r.originalUri?y.revive(r.originalUri):void 0,modifiedUri:r.modifiedUri?y.revive(r.modifiedUri):void 0,goToFileUri:r.goToFileUri?y.revive(r.goToFileUri):void 0,added:r.added,removed:r.removed}));return new Mu(o,n.multiDiffData.title,n.readOnly)}e.to=t})(W$||={});var Ag;(e=>{function i(n){let o=s=>y.isUri(s),r=s=>"name"in s;return{kind:"inlineReference",name:n.title,inlineReference:o(n.value)?n.value:r(n.value)?Gd.from(n.value):bi.from(n.value)}}e.from=i;function t(n){let o=Tt(n);return new Ks(y.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?Gd.to(o.inlineReference):bi.to(o.inlineReference),n.name)}e.to=t})(Ag||={});var xb;(e=>{function i(n){return{kind:"progressMessage",content:fe.from(n.value)}}e.from=i;function t(n){return new Ou(n.content.value)}e.to=t})(xb||={});var Sb;(e=>{function i(n){return{kind:"thinking",value:n.value,id:n.id,metadata:n.metadata}}e.from=i;function t(n){return new Ji(n.value??"",n.id,n.metadata)}e.to=t})(Sb||={});var ew;(e=>{function i(n){return{kind:"hook",hookType:n.hookType,stopReason:n.stopReason,systemMessage:n.systemMessage,metadata:n.metadata}}e.from=i;function t(n){return new rl(n.hookType,n.stopReason,n.systemMessage,n.metadata)}e.to=t})(ew||={});var tw;(t=>{function i(e){return{kind:"voiceProgress",id:e.id,value:e.value}}t.from=i})(tw||={});var nw;(e=>{function i(n){return{kind:"autoModeResolution",resolved:n.resolvedModel}}e.from=i;function t(n){return new js(n.resolved)}e.to=t})(nw||={});var Cb;(e=>{function i(n){return{kind:"warning",content:fe.from(n.value)}}e.from=i;function t(n){return new Gs(n.content.value)}e.to=t})(Cb||={});var ow;(e=>{function i(n){return{kind:"info",content:fe.from(n.value)}}e.from=i;function t(n){return new il(n.content.value)}e.to=t})(ow||={});var V$;(t=>{function i(e){return{kind:"extensions",extensions:e.extensions}}t.from=i})(V$||={});var B$;(t=>{function i(e,n,o){let r;if(e.command)r=n.toInternal(e.command,o);else{if(!e.uri)throw new Error("Pull request part must have a command if URI is provided");r={title:"Open Pull Request",id:"vscode.open",arguments:[e.uri]}}return{kind:"pullRequest",author:e.author,title:e.title,description:e.description,uri:e.uri,linkTag:e.linkTag,command:r}}t.from=i})(B$||={});var $$;(e=>{function i(n){return{kind:"move",uri:n.uri,range:K.from(n.range)}}e.from=i;function t(n){return new dl(y.revive(n.uri),K.to(n.range))}e.to=t})($$||={});var z$;(l=>{function i(d){let c,u;d.toolSpecificData&&t(d.toolSpecificData)?(c=e(d.toolSpecificData,d.isError),u=void 0):u=d.toolSpecificData?n(d.toolSpecificData):void 0;let m=d.presentation==="hidden"?"hidden":d.presentation==="hiddenAfterComplete"?"hiddenAfterComplete":void 0;return d.enablePartialUpdate?{kind:"externalToolInvocationUpdate",toolCallId:d.toolCallId,toolName:d.toolName,isComplete:!!d.isComplete,invocationMessage:d.invocationMessage?fe.from(d.invocationMessage):void 0,pastTenseMessage:d.pastTenseMessage?fe.from(d.pastTenseMessage):void 0,toolSpecificData:u,subagentInvocationId:d.subAgentInvocationId,resultDetails:c}:{kind:"toolInvocationSerialized",toolCallId:d.toolCallId,toolId:d.toolName,invocationMessage:d.invocationMessage?fe.from(d.invocationMessage):d.toolName,originMessage:d.originMessage?fe.from(d.originMessage):void 0,pastTenseMessage:d.pastTenseMessage?fe.from(d.pastTenseMessage):void 0,isConfirmed:d.isConfirmed,isComplete:!0,source:pn.External,toolSpecificData:u,resultDetails:c,presentation:m,subAgentInvocationId:d.subAgentInvocationId}}l.from=i;function t(d){return d!==null&&typeof d=="object"&&"input"in d&&typeof d.input=="string"&&"output"in d&&Array.isArray(d.output)}function e(d,c){return{input:d.input,output:d.output.map(u=>{let m=u.mimeType.startsWith("text/");return{type:"embed",mimeType:u.mimeType,value:m?H.wrap(u.data).toString():eo(H.wrap(u.data)),isText:m}}),isError:c??!1}}function n(d){return"command"in d&&"language"in d?{kind:"terminal",command:d.command,language:d.language}:"commandLine"in d&&"language"in d?{kind:"terminal",presentationOverrides:d.presentationOverrides&&typeof d.presentationOverrides.commandLine=="string"?{commandLine:d.presentationOverrides.commandLine,language:d.presentationOverrides.language}:void 0,commandLine:d.commandLine,language:d.language,terminalCommandOutput:typeof d.output?.text=="string"?{text:d.output.text}:void 0,terminalCommandState:d.state?{exitCode:d.state.exitCode,duration:d.state.duration}:void 0}:"todoList"in d&&Array.isArray(d.todoList)?{kind:"todoList",todoList:d.todoList.map(c=>({id:String(c.id),title:c.title,status:o(c.status)}))}:"input"in d&&"output"in d&&!Array.isArray(d.output)?{kind:"simpleToolInvocation",input:typeof d.input=="string"?d.input:"",output:typeof d.output=="string"?d.output:""}:d&&"values"in d&&Array.isArray(d.values)?{kind:"resources",values:d.values.map(c=>c instanceof rn?bi.from(c):y.revive(c))}:d instanceof hg?{kind:"subagent",description:d.description,agentName:d.agentName,prompt:d.prompt,result:d.result,modelName:d.modelName}:d}function o(d){switch(d){case 1:return"not-started";case 2:return"in-progress";case 3:return"completed";default:return"not-started"}}function r(d){switch(d){case"not-started":return 1;case"in-progress":return 2;case"completed":return 3;default:return 1}}function s(d){let c=new Nu(d.toolId||d.toolName,d.toolCallId,d.errorMessage);return d.invocationMessage&&(c.invocationMessage=d.invocationMessage),d.originMessage&&(c.originMessage=d.originMessage),d.pastTenseMessage&&(c.pastTenseMessage=d.pastTenseMessage),d.isConfirmed!==void 0&&(c.isConfirmed=d.isConfirmed),d.isComplete!==void 0&&(c.isComplete=d.isComplete),d.toolSpecificData&&(c.toolSpecificData=a(d.toolSpecificData)),c.subAgentInvocationId=d.subAgentInvocationId,c.subAgentName=d.subAgentName,c}l.to=s;function a(d){if(d.kind==="terminal")if(d.commandLine){let c={commandLine:d.commandLine,language:d.language};return d.terminalCommandOutput&&(c.output={text:d.terminalCommandOutput.text,truncated:d.terminalCommandOutput.truncated,lineCount:d.terminalCommandOutput.lineCount}),d.terminalCommandState&&(c.state={exitCode:d.terminalCommandState.exitCode,duration:d.terminalCommandState.duration}),c}else return{command:d.command,language:d.language};else{if(d.kind==="terminal2")return{commandLine:d.commandLine,language:d.language};if(d.kind==="todoList")return{todoList:d.todoList.map((c,u)=>{let m=Number(c.id);return{id:Number.isFinite(m)?m:u,title:c.title,status:r(c.status)}})}}return d}})(z$||={});var rw;(t=>{function i(e){return{kind:"progressTask",content:fe.from(e.value)}}t.from=i})(rw||={});var EL;(t=>{function i(e){return{kind:"progressTaskResult",content:typeof e=="string"?fe.from(e):void 0}}t.from=i})(EL||={});var cb;(e=>{function i(n,o,r){return{kind:"command",command:o.toInternal(n.value,r)??{command:n.value.command,title:n.value.title}}}e.from=i;function t(n,o){return new sl(o.fromInternal(n.command)??{command:n.command.id,title:n.command.title})}e.to=t})(cb||={});var iw;(e=>{function i(n){return{kind:"textEdit",uri:n.uri,edits:n.edits.map(o=>Mn.from(o)),done:n.isDone}}e.from=i;function t(n){let o=new Js(y.revive(n.uri),n.edits.map(r=>Mn.to(r)));return o.isDone=n.done,o}e.to=t})(iw||={});var sw;(t=>{function i(e){return e.newCellMetadata?{editType:3,index:e.range.start,metadata:e.newCellMetadata}:e.newNotebookMetadata?{editType:5,metadata:e.newNotebookMetadata}:{editType:1,index:e.range.start,count:e.range.end-e.range.start,cells:e.newCells.map(sb.from)}}t.from=i})(sw||={});var aw;(t=>{function i(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(sw.from),done:e.isDone}}t.from=i})(aw||={});var lw;(t=>{function i(e){return{kind:"workspaceEdit",edits:e.edits.map(n=>({oldResource:n.oldResource,newResource:n.newResource}))}}t.from=i})(lw||={});var ju;(e=>{function i(n){let o=ct.isThemeIcon(n.iconPath)?n.iconPath:y.isUri(n.iconPath)?{light:y.revive(n.iconPath)}:n.iconPath&&"light"in n.iconPath&&"dark"in n.iconPath&&y.isUri(n.iconPath.light)&&y.isUri(n.iconPath.dark)?{light:y.revive(n.iconPath.light),dark:y.revive(n.iconPath.dark)}:void 0;return typeof n.value=="object"&&"variableName"in n.value?{kind:"reference",reference:{variableName:n.value.variableName,value:y.isUri(n.value.value)||!n.value.value?n.value.value:bi.from(n.value.value)},iconPath:o,options:n.options}:{kind:"reference",reference:y.isUri(n.value)||typeof n.value=="string"?n.value:bi.from(n.value),iconPath:o,options:n.options}}e.from=i;function t(n){let o=Tt(n),r=s=>y.isUri(s)?s:bi.to(s);return new fi(typeof o.reference=="string"?o.reference:"variableName"in o.reference?{variableName:o.reference.variableName,value:o.reference.value&&r(o.reference.value)}:r(o.reference))}e.to=t})(ju||={});var dw;(t=>{function i(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}t.from=i})(dw||={});var Hg;(n=>{function i(o,r,s){return o instanceof tl?lb.from(o):o instanceof Ks?Ag.from(o):o instanceof fi?ju.from(o):o instanceof Ou?xb.from(o):o instanceof Ji?Sb.from(o):o instanceof rl?ew.from(o):o instanceof Bd?tw.from(o):o instanceof ol?db.from(o):o instanceof Mu?W$.from(o):o instanceof sl?cb.from(o,r,s):o instanceof Js?iw.from(o):o instanceof cl?aw.from(o):o instanceof qs?YE.from(o):o instanceof al?JE.from(o):o instanceof Gs?Cb.from(o):o instanceof il?ow.from(o):o instanceof nl?XE.from(o):o instanceof Qs?ZE.from(o):o instanceof ll?dw.from(o):o instanceof dl?$$.from(o):o instanceof $d?V$.from(o):o instanceof zd?B$.from(o,r,s):o instanceof Nu?z$.from(o):o instanceof qd?lw.from(o):o instanceof js?nw.from(o):{kind:"markdownContent",content:fe.from("")}}n.from=i;function t(o,r){switch(o.kind){case"reference":return ju.to(o);case"markdownContent":case"inlineReference":case"progressMessage":case"treeData":case"command":return e(o,r)}}n.to=t;function e(o,r){switch(o.kind){case"markdownContent":return lb.to(o);case"inlineReference":return Ag.to(o);case"progressMessage":return;case"treeData":return db.to(o);case"command":return cb.to(o,r)}}n.toContent=e})(Hg||={});var Wg;(t=>{function i(e,n,o,r,s,a,l,d){let c=[],u=[];for(let h of e.variables.variables)h.kind==="tool"?c.push(h):h.kind==="toolset"?c.push(...h.value):u.push(h);let m=Hr.parseLocalSessionId(e.sessionResource)??e.sessionResource.toString(),g={id:e.requestId,prompt:e.message,command:e.command,attempt:e.attempt??0,enableCommandDetection:e.enableCommandDetection??!0,isParticipantDetected:e.isParticipantDetected??!1,isVoiceModeInput:e.isVoiceModeInput,sessionId:m,sessionResource:e.sessionResource,references:u.flatMap(h=>cw.toReferences(h,s,d)),toolReferences:c.map(Gu.to),location:Vg.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:n,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource,workingDirectory:y.revive(e.workingDirectory)}),tools:a,model:o,modelConfiguration:r,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:Xu.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?j$.to(e.hooks):void 0,isSystemInitiated:e.isSystemInitiated};return Le(l,"chatParticipantPrivate")||(delete g.id,delete g.attempt,delete g.enableCommandDetection,delete g.isParticipantDetected,delete g.isVoiceModeInput,delete g.location,delete g.location2,delete g.editedFileEvents,delete g.sessionId,delete g.subAgentInvocationId,delete g.subAgentName,delete g.parentRequestId,delete g.hasHooksEnabled,delete g.hooks),Le(l,"chatParticipantAdditions")||(delete g.acceptedConfirmationData,delete g.rejectedConfirmationData,delete g.tools),g}t.to=i})(Wg||={});var Vg;(e=>{function i(n){switch(n){case"notebook":return 3;case"terminal":return 2;case"panel":return 1;case"editor":return 4}}e.to=i;function t(n){switch(n){case 3:return"notebook";case 2:return"terminal";case 1:return"panel";case 4:return"editor"}}e.from=t})(Vg||={});var Tb;(e=>{function i(n){return n.id}e.from=i;function t(n){switch(n){case"agent":return hi.Agent;case"skill":return hi.Skill;case"instructions":return hi.Instructions;case"prompt":return hi.Prompt;case"hook":return hi.Hook;case"plugins":return hi.Plugins;default:return new hi(n)}}e.to=t})(Tb||={});var cw;(e=>{function i(n,o,r){let s=t(n,o,r);if(!s)return[];let a=US(n)?n:void 0;if(!a)return[s];let l=X4(a.imageData);return l?[s,{id:`${n.id}-screenshot`,name:`${n.name} screenshot`,value:new Fu(a.imageMimeType??"image/png",()=>Promise.resolve(l))}]:[s]}e.toReferences=i;function t(n,o,r){let s=n.value;if(!s){let l;try{l=JSON.stringify(n)}catch{l=`kind=${n.kind}, id=${n.id}, name=${n.name}`}r.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${l}`);return}if(jl(s))s=y.revive(s);else if(s&&typeof s=="object"&&"uri"in s&&"range"in s&&jl(s.uri))s=bi.to(Tt(s));else if(DM(n)){let l=n.references?.[0]?.reference;s=new Fu(n.mimeType??"image/png",()=>Promise.resolve(new Uint8Array(Object.values(n.value))),l&&y.isUri(l)?l:void 0,n.isPasted,n.isURL)}else if(n.kind==="diagnostic"){let l=n.filterSeverity&&BE.to(n.filterSeverity),d=n.filterUri&&y.revive(n.filterUri).toString();s=new Kd(o.map(([c,u])=>n.filterUri&&c.toString()!==d?[c,[]]:[c,u.filter(m=>!(l&&m.severity>l||n.filterRange&&!ze.areIntersectingOrTouching(n.filterRange,K.from(m.range))))]).filter(([,c])=>c.length>0))}let a;return(dy(n)||$V(n))&&n.toolReferences&&(a=wL.to(n.toolReferences)),{id:n.id,name:n.name,range:n.range&&[n.range.start,n.range.endExclusive],toolReferences:a,value:s,modelDescription:n.modelDescription}}e.to=t})(cw||={});var Gu;(t=>{function i(e){if(e.value)throw new Error("Invalid tool reference");return{name:e.id,range:e.range&&[e.range.start,e.range.endExclusive]}}t.to=i})(Gu||={});var wL;(t=>{function i(e){let n=[];for(let o of e)if(o.kind==="tool")n.push(Gu.to(o));else if(o.kind==="toolset")n.push(...o.value.map(Gu.to));else throw new Error("Invalid tool reference in prompt variables");return n}t.to=i})(wL||={});var Xu;(e=>{function i(n){if(n)return{uri:y.revive(n.uri),name:n.name,content:n.content,toolReferences:wL.to(Tt(n.toolReferences)),allowedSubagents:n.allowedSubagents,metadata:n.metadata,isBuiltin:n.isBuiltin}}e.to=i;function t(n){if(n)return{uri:n.uri,name:n.name,content:n.content,toolReferences:n.toolReferences?.map(o=>({kind:"tool",id:o.name,name:o.name,value:void 0,range:o.range?{start:o.range[0],endExclusive:o.range[1]}:void 0}))??[],allowedSubagents:n.allowedSubagents,metadata:n.metadata,isBuiltin:n.isBuiltin}}e.from=t})(Xu||={});var kL;(t=>{function i(e,n,o){return{id:e.id,label:e.label,fullName:e.fullName,icon:e.icon?.id,value:e.values[0].value,insertText:e.insertText,detail:e.detail,documentation:e.documentation,command:n.toInternal(e.command,o)}}t.from=i})(kL||={});var Bg;(n=>{function i(o){return{errorDetails:o.errorDetails,metadata:e(o.metadata),nextQuestion:o.nextQuestion,details:o.details}}n.to=i;function t(o){return{errorDetails:o.errorDetails,metadata:o.metadata,nextQuestion:o.nextQuestion,details:o.details}}n.from=t;function e(o){return Mi(o,r=>{if(r.$mid===20)return new jd(Mi(r.content,e));if(r.$mid===21)return new sn(r.value);if(r.$mid===22)return new Yi(r.value,r.id,r.metadata);if(r.$mid===23)return new yi(r.value);if(r.$mid===24){let s;if(r.data&&typeof r.data=="object"&&r.data.type==="Buffer"&&Array.isArray(r.data.data))s=new Uint8Array(r.data.data);else if(typeof r.data=="string")try{s=fo(r.data).buffer}catch{s=new Uint8Array(0)}else s=new Uint8Array(0);return new Wn(s,r.mimeType,r.audience)}})}})(Bg||={});var PL;(t=>{function i(e,n,o){if(n.action.kind==="vote")return;let r=Bg.to(e);if(n.action.kind==="command"){let s=n.action.commandButton.command;return{action:{kind:"command",commandButton:{command:o.fromInternal(s)??{command:s.id,title:s.title}}},result:r}}else return n.action.kind==="followUp"?{action:{kind:"followUp",followup:GE.to(n.action.followup)},result:r}:n.action.kind==="inlineChat"?{action:{kind:"editor",accepted:n.action.action==="accepted"},result:r}:n.action.kind==="chatEditingSessionAction"?{action:{kind:"chatEditingSessionAction",outcome:new Map([["accepted",1],["rejected",2],["saved",3]]).get(n.action.outcome)??2,uri:y.revive(n.action.uri),hasRemainingEdits:n.action.hasRemainingEdits},result:r}:n.action.kind==="chatEditingHunkAction"?{action:{kind:"chatEditingHunkAction",outcome:new Map([["accepted",1],["rejected",2]]).get(n.action.outcome)??2,uri:y.revive(n.action.uri),hasRemainingEdits:n.action.hasRemainingEdits,lineCount:n.action.lineCount,linesAdded:n.action.linesAdded,linesRemoved:n.action.linesRemoved},result:r}:{action:n.action,result:r}}t.to=i})(PL||={});var uw;(t=>{function i(e,n,o){return"terminalCommand"in e?{terminalCommand:e.terminalCommand,shouldExecute:e.shouldExecute}:"uri"in e?{uri:e.uri}:n.toInternal(e,o)}t.from=i})(uw||={});var oL;(t=>{function i(e){return{...e,documentation:fe.fromStrict(e.documentation)}}t.from=i})(oL||={});var _L;(t=>{function i(e,n){return Array.isArray(e)?{items:e.map(o=>oL.from(o))}:{items:e.items.map(o=>oL.from(o)),resourceOptions:e.resourceOptions?q$.from(e.resourceOptions,n):void 0}}t.from=i})(_L||={});var q$;(t=>{function i(e,n){return{...e,pathSeparator:n,cwd:e.cwd,globPattern:Jo.from(e.globPattern)??void 0}}t.from=i})(q$||={});var RL;(t=>{function i(e){return{kind:K$.to(e.kind),acceptedLength:e.acceptedLength}}t.to=i})(RL||={});var K$;(t=>{function i(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}t.to=i})(K$||={});var DL;(t=>{function i(e,n){if(e.kind===2){let o=e.supersededBy?n(e.supersededBy):void 0;return{kind:2,supersededBy:o,userTypingDisagreed:e.userTypingDisagreed}}else if(e.kind===0)return{kind:0};return{kind:1}}t.to=i})(DL||={});var AL;(e=>{function i(n){return n===2?2:1}e.from=i;function t(n){return n===2?2:1}e.to=t})(AL||={});var ML;(t=>{function i(e,n){return{id:n,label:e.label,description:e.description,canEdit:e.canEdit,collapsibleState:e.collapsibleState||0,contextValue:e.contextValue}}t.from=i})(ML||={});var LL;(t=>{function i(e){return e.type==="mcp"?new Rg(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new _g(e.extensionId.value,e.label):void 0}t.to=i})(LL||={});var pw;(e=>{function i(n){let o=new jd(n.content.map(r=>r.kind==="text"?new sn(r.value,r.audience):r.kind==="data"?new Wn(r.value.data.buffer,r.value.mimeType,r.audience):new yi(r.value)));return n.toolMetadata!==void 0&&(o.toolMetadata=n.toolMetadata),n.toolResultError&&(o.hasError=!!n.toolResultError),o}e.to=i;function t(n,o){n.toolResultMessage&&M(o,"chatParticipantPrivate");let r=d=>{d.audience&&M(o,"languageModelToolResultAudience")},s=!1,a;Array.isArray(n.toolResultDetails)?a=n.toolResultDetails?.map(d=>y.isUri(d)?d:bi.from(d)):n.toolResultDetails2&&(a={output:{type:"data",mimeType:n.toolResultDetails2.mime,value:H.wrap(n.toolResultDetails2.value)}},s=!0);let l={content:n.content.map(d=>{if(d instanceof sn)return r(d),{kind:"text",value:d.value,audience:d.audience};if(d instanceof yi)return{kind:"promptTsx",value:d.value};if(d instanceof Wn)return r(d),s=!0,{kind:"data",value:{mimeType:d.mimeType,data:H.wrap(d.data)},audience:d.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:fe.fromStrict(n.toolResultMessage),toolResultDetails:a,toolMetadata:n.toolMetadata,toolResultError:n.hasError};return s?new Zt(l):l}e.from=t})(pw||={});var Xi;(n=>{function i(o){return o}n.fromThemeIcon=i;function t(o){if(o){if(ct.isThemeIcon(o))return o;if(y.isUri(o))return o;if(typeof o=="string")return y.file(o);if(typeof o=="object"&&o!==null&&"dark"in o){let r=typeof o.dark=="string"?y.file(o.dark):o.dark,s=typeof o.light=="string"?y.file(o.light):o.light;return r?{dark:r,light:s??r}:void 0}else return}else return}n.from=t;function e(o){if(o){if(ct.isThemeIcon(o))return o;if(jl(o))return y.revive(o);{let r=o;return{light:y.revive(r.light),dark:y.revive(r.dark)}}}else return}n.to=e})(Xi||={});var OL;(e=>{function i(n){return{query:n.query,kind:t(n.kind),settings:n.settings}}e.fromSettingsSearchResult=i;function t(n){switch(n){case 1:return 1;case 2:return 2;case 3:return 3;default:throw new Error("Unknown AiSettingsSearchResultKind")}}})(OL||={});var $g;(n=>{function i(o){return!!o.uri}function t(o){return vu.toSerialized(i(o)?{type:2,uri:o.uri,headers:Object.entries(o.headers),authentication:o.authentication?{providerId:o.authentication.providerId,scopes:o.authentication.scopes}:void 0}:{type:1,cwd:o.cwd?.fsPath,args:o.args,command:o.command,env:o.env,envFile:void 0,sandbox:void 0})}n.from=t;function e(o){let r=vu.fromSerialized(o.launch);if(r.type===2)return new Wu(o.label,r.uri,Object.fromEntries(r.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let s=new Hu(o.label,r.command,[...r.args],Object.fromEntries(Object.entries(r.env).map(([a,l])=>[a,l===null?null:String(l)])),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);return r.cwd&&(s.cwd=y.file(r.cwd)),s}}n.to=e})($g||={});var NL;(t=>{function i(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error("Unknown SourceControlInputBoxValidationType")}}t.from=i})(NL||={});var j$;(t=>{function i(e){let n={};for(let[o,r]of Object.entries(e)){if(!r||r.length===0)continue;let s=[];for(let a of r){let l=G$.to(a);l&&s.push(l)}s.length>0&&(n[o]=s)}return n}t.to=i})(j$||={});var G$;(t=>{function i(e){let n=d$(e,gr);if(n)return{command:n,cwd:e.cwd,env:e.env,timeout:e.timeout}}t.to=i})(G$||={});var vl;(e=>{function i(n){if(n!==void 0)switch(n){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return}}function t(n){let o=n.timing,r=o?.created??o?.startTime??0,s=o?.lastRequestStarted??o?.startTime,a=o?.lastRequestEnded??o?.endTime;return{resource:n.resource,label:n.label,description:n.description?fe.from(n.description):void 0,badge:n.badge?fe.from(n.badge):void 0,status:i(n.status),archived:n.archived,tooltip:fe.fromStrict(n.tooltip),timing:{created:r,lastRequestStarted:s,lastRequestEnded:a},changes:n.changes instanceof Array?n.changes:void 0,metadata:n.metadata,legacyResource:n.legacyResource}}e.from=t})(vl||={});var mw=class i{constructor(t,e){this.line=t;this.character=e}isBefore(t){return!1}isBeforeOrEqual(t){return!1}isAfter(t){return!1}isAfterOrEqual(t){return!1}isEqual(t){return!1}compareTo(t){return 0}translate(t,e){return new i(0,0)}with(t){return new i(0,0)}},zg=class i{constructor(t,e,n,o){this.isEmpty=!1;this.isSingleLine=!1;this.start=new mw(t,e),this.end=new mw(n,o)}contains(t){return!1}isEqual(t){return!1}intersection(t){}union(t){return new i(0,0,0,0)}with(t){return new i(0,0,0,0)}},Yo=class{constructor(t,e,n){this.uri=t;this.ranges=e;this.previewText=n}},ta=class{constructor(t,e,n){this.uri=t;this.text=e;this.lineNumber=n}},Zu=class{constructor(t){this.keyword=t}},gw=(n=>(n[n.None=1]="None",n[n.FilesExclude=2]="FilesExclude",n[n.SearchAndFilesExclude=3]="SearchAndFilesExclude",n))(gw||{}),Eb=(e=>(e[e.Information=1]="Information",e[e.Warning=2]="Warning",e))(Eb||{});var Jd=2e4,Q$="\u27EA ",J$=" characters skipped \u27EB",PQ=(Q$.length+J$.length+5)*2,_Q=A("searchService");function wb(i){return!!i.rangeLocations&&!!i.previewText}var qg=class{constructor(t,e,n,o){this.rangeLocations=[];this.webviewIndex=o;let r=Array.isArray(e)?e:[e];if(n&&n.matchLines===1&&RQ(r)){t=y2(t,n.matchLines);let s="",a=0,l=0,d=Math.floor(n.charsPerLine/5);for(let c of r){let u=Math.max(c.startColumn-d,0),m=c.startColumn+n.charsPerLine;if(u>l+d+PQ){let g=Q$+(u-l)+J$;s+=g+t.slice(u,m),a+=u-(l+g.length)}else s+=t.slice(l,m);l=m,this.rangeLocations.push({source:c,preview:new UL(0,c.startColumn-a,c.endColumn-a)})}this.previewText=s}else{let s=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,a=Ec(e,l=>({preview:new Kg(l.startLineNumber-s,l.startColumn,l.endLineNumber-s,l.endColumn),source:l}));this.rangeLocations=Array.isArray(a)?a:[a],this.previewText=t}}};function RQ(i){let t=i[0].startLineNumber;for(let e of i)if(e.startLineNumber!==t||e.endLineNumber!==t)return!1;return!0}var Kg=class{constructor(t,e,n,o){this.startLineNumber=t,this.startColumn=e,this.endLineNumber=n,this.endColumn=o}},UL=class extends Kg{constructor(t,e,n){super(t,e,t,n)}};function Y$(i,t=!0){let e=i&&i.files&&i.files.exclude,n=t&&i&&i.search&&i.search.exclude;if(!e&&!n)return;if(!e||!n)return e||n||void 0;let o=Object.create(null);return o=or(o,ft(e)),o=or(o,ft(n),!0),o}function fw(i,t){let e=i.ignoreGlobCase?{ignoreCase:!0}:void 0;return i.excludePattern&&_r(i.excludePattern,t,e)?!1:i.includePattern||i.usingSearchPaths?i.includePattern&&_r(i.includePattern,t,e)?!0:i.usingSearchPaths?!!i.folderQueries&&i.folderQueries.some(n=>{let o=n.folder.fsPath;if(Or(t,o,i.ignoreGlobCase)){let r=_i(o,t);return!n.includePattern||!!_r(n.includePattern,r,e)}else return!1}):!1:!0}var na=class extends Error{constructor(e,n){super(e);this.code=n}};function FL(i){let t={message:i.message,code:i.code};return new Error(JSON.stringify(t))}function X$(i){return!!i.path}var DQ={ignoreCase:!0};function kb(i,t,e=!0,n){let o=i.searchPath?i.searchPath:i.relativePath;return e?h2(o,t):_r(t,o,n?DQ:void 0)}function Yd(i,t){let e={...i||{},...t||{}};return Object.keys(e).filter(n=>{let o=e[n];return typeof o=="boolean"&&o})}var jg=class{constructor(t,e){this._parsedIncludeExpression=null;let n=t.ignoreGlobCase||e.ignoreGlobCase?{ignoreCase:!0}:void 0;this._excludeExpression=e.excludePattern?.map(r=>({...t.excludePattern||{},...r.pattern||{}}))??[],this._excludeExpression.length===0&&(this._excludeExpression=[t.excludePattern||{}]),this._parsedExcludeExpression=this._excludeExpression.map(r=>Po(r,n));let o=t.includePattern;e.includePattern&&(o?o={...o,...e.includePattern}:o=e.includePattern),o&&(this._parsedIncludeExpression=Po(o,n))}_evalParsedExcludeExpression(t,e,n){let o=null;for(let r of this._parsedExcludeExpression){let s=r(t,e,n);if(typeof s=="string"){o=s;break}}return o}matchesExcludesSync(t,e,n){return!!(this._parsedExcludeExpression&&this._evalParsedExcludeExpression(t,e,n))}includedInQuerySync(t,e,n){return!(this._parsedExcludeExpression&&this._evalParsedExcludeExpression(t,e,n)||this._parsedIncludeExpression&&!this._parsedIncludeExpression(t,e,n))}includedInQuery(t,e,n){let o=()=>this._parsedIncludeExpression?!!this._parsedIncludeExpression(t,e,n):!0;return Promise.all(this._parsedExcludeExpression.map(r=>{let s=r(t,e,n);return oi(s)?s.then(a=>a?!1:o()):o()})).then(r=>r.some(s=>!!s))}hasSiblingExcludeClauses(){return this._excludeExpression.reduce((t,e)=>AQ(e)||t,!1)}};function AQ(i){for(let t in i)if(typeof i[t]!="boolean")return!0;return!1}function Z$(i){if(!i)return;let t;return e=>(t||(t=(i()||Promise.resolve([])).then(n=>n?e5(n):{})),t.then(n=>!!n[e]))}function Pb(i){if(!i)return;let t;return e=>{if(!t){let n=i();t=n?e5(n):{}}return!!t[e]}}function e5(i){let t={};for(let e of i)t[e]=!0;return t}function hw(i){return i.flatMap(t=>t.patterns.map(e=>t.baseUri?{baseUri:t.baseUri,pattern:e}:e))}var _b={matchLines:100,charsPerLine:1e4};var WL=class{constructor(t,e,n){this.id=t;this.dependencies=e;this.callback=n}};var VL=class i{constructor(){this._isWebWorker=typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope";this._isRenderer=typeof document=="object";this._defineCalls=[];this._state=1}static{this.INSTANCE=new i}_initialize(){if(this._state===1){if(globalThis.define){this._state=3;return}}else return;this._state=2,globalThis.define=(t,e,n)=>{typeof t!="string"&&(n=e,e=t,t=null),(typeof e!="object"||!Array.isArray(e))&&(n=e,e=null),this._defineCalls.push(new WL(t,e,n))},globalThis.define.amd=!0,this._isRenderer?this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??window.trustedTypes?.createPolicy("amdLoader",{createScriptURL(t){if(t.startsWith(window.location.origin)||t.startsWith(`${B.vscodeFileResource}://${XR}`))return t;throw new Error(`[trusted_script_src] Invalid script url: ${t}`)}}):this._isWebWorker&&(this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??globalThis.trustedTypes?.createPolicy("amdLoader",{createScriptURL(t){return t}}))}async load(t){if(this._initialize(),this._state===3)return new Promise(s=>{let a=_e();globalThis.define(a,[t],function(l){s(l)})});let e=await(this._isWebWorker?this._workerLoadScript(t):this._isRenderer?this._rendererLoadScript(t):this._nodeJSLoadScript(t));if(!e){console.warn(`Did not receive a define call from script ${t}`);return}let n={},o=[],r=[];if(Array.isArray(e.dependencies))for(let s of e.dependencies)s==="exports"?o.push(n):r.push(s);if(r.length>0)throw new Error(`Cannot resolve dependencies for script ${t}. The dependencies are: ${r.join(", ")}`);return typeof e.callback=="function"?e.callback(...o)??n:e.callback}_rendererLoadScript(t){return new Promise((e,n)=>{let o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript");let r=()=>{o.removeEventListener("load",s),o.removeEventListener("error",a)},s=l=>{r(),e(this._defineCalls.pop())},a=l=>{r(),n(l)};o.addEventListener("load",s),o.addEventListener("error",a),this._amdPolicy&&(t=this._amdPolicy.createScriptURL(t)),o.setAttribute("src",t),window.document.getElementsByTagName("head")[0].appendChild(o)})}async _workerLoadScript(t){return this._amdPolicy&&(t=this._amdPolicy.createScriptURL(t)),await import(t),this._defineCalls.pop()}async _nodeJSLoadScript(t){try{let e=(await import("module")).default,n=e.createRequire(import.meta.url),o=n("fs"),r=n("vm"),s=y.parse(t).fsPath,a=o.readFileSync(s).toString(),l=e.wrap(a.replace(/^#!.*/,""));return new r.Script(l).runInThisContext().apply(),this._defineCalls.pop()}catch(e){throw e}}},HL=new Map;async function vw(i,t,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let n=t?`${i}/${t}`:i;if(HL.has(n))return HL.get(n);let o;if(/^\w[\w\d+.-]*:\/\//.test(n))o=n;else{let l=`${e&&(BH||TR&&GH)?R2:_2}/${n}`;o=Gl.asBrowserUri(l).toString(!0)}let r=VL.INSTANCE.load(o);return HL.set(n,r),r}var Db="utf8",KL="utf8bom",bw="utf16be",Iw="utf16le";var yw=[254,255],$L=[255,254],Rb=[239,187,191],MQ=512,LQ=512,OQ=512*8,NQ=512*128;var zL=class extends Error{constructor(e,n){super(e);this.decodeStreamErrorKind=n}},qL=class i{constructor(t){this.iconvLiteDecoder=t}static async create(t){let e;if(t!==Db)e=(await vw("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(o5(t));else{let n=new TextDecoder;e={write(o){return n.decode(o,{stream:!0})},end(){return n.decode()}}}return new i(e)}write(t){return this.iconvLiteDecoder.write(t)}end(){return this.iconvLiteDecoder.end()}};function t5(i,t){let e=t.minBytesRequiredForDetection??(t.guessEncoding?OQ:LQ);return new Promise((n,o)=>{let r=Uc(u=>u.join("")),s=[],a=0,l,d=new Ee,c=async()=>{try{let u=await zQ({buffer:H.concat(s),bytesRead:a},t.guessEncoding,t.candidateGuessEncodings);if(u.seemsBinary&&t.acceptTextOnly)throw new zL("Stream is binary but only text is accepted for decoding",1);u.encoding=await t.overwriteEncoding(u.encoding),l=await qL.create(u.encoding);let m=l.write(H.concat(s).buffer);r.write(m),s.length=0,a=0,n({stream:r,detected:u})}catch(u){d.cancel(),r.destroy(),o(u)}};Ux(i,{onData:async u=>{l?r.write(l.write(u.buffer)):(s.push(u),a+=u.byteLength,a>=e&&(i.pause(),await c(),setTimeout(()=>i.resume())))},onError:u=>r.error(u),onEnd:async()=>{l||await c(),r.end(l?.end())}},d.token)})}async function n5(i,t,e){let o=(await vw("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(o5(t),e),r=!1,s=!1;return{read(){if(s)return null;let a=i.read();if(typeof a!="string"){if(s=!0,!r&&e?.addBOM)switch(t){case Db:case KL:return H.wrap(Uint8Array.from(Rb));case bw:return H.wrap(Uint8Array.from(yw));case Iw:return H.wrap(Uint8Array.from($L))}let l=o.end();return l&&l.length>0?(r=!0,H.wrap(l)):null}return r=!0,H.wrap(o.write(a))}}}function o5(i){return i===KL||i===null?Db:i}function UQ(i,t){if(!i||t<yw.length)return null;let e=i.readUInt8(0),n=i.readUInt8(1);if(e===yw[0]&&n===yw[1])return bw;if(e===$L[0]&&n===$L[1])return Iw;if(t<Rb.length)return null;let o=i.readUInt8(2);return e===Rb[0]&&n===Rb[1]&&o===Rb[2]?KL:null}var FQ=["ascii","utf-16","utf-32"];async function HQ(i,t){let e=await vw("jschardet","dist/jschardet.min.js"),n=i.slice(0,NQ),o=$Q(n.buffer);t&&(t=nt(t.map(a=>BQ(a))),t.length===0&&(t=void 0));let r;try{r=e.detect(o,t?{detectEncodings:t}:void 0)}catch{return null}if(!r?.encoding)return null;let s=r.encoding.toLowerCase();return 0<=FQ.indexOf(s)?null:VQ(r.encoding)}var WQ={ibm866:"cp866",big5:"cp950"};function r5(i){return i.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function VQ(i){let t=r5(i);return WQ[t]||t}function BQ(i){let t=r5(i),e=qQ[t];return e?e.guessableName:void 0}function $Q(i){let t="";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t}function i5(i){switch(i){case"shiftjis":return"shift-jis";case"utf16le":return"utf-16le";case"utf16be":return"utf-16be";case"big5hkscs":return"big5-hkscs";case"eucjp":return"euc-jp";case"euckr":return"euc-kr";case"koi8r":return"koi8-r";case"koi8u":return"koi8-u";case"macroman":return"x-mac-roman";case"utf8bom":return"utf8";default:{let t=i.match(/windows(\d+)/);return t?"windows-"+t[1]:i}}}function zQ({buffer:i,bytesRead:t},e,n){let o=UQ(i,t),r=!1;if(o!==bw&&o!==Iw&&i){let s=!0,a=!0,l=!1;for(let d=0;d<t&&d<MQ;d++){let c=d%2===1,u=i.readUInt8(d)===0;if(u&&(l=!0),s&&(c&&!u||!c&&u)&&(s=!1),a&&(c&&u||!c&&!u)&&(a=!1),u&&!s&&!a)break}l&&(s?o=Iw:a?o=bw:r=!0)}return e&&!r&&!o&&i?HQ(i.slice(0,t),n).then(s=>({seemsBinary:!1,encoding:s})):{seemsBinary:r,encoding:o}}var BL={utf8:{labelLong:"UTF-8",labelShort:"UTF-8",order:1,alias:"utf8bom",guessableName:"UTF-8"},utf8bom:{labelLong:"UTF-8 with BOM",labelShort:"UTF-8 with BOM",encodeOnly:!0,order:2,alias:"utf8"},utf16le:{labelLong:"UTF-16 LE",labelShort:"UTF-16 LE",order:3,guessableName:"UTF-16LE"},utf16be:{labelLong:"UTF-16 BE",labelShort:"UTF-16 BE",order:4,guessableName:"UTF-16BE"},windows1252:{labelLong:"Western (Windows 1252)",labelShort:"Windows 1252",order:5,guessableName:"windows-1252"},iso88591:{labelLong:"Western (ISO 8859-1)",labelShort:"ISO 8859-1",order:6},iso88593:{labelLong:"Western (ISO 8859-3)",labelShort:"ISO 8859-3",order:7},iso885915:{labelLong:"Western (ISO 8859-15)",labelShort:"ISO 8859-15",order:8},macroman:{labelLong:"Western (Mac Roman)",labelShort:"Mac Roman",order:9},cp437:{labelLong:"DOS (CP 437)",labelShort:"CP437",order:10},windows1256:{labelLong:"Arabic (Windows 1256)",labelShort:"Windows 1256",order:11},iso88596:{labelLong:"Arabic (ISO 8859-6)",labelShort:"ISO 8859-6",order:12},windows1257:{labelLong:"Baltic (Windows 1257)",labelShort:"Windows 1257",order:13},iso88594:{labelLong:"Baltic (ISO 8859-4)",labelShort:"ISO 8859-4",order:14},iso885914:{labelLong:"Celtic (ISO 8859-14)",labelShort:"ISO 8859-14",order:15},windows1250:{labelLong:"Central European (Windows 1250)",labelShort:"Windows 1250",order:16,guessableName:"windows-1250"},iso88592:{labelLong:"Central European (ISO 8859-2)",labelShort:"ISO 8859-2",order:17,guessableName:"ISO-8859-2"},cp852:{labelLong:"Central European (CP 852)",labelShort:"CP 852",order:18},windows1251:{labelLong:"Cyrillic (Windows 1251)",labelShort:"Windows 1251",order:19,guessableName:"windows-1251"},cp866:{labelLong:"Cyrillic (CP 866)",labelShort:"CP 866",order:20,guessableName:"IBM866"},cp1125:{labelLong:"Cyrillic (CP 1125)",labelShort:"CP 1125",order:21,guessableName:"IBM1125"},iso88595:{labelLong:"Cyrillic (ISO 8859-5)",labelShort:"ISO 8859-5",order:22,guessableName:"ISO-8859-5"},koi8r:{labelLong:"Cyrillic (KOI8-R)",labelShort:"KOI8-R",order:23,guessableName:"KOI8-R"},koi8u:{labelLong:"Cyrillic (KOI8-U)",labelShort:"KOI8-U",order:24},iso885913:{labelLong:"Estonian (ISO 8859-13)",labelShort:"ISO 8859-13",order:25},windows1253:{labelLong:"Greek (Windows 1253)",labelShort:"Windows 1253",order:26,guessableName:"windows-1253"},iso88597:{labelLong:"Greek (ISO 8859-7)",labelShort:"ISO 8859-7",order:27,guessableName:"ISO-8859-7"},windows1255:{labelLong:"Hebrew (Windows 1255)",labelShort:"Windows 1255",order:28,guessableName:"windows-1255"},iso88598:{labelLong:"Hebrew (ISO 8859-8)",labelShort:"ISO 8859-8",order:29,guessableName:"ISO-8859-8"},iso885910:{labelLong:"Nordic (ISO 8859-10)",labelShort:"ISO 8859-10",order:30},iso885916:{labelLong:"Romanian (ISO 8859-16)",labelShort:"ISO 8859-16",order:31},windows1254:{labelLong:"Turkish (Windows 1254)",labelShort:"Windows 1254",order:32},iso88599:{labelLong:"Turkish (ISO 8859-9)",labelShort:"ISO 8859-9",order:33},cp857:{labelLong:"Turkish (CP 857)",labelShort:"CP 857",order:34},windows1258:{labelLong:"Vietnamese (Windows 1258)",labelShort:"Windows 1258",order:35},gbk:{labelLong:"Simplified Chinese (GBK)",labelShort:"GBK",order:36},gb18030:{labelLong:"Simplified Chinese (GB18030)",labelShort:"GB18030",order:37},cp950:{labelLong:"Traditional Chinese (Big5)",labelShort:"Big5",order:38,guessableName:"Big5"},big5hkscs:{labelLong:"Traditional Chinese (Big5-HKSCS)",labelShort:"Big5-HKSCS",order:39},shiftjis:{labelLong:"Japanese (Shift JIS)",labelShort:"Shift JIS",order:40,guessableName:"SHIFT_JIS"},eucjp:{labelLong:"Japanese (EUC-JP)",labelShort:"EUC-JP",order:41,guessableName:"EUC-JP"},euckr:{labelLong:"Korean (EUC-KR)",labelShort:"EUC-KR",order:42,guessableName:"EUC-KR"},windows874:{labelLong:"Thai (Windows 874)",labelShort:"Windows 874",order:43},iso885911:{labelLong:"Latin/Thai (ISO 8859-11)",labelShort:"ISO 8859-11",order:44},koi8ru:{labelLong:"Cyrillic (KOI8-RU)",labelShort:"KOI8-RU",order:45},koi8t:{labelLong:"Tajik (KOI8-T)",labelShort:"KOI8-T",order:46},gb2312:{labelLong:"Simplified Chinese (GB 2312)",labelShort:"GB 2312",order:47,guessableName:"GB2312"},cp865:{labelLong:"Nordic DOS (CP 865)",labelShort:"CP 865",order:48},cp850:{labelLong:"Western European DOS (CP 850)",labelShort:"CP 850",order:49}},qQ=(()=>{let i={};for(let t in BL)BL[t].guessableName&&(i[t]=BL[t]);return i})();var E4e=A("textFileService");function s5(i){let t=!1;return{read(){return t?null:(t=!0,i)}}}function Mb(i,t,e){return new vs(n=>Sw(n,e)).isEqual(i,t)}function KQ(i,t,e){return Mb(i.uri,t.uri,e)?0:Ri(i.uri.toString(),t.uri.toString())}function jQ(i,t,e){return i.index!==t.index?i.index<t.index?-1:1:Mb(i.uri,t.uri,e)?Ri(i.name,t.name):Ri(i.uri.toString(),t.uri.toString())}function l5(i,t,e,n){let o=i.slice(0).sort((s,a)=>e(s,a,n)),r=t.slice(0).sort((s,a)=>e(s,a,n));return vH(o,r,(s,a)=>e(s,a,n))}function Sw(i,t){let e=t.getCapabilities(i.scheme);return!(e&&e&1024)}var Ab=class i extends bS{constructor(e,n,o,r,s,a,l){super(e,o.map(d=>new Zc(d)),r,s,l);this._name=n;this._isUntitled=a;this._workspaceFolders=[];this._structure=ar.forUris(l,()=>!0),o.forEach(d=>{this._workspaceFolders.push(d),this._structure.set(d.uri,d)})}static toExtHostWorkspace(e,n,o,r){if(!e)return{workspace:null,added:[],removed:[]};let{id:s,name:a,folders:l,configuration:d,transient:c,isUntitled:u}=e,m=[],g=n;n?l.forEach((x,E)=>{let w=y.revive(x.uri),R=i._findFolder(o||n,w,r);R?(R.name=x.name,R.index=x.index,m.push(R)):m.push({uri:w,name:x.name,index:E})}):m.push(...l.map(({uri:x,name:E,index:w})=>({uri:y.revive(x),name:E,index:w}))),m.sort((x,E)=>x.index<E.index?-1:1);let h=new i(s,a,m,!!c,d?y.revive(d):null,!!u,x=>Sw(x,r)),{added:f,removed:I}=l5(g?g.workspaceFolders:[],h.workspaceFolders,KQ,r);return{workspace:h,added:f,removed:I}}static _findFolder(e,n,o){for(let r=0;r<e.folders.length;r++){let s=e.workspaceFolders[r];if(Mb(s.uri,n,o))return s}}get name(){return this._name}get isUntitled(){return this._isUntitled}get workspaceFolders(){return this._workspaceFolders.slice(0)}getWorkspaceFolder(e,n){return n&&this._structure.get(e)&&(e=Ho(e)),this._structure.findSubstr(e)}resolveWorkspaceFolder(e){return this._structure.get(e)}},Gg=class{constructor(t,e,n,o,r){this._onDidChangeWorkspace=new T;this.onDidChangeWorkspace=this._onDidChangeWorkspace.event;this._onDidGrantWorkspaceTrust=new T;this.onDidGrantWorkspaceTrust=this._onDidGrantWorkspaceTrust.event;this._onDidChangeWorkspaceTrustedFolders=new T;this.onDidChangeWorkspaceTrustedFolders=this._onDidChangeWorkspaceTrustedFolders.event;this._activeSearchCallbacks=[];this._trusted=!1;this._editSessionIdentityProviders=new Map;this._providerHandlePool=0;this._onWillCreateEditSessionIdentityEvent=new ms;this._canonicalUriProviders=new Map;this._logService=o,this._extHostFileSystemInfo=n,this._uriTransformerService=r,this._requestIdProvider=new fS,this._barrier=new kn,this._proxy=t.getProxy(F.MainThreadWorkspace),this._messageService=t.getProxy(F.MainThreadMessageService),this._telemetryProxy=t.getProxy(F.MainThreadTelemetry);let s=e.workspace;this._confirmedWorkspace=s?new Ab(s.id,s.name,[],!!s.transient,s.configuration?y.revive(s.configuration):null,!!s.isUntitled,a=>Sw(a,n)):void 0}$setConfigProvider(t){this._configProvider=t}_useIgnoreFilesInFindFiles(){return this._configProvider?.getConfiguration("search").get("experimental.useIgnoreFilesInFindFiles")??!1}_userIgnoreFilesSetting(){return this._configProvider?.getConfiguration("search").get("useIgnoreFiles")??!0}$initializeWorkspace(t,e){this._trusted=e,this.$acceptWorkspaceData(t),this._barrier.open()}waitForInitializeCall(){return this._barrier.wait()}get workspace(){return this._actualWorkspace}get name(){return this._actualWorkspace?this._actualWorkspace.name:void 0}get workspaceFile(){if(this._actualWorkspace&&this._actualWorkspace.configuration)return this._actualWorkspace.isUntitled?y.from({scheme:B.untitled,path:Ze(Ho(this._actualWorkspace.configuration))}):this._actualWorkspace.configuration}get _actualWorkspace(){return this._unconfirmedWorkspace||this._confirmedWorkspace}getWorkspaceFolders(){if(this._actualWorkspace)return this._actualWorkspace.workspaceFolders.slice(0)}async getWorkspaceFolders2(){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.workspaceFolders.slice(0)}updateWorkspaceFolders(t,e,n,...o){let r=[];if(Array.isArray(o)&&o.forEach(c=>{y.isUri(c.uri)&&!r.some(u=>Mb(u.uri,c.uri,this._extHostFileSystemInfo))&&r.push({uri:c.uri,name:c.name||vv(c.uri)})}),this._unconfirmedWorkspace||[e,n].some(c=>typeof c!="number"||c<0)||n===0&&r.length===0)return!1;let s=this._actualWorkspace?this._actualWorkspace.workspaceFolders:[];if(e+n>s.length)return!1;let a=s.slice(0);a.splice(e,n,...r.map(c=>({uri:c.uri,name:c.name||vv(c.uri),index:void 0})));for(let c=0;c<a.length;c++){let u=a[c];if(a.some((m,g)=>g!==c&&Mb(u.uri,m.uri,this._extHostFileSystemInfo)))return!1}a.forEach((c,u)=>c.index=u);let{added:l,removed:d}=l5(s,a,jQ,this._extHostFileSystemInfo);if(l.length===0&&d.length===0)return!1;if(this._proxy){let c=t.displayName||t.name;this._proxy.$updateWorkspaceFolders(c,e,n,r).then(void 0,u=>{this._unconfirmedWorkspace=void 0;let m={source:{identifier:t.identifier,label:t.displayName||t.name}};this._messageService.$showMessage(XW.Error,p(5894,null,c,u.toString()),m,[])})}return this.trySetWorkspaceFolders(a),!0}getWorkspaceFolder(t,e){if(this._actualWorkspace)return this._actualWorkspace.getWorkspaceFolder(t,e)}async getWorkspaceFolder2(t,e){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.getWorkspaceFolder(t,e)}async resolveWorkspaceFolder(t){if(await this._barrier.wait(),!!this._actualWorkspace)return this._actualWorkspace.resolveWorkspaceFolder(t)}getPath(){if(!this._actualWorkspace)return;let{folders:t}=this._actualWorkspace;if(t.length!==0)return t[0].uri.fsPath}getRelativePath(t,e){let n,o="";if(typeof t=="string"?(n=y.file(t),o=t):typeof t<"u"&&(n=t,o=t.fsPath),!n)return o;let r=this.getWorkspaceFolder(n,!0);if(!r)return o;typeof e>"u"&&this._actualWorkspace&&(e=this._actualWorkspace.folders.length>1);let s=bv(r.uri,n);return e&&r.name&&(s=`${r.name}/${s}`),s}trySetWorkspaceFolders(t){this._actualWorkspace&&(this._unconfirmedWorkspace=Ab.toExtHostWorkspace({id:this._actualWorkspace.id,name:this._actualWorkspace.name,configuration:this._actualWorkspace.configuration,folders:t,isUntitled:this._actualWorkspace.isUntitled},this._actualWorkspace,void 0,this._extHostFileSystemInfo).workspace||void 0)}$acceptWorkspaceData(t){let{workspace:e,added:n,removed:o}=Ab.toExtHostWorkspace(t,this._confirmedWorkspace,this._unconfirmedWorkspace,this._extHostFileSystemInfo);this._confirmedWorkspace=e||void 0,this._unconfirmedWorkspace=void 0,this._onDidChangeWorkspace.fire(Object.freeze({added:n,removed:o}))}findFiles(t,e,n,o,r=pe.None){this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${o.value}, entryPoint: findFiles`);let s="",a=!0;e===null?a=!1:e!==void 0&&(typeof e=="string"?s=e:s=e.pattern);let d=this._useIgnoreFilesInFindFiles()&&e!==null?void 0:!1;return this._findFilesImpl({type:"include",value:t},{exclude:[s],maxResults:n,useExcludeSettings:a?2:1,useIgnoreFiles:{local:d}},o,"findFiles",{useIgnoreFilesLocal:void 0,excludeWasNull:e===null},r)}findFiles2(t,e={},n,o=pe.None){return this._logService.trace(`extHostWorkspace#findFiles2New: fileSearch, extension: ${n.value}, entryPoint: findFiles2New`),this._findFilesImpl({type:"filePatterns",value:t},e,n,"findFiles2",{useIgnoreFilesLocal:e.useIgnoreFiles?.local,excludeWasNull:!1},o)}async _findFilesImpl(t,e,n,o,r,s){let a=r.useIgnoreFilesLocal===!0?"true":r.useIgnoreFilesLocal===!1?"false":"unspecified",l=new Xt(!0),d=0,c=this._userIgnoreFilesSetting(),u=0,m=!1,g=!1;try{if(s.isCancellationRequested)return m=!0,[];let h=t.type==="include"?[t.value]:t.value??[];if(!Array.isArray(h))throw console.error("Invalid file pattern provided",h),new Error(`Invalid file pattern provided ${JSON.stringify(h)}`);let f=h.map(E=>{let w=a5(e.exclude),R={ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles?.local=="boolean"?!e.useIgnoreFiles.local:void 0,disregardGlobalIgnoreFiles:typeof e.useIgnoreFiles?.global=="boolean"?!e.useIgnoreFiles.global:void 0,disregardParentIgnoreFiles:typeof e.useIgnoreFiles?.parent=="boolean"?!e.useIgnoreFiles.parent:void 0,disregardExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings===1,disregardSearchExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings!==3,maxResults:e.maxResults,excludePattern:w.length>0?w:void 0,ignoreGlobCase:e.caseInsensitive,_reason:"startFileSearch",shouldGlobSearch:t.type==="include"?void 0:!0},L=xw(Jo.from(E)),U=L?.folder;return t.type==="include"?R.includePattern=L?.pattern:R.filePattern=L?.pattern,{folder:U,options:R}});d=f.length;let I=this._userIgnoreFilesSetting();c=f.every(E=>E.options.disregardIgnoreFiles===!0?!1:E.options.disregardIgnoreFiles===!1?!0:I);let x=await this._findFilesBase(f,s);return u=x.length,m=s.isCancellationRequested,x}catch(h){throw g=!0,m=s.isCancellationRequested,h}finally{this._reportFindFilesTelemetry({extensionId:n.value,apiKind:o,respectedIgnoreFiles:c,useIgnoreFilesLocalRequested:a,excludeWasNull:r.excludeWasNull,resultCount:u,durationMs:l.elapsed(),queryCount:d,cancelled:m,errored:g})}}async _findFilesBase(t,e){let n=e,o;if(!pe.isCancellationToken(e)){o=new Ee;let d=e;typeof d.onCancellationRequested=="function"&&d.onCancellationRequested(()=>o.cancel()),n=o.token}let s=(await Promise.all(t?.map(d=>this._proxy.$startFileSearch(d.folder??null,d.options,n).then(c=>Array.isArray(c)?c.map(u=>y.revive(u)):[]))??[])).flat();o?.dispose();let a=new vs(d=>Sw(d,this._extHostFileSystemInfo)),l=new Map;for(let d of s){let c=a.getComparisonKey(d);l.has(c)||l.set(c,d)}return Array.from(l.values())}_reportFindFilesTelemetry(t){this._telemetryProxy.$publicLog2("extHostFindFiles",t)}findTextInFiles2(t,e,n,o=pe.None){this._logService.trace(`extHostWorkspace#findTextInFiles2: textSearch, extension: ${n.value}, entryPoint: findTextInFiles2`);let r=m=>{if(!e)return{folder:void 0,options:{}};let g=m?xw(Jo.from(m)):void 0,h=e.exclude?a5(e.exclude):void 0;return{options:{ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles?.local=="boolean"?!e.useIgnoreFiles?.local:void 0,disregardGlobalIgnoreFiles:typeof e.useIgnoreFiles?.global=="boolean"?!e.useIgnoreFiles?.global:void 0,disregardParentIgnoreFiles:typeof e.useIgnoreFiles?.parent=="boolean"?!e.useIgnoreFiles?.parent:void 0,disregardExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings===1,disregardSearchExcludeSettings:e.useExcludeSettings!==void 0&&e.useExcludeSettings!==3,fileEncoding:e.encoding,maxResults:e.maxResults,ignoreGlobCase:e.caseInsensitive,previewOptions:e.previewOptions?{matchLines:e.previewOptions?.numMatchLines??100,charsPerLine:e.previewOptions?.charsPerLine??1e4}:void 0,surroundingContext:e.surroundingContext,includePattern:g?.pattern,excludePattern:h},folder:g?.folder}},a=(e?.include?.map(m=>r(m))??[r(void 0)]).filter(m=>!!m),l=new $,d=l.add(new T),c=this.findTextInFilesBase(t,a,(m,g)=>d.fire({result:m,uri:g}),o);return{results:new qp(async m=>{l.add(d.event(g=>{let h=g.result,f=g.uri;wb(h)?m.emitOne(new Yo(f,h.rangeLocations.map(I=>({previewRange:new ve(I.preview.startLineNumber,I.preview.startColumn,I.preview.endLineNumber,I.preview.endColumn),sourceRange:new ve(I.source.startLineNumber,I.source.startColumn,I.source.endLineNumber,I.source.endColumn)})),h.previewText)):m.emitOne(new ta(f,h.text,h.lineNumber))})),await c}),complete:c.then(m=>(l.dispose(),{limitHit:m?.limitHit??!1}))}}async findTextInFilesBase(t,e,n,o=pe.None){let r=this._requestIdProvider.getNext(),s=!1;if(o.onCancellationRequested(a=>{s=!0}),this._activeSearchCallbacks[r]=a=>{if(s)return;let l=y.revive(a.resource);a.results.forEach(d=>{let c=Tt(d);n(c,l)})},o.isCancellationRequested)return{};try{let a=await Promise.all(e?.map(l=>this._proxy.$startTextSearch(t,l.folder??null,l.options,r,o)||{})??[]);return delete this._activeSearchCallbacks[r],a.reduce((l,d)=>({limitHit:l?.limitHit||(d?.limitHit??!1),message:[l?.message??[],d?.message??[]].flat()}),{})??{limitHit:!1}}catch(a){throw delete this._activeSearchCallbacks[r],a}}async findTextInFiles(t,e,n,o,r=pe.None){this._logService.trace(`extHostWorkspace#findTextInFiles: textSearch, extension: ${o.value}, entryPoint: findTextInFiles`);let s=typeof e.previewOptions>"u"?{matchLines:100,charsPerLine:1e4}:e.previewOptions,a=xw(Jo.from(e.include)),l=typeof e.exclude=="string"?e.exclude:e.exclude?e.exclude.pattern:void 0,d={ignoreSymlinks:typeof e.followSymlinks=="boolean"?!e.followSymlinks:void 0,disregardIgnoreFiles:typeof e.useIgnoreFiles=="boolean"?!e.useIgnoreFiles:void 0,disregardGlobalIgnoreFiles:typeof e.useGlobalIgnoreFiles=="boolean"?!e.useGlobalIgnoreFiles:void 0,disregardParentIgnoreFiles:typeof e.useParentIgnoreFiles=="boolean"?!e.useParentIgnoreFiles:void 0,disregardExcludeSettings:typeof e.useDefaultExcludes=="boolean"?!e.useDefaultExcludes:!0,disregardSearchExcludeSettings:typeof e.useSearchExclude=="boolean"?!e.useSearchExclude:!0,fileEncoding:e.encoding,maxResults:e.maxResults,previewOptions:s,surroundingContext:e.afterContext,includePattern:a?.pattern,excludePattern:l?[{pattern:l}]:void 0},c=(u,m)=>{wb(u)?n({uri:m,preview:{text:u.previewText,matches:Ec(u.rangeLocations,g=>new ve(g.preview.startLineNumber,g.preview.startColumn,g.preview.endLineNumber,g.preview.endColumn))},ranges:Ec(u.rangeLocations,g=>new ve(g.source.startLineNumber,g.source.startColumn,g.source.endLineNumber,g.source.endColumn))}):n({uri:m,text:u.text,lineNumber:u.lineNumber})};return this.findTextInFilesBase(t,[{options:d,folder:a?.folder}],c,r)}$handleTextSearchResult(t,e){this._activeSearchCallbacks[e]?.(t)}async save(t){let e=await this._proxy.$save(t,{saveAs:!1});return y.revive(e)}async saveAs(t){let e=await this._proxy.$save(t,{saveAs:!0});return y.revive(e)}saveAll(t){return this._proxy.$saveAll(t)}resolveProxy(t){return this._proxy.$resolveProxy(t)}lookupAuthorization(t){return this._proxy.$lookupAuthorization(t)}lookupKerberosAuthorization(t){return this._proxy.$lookupKerberosAuthorization(t)}loadCertificates(){return this._proxy.$loadCertificates()}get trusted(){return this._trusted}requestResourceTrust(t){return this._proxy.$requestResourceTrust(t)}requestWorkspaceTrust(t){return this._proxy.$requestWorkspaceTrust(t)}$onDidGrantWorkspaceTrust(){this._trusted||(this._trusted=!0,this._onDidGrantWorkspaceTrust.fire())}$onDidChangeWorkspaceTrustedFolders(){this._onDidChangeWorkspaceTrustedFolders.fire()}isResourceTrusted(t){return this._proxy.$isResourceTrusted(t)}registerEditSessionIdentityProvider(t,e){if(this._editSessionIdentityProviders.has(t))throw new Error(`A provider has already been registered for scheme ${t}`);this._editSessionIdentityProviders.set(t,e);let n=this._uriTransformerService.transformOutgoingScheme(t),o=this._providerHandlePool++;return this._proxy.$registerEditSessionIdentityProvider(o,n),q(()=>{this._editSessionIdentityProviders.delete(t),this._proxy.$unregisterEditSessionIdentityProvider(o)})}async $getEditSessionIdentifier(t,e){this._logService.info("Getting edit session identifier for workspaceFolder",t);let n=await this.resolveWorkspaceFolder(y.revive(t));if(!n){this._logService.warn("Unable to resolve workspace folder");return}this._logService.info("Invoking #provideEditSessionIdentity for workspaceFolder",n);let o=this._editSessionIdentityProviders.get(n.uri.scheme);if(this._logService.info(`Provider for scheme ${n.uri.scheme} is defined: `,!!o),!o)return;let r=await o.provideEditSessionIdentity(n,e);if(this._logService.info("Provider returned edit session identifier: ",r),!!r)return r}async $provideEditSessionIdentityMatch(t,e,n,o){this._logService.info("Getting edit session identifier for workspaceFolder",t);let r=await this.resolveWorkspaceFolder(y.revive(t));if(!r){this._logService.warn("Unable to resolve workspace folder");return}this._logService.info("Invoking #provideEditSessionIdentity for workspaceFolder",r);let s=this._editSessionIdentityProviders.get(r.uri.scheme);if(this._logService.info(`Provider for scheme ${r.uri.scheme} is defined: `,!!s),!s)return;let a=await s.provideEditSessionIdentityMatch?.(e,n,o);if(this._logService.info("Provider returned edit session identifier match result: ",a),!!a)return a}getOnWillCreateEditSessionIdentityEvent(t){return(e,n,o)=>{let r=function(a){e.call(n,a)};return r.extension=t,this._onWillCreateEditSessionIdentityEvent.event(r,void 0,o)}}async $onWillCreateEditSessionIdentity(t,e,n){let o=await this.resolveWorkspaceFolder(y.revive(t));if(o===void 0)throw new Error("Unable to resolve workspace folder");await this._onWillCreateEditSessionIdentityEvent.fireAsync({workspaceFolder:o},e,async(r,s)=>{let a=Date.now();await Promise.resolve(r),Date.now()-a>n&&this._logService.warn("SLOW edit session create-participant",s.extension.identifier)}),e.isCancellationRequested}registerCanonicalUriProvider(t,e){if(this._canonicalUriProviders.has(t))throw new Error(`A provider has already been registered for scheme ${t}`);this._canonicalUriProviders.set(t,e);let n=this._uriTransformerService.transformOutgoingScheme(t),o=this._providerHandlePool++;return this._proxy.$registerCanonicalUriProvider(o,n),q(()=>{this._canonicalUriProviders.delete(t),this._proxy.$unregisterCanonicalUriProvider(o)})}async provideCanonicalUri(t,e,n){let o=this._canonicalUriProviders.get(t.scheme);if(!o)return;let r=await o.provideCanonicalUri?.(y.revive(t),e,n);if(r)return r}async $provideCanonicalUri(t,e,n){return this.provideCanonicalUri(y.revive(t),{targetScheme:e},n)}async decode(t,e){let[n,o]=this.toEncodeDecodeParameters(e),r=await this._proxy.$resolveDecoding(n,o),s=(await t5(K2(H.wrap(t)),{...r,acceptTextOnly:!0,overwriteEncoding:a=>a===null||a===r.preferredEncoding?Promise.resolve(r.preferredEncoding):this._proxy.$validateDetectedEncoding(n,a,o)})).stream;return Nx(s,a=>a.join(""))}async encode(t,e){let[n,o]=this.toEncodeDecodeParameters(e),{encoding:r,addBOM:s}=await this._proxy.$resolveEncoding(n,o);if(r===Db&&!s)return H.fromString(t).buffer;let a=await n5(s5(t),r,{addBOM:s});return q2(a).buffer}toEncodeDecodeParameters(t){let e=jl(t?.uri)?t.uri:void 0,n=typeof t?.encoding=="string"?t.encoding:void 0;return[e,n?{encoding:n}:void 0]}};Gg=_([S(0,le),S(1,Ye),S(2,ai),S(3,te),S(4,xs)],Gg);var Vn=A("IExtHostWorkspace");function xw(i){let t,e;if(i)return typeof i=="string"?t=i:(t=i.pattern,e=y.revive(i.baseUri)),{pattern:t,folder:e}}function a5(i){return(i?.map(t=>{if(typeof t=="string")return t===""?void 0:{pattern:t,uri:void 0};{let e=xw(t);return e?{pattern:e.pattern,uri:e.folder}:void 0}})??[]).filter(t=>!!t)}function Lb(i){return Object.isFrozen(i)?i:Ov(i)}var Zd=class i{constructor(t,e,n,o,r){this._contents=t;this._keys=e;this._overrides=n;this._raw=o;this.logService=r;this.overrideConfigurations=new Map}static createEmptyModel(t){return new i({},[],[],void 0,t)}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){let t=(Array.isArray(this._raw)?this._raw:[this._raw]).map(e=>{if(e instanceof i)return e;let n=new jL("",this.logService);return n.parseRaw(e),n.configurationModel});this._rawConfiguration=t.reduce((e,n)=>n===e?n:e.merge(n),t[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}get raw(){if(this._raw&&!(Array.isArray(this._raw)&&this._raw.every(t=>t instanceof i)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(t){return t?hy(this.contents,t):this.contents}inspect(t,e){let n=this;return{get value(){return Lb(n.rawConfiguration.getValue(t))},get override(){return e?Lb(n.rawConfiguration.getOverrideValue(t,e)):void 0},get merged(){return Lb(e?n.rawConfiguration.override(e).getValue(t):n.rawConfiguration.getValue(t))},get overrides(){let o=[];for(let{contents:r,identifiers:s,keys:a}of n.rawConfiguration.overrides){let l=new i(r,a,[],void 0,n.logService).getValue(t);l!==void 0&&o.push({identifiers:s,value:l})}return o.length?Lb(o):void 0}}}getOverrideValue(t,e){let n=this.getContentsForOverrideIdentifer(e);return n?t?hy(n,t):n:void 0}getKeysForOverrideIdentifier(t){let e=[];for(let n of this.overrides)n.identifiers.includes(t)&&e.push(...n.keys);return er(e)}getAllOverrideIdentifiers(){let t=[];for(let e of this.overrides)t.push(...e.identifiers);return er(t)}override(t){let e=this.overrideConfigurations.get(t);return e||(e=this.createOverrideConfigurationModel(t),this.overrideConfigurations.set(t,e)),e}merge(...t){let e=ft(this.contents),n=ft(this.overrides),o=[...this.keys],r=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(let s of t)if(r.push(...s._raw?Array.isArray(s._raw)?s._raw:[s._raw]:[s]),!s.isEmpty()){this.mergeContents(e,s.contents);for(let a of s.overrides){let[l]=n.filter(d=>dn(d.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=er(l.keys)):n.push(ft(a))}for(let a of s.keys)o.indexOf(a)===-1&&o.push(a)}return new i(e,o,n,!r.length||r.every(s=>s instanceof i)?void 0:r,this.logService)}createOverrideConfigurationModel(t){let e=this.getContentsForOverrideIdentifer(t);if(!e||typeof e!="object"||!Object.keys(e).length)return this;let n={};for(let o of er([...Object.keys(this.contents),...Object.keys(e)])){let r=this.contents[o],s=e[o];s&&(typeof r=="object"&&typeof s=="object"?(r=ft(r),this.mergeContents(r,s)):r=s),n[o]=r}return new i(n,this.keys,this.overrides,void 0,this.logService)}mergeContents(t,e){for(let n of Object.keys(e)){if(n in t&&st(t[n])&&st(e[n])){this.mergeContents(t[n],e[n]);continue}t[n]=ft(e[n])}}getContentsForOverrideIdentifer(t){let e=null,n=null,o=r=>{r&&(n?this.mergeContents(n,r):n=ft(r))};for(let r of this.overrides)r.identifiers.length===1&&r.identifiers[0]===t?e=r.contents:r.identifiers.includes(t)&&o(r.contents);return o(e),n}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(t,e){this.updateValue(t,e,!0)}setValue(t,e){this.updateValue(t,e,!1)}removeValue(t){let e=this.keys.indexOf(t);e!==-1&&(this.keys.splice(e,1),hB(this.contents,t),ci.test(t)&&this.overrides.splice(this.overrides.findIndex(n=>dn(n.identifiers,vm(t))),1))}updateValue(t,e,n){if(jM(this.contents,t,e,o=>this.logService.error(o)),n=n||this.keys.indexOf(t)===-1,n&&this.keys.push(t),ci.test(t)){let o=this.contents[t],r=vm(t),s={identifiers:r,keys:Object.keys(o),contents:GS(o,l=>this.logService.error(l))},a=this.overrides.findIndex(l=>dn(l.identifiers,r));a!==-1?this.overrides[a]=s:this.overrides.push(s)}}},jL=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||Zd.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(t,e){if(!Wt(t)){let n=this.doParseContent(t);this.parseRaw(n,e)}}reparse(t){this._raw&&this.parseRaw(this._raw,t)}parseRaw(t,e){this._raw=t;let{contents:n,keys:o,overrides:r,restricted:s,hasExcludedProperties:a}=this.doParseRaw(t,e);this._configurationModel=new Zd(n,o,r,a?[t]:void 0,this.logService),this._restrictedConfigurations=s||[]}doParseContent(t){let e={},n=null,o=[],r=[],s=[];function a(d){Array.isArray(o)?o.push(d):n!==null&&(o[n]=d)}let l={onObjectBegin:()=>{let d={};a(d),r.push(o),o=d,n=null},onObjectProperty:d=>{n=d},onObjectEnd:()=>{o=r.pop()},onArrayBegin:()=>{let d=[];a(d),r.push(o),o=d,n=null},onArrayEnd:()=>{o=r.pop()},onLiteralValue:a,onError:(d,c,u)=>{s.push({error:d,offset:c,length:u})}};if(t)try{H1(t,l),e=o[0]||{}}catch(d){this.logService.error(`Error while parsing settings file ${this._name}: ${d}`),this._parseErrors=[d]}return e}doParseRaw(t,e){let n=wt.as(kr.Configuration),o=n.getConfigurationProperties(),r=n.getExcludedConfigurationProperties(),s=this.filter(t,o,r,!0,e);t=s.raw;let a=GS(t,c=>this.logService.error(`Conflict in settings file ${this._name}: ${c}`)),l=Object.keys(t),d=this.toOverrides(t,c=>this.logService.error(`Conflict in settings file ${this._name}: ${c}`));return{contents:a,keys:l,overrides:d,restricted:s.restricted,hasExcludedProperties:s.hasExcludedProperties}}filter(t,e,n,o,r){let s=!1;if(!r?.scopes&&!r?.skipRestricted&&!r?.skipUnregistered&&!r?.exclude?.length)return{raw:t,restricted:[],hasExcludedProperties:s};let a={},l=[];for(let d in t)if(ci.test(d)&&o){let c=this.filter(t[d],e,n,!1,r);a[d]=c.raw,s=s||c.hasExcludedProperties,l.push(...c.restricted)}else{let c=e[d];c?.restricted&&l.push(d),this.shouldInclude(d,c,n,r)?a[d]=t[d]:s=!0}return{raw:a,restricted:l,hasExcludedProperties:s}}shouldInclude(t,e,n,o){if(o.exclude?.includes(t))return!1;if(o.include?.includes(t))return!0;if(o.skipRestricted&&e?.restricted||o.skipUnregistered&&!e)return!1;let r=e??n[t],s=r?typeof r.scope<"u"?r.scope:4:void 0;return s===void 0||o.scopes===void 0?!0:o.scopes.includes(s)}toOverrides(t,e){let n=[];for(let o of Object.keys(t))if(ci.test(o)){let r={},s=t[o];for(let a in s)r[a]=s[a];n.push({identifiers:vm(o),keys:Object.keys(r),contents:GS(r,e)})}return n}};var GL=class{constructor(t,e,n,o,r,s,a,l,d,c,u,m,g){this.key=t;this.overrides=e;this._value=n;this.overrideIdentifiers=o;this.defaultConfiguration=r;this.policyConfiguration=s;this.applicationConfiguration=a;this.userConfiguration=l;this.localUserConfiguration=d;this.remoteUserConfiguration=c;this.workspaceConfiguration=u;this.folderConfigurationModel=m;this.memoryConfigurationModel=g}get value(){return Lb(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)}},Qg=class i{constructor(t,e,n,o,r,s,a,l,d,c){this._defaultConfiguration=t;this._policyConfiguration=e;this._applicationConfiguration=n;this._localUserConfiguration=o;this._remoteUserConfiguration=r;this._workspaceConfiguration=s;this._folderConfigurations=a;this._memoryConfiguration=l;this._memoryConfigurationByResource=d;this.logService=c;this._workspaceConsolidatedConfiguration=null;this._foldersConsolidatedConfigurations=new Ve;this._userConfiguration=null}getValue(t,e,n){return this.getConsolidatedConfigurationModel(t,e,n).getValue(t)}updateValue(t,e,n={}){let o;n.resource?(o=this._memoryConfigurationByResource.get(n.resource),o||(o=Zd.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(n.resource,o))):o=this._memoryConfiguration,e===void 0?o.removeValue(t):o.setValue(t,e),n.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(t,e,n){let o=this.getConsolidatedConfigurationModel(t,e,n),r=this.getFolderConfigurationModelForResource(e.resource,n),s=e.resource?this._memoryConfigurationByResource.get(e.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(let l of o.overrides)for(let d of l.identifiers)o.getOverrideValue(t,d)!==void 0&&a.add(d);return new GL(t,e,o.getValue(t),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,n?this._workspaceConfiguration:void 0,r||void 0,s)}keys(t){let e=this.getFolderConfigurationModelForResource(void 0,t);return{default:this._defaultConfiguration.keys.slice(0),policy:this._policyConfiguration.keys.slice(0),user:this.userConfiguration.keys.slice(0),workspace:this._workspaceConfiguration.keys.slice(0),workspaceFolder:e?e.keys.slice(0):[]}}updateDefaultConfiguration(t){this._defaultConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(t){this._policyConfiguration=t}updateApplicationConfiguration(t){this._applicationConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(t){this._localUserConfiguration=t,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(t){this._remoteUserConfiguration=t,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(t){this._workspaceConfiguration=t,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(t,e){this._folderConfigurations.set(t,e),this._foldersConsolidatedConfigurations.delete(t)}deleteFolderConfiguration(t){this.folderConfigurations.delete(t),this._foldersConsolidatedConfigurations.delete(t)}compareAndUpdateDefaultConfiguration(t,e){let n=[];if(!e){let{added:o,updated:r,removed:s}=Xd(this._defaultConfiguration,t);e=[...o,...r,...s]}for(let o of e)for(let r of vm(o)){let s=this._defaultConfiguration.getKeysForOverrideIdentifier(r),a=t.getKeysForOverrideIdentifier(r),l=[...a.filter(d=>s.indexOf(d)===-1),...s.filter(d=>a.indexOf(d)===-1),...s.filter(d=>!Et(this._defaultConfiguration.override(r).getValue(d),t.override(r).getValue(d)))];n.push([r,l])}return this.updateDefaultConfiguration(t),{keys:e,overrides:n}}compareAndUpdatePolicyConfiguration(t){let{added:e,updated:n,removed:o}=Xd(this._policyConfiguration,t),r=[...e,...n,...o];return r.length&&this.updatePolicyConfiguration(t),{keys:r,overrides:[]}}compareAndUpdateApplicationConfiguration(t){let{added:e,updated:n,removed:o,overrides:r}=Xd(this.applicationConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateApplicationConfiguration(t),{keys:s,overrides:r}}compareAndUpdateLocalUserConfiguration(t){let{added:e,updated:n,removed:o,overrides:r}=Xd(this.localUserConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateLocalUserConfiguration(t),{keys:s,overrides:r}}compareAndUpdateRemoteUserConfiguration(t){let{added:e,updated:n,removed:o,overrides:r}=Xd(this.remoteUserConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateRemoteUserConfiguration(t),{keys:s,overrides:r}}compareAndUpdateWorkspaceConfiguration(t){let{added:e,updated:n,removed:o,overrides:r}=Xd(this.workspaceConfiguration,t),s=[...e,...n,...o];return s.length&&this.updateWorkspaceConfiguration(t),{keys:s,overrides:r}}compareAndUpdateFolderConfiguration(t,e){let n=this.folderConfigurations.get(t),{added:o,updated:r,removed:s,overrides:a}=Xd(n,e),l=[...o,...r,...s];return(l.length||!n)&&this.updateFolderConfiguration(t,e),{keys:l,overrides:a}}compareAndDeleteFolderConfiguration(t){let e=this.folderConfigurations.get(t);if(!e)throw new Error("Unknown folder");this.deleteFolderConfiguration(t);let{added:n,updated:o,removed:r,overrides:s}=Xd(e,void 0);return{keys:[...n,...o,...r],overrides:s}}get defaults(){return this._defaultConfiguration}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{let t=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new Zd(t.contents,t.keys,t.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(t,e,n){let o=this.getConsolidatedConfigurationModelForResource(e,n);if(e.overrideIdentifier&&(o=o.override(e.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(t)!==void 0){o=o.merge();for(let r of this._policyConfiguration.keys)o.setValue(r,this._policyConfiguration.getValue(r))}return o}getConsolidatedConfigurationModelForResource({resource:t},e){let n=this.getWorkspaceConsolidatedConfiguration();if(e&&t){let o=e.getFolder(t);o&&(n=this.getFolderConsolidatedConfiguration(o.uri)||n);let r=this._memoryConfigurationByResource.get(t);r&&(n=n.merge(r))}return n}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(t){let e=this._foldersConsolidatedConfigurations.get(t);if(!e){let n=this.getWorkspaceConsolidatedConfiguration(),o=this._folderConfigurations.get(t);o?(e=n.merge(o),this._foldersConsolidatedConfigurations.set(t,e)):e=n}return e}getFolderConfigurationModelForResource(t,e){if(e&&t){let n=e.getFolder(t);if(n)return this._folderConfigurations.get(n.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((t,e)=>{let{contents:n,overrides:o,keys:r}=this._folderConfigurations.get(e);return t.push([e,{contents:n,overrides:o,keys:r}]),t},[])}}allKeys(){let t=new Set;return this._defaultConfiguration.keys.forEach(e=>t.add(e)),this.userConfiguration.keys.forEach(e=>t.add(e)),this._workspaceConfiguration.keys.forEach(e=>t.add(e)),this._folderConfigurations.forEach(e=>e.keys.forEach(n=>t.add(n))),[...t.values()]}allOverrideIdentifiers(){let t=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this.userConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(e=>t.add(e)),this._folderConfigurations.forEach(e=>e.getAllOverrideIdentifiers().forEach(n=>t.add(n))),[...t.values()]}getAllKeysForOverrideIdentifier(t){let e=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this.userConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this._workspaceConfiguration.getKeysForOverrideIdentifier(t).forEach(n=>e.add(n)),this._folderConfigurations.forEach(n=>n.getKeysForOverrideIdentifier(t).forEach(o=>e.add(o))),[...e.values()]}static parse(t,e){let n=this.parseConfigurationModel(t.defaults,e),o=this.parseConfigurationModel(t.policy,e),r=this.parseConfigurationModel(t.application,e),s=this.parseConfigurationModel(t.userLocal,e),a=this.parseConfigurationModel(t.userRemote,e),l=this.parseConfigurationModel(t.workspace,e),d=t.folders.reduce((c,u)=>(c.set(y.revive(u[0]),this.parseConfigurationModel(u[1],e)),c),new Ve);return new i(n,o,r,s,a,l,d,Zd.createEmptyModel(e),new Ve,e)}static parseConfigurationModel(t,e){return new Zd(t.contents,t.keys,t.overrides,t.raw,e)}};var Cw=class{constructor(t,e,n,o,r){this.change=t;this.previous=e;this.currentConfiguraiton=n;this.currentWorkspace=o;this.logService=r;this._marker=`
`;this._markerCode1=this._marker.charCodeAt(0);this._markerCode2=46;this.affectedKeys=new Set;this._previousConfiguration=void 0;for(let s of t.keys)this.affectedKeys.add(s);for(let[,s]of t.overrides)for(let a of s)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(let s of this.affectedKeys)this._affectsConfigStr+=s+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Qg.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(t,e){let n=this._marker+t,o=this._affectsConfigStr.indexOf(n);if(o<0)return!1;let r=o+n.length;if(r>=this._affectsConfigStr.length)return!1;let s=this._affectsConfigStr.charCodeAt(r);if(s!==this._markerCode1&&s!==this._markerCode2)return!1;if(e){let a=this.previousConfiguration?this.previousConfiguration.getValue(t,e,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(t,e,this.currentWorkspace);return!Et(a,l)}return!0}};function Xd(i,t){let{added:e,removed:n,updated:o}=d5(t?.rawConfiguration,i?.rawConfiguration),r=[],s=i?.getAllOverrideIdentifiers()||[],a=t?.getAllOverrideIdentifiers()||[];if(t){let l=a.filter(d=>!s.includes(d));for(let d of l)r.push([d,t.getKeysForOverrideIdentifier(d)])}if(i){let l=s.filter(d=>!a.includes(d));for(let d of l)r.push([d,i.getKeysForOverrideIdentifier(d)])}if(t&&i){for(let l of s)if(a.includes(l)){let d=d5({contents:i.getOverrideValue(void 0,l)||{},keys:i.getKeysForOverrideIdentifier(l)},{contents:t.getOverrideValue(void 0,l)||{},keys:t.getKeysForOverrideIdentifier(l)});r.push([l,[...d.added,...d.removed,...d.updated]])}}return{added:e,removed:n,updated:o,overrides:r}}function d5(i,t){let e=i?t?i.keys.filter(r=>t.keys.indexOf(r)===-1):[...i.keys]:[],n=t?i?t.keys.filter(r=>i.keys.indexOf(r)===-1):[...t.keys]:[],o=[];if(i&&t){for(let r of t.keys)if(i.keys.indexOf(r)!==-1){let s=hy(t.contents,r),a=hy(i.contents,r);Et(s,a)||o.push(r)}}return{added:e,removed:n,updated:o}}function Tw(i,t){if(t){let e=t.split("."),n=i;for(let o=0;n&&o<e.length;o++)n=n[e[o]];return n}}function QQ(i){return i instanceof y}function JQ(i){return st(i)&&i.uri instanceof y&&!!i.languageId&&typeof i.languageId=="string"}function YQ(i){return st(i)&&!i.uri&&!!i.languageId&&typeof i.languageId=="string"}function XQ(i){return st(i)&&i.uri instanceof y&&(!i.name||typeof i.name=="string")&&(!i.index||typeof i.index=="number")}function c5(i){if(QQ(i))return{resource:i};if(JQ(i))return{resource:i.uri,overrideIdentifier:i.languageId};if(YQ(i))return{overrideIdentifier:i.languageId};if(XQ(i))return{resource:i.uri};if(i===null)return{resource:null}}var Jg=class{constructor(t,e,n){this._proxy=t.getProxy(F.MainThreadConfiguration),this._extHostWorkspace=e,this._logService=n,this._barrier=new kn,this._actual=null}getConfigProvider(){return this._barrier.wait().then(t=>this._actual)}$initializeConfiguration(t){this._actual=new QL(this._proxy,this._extHostWorkspace,t,this._logService),this._extHostWorkspace.$setConfigProvider(this._actual),this._barrier.open()}$acceptConfigurationChanged(t,e){this.getConfigProvider().then(n=>n.$acceptConfigurationChanged(t,e))}};Jg=_([S(0,le),S(1,Vn),S(2,te)],Jg);var QL=class{constructor(t,e,n,o){this._onDidChangeConfiguration=new T;this._proxy=t,this._logService=o,this._extHostWorkspace=e,this._configuration=Qg.parse(n,o),this._configurationScopes=this._toMap(n.configurationScopes)}get onDidChangeConfiguration(){return this._onDidChangeConfiguration&&this._onDidChangeConfiguration.event}$acceptConfigurationChanged(t,e){let n={data:this._configuration.toData(),workspace:this._extHostWorkspace.workspace};this._configuration=Qg.parse(t,this._logService),this._configurationScopes=this._toMap(t.configurationScopes),this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(e,n))}getConfiguration(t,e,n){let o=c5(e)||{},r=this._toReadonlyValue(this._configuration.getValue(t,o,this._extHostWorkspace.workspace));t&&this._validateConfigurationAccess(t,o,n?.identifier);function s(l){if(l==null)return null;if(typeof l=="boolean")return l?2:5;switch(l){case 1:return 2;case 2:return 5;case 3:return 6}}let a={has(l){return typeof Tw(r,l)<"u"},get:(l,d)=>{this._validateConfigurationAccess(t?`${t}.${l}`:l,o,n?.identifier);let c=Tw(r,l);if(typeof c>"u")c=d;else{let u,m=(g,h)=>{if(st(g)){let f,I=()=>{u=u||ft(r),f=f||Tw(u,h)};return new Proxy(g,{get:(x,E)=>{if(typeof E=="string"&&E.toLowerCase()==="tojson")return I(),()=>f;if(u)return f=f||Tw(u,h),f[E];let w=x[E];return typeof E=="string"?m(w,`${h}.${E}`):w},set:(x,E,w)=>(I(),f&&(f[E]=w),!0),deleteProperty:(x,E)=>(I(),f&&delete f[E],!0),defineProperty:(x,E,w)=>(I(),f&&Object.defineProperty(f,E,w),!0)})}return Array.isArray(g)?ft(g):g};c=m(c,l)}return c},update:(l,d,c,u)=>{l=t?`${t}.${l}`:l;let m=s(c);return d!==void 0?this._proxy.$updateConfigurationOption(m,l,d,o,u):this._proxy.$removeConfigurationOption(m,l,o,u)},inspect:l=>{l=t?`${t}.${l}`:l;let d=this._configuration.inspect(l,o,this._extHostWorkspace.workspace);if(d)return{key:l,defaultValue:ft(d.policy?.value??d.default?.value),globalLocalValue:ft(d.userLocal?.value),globalRemoteValue:ft(d.userRemote?.value),globalValue:ft(d.user?.value??d.application?.value),workspaceValue:ft(d.workspace?.value),workspaceFolderValue:ft(d.workspaceFolder?.value),defaultLanguageValue:ft(d.default?.override),globalLocalLanguageValue:ft(d.userLocal?.override),globalRemoteLanguageValue:ft(d.userRemote?.override),globalLanguageValue:ft(d.user?.override??d.application?.override),workspaceLanguageValue:ft(d.workspace?.override),workspaceFolderLanguageValue:ft(d.workspaceFolder?.override),languageIds:ft(d.overrideIdentifiers)}}};return typeof r=="object"&&or(a,r,!1),Object.freeze(a)}_toReadonlyValue(t){let e=n=>st(n)?new Proxy(n,{get:(o,r)=>e(o[r]),set:(o,r,s)=>{throw new Error(`TypeError: Cannot assign to read only property '${String(r)}' of object`)},deleteProperty:(o,r)=>{throw new Error(`TypeError: Cannot delete read only property '${String(r)}' of object`)},defineProperty:(o,r)=>{throw new Error(`TypeError: Cannot define property '${String(r)}' for a readonly object`)},setPrototypeOf:o=>{throw new Error("TypeError: Cannot set prototype for a readonly object")},isExtensible:()=>!1,preventExtensions:()=>!0}):n;return e(t)}_validateConfigurationAccess(t,e,n){let o=ci.test(t)?5:this._configurationScopes.get(t),r=n?`[${n.value}] `:"";if(5===o){typeof e?.resource>"u"&&this._logService.warn(`${r}Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '${t}', provide the URI of a resource or 'null' for any resource.`);return}if(4===o){e?.resource&&this._logService.warn(`${r}Accessing a window scoped configuration for a resource is not expected. To associate '${t}' to a resource, define its scope to 'resource' in configuration contributions in 'package.json'.`);return}}_toConfigurationChangeEvent(t,e){let n=new Cw(t,e,this._configuration,this._extHostWorkspace.workspace,this._logService);return Object.freeze({affectsConfiguration:(o,r)=>n.affectsConfiguration(o,c5(r))})}_toMap(t){return t.reduce((e,n)=>(e.set(n[0],n[1]),e),new Map)}},_n=A("IExtHostConfiguration");var JL=class{constructor(t,e){this.versionId=t;this.removedDueToLooping=e}},yl=class i extends N{constructor(e,n){super();this._activationEventsReader=e;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._versionId=0;this._extensionDescriptions=n,this._initialize()}static isHostExtension(e,n,o){if(n.getExtensionDescription(e))return!1;let r=o.getExtensionDescription(e);return r?!!((r.main||r.browser)&&r.api==="none"):!1}_initialize(){this._extensionDescriptions.sort(ZQ),this._extensionsMap=new vo,this._extensionsArr=[],this._activationMap=new Map;for(let e of this._extensionDescriptions){if(this._extensionsMap.has(e.identifier)){console.error("Extension `"+e.identifier.value+"` is already registered");continue}this._extensionsMap.set(e.identifier,e),this._extensionsArr.push(e);let n=this._activationEventsReader.readActivationEvents(e);for(let o of n)this._activationMap.has(o)||this._activationMap.set(o,[]),this._activationMap.get(o).push(e)}}set(e){return this._extensionDescriptions=e,this._initialize(),this._versionId++,this._onDidChange.fire(void 0),{versionId:this._versionId}}deltaExtensions(e,n){this._extensionDescriptions=u5(this._extensionDescriptions,n),this._extensionDescriptions=this._extensionDescriptions.concat(e);let o=i._findLoopingExtensions(this._extensionDescriptions);return this._extensionDescriptions=u5(this._extensionDescriptions,o.map(r=>r.identifier)),this._initialize(),this._versionId++,this._onDidChange.fire(void 0),new JL(this._versionId,o)}static _findLoopingExtensions(e){let n=new class{constructor(){this._arcs=new Map;this._nodesSet=new Set;this._nodesArr=[]}addNode(l){this._nodesSet.has(l)||(this._nodesSet.add(l),this._nodesArr.push(l))}addArc(l,d){this.addNode(l),this.addNode(d),this._arcs.has(l)?this._arcs.get(l).push(d):this._arcs.set(l,[d])}getArcs(l){return this._arcs.has(l)?this._arcs.get(l):[]}hasOnlyGoodArcs(l,d){let c=n.getArcs(l);for(let u=0;u<c.length;u++)if(!d.has(c[u]))return!1;return!0}getNodes(){return this._nodesArr}},o=new vo;for(let l of e)if(o.set(l.identifier,l),l.extensionDependencies)for(let d of l.extensionDependencies)n.addArc(xe.toKey(l.identifier),xe.toKey(d));let r=new Set;n.getNodes().filter(l=>n.getArcs(l).length===0).forEach(l=>r.add(l));let s=n.getNodes().filter(l=>!r.has(l)),a;do{a=!1;for(let l=0;l<s.length;l++){let d=s[l];n.hasOnlyGoodArcs(d,r)&&(s.splice(l,1),l--,r.add(d),a=!0)}}while(a);return s.map(l=>o.get(l))}containsActivationEvent(e){return this._activationMap.has(e)}containsExtension(e){return this._extensionsMap.has(e)}getExtensionDescriptionsForActivationEvent(e){let n=this._activationMap.get(e);return n?n.slice(0):[]}getAllExtensionDescriptions(){return this._extensionsArr.slice(0)}getSnapshot(){return new YL(this._versionId,this.getAllExtensionDescriptions())}getExtensionDescription(e){let n=this._extensionsMap.get(e);return n||void 0}getExtensionDescriptionByUUID(e){for(let n of this._extensionsArr)if(n.uuid===e)return n}getExtensionDescriptionByIdOrUUID(e,n){return this.getExtensionDescription(e)??(n?this.getExtensionDescriptionByUUID(n):void 0)}},YL=class{constructor(t,e){this.versionId=t;this.extensions=e}};function ZQ(i,t){let e=i.isBuiltin?0:i.isUnderDevelopment?2:1,n=t.isBuiltin?0:t.isUnderDevelopment?2:1;if(e!==n)return e-n;let o=qe.basename(i.extensionLocation.path),r=qe.basename(t.extensionLocation.path);return o<r?-1:o>r?1:0}function u5(i,t){let e=new $o(t);return i.filter(n=>!e.has(n.identifier))}var ep=class i{static{this.NONE=new i(!1,-1,-1,-1)}constructor(t,e,n,o){this.startup=t,this.codeLoadingTime=e,this.activateCallTime=n,this.activateResolvedTime=o}},Xg=class{constructor(t){this._startup=t,this._codeLoadingStart=-1,this._codeLoadingStop=-1,this._activateCallStart=-1,this._activateCallStop=-1,this._activateResolveStart=-1,this._activateResolveStop=-1}_delta(t,e){return t===-1||e===-1?-1:e-t}build(){return new ep(this._startup,this._delta(this._codeLoadingStart,this._codeLoadingStop),this._delta(this._activateCallStart,this._activateCallStop),this._delta(this._activateResolveStart,this._activateResolveStop))}codeLoadingStart(){this._codeLoadingStart=Date.now()}codeLoadingStop(){this._codeLoadingStop=Date.now()}activateCallStart(){this._activateCallStart=Date.now()}activateCallStop(){this._activateCallStop=Date.now()}activateResolveStart(){this._activateResolveStart=Date.now()}activateResolveStop(){this._activateResolveStop=Date.now()}},tp=class{constructor(t,e,n,o,r,s){this.activationFailed=t,this.activationFailedError=e,this.activationTimes=n,this.module=o,this.exports=r,this.disposable=s}},Ew=class extends tp{constructor(t){super(!1,null,t,{activate:void 0,deactivate:void 0},void 0,N.None)}},ww=class extends tp{constructor(){super(!1,null,ep.NONE,{activate:void 0,deactivate:void 0},void 0,N.None)}},Zg=class extends tp{constructor(t){super(!0,t,ep.NONE,{activate:void 0,deactivate:void 0},void 0,N.None)}},Yg=class{constructor(t,e,n,o){this._logService=o;this._registry=t,this._globalRegistry=e,this._host=n,this._operations=new vo,this._alreadyActivatedEvents=Object.create(null)}dispose(){for(let[t,e]of this._operations)e.dispose()}async waitForActivatingExtensions(){let t=[];for(let[e,n]of this._operations)t.push(n.wait());await Promise.all(t)}isActivated(t){let e=this._operations.get(t);return!!(e&&e.value)}getActivatedExtension(t){let e=this._operations.get(t);if(!e||!e.value)throw new Error(`Extension '${t.value}' is not known or not activated`);return e.value}async activateByEvent(t,e){if(this._alreadyActivatedEvents[t])return;let n=this._registry.getExtensionDescriptionsForActivationEvent(t);await this._activateExtensions(n.map(o=>({id:o.identifier,reason:{startup:e,extensionId:o.identifier,activationEvent:t}}))),this._alreadyActivatedEvents[t]=!0}activateById(t,e){let n=this._registry.getExtensionDescription(t);if(!n)throw new Error(`Extension '${t.value}' is not known`);return this._activateExtensions([{id:n.identifier,reason:e}])}async _activateExtensions(t){let e=t.filter(n=>!this.isActivated(n.id)).map(n=>this._handleActivationRequest(n));await Promise.all(e.map(n=>n.wait()))}_handleActivationRequest(t){if(this._operations.has(t.id))return this._operations.get(t.id);if(this._isHostExtension(t.id))return this._createAndSaveOperation(t,null,[],null);let e=this._registry.getExtensionDescription(t.id);if(!e){let r=new Error(`Cannot activate unknown extension '${t.id.value}'`),s=this._createAndSaveOperation(t,null,[],new Zg(r));return this._host.onExtensionActivationError(t.id,r,new ky(t.id.value)),s}let n=[],o=typeof e.extensionDependencies>"u"?[]:e.extensionDependencies;for(let r of o){if(this._isResolvedExtension(r))continue;let s=this._operations.get(r);if(s){n.push(s);continue}if(this._isHostExtension(r)){n.push(this._handleActivationRequest({id:this._globalRegistry.getExtensionDescription(r).identifier,reason:t.reason}));continue}let a=this._registry.getExtensionDescription(r);if(a){if(!a.main&&!a.browser)continue;n.push(this._handleActivationRequest({id:a.identifier,reason:t.reason}));continue}let l=e.displayName||e.identifier.value,d=new Error(`Cannot activate the '${l}' extension because it depends on unknown extension '${r}'`),c=this._createAndSaveOperation(t,e.displayName,[],new Zg(d));return this._host.onExtensionActivationError(e.identifier,d,new ky(r)),c}return this._createAndSaveOperation(t,e.displayName,n,null)}_createAndSaveOperation(t,e,n,o){let r=new Ob(t.id,e,t.reason,n,o,this._host,this._logService);return this._operations.set(t.id,r),r}_isHostExtension(t){return yl.isHostExtension(t,this._registry,this._globalRegistry)}_isResolvedExtension(t){let e=this._globalRegistry.getExtensionDescription(t);return e?!e.main&&!e.browser:!1}};Yg=_([S(3,te)],Yg);var Ob=class{constructor(t,e,n,o,r,s,a){this._id=t;this._displayName=e;this._reason=n;this._deps=o;this._value=r;this._host=s;this._logService=a;this._barrier=new kn;this._isDisposed=!1;this._initialize()}get value(){return this._value}get friendlyName(){return this._displayName||this._id.value}dispose(){this._isDisposed=!0}wait(){return this._barrier.wait()}async _initialize(){await this._waitForDepsThenActivate(),this._barrier.open()}async _waitForDepsThenActivate(){if(!this._value){for(;this._deps.length>0;){for(let t=0;t<this._deps.length;t++){let e=this._deps[t];if(e.value&&!e.value.activationFailed){this._deps.splice(t,1),t--;continue}if(e.value&&e.value.activationFailed){let n=new Error(`Cannot activate the '${this.friendlyName}' extension because its dependency '${e.friendlyName}' failed to activate`);n.detail=e.value.activationFailedError,this._value=new Zg(n),this._host.onExtensionActivationError(this._id,n,null);return}}this._deps.length>0&&await Promise.race(this._deps.map(t=>t.wait()))}await this._activate()}}async _activate(){try{this._value=await this._host.actualActivateExtension(this._id,this._reason)}catch(t){let e=new Error;if(t&&t.name&&(e.name=t.name),t&&t.message?e.message=`Activating extension '${this._id.value}' failed: ${t.message}.`:e.message=`Activating extension '${this._id.value}' failed: ${t}.`,t&&t.stack&&(e.stack=t.stack),this._value=new Zg(e),this._isDisposed&&Yt(t))return;this._host.onExtensionActivationError(this._id,e,null),this._logService.error(`Activating extension ${this._id.value} failed due to an error:`),this._logService.error(t)}}};Ob=_([S(6,te)],Ob);var ef=class{constructor(t,e){this._logService=e;this._onDidChangeStorage=new T;this.onDidChangeStorage=this._onDidChangeStorage.event;this._proxy=t.getProxy(F.MainThreadStorage)}registerExtensionStorageKeysToSync(t,e){this._proxy.$registerExtensionStorageKeysToSync(t,e)}async initializeExtensionStorage(t,e,n){let o=await this._proxy.$initializeExtensionStorage(t,e),r;return o&&(r=this.safeParseValue(t,e,o)),r||n}setValue(t,e,n){return this._proxy.$setValue(t,e,n)}$acceptValue(t,e,n){let o=this.safeParseValue(t,e,n);o&&this._onDidChangeStorage.fire({shared:t,key:e,value:o})}safeParseValue(t,e,n){try{return JSON.parse(n)}catch(o){this._logService.error(`[extHostStorage] unexpected error parsing storage contents (extensionId: ${e}, global: ${t}): ${o}`)}}},tf=A("IExtHostStorage");var Nb=class{constructor(t,e,n){this._deferredPromises=new Map;this._id=t,this._shared=e,this._storage=n,this._init=this._storage.initializeExtensionStorage(this._shared,this._id,Object.create(null)).then(o=>(this._value=o,this)),this._storageListener=this._storage.onDidChangeStorage(o=>{o.shared===this._shared&&o.key===this._id&&(this._value=o.value)}),this._scheduler=new Pn(()=>{let o=this._deferredPromises;this._deferredPromises=new Map,(async()=>{try{await this._storage.setValue(this._shared,this._id,this._value);for(let r of o.values())r.complete()}catch(r){for(let s of o.values())s.error(r)}})()},0)}keys(){return Object.entries(this._value??{}).filter(([,t])=>t!==void 0).map(([t])=>t)}get whenReady(){return this._init}get(t,e){let n=this._value[t];return typeof n>"u"&&(n=e),n}update(t,e){e!==null&&typeof e=="object"?this._value[t]=JSON.parse(JSON.stringify(e)):this._value[t]=e;let n=this._deferredPromises.get(t);if(n!==void 0)return n.p;let o=new jt;return this._deferredPromises.set(t,o),this._scheduler.isScheduled()||this._scheduler.schedule(),o.p}dispose(){this._storageListener.dispose()}},kw=class extends Nb{setKeysForSync(t){this._storage.registerExtensionStorageKeysToSync({id:this._id,version:this._extension.version},t)}constructor(t,e){super(t.identifier.value,!0,e),this._extension=t}};var dr=class{constructor(t,e){this._fileSystemProvider=new Map;this._writeQueue=new Bp;this._proxy=t.getProxy(F.MainThreadFileSystem);let n=this;this.value=Object.freeze({async stat(o){try{let r,s=n._fileSystemProvider.get(o.scheme);return s?(await n._proxy.$ensureActivation(o.scheme),r=await s.impl.stat(o)):r=await n._proxy.$stat(o),{type:r.type,ctime:r.ctime,mtime:r.mtime,size:r.size,permissions:r.permissions===1?1:void 0}}catch(r){dr._handleError(r)}},async readDirectory(o){try{let r=n._fileSystemProvider.get(o.scheme);return r?(await n._proxy.$ensureActivation(o.scheme),(await r.impl.readDirectory(o)).slice()):await n._proxy.$readdir(o)}catch(r){return dr._handleError(r)}},async createDirectory(o){try{let r=n._fileSystemProvider.get(o.scheme);return r&&!r.isReadonly?(await n._proxy.$ensureActivation(o.scheme),await n.mkdirp(r.impl,r.extUri,o)):await n._proxy.$mkdir(o)}catch(r){return dr._handleError(r)}},async readFile(o){try{let r=n._fileSystemProvider.get(o.scheme);return r?(await n._proxy.$ensureActivation(o.scheme),(await r.impl.readFile(o)).slice()):(await n._proxy.$readFile(o)).buffer}catch(r){return dr._handleError(r)}},async writeFile(o,r){try{let s=n._fileSystemProvider.get(o.scheme);return s&&!s.isReadonly?(await n._proxy.$ensureActivation(o.scheme),await n.mkdirp(s.impl,s.extUri,s.extUri.dirname(o)),await n._writeQueue.queueFor(o,()=>Promise.resolve(s.impl.writeFile(o,r,{create:!0,overwrite:!0})))):await n._proxy.$writeFile(o,H.wrap(r))}catch(s){return dr._handleError(s)}},async delete(o,r){try{let s=n._fileSystemProvider.get(o.scheme);return s&&!s.isReadonly&&!r?.useTrash?(await n._proxy.$ensureActivation(o.scheme),await s.impl.delete(o,{recursive:!1,...r})):await n._proxy.$delete(o,{recursive:!1,useTrash:!1,atomic:!1,...r})}catch(s){return dr._handleError(s)}},async rename(o,r,s){try{return await n._proxy.$rename(o,r,{overwrite:!1,...s})}catch(a){return dr._handleError(a)}},async copy(o,r,s){try{return await n._proxy.$copy(o,r,{overwrite:!1,...s})}catch(a){return dr._handleError(a)}},isWritableFileSystem(o){let r=e.getCapabilities(o);if(typeof r=="number")return!(r&2048)}})}async mkdirp(t,e,n){let o=[];for(;!e.isEqual(n,e.dirname(n));)try{if(((await t.stat(n)).type&2)===0)throw kt.FileExists(`Unable to create folder '${n.scheme===B.file?n.fsPath:n.toString(!0)}' that already exists but is not a directory`);break}catch(r){if(im(r)!=="EntryNotFound")throw r;o.push(e.basename(n)),n=e.dirname(n)}for(let r=o.length-1;r>=0;r--){n=e.joinPath(n,o[r]);try{await t.createDirectory(n)}catch(s){if(im(s)!=="EntryExists")throw s}}}static _handleError(t){if(t instanceof kt)throw t;if(t instanceof id)switch(t.code){case"EntryExists":throw kt.FileExists(t.message);case"EntryNotFound":throw kt.FileNotFound(t.message);case"EntryNotADirectory":throw kt.FileNotADirectory(t.message);case"EntryIsADirectory":throw kt.FileIsADirectory(t.message);case"NoPermissions":throw kt.NoPermissions(t.message);case"Unavailable":throw kt.Unavailable(t.message);default:throw new kt(t.message,t.name)}if(!(t instanceof Error))throw new kt(String(t));if(t.name==="ENOPRO"||t.message.includes("ENOPRO"))throw kt.Unavailable(t.message);switch(t.name){case"EntryExists":throw kt.FileExists(t.message);case"EntryNotFound":throw kt.FileNotFound(t.message);case"EntryNotADirectory":throw kt.FileNotADirectory(t.message);case"EntryIsADirectory":throw kt.FileIsADirectory(t.message);case"NoPermissions":throw kt.NoPermissions(t.message);case"Unavailable":throw kt.Unavailable(t.message);default:throw new kt(t.message,t.name)}}addFileSystemProvider(t,e,n){return this._fileSystemProvider.set(t,{impl:e,extUri:n?.isCaseSensitive?Ct:ZR,isReadonly:!!n?.isReadonly}),q(()=>this._fileSystemProvider.delete(t))}getFileSystemProviderExtUri(t){return this._fileSystemProvider.get(t)?.extUri??Ct}};dr=_([S(0,le),S(1,ai)],dr);var oa=A("IExtHostConsumerFileSystem");var of=A("IExtensionStoragePaths"),nf=class{constructor(t,e,n){this._logService=e;this._extHostFileSystem=n;this._workspace=t.workspace??void 0,this._environment=t.environment,this.whenReady=this._getOrCreateWorkspaceStoragePath().then(o=>this._value=o)}async _getWorkspaceStorageURI(t){return y.joinPath(this._environment.workspaceStorageHome,t)}async _getOrCreateWorkspaceStoragePath(){if(!this._workspace)return Promise.resolve(void 0);let t=this._workspace.id,e=await this._getWorkspaceStorageURI(t);try{return await this._extHostFileSystem.value.stat(e),this._logService.trace("[ExtHostStorage] storage dir already exists",e),e}catch{}try{return this._logService.trace("[ExtHostStorage] creating dir and metadata-file",e),await this._extHostFileSystem.value.createDirectory(e),await this._extHostFileSystem.value.writeFile(y.joinPath(e,"meta.json"),new TextEncoder().encode(JSON.stringify({id:this._workspace.id,configuration:y.revive(this._workspace.configuration)?.toString(),name:this._workspace.name},void 0,2))),e}catch(n){this._logService.error("[ExtHostStorage]",n);return}}workspaceValue(t){if(this._value)return y.joinPath(this._value,t.identifier.value)}globalValue(t){return y.joinPath(this._environment.globalStorageHome,t.identifier.value.toLowerCase())}onWillDeactivateAll(){}};nf=_([S(0,Ye),S(1,te),S(2,oa)],nf);var p5=A("tunnelService"),vze=A("sharedTunnelsService");function m5(i){return!!i.forwardPort}function eJ(i){if(i.scheme!=="http"&&i.scheme!=="https")return;let t=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(i.authority);if(t)return{address:t[1],port:+t[2]}}var sf=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function ra(i){return sf.indexOf(i)>=0}var Ub=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function xi(i){return Ub.indexOf(i)>=0}function g5(i,t,e,n){if(e===1)return!1;if(e===2&&xi(t)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(n);if(o?.length===4&&parseInt(o[1])>=18)return!1}return i<1024}var Pw=class{constructor(t,e,n){this.remoteAddress=t;this.localAddress=e;this._dispose=n;this._onDispose=new T;this.onDidDispose=this._onDispose.event}dispose(){return this._onDispose.fire(),this._onDispose.dispose(),this._dispose()}},rf=class extends N{constructor(e,n){super();this.logService=e;this.configurationService=n;this._onTunnelOpened=this._register(new T);this.onTunnelOpened=this._onTunnelOpened.event;this._onTunnelClosed=this._register(new T);this.onTunnelClosed=this._onTunnelClosed.event;this._onAddedTunnelProvider=this._register(new T);this.onAddedTunnelProvider=this._onAddedTunnelProvider.event;this._tunnels=new Map;this._canElevate=!1;this._canChangeProtocol=!0;this._privacyOptions=[];this._factoryInProgress=new Set}get hasTunnelProvider(){return!!this._tunnelProvider}get defaultTunnelHost(){let e=this.configurationService.getValue("remote.localPortHost");return!e||e==="localhost"?"127.0.0.1":"0.0.0.0"}setTunnelProvider(e){return this._tunnelProvider=e,e?(this._onAddedTunnelProvider.fire(),{dispose:()=>{this._tunnelProvider=void 0,this._canElevate=!1,this._privacyOptions=[]}}):(this._canElevate=!1,this._privacyOptions=[],this._onAddedTunnelProvider.fire(),{dispose:()=>{}})}setTunnelFeatures(e){this._canElevate=e.elevation,this._privacyOptions=e.privacyOptions,this._canChangeProtocol=e.protocol}get canChangeProtocol(){return this._canChangeProtocol}get canElevate(){return this._canElevate}get canChangePrivacy(){return this._privacyOptions.length>0}get privacyOptions(){return this._privacyOptions}get tunnels(){return this.getTunnels()}async getTunnels(){let e=[],n=Array.from(this._tunnels.values());for(let o of n){let r=Array.from(o.values());for(let s of r){let a=await s.value;a&&typeof a!="string"&&e.push(a)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:n}of e.values())await n.then(o=>typeof o!="string"?o?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,n,o,r,s){this.addTunnelToMap(e,n,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:n,localAddress:o,privacy:r,protocol:s,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,n){(xi(e)||ra(e))&&(e=sf[0]);let o=this.getTunnelFromMap(e,n);if(o)return++o.refcount,o.value}openTunnel(e,n,o,r,s,a=!1,l,d){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${n}:${o} on local port ${s}.`);let c=this._tunnelProvider??e;if(!c)return;if(n||(n="localhost"),r||(r=this.defaultTunnelHost),this._tunnelProvider&&this._factoryInProgress.has(o)){this.logService.debug("ForwardedPorts: (TunnelService) Another call to create a tunnel with the same address has occurred before the last one completed. This call will be ignored.");return}let u=this.retainOrCreateTunnel(c,n,o,r,s,a,l,d);return u?u.then(m=>{if(m){if(typeof m=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(n,o),m}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(n,o);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let g=this.makeTunnel(m);return(m.tunnelRemoteHost!==n||m.tunnelRemotePort!==o)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&m.privacy!==l&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Privacy mismatch."),this._onTunnelOpened.fire(g),g}):(this.logService.trace("ForwardedPorts: (TunnelService) Tunnel was not created."),u)}makeTunnel(e){return{tunnelRemotePort:e.tunnelRemotePort,tunnelRemoteHost:e.tunnelRemoteHost,tunnelLocalPort:e.tunnelLocalPort,localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol,dispose:async()=>{this.logService.trace(`ForwardedPorts: (TunnelService) dispose request for ${e.tunnelRemoteHost}:${e.tunnelRemotePort} `);let n=this._tunnels.get(e.tunnelRemoteHost);if(n){let o=n.get(e.tunnelRemotePort);o&&(o.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,o))}}}}async tryDisposeTunnel(e,n,o){if(o.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${n}.`);let r=o.value.then(async s=>{s&&typeof s!="string"&&(await s.dispose(!0),this._onTunnelClosed.fire({host:s.tunnelRemoteHost,port:s.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(n),r}}async closeTunnel(e,n){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${n} `);let o=this._tunnels.get(e);if(o&&o.has(n)){let r=o.get(n);r.refcount=0,await this.tryDisposeTunnel(e,n,r)}}addTunnelToMap(e,n,o){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(n,{refcount:1,value:o})}async removeEmptyOrErrorTunnelFromMap(e,n){let o=this._tunnels.get(e);if(o){let r=o.get(n),s=r?await r.value:void 0;(!s||typeof s=="string")&&o.delete(n),o.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,n){let o=[e];ra(e)?(o.push(...sf),o.push(...Ub)):xi(e)&&o.push(...Ub);let r=o.map(s=>this._tunnels.get(s));for(let s of r){let a=s?.get(n);if(a)return a}}canTunnel(e){return!!eJ(e)}createWithProvider(e,n,o,r,s,a,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${n}:${o} on local port ${r}.`);let d=o;this._factoryInProgress.add(d);let c=r===void 0?o:r,u={elevationRequired:s?this.isPortPrivileged(c):!1},m={remoteAddress:{host:n,port:o},localAddressPort:r,privacy:a,public:a?a!=="private":void 0,protocol:l},g=e.forwardPort(m,u);return g?(this.addTunnelToMap(n,o,g),g.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(d)})):this._factoryInProgress.delete(d),g}};rf=_([S(0,te),S(1,$t)],rf);var XL=class extends Pw{},h5;(e=>{function i(n){return{remoteAddress:n.remoteAddress,localAddress:n.localAddress,public:!!n.public,privacy:n.privacy??(n.public?"public":"private"),protocol:n.protocol}}e.fromApiTunnel=i;function t(n){return{remoteAddress:{host:n.tunnelRemoteHost,port:n.tunnelRemotePort},localAddress:n.localAddress,public:n.privacy!=="constantPrivate"&&n.privacy!=="constantPrivate",privacy:n.privacy,protocol:n.protocol}}e.fromServiceTunnel=t})(h5||={});var tc=A("IExtHostTunnelService"),ec=class extends N{constructor(e,n,o){super();this.logService=o;this._showCandidatePort=()=>Promise.resolve(!0);this._extensionTunnels=new Map;this._onDidChangeTunnels=this._register(new T);this.onDidChangeTunnels=this._onDidChangeTunnels.event;this._providerHandleCounter=0;this._portAttributesProviders=new Map;this._proxy=e.getProxy(F.MainThreadTunnelService)}async openTunnel(e,n){this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) ${e.identifier.value} called openTunnel API for ${n.remoteAddress.host}:${n.remoteAddress.port}.`);let o=await this._proxy.$openTunnel(n,e.displayName);if(o){let r=new XL(o.remoteAddress,o.localAddress,()=>this._proxy.$closeTunnel(o.remoteAddress));return this._register(r),r}}async getTunnels(){return this._proxy.$getTunnels()}nextPortAttributesProviderHandle(){return this._providerHandleCounter++}registerPortsAttributesProvider(e,n){e.portRange===void 0&&e.commandPattern===void 0&&this.logService.error("PortAttributesProvider must specify either a portRange or a commandPattern");let o=this.nextPortAttributesProviderHandle();return this._portAttributesProviders.set(o,{selector:e,provider:n}),this._proxy.$registerPortsAttributesProvider(e,o),new Se(()=>{this._portAttributesProviders.delete(o),this._proxy.$unregisterPortsAttributesProvider(o)})}async $providePortAttributes(e,n,o,r,s){let a=[];for(let d of e){let c=this._portAttributesProviders.get(d);if(!c)return[];a.push(...await Promise.all(n.map(async u=>{let m;try{m=await c.provider.providePortAttributes({port:u,pid:o,commandLine:r},s)}catch{m=await c.provider.providePortAttributes(u,o,r,s)}return{providedAttributes:m,port:u}})))}let l=a.filter(d=>!!d.providedAttributes);return l.length>0?l.map(d=>({autoForwardAction:d.providedAttributes.autoForwardAction,port:d.port})):[]}async $registerCandidateFinder(e){}registerTunnelProvider(e,n){if(this._forwardPortProvider)throw new Error("A tunnel provider has already been registered. Only the first tunnel provider to be registered will be used.");this._forwardPortProvider=async(r,s)=>await e.provideTunnel(r,s,pe.None)??void 0;let o=n.tunnelFeatures?{elevation:!!n.tunnelFeatures?.elevation,privacyOptions:n.tunnelFeatures?.privacyOptions,protocol:n.tunnelFeatures.protocol===void 0?!0:n.tunnelFeatures.protocol}:void 0;return this._proxy.$setTunnelProvider(o,!0),Promise.resolve(q(()=>{this._forwardPortProvider=void 0,this._proxy.$setTunnelProvider(void 0,!1)}))}hasTunnelProvider(){return this._proxy.$hasTunnelProvider()}async setTunnelFactory(e,n){if(e){e.candidatePortSource!==void 0&&this._proxy.$setCandidatePortSource(e.candidatePortSource),e.showCandidatePort&&(this._showCandidatePort=e.showCandidatePort,this._proxy.$setCandidateFilter());let o=e.tunnelFactory??(n?this.makeManagedTunnelFactory(n):void 0);if(o){this._forwardPortProvider=o;let r=e.tunnelFeatures?.privacyOptions??[];e.tunnelFeatures?.public&&r.length===0&&(r=[{id:"private",label:p(5892,null),themeIcon:"lock"},{id:"public",label:p(5893,null),themeIcon:"eye"}]);let s=e.tunnelFeatures?{elevation:!!e.tunnelFeatures?.elevation,public:!!e.tunnelFeatures?.public,privacyOptions:r,protocol:!0}:void 0;this._proxy.$setTunnelProvider(s,!!e.tunnelFactory)}}else this._forwardPortProvider=void 0;return q(()=>{this._forwardPortProvider=void 0})}makeManagedTunnelFactory(e){}async $closeTunnel(e,n){if(this._extensionTunnels.has(e.host)){let o=this._extensionTunnels.get(e.host);o.has(e.port)&&(n&&o.get(e.port).disposeListener.dispose(),await o.get(e.port).tunnel.dispose(),o.delete(e.port))}}async $onDidTunnelsChange(){this._onDidChangeTunnels.fire()}async $forwardPort(e,n){if(this._forwardPortProvider)try{this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Getting tunnel from provider.");let o=this._forwardPortProvider(e,n);if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Got tunnel promise from provider."),o!==void 0){let r=await o;if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Successfully awaited tunnel from provider."),r===void 0){this.logService.error("ForwardedPorts: (ExtHostTunnelService) Resolved tunnel is undefined");return}this._extensionTunnels.has(e.remoteAddress.host)||this._extensionTunnels.set(e.remoteAddress.host,new Map);let s=this._register(r.onDidDispose(()=>(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Extension fired tunnel's onDidDispose."),this._proxy.$closeTunnel(r.remoteAddress))));return this._extensionTunnels.get(e.remoteAddress.host).set(e.remoteAddress.port,{tunnel:r,disposeListener:s}),h5.fromApiTunnel(r)}else this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Tunnel is undefined")}catch(o){if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) tunnel provider error"),o instanceof Error)return o.message}}async $applyCandidateFilter(e){let n=await Promise.all(e.map(r=>this._showCandidatePort(r.host,r.port,r.detail??""))),o=e.filter((r,s)=>n[s]);return this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) filtered from ${e.map(r=>r.port).join(", ")} to ${o.map(r=>r.port).join(", ")}`),o}};ec=_([S(0,le),S(1,Ye),S(2,te)],ec);function v5(i){return[...i.entries()]}function y5(i){return i?[...i.entries()]:[]}var zze=A("ptyService");var tJ={Backend:"workbench.contributions.terminal.processBackend"},ZL=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(t){let e=this._sanitizeRemoteAuthority(t.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,t)}getTerminalBackend(t){return this._backends.get(this._sanitizeRemoteAuthority(t))}_sanitizeRemoteAuthority(t){return t?.toLowerCase()??""}};wt.add(tJ.Backend,new ZL);var qze=A("localPtyService"),Kze=A("terminalLogService");var _w=class{constructor(t){this._callback=t;this._terminalBufferMap=new Map}dispose(){for(let t of this._terminalBufferMap.values())t.dispose()}startBuffering(t,e,n=5){let o=e(r=>{let s=Pe(r)?r:r.data,a=this._terminalBufferMap.get(t);if(a){a.data.push(s);return}let l=setTimeout(()=>this.flushBuffer(t),n);a={data:[s],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(t),o.dispose()}},this._terminalBufferMap.set(t,a)});return o}stopBuffering(t){this._terminalBufferMap.get(t)?.dispose()}flushBuffer(t){let e=this._terminalBufferMap.get(t);e&&(this._terminalBufferMap.delete(t),this._callback(t,e.data.join("")))}};var np=(i,t,e,n)=>{let o=t;return{enumerable:!0,configurable:!1,get(){return o},set(r){if(!e(o,r)){let s=o;o=r,i.listener?.(n(r,s))}}}},af=(i,t)=>i===t,nc={range:(i,t)=>i===t?!0:!i||!t?!1:i.isEqual(t),label:af,description:af,sortText:af,busy:af,error:af,canResolveChildren:af,tags:(i,t)=>!(i.length!==t.length||i.some(e=>!t.find(n=>e.id===n.id)))},lf=i=>t=>({op:4,update:i(t)}),nJ=(i,t)=>({range:(()=>{let e,n=lf(o=>({range:ze.lift(K.from(o))}));return{enumerable:!0,configurable:!1,get(){return e},set(o){i.listener?.({op:6}),nc.range(e,o)||(e=o,i.listener?.(n(o)))}}})(),label:np(i,t,nc.label,lf(e=>({label:e}))),description:np(i,void 0,nc.description,lf(e=>({description:e}))),sortText:np(i,void 0,nc.sortText,lf(e=>({sortText:e}))),canResolveChildren:np(i,!1,nc.canResolveChildren,e=>({op:2,state:e})),busy:np(i,!1,nc.busy,lf(e=>({busy:e}))),error:np(i,void 0,nc.error,lf(e=>({error:fe.fromStrict(e)||null}))),tags:np(i,[],nc.tags,(e,n)=>({op:1,new:e.map(Ii.from),old:n.map(Ii.from)}))}),oJ=i=>{let t=et.fromString(i.extId),e=new bl(t.controllerId,t.localId,i.label,y.revive(i.uri)||void 0);return e.range=K.to(i.range||void 0),e.description=i.description||void 0,e.sortText=i.sortText||void 0,e.tags=i.tags.map(n=>Ii.to({id:iT(n).tagId})),e},eO=i=>{let t;for(let e of i.tests){let n=oJ(e.item);Vm(n).parent=t,t=n}return t},bl=class i{constructor(t,e,n,o){if(e.includes("\0"))throw new Error(`Test IDs may not include the ${JSON.stringify(e)} symbol`);let r=w$(this,t);Object.defineProperties(this,{id:{value:e,enumerable:!0,writable:!1},uri:{value:o,enumerable:!0,writable:!1},parent:{enumerable:!1,get(){return r.parent instanceof df?void 0:r.parent}},children:{value:T$(r,Vm,i),enumerable:!0,writable:!1},...nJ(r,n)})}},df=class extends bl{constructor(e,n){super(e,e,n,void 0);this._isRoot=!0}},Rw=class extends lT{constructor(t,e,n){super({controllerId:t,getDocumentVersion:o=>o&&n.getDocument(o)?.version,getApiFor:Vm,getChildren:o=>o.children,root:new df(t,e),toITestItem:ea.from})}};var Dw=(e=>(e[e.Desktop=1]="Desktop",e[e.Web=2]="Web",e))(Dw||{});function tO(i){let t=H.alloc(1);switch(i){case 0:t.writeUInt8(1,0);break;case 1:t.writeUInt8(2,0);break;case 2:t.writeUInt8(3,0);break}return t}function b5(i,t){if(i.byteLength!==1)return!1;switch(i.readUInt8(0)){case 1:return t===0;case 2:return t===1;case 3:return t===2;default:return!1}}var cf=class extends N{constructor(e,n,o){super();this.initData=n;this._onDidChangeTelemetryEnabled=this._register(new T);this.onDidChangeTelemetryEnabled=this._onDidChangeTelemetryEnabled.event;this._onDidChangeTelemetryConfiguration=this._register(new T);this.onDidChangeTelemetryConfiguration=this._onDidChangeTelemetryConfiguration.event;this._productConfig={usage:!0,error:!0};this._level=0;this._inLoggingOnlyMode=!1;this._telemetryLoggers=new Map;this._inLoggingOnlyMode=this.initData.environment.isExtensionTelemetryLoggingOnly;let r=n.remote.isRemote?"remoteExtHostTelemetry":e?"workerExtHostTelemetry":"extHostTelemetry";this._outputLogger=this._register(o.createLogger(r,{name:p(5890,null,this._inLoggingOnlyMode?" (Not Sent)":""),hidden:!0,group:l4}))}getTelemetryConfiguration(){return this._level===3}getTelemetryDetails(){return{isCrashEnabled:this._level>=1,isErrorsEnabled:this._productConfig.error?this._level>=2:!1,isUsageEnabled:this._productConfig.usage?this._level>=3:!1}}instantiateLogger(e,n,o){let r=this.getTelemetryDetails(),s=new Fb(n,o,e,this._outputLogger,this._inLoggingOnlyMode,this.getBuiltInCommonProperties(e),{isUsageEnabled:r.isUsageEnabled,isErrorsEnabled:r.isErrorsEnabled}),a=this._telemetryLoggers.get(e.identifier.value)??[];return this._telemetryLoggers.set(e.identifier.value,[...a,s]),s.apiTelemetryLogger}$initializeTelemetryLevel(e,n,o){this._level=e,this._productConfig=o??{usage:!0,error:!0}}getBuiltInCommonProperties(e){let n=Object.create(null);switch(n["common.extname"]=`${e.publisher}.${e.name}`,n["common.extversion"]=e.version,n["common.vscodemachineid"]=this.initData.telemetryInfo.machineId,n["common.vscodesessionid"]=this.initData.telemetryInfo.sessionId,n["common.vscodecommithash"]=this.initData.commit,n["common.sqmid"]=this.initData.telemetryInfo.sqmId,n["common.devDeviceId"]=this.initData.telemetryInfo.devDeviceId??this.initData.telemetryInfo.machineId,n["common.vscodeversion"]=this.initData.version,n["common.vscodereleasedate"]=this.initData.date,n["common.isnewappinstall"]=nO(this.initData.telemetryInfo.firstSessionDate),n["common.product"]=this.initData.environment.appHost,this.initData.uiKind){case 2:n["common.uikind"]="web";break;case 1:n["common.uikind"]="desktop";break;default:n["common.uikind"]="unknown"}return n["common.remotename"]=d4(this.initData.remote.authority,this.initData),this.initData.environment.isSessionsWindow&&(n["common.isAgentsWindow"]=!0),n}$onDidChangeTelemetryLevel(e){this._oldTelemetryEnablement=this.getTelemetryConfiguration(),this._level=e;let n=this.getTelemetryDetails();this._telemetryLoggers.forEach((o,r)=>{let s=o.filter(a=>!a.isDisposed);s.length===0?this._telemetryLoggers.delete(r):this._telemetryLoggers.set(r,s)}),this._telemetryLoggers.forEach(o=>{for(let r of o)r.updateTelemetryEnablements(n.isUsageEnabled,n.isErrorsEnabled)}),this._oldTelemetryEnablement!==this.getTelemetryConfiguration()&&this._onDidChangeTelemetryEnabled.fire(this.getTelemetryConfiguration()),this._onDidChangeTelemetryConfiguration.fire(this.getTelemetryDetails())}onExtensionError(e,n){let r=this._telemetryLoggers.get(e.value)?.filter(a=>!a.isDisposed);if(!r)return this._telemetryLoggers.delete(e.value),!1;let s=!1;for(let a of r)a.ignoreUnhandledExtHostErrors||(a.logError(n),s=!0);return s}};cf=_([S(1,Ye),S(2,ir)],cf);var Fb=class{constructor(t,e,n,o,r,s,a){this._extension=n;this._logger=o;this._inLoggingOnlyMode=r;this._commonProperties=s;this._onDidChangeEnableStates=new T;this.ignoreUnhandledExtHostErrors=e?.ignoreUnhandledErrors??!1,this._ignoreBuiltinCommonProperties=e?.ignoreBuiltInCommonProperties??!1,this._additionalCommonProperties=e?.additionalCommonProperties,this._sender=t,this._telemetryEnablements={isUsageEnabled:a.isUsageEnabled,isErrorsEnabled:a.isErrorsEnabled}}static validateSender(t){if(typeof t!="object")throw new TypeError("TelemetrySender argument is invalid");if(typeof t.sendEventData!="function")throw new TypeError("TelemetrySender.sendEventData must be a function");if(typeof t.sendErrorData!="function")throw new TypeError("TelemetrySender.sendErrorData must be a function");if(typeof t.flush<"u"&&typeof t.flush!="function")throw new TypeError("TelemetrySender.flush must be a function or undefined")}updateTelemetryEnablements(t,e){this._apiObject&&(this._telemetryEnablements={isUsageEnabled:t,isErrorsEnabled:e},this._onDidChangeEnableStates.fire(this._apiObject))}mixInCommonPropsAndCleanData(t){let e=t.properties?t.properties??{}:t;return e=a1(e,[]),this._additionalCommonProperties&&(e=or(e,this._additionalCommonProperties)),this._ignoreBuiltinCommonProperties||(e=or(e,this._commonProperties)),t.properties?t.properties=e:t=e,t}logEvent(t,e){this._sender&&(this._extension.publisher==="vscode"?t=this._extension.name+"/"+t:t=this._extension.identifier.value+"/"+t,e=this.mixInCommonPropsAndCleanData(e||{}),this._inLoggingOnlyMode||this._sender?.sendEventData(t,e),this._logger.trace(t,e))}logUsage(t,e){this._telemetryEnablements.isUsageEnabled&&this.logEvent(t,e)}logError(t,e){if(!(!this._telemetryEnablements.isErrorsEnabled||!this._sender))if(typeof t=="string")this.logEvent(t,e);else{let n={name:t.name,message:t.message,stack:t.stack,cause:t.cause},o=a1(n,[]),r=new Error(typeof o.message=="string"?o.message:void 0,{cause:o.cause});r.stack=typeof o.stack=="string"?o.stack:void 0,r.name=typeof o.name=="string"?o.name:"unknown",e=this.mixInCommonPropsAndCleanData(e||{}),this._inLoggingOnlyMode||this._sender.sendErrorData(r,e),this._logger.trace("exception",e)}}get apiTelemetryLogger(){if(!this._apiObject){let t=this,e={logUsage:t.logUsage.bind(t),get isUsageEnabled(){return t._telemetryEnablements.isUsageEnabled},get isErrorsEnabled(){return t._telemetryEnablements.isErrorsEnabled},logError:t.logError.bind(t),dispose:t.dispose.bind(t),onDidChangeEnableStates:t._onDidChangeEnableStates.event.bind(t)};this._apiObject=Object.freeze(e)}return this._apiObject}get isDisposed(){return!this._sender}dispose(){if(this._sender?.flush){let t=this._sender;this._sender=void 0,Promise.resolve(t.flush()).then(t=void 0),this._apiObject=void 0}else this._sender=void 0;this._onDidChangeEnableStates.dispose()}};function nO(i){let t=Date.now()-new Date(i).getTime();return isNaN(t)?!1:t<1e3*60*60*24}var oc=A("IExtHostTelemetry");var uf=class{constructor(t,e,n){this._commands=new Map;this._apiCommands=new Map;this.#e=t.getProxy(F.MainThreadCommands),this._logService=e,this.#n=n,this.#t=t.getProxy(F.MainThreadTelemetry),this.converter=new oO(this,o=>{let r=this._apiCommands.get(o);return r?.result===Ae.Void?r:void 0},e),this._argumentProcessors=[{processArgument(o){return Tt(o)}},{processArgument(o){return Mi(o,function(r){if(ze.isIRange(r))return K.to(r);if(Un.isIPosition(r))return ht.to(r);if(ze.isIRange(r.range)&&y.isUri(r.uri))return bo.to(r);if(r instanceof H)return r.buffer.buffer.slice(r.buffer.byteOffset,r.buffer.byteOffset+r.buffer.byteLength);if(!Array.isArray(r))return r})}}]}#e;#t;#n;registerArgumentProcessor(t){this._argumentProcessors.push(t)}registerApiCommand(t){let e=this.registerCommand(!1,t.id,async(...n)=>{let o=t.args.map((s,a)=>{if(!s.validate(n[a]))throw new Error(`Invalid argument '${s.name}' when running '${t.id}', received: ${typeof n[a]=="object"?JSON.stringify(n[a],null,"	"):n[a]} `);return s.convert(n[a])}),r=await this.executeCommand(t.internalId,...o);return t.result.convert(r,n,this.converter)},void 0,{description:t.description,args:t.args,returns:t.result.description});return this._apiCommands.set(t.id,t),new Se(()=>{e.dispose(),this._apiCommands.delete(t.id)})}registerCommand(t,e,n,o,r,s){if(this._logService.trace("ExtHostCommands#registerCommand",e),!e.trim().length)throw new Error("invalid id");if(this._commands.has(e))throw new Error(`command '${e}' already exists`);return this._commands.set(e,{callback:n,thisArg:o,metadata:r,extension:s}),t&&this.#e.$registerCommand(e),new Se(()=>{this._commands.delete(e)&&t&&this.#e.$unregisterCommand(e)})}executeCommand(t,...e){return this._logService.trace("ExtHostCommands#executeCommand",t),this._doExecuteCommand(t,e,!0)}async _doExecuteCommand(t,e,n){if(this._commands.has(t))return this.#e.$fireCommandActivationEvent(t),this._executeContributedCommand(t,e,!1);{let o=!1,r=Mi(e,function(s){if(s instanceof De)return ht.from(s);if(s instanceof ve)return K.from(s);if(s instanceof rn)return bo.from(s);if(uo.isNotebookRange(s))return qr.from(s);if(s instanceof ArrayBuffer)return o=!0,H.wrap(new Uint8Array(s));if(s instanceof Uint8Array)return o=!0,H.wrap(s);if(s instanceof H)return o=!0,s;if(!Array.isArray(s))return s});try{let s=await this.#e.$executeCommand(t,o?new Zt(r):r,n);return Tt(s)}catch(s){if(s instanceof Error&&s.message==="$executeCommand:retry")return this._doExecuteCommand(t,e,!1);throw s}}}async _executeContributedCommand(t,e,n){let o=this._commands.get(t);if(!o)throw new Error("Unknown command");let{callback:r,thisArg:s,metadata:a}=o;if(a?.args)for(let d=0;d<a.args.length;d++)try{bR(e[d],a.args[d].constraint)}catch{throw new Error(`Running the contributed command: '${t}' failed. Illegal argument '${a.args[d].name}' - ${a.args[d].description}`)}let l=Xt.create();try{return await r.apply(s,e)}catch(d){if(t===this.converter.delegatingCommandId){let c=this.converter.getActualCommand(...e);c&&(t=c.command)}if(Yt(d)||this._logService.error(d,t,o.extension?.identifier),!n)throw d;if(o.extension?.identifier){let c=this.#n.onExtensionError(o.extension.identifier,d);this._logService.trace("forwarded error to extension?",c,o.extension?.identifier)}throw new class extends Error{constructor(){super(To(d));this.id=t;this.source=o.extension?.displayName??o.extension?.name}}}finally{this._reportTelemetry(o,t,l.elapsed())}}_reportTelemetry(t,e,n){t.extension&&(e.startsWith("code.copilot.logStructured")||this.#t.$publicLog2("Extension:ActionExecuted",{extensionId:t.extension.identifier.value,id:new fd(e),duration:n}))}$executeContributedCommand(t,...e){this._logService.trace("ExtHostCommands#$executeContributedCommand",t);let n=this._commands.get(t);return n?(e=e.map(o=>this._argumentProcessors.reduce((r,s)=>s.processArgument(r,n.extension),o)),this._executeContributedCommand(t,e,!0)):Promise.reject(new Error(`Contributed command '${t}' does not exist.`))}getCommands(t=!1){return this._logService.trace("ExtHostCommands#getCommands",t),this.#e.$getCommands().then(e=>(t&&(e=e.filter(n=>n[0]!=="_")),e))}$getContributedCommandMetadata(){let t=Object.create(null);for(let[e,n]of this._commands){let{metadata:o}=n;o&&(t[e]=o)}return Promise.resolve(t)}};uf=_([S(0,le),S(1,te),S(2,oc)],uf);var Bn=A("IExtHostCommands"),oO=class{constructor(t,e,n){this._commands=t;this._lookupApiCommand=e;this._logService=n;this.delegatingCommandId=`__vsc${_e()}`;this._cache=new Map;this._cachIdPool=0;this._commands.registerCommand(!0,this.delegatingCommandId,this._executeConvertedCommand,this)}toInternal(t,e){if(!t)return;let n={$ident:void 0,id:t.command,title:t.title,tooltip:t.tooltip};if(!t.command)return n;let o=this._lookupApiCommand(t.command);if(o)n.id=o.internalId,n.arguments=o.args.map((r,s)=>r.convert(t.arguments&&t.arguments[s]));else if(Ul(t.arguments)){let r=`${t.command} /${++this._cachIdPool}`;this._cache.set(r,t),e.add(q(()=>{this._cache.delete(r),this._logService.trace("CommandsConverter#DISPOSE",r)})),n.$ident=r,n.id=this.delegatingCommandId,n.arguments=[r],this._logService.trace("CommandsConverter#CREATE",t.command,r)}return n}fromInternal(t){return typeof t.$ident=="string"?this._cache.get(t.$ident):{command:t.id,title:t.title,arguments:t.arguments}}getActualCommand(...t){return this._cache.get(t[0])}_executeConvertedCommand(...t){let e=this.getActualCommand(...t);return this._logService.trace("CommandsConverter#EXECUTE",t[0],e?e.command:"MISSING"),e?this._commands.executeCommand(e.command,...e.arguments||[]):Promise.reject(`Actual command not found, wanted to execute ${t[0]}`)}},oe=class i{constructor(t,e,n,o){this.name=t;this.description=e;this.validate=n;this.convert=o}static{this.Uri=new i("uri","Uri of a text document",t=>y.isUri(t),t=>t)}static{this.Position=new i("position","A position in a text document",t=>De.isPosition(t),ht.from)}static{this.Range=new i("range","A range in a text document",t=>ve.isRange(t),K.from)}static{this.Selection=new i("selection","A selection in a text document",t=>oo.isSelection(t),Do.from)}static{this.Number=new i("number","",t=>typeof t=="number",t=>t)}static{this.String=new i("string","",t=>typeof t=="string",t=>t)}static Arr(t){return new i(`${t.name}_array`,`Array of ${t.name}, ${t.description}`,e=>Array.isArray(e)&&e.every(n=>t.validate(n)),e=>e.map(n=>t.convert(n)))}static{this.CallHierarchyItem=new i("item","A call hierarchy item",t=>t instanceof Md,gl.from)}static{this.TypeHierarchyItem=new i("item","A type hierarchy item",t=>t instanceof Nd,hl.from)}static{this.TestItem=new i("testItem","A VS Code TestItem",t=>t instanceof bl,ea.from)}static{this.TestProfile=new i("testProfile","A VS Code test profile",t=>t instanceof sg,SL.from)}optional(){return new i(this.name,`(optional) ${this.description}`,t=>t==null||this.validate(t),t=>t===void 0?void 0:t===null?null:this.convert(t))}with(t,e){return new i(t??this.name,e??this.description,this.validate,this.convert)}},Ae=class i{constructor(t,e){this.description=t;this.convert=e}static{this.Void=new i("no result",t=>t)}},Me=class{constructor(t,e,n,o,r){this.id=t;this.internalId=e;this.description=n;this.args=o;this.result=r}};var Ao=A("IExtHostTerminalService"),rp=class extends N{constructor(e,n,o,r){super();this._proxy=e;this._id=n;this._creationOptions=o;this._name=r;this._disposed=!1;this._state={isInteractedWith:!1,shell:void 0};this.isOpen=!1;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._creationOptions=Object.freeze(this._creationOptions),this._pidPromise=new Promise(a=>this._pidPromiseComplete=a);let s=this;this.value={get name(){return s._name||""},get processId(){return s._pidPromise},get creationOptions(){return s._creationOptions},get exitStatus(){return s._exitStatus},get state(){return s._state},get selection(){return s._selection},get shellIntegration(){return s.shellIntegration},sendText(a,l=!0){s._checkDisposed(),s._proxy.$sendText(s._id,a,l)},show(a){s._checkDisposed(),s._proxy.$show(s._id,a)},hide(){s._checkDisposed(),s._proxy.$hide(s._id)},dispose(){s._disposed||(s._disposed=!0,s._proxy.$dispose(s._id))},get dimensions(){if(!(s._cols===void 0||s._rows===void 0))return{columns:s._cols,rows:s._rows}}}}dispose(){this._onWillDispose.fire(),super.dispose()}async create(e,n){if(typeof this._id!="string")throw new Error("Terminal has already been created");await this._proxy.$createTerminal(this._id,{name:e.name,shellPath:e.shellPath??void 0,shellArgs:e.shellArgs??void 0,cwd:e.cwd??n?.cwd??void 0,env:e.env??void 0,icon:x5(e.iconPath)??void 0,color:am.isThemeColor(e.color)?e.color.id:void 0,initialText:e.message??void 0,strictEnv:e.strictEnv??void 0,hideFromUser:e.hideFromUser??void 0,forceShellIntegration:n?.forceShellIntegration??void 0,isFeatureTerminal:n?.isFeatureTerminal??void 0,isRemoteResolverTerminal:n?.isRemoteResolverTerminal??void 0,isExtensionOwnedTerminal:!0,useShellEnvironment:n?.useShellEnvironment??void 0,location:n?.location||this._serializeParentTerminal(e.location,n?.resolvedExtHostIdentifier),isTransient:e.isTransient??void 0,shellIntegrationNonce:e.shellIntegrationNonce??void 0,titleTemplate:e.titleTemplate??void 0})}async createExtensionTerminal(e,n,o,r,s,a,l){if(typeof this._id!="string")throw new Error("Terminal has already been created");if(await this._proxy.$createTerminal(this._id,{name:this._name,isExtensionCustomPtyTerminal:!0,icon:r,color:am.isThemeColor(s)?s.id:void 0,location:n?.location||this._serializeParentTerminal(e,o),isTransient:!0,shellIntegrationNonce:a??void 0,titleTemplate:l??void 0}),typeof this._id=="string")throw new Error("Terminal creation failed");return this._id}_serializeParentTerminal(e,n){return typeof e=="object"?Gn(e,{parentTerminal:!0})&&e.parentTerminal&&n?{parentTerminal:n}:Gn(e,{viewColumn:!0})?{viewColumn:zt.from(e.viewColumn),preserveFocus:e.preserveFocus}:void 0:e}_checkDisposed(){if(this._disposed)throw new Error("Terminal has already been disposed")}set name(e){this._name=e}setExitStatus(e,n){this._exitStatus=Object.freeze({code:e,reason:n})}setDimensions(e,n){return e===this._cols&&n===this._rows||e===0||n===0?!1:(this._cols=e,this._rows=n,!0)}setInteractedWith(){return this._state.isInteractedWith?!1:(this._state={...this._state,isInteractedWith:!0},!0)}setShellType(e){return this._state.shell!==e?(this._state={...this._state,shell:e},!0):!1}setSelection(e){this._selection=e}_setProcessId(e){this._pidPromiseComplete?(this._pidPromiseComplete(e),this._pidPromiseComplete=void 0):this._pidPromise.then(n=>{n!==e&&(this._pidPromise=Promise.resolve(e))})}},Hb=class{constructor(t){this._pty=t;this.id=0;this.shouldPersist=!1;this._onProcessData=new T;this.onProcessData=this._onProcessData.event;this._onProcessReady=new T;this._onDidChangeProperty=new T;this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=new T;this.onProcessExit=this._onProcessExit.event}get onProcessReady(){return this._onProcessReady.event}refreshProperty(t){throw new Error(`refreshProperty is not suppported in extension owned terminals. property: ${t}`)}updateProperty(t,e){throw new Error(`updateProperty is not suppported in extension owned terminals. property: ${t}, value: ${e}`)}async start(){}shutdown(){this._pty.close()}input(t){this._pty.handleInput?.(t)}sendSignal(t){}resize(t,e){this._pty.setDimensions?.({columns:t,rows:e})}clearBuffer(){}async processBinary(t){}acknowledgeDataEvent(t){}async setUnicodeVersion(t){}getInitialCwd(){return Promise.resolve("")}getCwd(){return Promise.resolve("")}startSendingEvents(t){this._pty.onDidWrite(e=>this._onProcessData.fire(e)),this._pty.onDidClose?.((e=void 0)=>{this._onProcessExit.fire(e===void 0?void 0:e)}),this._pty.onDidOverrideDimensions?.(e=>{e&&this._onDidChangeProperty.fire({type:"overrideDimensions",value:{cols:e.columns,rows:e.rows}})}),this._pty.onDidChangeName?.(e=>{this._onDidChangeProperty.fire({type:"title",value:e})}),this._pty.open(t||void 0),t&&this._pty.setDimensions?.(t),this._onProcessReady.fire({pid:-1,cwd:"",windowsPty:void 0})}},rJ=1,op=class extends N{constructor(e,n,o){super();this._extHostCommands=n;this._terminals=[];this._terminalProcesses=new Map;this._terminalProcessDisposables={};this._extensionTerminalAwaitingStart={};this._getTerminalPromises={};this._environmentVariableCollections=new Map;this._lastQuickFixCommands=this._register(new tn);this._linkProviders=new Set;this._completionProviders=new Map;this._profileProviders=new Map;this._quickFixProviders=new Map;this._terminalLinkCache=new Map;this._terminalLinkCancellationSource=new Map;this._onDidCloseTerminal=new T;this.onDidCloseTerminal=this._onDidCloseTerminal.event;this._onDidOpenTerminal=new T;this.onDidOpenTerminal=this._onDidOpenTerminal.event;this._onDidChangeActiveTerminal=new T;this.onDidChangeActiveTerminal=this._onDidChangeActiveTerminal.event;this._onDidChangeTerminalDimensions=new T;this.onDidChangeTerminalDimensions=this._onDidChangeTerminalDimensions.event;this._onDidChangeTerminalState=new T;this.onDidChangeTerminalState=this._onDidChangeTerminalState.event;this._onDidChangeShell=new T;this.onDidChangeShell=this._onDidChangeShell.event;this._onDidWriteTerminalData=new T({onWillAddFirstListener:()=>this._proxy.$startSendingDataEvents(),onDidRemoveLastListener:()=>this._proxy.$stopSendingDataEvents()});this.onDidWriteTerminalData=this._onDidWriteTerminalData.event;this._onDidExecuteCommand=new T({onWillAddFirstListener:()=>this._proxy.$startSendingCommandEvents(),onDidRemoveLastListener:()=>this._proxy.$stopSendingCommandEvents()});this.onDidExecuteTerminalCommand=this._onDidExecuteCommand.event;this._proxy=o.getProxy(F.MainThreadTerminalService),this._bufferer=new _w(this._proxy.$sendProcessData),this._proxy.$registerProcessSupport(e),this._extHostCommands.registerArgumentProcessor({processArgument:r=>{let s=a=>this.getTerminalById(a.instanceId)?.value;switch(r?.$mid){case 15:return s(r);default:{if(Array.isArray(r))for(let a=0;a<r.length&&r[a].$mid===15;a++)r[a]=s(r[a]);return r}}}}),this._register({dispose:()=>{for(let[r,s]of this._terminalProcesses)s.shutdown(!0)}})}get activeTerminal(){return this._activeTerminal?.value}get terminals(){return this._terminals.map(e=>e.value)}getDefaultShell(e){return(e?this._defaultAutomationProfile:this._defaultProfile)?.path||""}getDefaultShellArgs(e){return(e?this._defaultAutomationProfile:this._defaultProfile)?.args||[]}createExtensionTerminal(e,n){let o=new rp(this._proxy,_e(),e,e.name),r=new Hb(e.pty);return o.createExtensionTerminal(e.location,n,this._serializeParentTerminal(e,n).resolvedExtHostIdentifier,x5(e.iconPath),iJ(e.color),e.shellIntegrationNonce,e.titleTemplate).then(s=>{let a=this._setupExtHostProcessListeners(s,r);this._terminalProcessDisposables[s]=a}),this._terminals.push(o),o.value}_serializeParentTerminal(e,n){if(n=n||{},e.location&&typeof e.location=="object"&&Gn(e.location,{parentTerminal:!0})){let o=e.location.parentTerminal;if(o){let r=this._terminals.find(s=>s.value===o);r&&(n.resolvedExtHostIdentifier=r._id)}}else e.location&&typeof e.location!="object"?n.location=e.location:n.location&&typeof n.location=="object"&&Gn(n.location,{splitActiveTerminal:!0})&&(n.location={splitActiveTerminal:!0});return n}attachPtyToTerminal(e,n){if(!this.getTerminalById(e))throw new Error(`Cannot resolve terminal with id ${e} for virtual process`);let r=new Hb(n),s=this._setupExtHostProcessListeners(e,r);this._terminalProcessDisposables[e]=s}async $acceptActiveTerminalChanged(e){let n=this._activeTerminal;if(e===null){this._activeTerminal=void 0,n!==this._activeTerminal&&this._onDidChangeActiveTerminal.fire(this._activeTerminal);return}let o=this.getTerminalById(e);o&&(this._activeTerminal=o,n!==this._activeTerminal&&this._onDidChangeActiveTerminal.fire(this._activeTerminal.value))}async $acceptTerminalProcessData(e,n){let o=this.getTerminalById(e);o&&this._onDidWriteTerminalData.fire({terminal:o.value,data:n})}async $acceptTerminalDimensions(e,n,o){let r=this.getTerminalById(e);r&&r.setDimensions(n,o)&&this._onDidChangeTerminalDimensions.fire({terminal:r.value,dimensions:r.value.dimensions})}async $acceptDidExecuteCommand(e,n){let o=this.getTerminalById(e);o&&this._onDidExecuteCommand.fire({terminal:o.value,...n})}async $acceptTerminalMaximumDimensions(e,n,o){this._terminalProcesses.get(e)?.resize(n,o)}async $acceptTerminalTitleChange(e,n){let o=this.getTerminalById(e);o&&(o.name=n)}async $acceptTerminalClosed(e,n,o){this._terminalLinkCache.delete(e);let r=this._terminalLinkCancellationSource.get(e);r&&(this._terminalLinkCancellationSource.delete(e),r.dispose(!0));let s=this._getTerminalObjectIndexById(this._terminals,e);if(s!==null){let a=this._terminals.splice(s,1)[0];a.setExitStatus(n,o),this._onDidCloseTerminal.fire(a.value)}}$acceptTerminalOpened(e,n,o,r){if(n){let l=this._getTerminalObjectIndexById(this._terminals,n);if(l!==null){this._terminals[l]._id=e,this._onDidOpenTerminal.fire(this.terminals[l]),this._terminals[l].isOpen=!0;return}}let s={name:r.name,shellPath:r.executable,shellArgs:r.args,cwd:typeof r.cwd=="string"?r.cwd:y.revive(r.cwd),env:r.env,hideFromUser:r.hideFromUser,titleTemplate:r.titleTemplate},a=new rp(this._proxy,e,s,o);this._terminals.push(a),this._onDidOpenTerminal.fire(a.value),a.isOpen=!0}async $acceptTerminalProcessId(e,n){this.getTerminalById(e)?._setProcessId(n)}async $startExtensionTerminal(e,n){let o=this.getTerminalById(e);if(!o)return{message:p(5891,null,e)};o.isOpen||await new Promise(s=>{let a=this.onDidOpenTerminal(async l=>{l===o.value&&(a.dispose(),s())})});let r=this._terminalProcesses.get(e);r?r.startSendingEvents(n):this._extensionTerminalAwaitingStart[e]={initialDimensions:n}}_setupExtHostProcessListeners(e,n){let o=new $;o.add(n.onProcessReady(s=>this._proxy.$sendProcessReady(e,s.pid,s.cwd,s.windowsPty))),o.add(n.onDidChangeProperty(s=>this._proxy.$sendProcessProperty(e,s))),this._bufferer.startBuffering(e,n.onProcessData),o.add(n.onProcessExit(s=>this._onProcessExit(e,s))),this._terminalProcesses.set(e,n);let r=this._extensionTerminalAwaitingStart[e];return r&&n instanceof Hb&&(n.startSendingEvents(r.initialDimensions),delete this._extensionTerminalAwaitingStart[e]),o}$acceptProcessAckDataEvent(e,n){this._terminalProcesses.get(e)?.acknowledgeDataEvent(n)}$acceptProcessInput(e,n){this._terminalProcesses.get(e)?.input(n)}$acceptTerminalInteraction(e){let n=this.getTerminalById(e);n?.setInteractedWith()&&this._onDidChangeTerminalState.fire(n.value)}$acceptTerminalSelection(e,n){this.getTerminalById(e)?.setSelection(n)}$acceptProcessResize(e,n,o){try{this._terminalProcesses.get(e)?.resize(n,o)}catch(r){if(r.code!=="EPIPE"&&r.code!=="ERR_IPC_CHANNEL_CLOSED")throw r}}$acceptProcessShutdown(e,n){this._terminalProcesses.get(e)?.shutdown(n)}$acceptProcessRequestInitialCwd(e){this._terminalProcesses.get(e)?.getInitialCwd().then(n=>this._proxy.$sendProcessProperty(e,{type:"initialCwd",value:n}))}$acceptProcessRequestCwd(e){this._terminalProcesses.get(e)?.getCwd().then(n=>this._proxy.$sendProcessProperty(e,{type:"cwd",value:n}))}$acceptProcessRequestLatency(e){return Promise.resolve(e)}registerProfileProvider(e,n,o){if(this._profileProviders.has(n))throw new Error(`Terminal profile provider "${n}" already registered`);return this._profileProviders.set(n,{provider:o,extension:e}),this._proxy.$registerProfileProvider(n,e.identifier.value),new Se(()=>{this._profileProviders.delete(n),this._proxy.$unregisterProfileProvider(n)})}registerTerminalCompletionProvider(e,n,...o){if(this._completionProviders.has(e.identifier.value))throw new Error(`Terminal completion provider "${e.identifier.value}" already registered`);return this._completionProviders.set(e.identifier.value,n),this._proxy.$registerCompletionProvider(e.identifier.value,e.identifier.value,...o),new Se(()=>{this._completionProviders.delete(e.identifier.value),this._proxy.$unregisterCompletionProvider(e.identifier.value)})}async $provideTerminalCompletions(e,n){let o=new Ee().token;if(o.isCancellationRequested||!this.activeTerminal)return;let r=this._completionProviders.get(e);if(!r)return;let s=await r.provideTerminalCompletions(this.activeTerminal,n,o);if(s==null)return;let a=!Te||this.activeTerminal.state?.shell==="gitbash"?"/":"\\";return _L.from(s,a)}$acceptTerminalShellType(e,n){let o=this.getTerminalById(e);o?.setShellType(n)&&this._onDidChangeTerminalState.fire(o.value)}registerTerminalQuickFixProvider(e,n,o){if(this._quickFixProviders.has(e))throw new Error(`Terminal quick fix provider "${e}" is already registered`);return this._quickFixProviders.set(e,o),this._proxy.$registerQuickFixProvider(e,n),new Se(()=>{this._quickFixProviders.delete(e),this._proxy.$unregisterQuickFixProvider(e)})}async $provideTerminalQuickFixes(e,n){let o=new Ee().token;if(o.isCancellationRequested)return;let r=this._quickFixProviders.get(e);if(!r)return;let s=await r.provideTerminalQuickFixes(n,o);if(s===null||Array.isArray(s)&&s.length===0)return;let a=new $;if(this._lastQuickFixCommands.value=a,!Array.isArray(s))return s?uw.from(s,this._extHostCommands.converter,a):void 0;let l=[];for(let d of s){let c=uw.from(d,this._extHostCommands.converter,a);c&&l.push(c)}return l}async $createContributedProfileTerminal(e,n){let o=new Ee().token,r=this._profileProviders.get(e);if(!r)throw new Error(`No terminal profile provider registered for id "${e}"`);let s=await r.provider.provideTerminalProfile(o);if(o.isCancellationRequested)return;if(s&&!Gn(s,{options:!0})&&(s={options:s}),!s||!Gn(s,{options:!0}))throw new Error(`No terminal profile options provided for id "${e}"`);let a=Le(r.extension,"terminalTitle");!a&&s.options.titleTemplate!==void 0&&(console.error(`[${r.extension.identifier.value}] \`titleTemplate\` returned from TerminalProfileProvider is ignored because the \`terminalTitle\` proposed API is not enabled.`),s={options:{...s.options,titleTemplate:void 0}}),!a&&n.titleTemplate!==void 0&&console.error(`[${r.extension.identifier.value}] \`titleTemplate\` passed to createContributedTerminalProfile is ignored because the \`terminalTitle\` proposed API is not enabled.`);let l=a&&n.titleTemplate&&!s.options.titleTemplate?{...s.options,titleTemplate:n.titleTemplate}:s.options;if(Gn(l,{pty:!0})){this.createExtensionTerminal(l,n);return}this.createTerminalFromOptions(l,n)}registerLinkProvider(e){return this._linkProviders.add(e),this._linkProviders.size===1&&this._proxy.$startLinkProvider(),new Se(()=>{this._linkProviders.delete(e),this._linkProviders.size===0&&this._proxy.$stopLinkProvider()})}async $provideLinks(e,n){let o=this.getTerminalById(e);if(!o)return[];this._terminalLinkCache.delete(e),this._terminalLinkCancellationSource.get(e)?.dispose(!0);let s=new Ee;this._terminalLinkCancellationSource.set(e,s);let a=[],l={terminal:o.value,line:n},d=[];for(let m of this._linkProviders)d.push(ii.withAsyncBody(async g=>{let h=s.token.onCancellationRequested(()=>g({provider:m,links:[]}));try{let f=await m.provideTerminalLinks(l,s.token)||[];s.token.isCancellationRequested||g({provider:m,links:f})}finally{h.dispose()}}));let c=await Promise.all(d);if(s.token.isCancellationRequested)return[];let u=new Map;for(let m of c)m&&m.links.length>0&&a.push(...m.links.map(g=>{let h={id:rJ++,startIndex:g.startIndex,length:g.length,label:g.tooltip};return u.set(h.id,{provider:m.provider,link:g}),h}));return this._terminalLinkCache.set(e,u),a}$activateLink(e,n){let o=this._terminalLinkCache.get(e)?.get(n);o&&o.provider.handleTerminalLink(o.link)}_onProcessExit(e,n){this._bufferer.stopBuffering(e),this._terminalProcesses.delete(e),delete this._extensionTerminalAwaitingStart[e];let o=this._terminalProcessDisposables[e];o&&(o.dispose(),delete this._terminalProcessDisposables[e]),this._proxy.$sendProcessExit(e,n)}getTerminalById(e){return this._getTerminalObjectById(this._terminals,e)}getTerminalIdByApiObject(e){let n=this._terminals.findIndex(o=>o.value===e);return n>=0?n:null}_getTerminalObjectById(e,n){let o=this._getTerminalObjectIndexById(e,n);return o!==null?e[o]:null}_getTerminalObjectIndexById(e,n){let o=e.findIndex(r=>r._id===n);return o>=0?o:null}getEnvironmentVariableCollection(e){let n=this._environmentVariableCollections.get(e.identifier.value);return n||(n=this._register(new Aw),this._setEnvironmentVariableCollection(e.identifier.value,n)),n.getScopedEnvironmentVariableCollection(void 0)}_syncEnvironmentVariableCollection(e,n){let o=v5(n.map),r=y5(n.descriptionMap);this._proxy.$setEnvironmentVariableCollection(e,n.persistent,o.length===0?void 0:o,r)}$initEnvironmentVariableCollections(e){e.forEach(n=>{let o=n[0],r=this._register(new Aw(n[1]));this._setEnvironmentVariableCollection(o,r)})}$acceptDefaultProfile(e,n){let o=this._defaultProfile;this._defaultProfile=e,this._defaultAutomationProfile=n,o?.path!==e.path&&this._onDidChangeShell.fire(e.path)}_setEnvironmentVariableCollection(e,n){this._environmentVariableCollections.set(e,n),this._register(n.onDidChangeCollection(()=>{this._syncEnvironmentVariableCollection(e,n)}))}};op=_([S(1,Bn),S(2,le)],op);var Aw=class extends N{constructor(e){super();this.map=new Map;this.scopedCollections=new Map;this.descriptionMap=new Map;this._persistent=!0;this._onDidChangeCollection=this._register(new T);this.map=new Map(e)}get persistent(){return this._persistent}set persistent(e){this._persistent=e,this._onDidChangeCollection.fire()}get onDidChangeCollection(){return this._onDidChangeCollection&&this._onDidChangeCollection.event}getScopedEnvironmentVariableCollection(e){let n=this.getScopeKey(e),o=this.scopedCollections.get(n);return o||(o=new rO(this,e),this.scopedCollections.set(n,o),this._register(o.onDidChangeCollection(()=>this._onDidChangeCollection.fire()))),o}replace(e,n,o,r){this._setIfDiffers(e,{value:n,type:1,options:o??{applyAtProcessCreation:!0},scope:r})}append(e,n,o,r){this._setIfDiffers(e,{value:n,type:2,options:o??{applyAtProcessCreation:!0},scope:r})}prepend(e,n,o,r){this._setIfDiffers(e,{value:n,type:3,options:o??{applyAtProcessCreation:!0},scope:r})}_setIfDiffers(e,n){if(n.options&&n.options.applyAtProcessCreation===!1&&!n.options.applyAtShellIntegration)throw new Error("EnvironmentVariableMutatorOptions must apply at either process creation or shell integration");let o=this.getKey(e,n.scope),r=this.map.get(o),s=n.options?{applyAtProcessCreation:n.options.applyAtProcessCreation??!1,applyAtShellIntegration:n.options.applyAtShellIntegration??!1}:{applyAtProcessCreation:!0};if(!r||r.value!==n.value||r.type!==n.type||r.options?.applyAtProcessCreation!==s.applyAtProcessCreation||r.options?.applyAtShellIntegration!==s.applyAtShellIntegration||r.scope?.workspaceFolder?.index!==n.scope?.workspaceFolder?.index){let a=this.getKey(e,n.scope),l={variable:e,...n,options:s};this.map.set(a,l),this._onDidChangeCollection.fire()}}get(e,n){let o=this.getKey(e,n),r=this.map.get(o);return r?I5(r):void 0}getKey(e,n){let o=this.getScopeKey(n);return o.length?`${e}:::${o}`:e}getScopeKey(e){return this.getWorkspaceKey(e?.workspaceFolder)??""}getWorkspaceKey(e){return e?e.uri.toString():void 0}getVariableMap(e){let n=new Map;for(let[o,r]of this.map)this.getScopeKey(r.scope)===this.getScopeKey(e)&&n.set(r.variable,I5(r));return n}delete(e,n){let o=this.getKey(e,n);this.map.delete(o),this._onDidChangeCollection.fire()}clear(e){if(e?.workspaceFolder){for(let[n,o]of this.map)o.scope?.workspaceFolder?.index===e.workspaceFolder.index&&this.map.delete(n);this.clearDescription(e)}else this.map.clear(),this.descriptionMap.clear();this._onDidChangeCollection.fire()}setDescription(e,n){let o=this.getScopeKey(n),r=this.descriptionMap.get(o);if(!r||r.description!==e){let s;typeof e=="string"?s=e:s=e?.value.split(`

`)[0];let a={description:s,scope:n};this.descriptionMap.set(o,a),this._onDidChangeCollection.fire()}}getDescription(e){let n=this.getScopeKey(e);return this.descriptionMap.get(n)?.description}clearDescription(e){let n=this.getScopeKey(e);this.descriptionMap.delete(n)}},rO=class{constructor(t,e){this.collection=t;this.scope=e;this._onDidChangeCollection=new T}get persistent(){return this.collection.persistent}set persistent(t){this.collection.persistent=t}get onDidChangeCollection(){return this._onDidChangeCollection&&this._onDidChangeCollection.event}getScoped(t){return this.collection.getScopedEnvironmentVariableCollection(t)}replace(t,e,n){this.collection.replace(t,e,n,this.scope)}append(t,e,n){this.collection.append(t,e,n,this.scope)}prepend(t,e,n){this.collection.prepend(t,e,n,this.scope)}get(t){return this.collection.get(t,this.scope)}forEach(t,e){this.collection.getVariableMap(this.scope).forEach((n,o)=>t.call(e,o,n,this),this.scope)}[Symbol.iterator](){return this.collection.getVariableMap(this.scope).entries()}delete(t){this.collection.delete(t,this.scope),this._onDidChangeCollection.fire(void 0)}clear(){this.collection.clear(this.scope)}set description(t){this.collection.setDescription(t,this.scope)}get description(){return this.collection.getDescription(this.scope)}},pf=class extends op{constructor(t,e,n){super(!1,t,e),this._hasRemoteAuthority=!!n.remote.authority}createTerminal(t,e,n){if(!this._hasRemoteAuthority)throw new Tc;return this.createTerminalFromOptions({name:t,shellPath:e,shellArgs:n})}createTerminalFromOptions(t,e){if(!this._hasRemoteAuthority)throw new Tc;let n=new rp(this._proxy,_e(),t,t.name);return this._terminals.push(n),n.create(t,this._serializeParentTerminal(t,e)),n.value}};pf=_([S(0,Bn),S(1,le),S(2,Ye)],pf);function x5(i){if(!(!i||typeof i=="string"))return Gn(i,{id:!0})?{id:i.id,color:i.color}:i}function iJ(i){return am.isThemeColor(i)?i:void 0}function I5(i){let t={...i};return delete t.scope,t.options=t.options??void 0,t}var sO="/.well-known",sJ=`${sO}/oauth-protected-resource`,aJ=`${sO}/oauth-authorization-server`,iO=`${sO}/openid-configuration`,mf=" ",lJ="urn:ietf:params:oauth:grant-type:token-exchange";var dJ="urn:ietf:params:oauth:token-type:id_token",cJ="urn:ietf:params:oauth:token-type:id-jag",uJ="urn:ietf:params:oauth:grant-type:jwt-bearer";function C5(i,t,e,n,o,r){let s=new URLSearchParams;return s.append("client_id",i),t&&s.append("client_secret",t),s.append("grant_type",lJ),s.append("subject_token",e),s.append("subject_token_type",dJ),s.append("requested_token_type",cJ),s.append("audience",n),o&&s.append("resource",o),r.length&&s.append("scope",r.join(mf)),s}function T5(i,t,e,n,o){let r=new URLSearchParams;return r.append("client_id",i),t&&r.append("client_secret",t),r.append("grant_type",uJ),r.append("assertion",e),n&&r.append("resource",n),o.length&&r.append("scope",o.join(mf)),r}function pJ(i){if(typeof i!="object"||i===null)return!1;let t=i;return!(!t.resource||t.scopes_supported!==void 0&&!Array.isArray(t.scopes_supported))}var mJ=["issuer","authorization_endpoint","token_endpoint","registration_endpoint","jwks_uri"];function gJ(i){if(typeof i!="object"||i===null)return!1;let t=i;if(!t.issuer)throw new Error("Authorization server metadata must have an issuer");for(let e of mJ)if(t[e]){if(typeof t[e]!="string")throw new Error(`Authorization server metadata '${e}' must be a string`);if(!t[e].startsWith("https://")&&!t[e].startsWith("http://"))throw new Error(`Authorization server metadata '${e}' must start with http:// or https://`)}return!0}function fJ(i){return typeof i!="object"||i===null?!1:i.client_id!==void 0}function ip(i){if(typeof i!="object"||i===null)return!1;let t=i;return t.access_token!==void 0&&t.token_type!==void 0}function E5(i){if(typeof i!="object"||i===null)return!1;let t=i;return t.device_code!==void 0&&t.user_code!==void 0&&t.verification_uri!==void 0&&t.expires_in!==void 0}function aO(i){return typeof i!="object"||i===null?!1:i.error!==void 0}function hJ(i){return typeof i!="object"||i===null?!1:i.error!==void 0}function w5(i){return{issuer:i.toString(),authorization_endpoint:new URL("/authorize",i).toString(),token_endpoint:new URL("/token",i).toString(),registration_endpoint:new URL("/register",i).toString(),response_types_supported:["code","id_token","id_token token"]}}var S5=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:device_code"],lO=33418;async function dO(i,t,e){if(!i.registration_endpoint)throw new Error("Server does not support dynamic registration");let n={client_name:t,client_uri:"https://code.visualstudio.com",grant_types:i.grant_types_supported?i.grant_types_supported.filter(s=>S5.includes(s)):S5,response_types:["code"],redirect_uris:["https://insiders.vscode.dev/redirect","https://vscode.dev/redirect","http://127.0.0.1/",`http://127.0.0.1:${lO}/`],scope:e?.join(mf),token_endpoint_auth_method:"none",application_type:"native"},o=await fetch(i.registration_endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok){let s=await o.text(),a=s;try{let l=JSON.parse(s);hJ(l)&&(a=`${l.error}${l.error_description?`: ${l.error_description}`:""}`)}catch{}throw new Error(`Registration to ${i.registration_endpoint} failed: ${a}`)}let r=await o.json();if(fJ(r))return r;throw new Error(`Invalid authorization dynamic client registration response: ${JSON.stringify(r)}`)}function cO(i){let t=[],e=[],n="",o=!1;for(let s=0;s<i.length;s++){let a=i[s];a==='"'?(o=!o,n+=a):a===","&&!o?(n.trim()&&e.push(n.trim()),n=""):n+=a}n.trim()&&e.push(n.trim());let r;for(let s of e)if(!s.includes("="))r&&t.push(r),r={scheme:s.trim(),params:{}};else{let l=s.indexOf(" ");if(l>0){let d=s.substring(0,l),c=s.substring(l+1);if(!d.includes("=")&&c.includes("=")){r&&t.push(r),r={scheme:d.trim(),params:{}};let u=c.indexOf("=");if(u>0){let m=c.substring(0,u).trim(),g=c.substring(u+1).trim().replace(/^"|"$/g,"");m&&g!==void 0&&(r.params[m]=g)}continue}}if(r){let d=s.indexOf("=");if(d>0){let c=s.substring(0,d).trim(),u=s.substring(d+1).trim().replace(/^"|"$/g,"");c&&u!==void 0&&(r.params[c]=u)}}}return r&&t.push(r),t}function gf(i){let t=i.split(".");if(t.length!==3)throw new Error("Invalid JWT token format: token must have three parts separated by dots");let[e,n,o]=t;try{if(typeof JSON.parse(fo(e).toString())!="object")throw new Error("Invalid JWT token format: header is not a JSON object");let s=JSON.parse(fo(n).toString());if(typeof s!="object")throw new Error("Invalid JWT token format: payload is not a JSON object");return s}catch(r){throw r instanceof Error?new Error(`Failed to parse JWT token: ${r.message}`):new Error("Failed to parse JWT token")}}function k5(i,t){if(i===t)return!0;if(!i||!t||i.length!==t.length)return!1;let e=[...i].sort(),n=[...t].sort();return e.every((o,r)=>o===n[r])}async function P5(i,t,e={}){let{sameOriginHeaders:n={},fetch:o=fetch}=e,r=new URL(i),s=async(c,u)=>{let m={Accept:"application/json"};new URL(c).origin===r.origin&&(m={...m,...n});let h=await o(c,{method:"GET",headers:m});if(h.status!==200){let I;try{I=await h.text()}catch{I=h.statusText}throw new Error(`Failed to fetch resource metadata from ${c}: ${h.status} ${I}`)}let f=await h.json();if(pJ(f)){let I=new URL(f.resource).toString(),x=new URL(u).toString();if(I!==x)throw new Error(`Protected Resource Metadata 'resource' property value "${I}" does not match expected value "${x}" for URL ${c}. Per RFC 9728, these MUST match. See https://datatracker.ietf.org/doc/html/rfc9728#PRConfigurationValidation`);return f}else throw new Error(`Invalid resource metadata from ${c}. Expected to follow shape of https://datatracker.ietf.org/doc/html/rfc9728#name-protected-resource-metadata (Hints: is scopes_supported an array? Is resource a string?). Current payload: ${JSON.stringify(f)}`)},a=[];if(t)try{return{metadata:await s(t,i),discoveryUrl:t,errors:a}}catch(c){a.push(c instanceof Error?c:new Error(String(c)))}let l=r.pathname!=="/",d=`${r.origin}${sJ}`;if(l){let c=`${d}${r.pathname}`;try{return{metadata:await s(c,i),discoveryUrl:c,errors:a}}catch(u){a.push(u instanceof Error?u:new Error(String(u)))}}try{return{metadata:await s(d,r.origin),discoveryUrl:d,errors:a}}catch(c){a.push(c instanceof Error?c:new Error(String(c)))}throw a.length===1?a[0]:new AggregateError(a,"Failed to fetch resource metadata from all attempted URLs")}async function vJ(i){if(i.status===200)try{let t=await i.json();if(gJ(t))return t}catch{}}async function yJ(i){try{return await i.text()}catch{return i.statusText}}async function Mw(i,t={}){let{additionalHeaders:e={},fetch:n=fetch}=t,o=new URL(i),r=o.pathname==="/"?"":o.pathname,s=[],a=async m=>{try{let g=await n(m,{method:"GET",headers:{...e,Accept:"application/json"}}),h=await vJ(g);if(h)return h;s.push(new Error(`Failed to fetch authorization server metadata from ${m}: ${g.status} ${await yJ(g)}`));return}catch(g){s.push(g instanceof Error?g:new Error(String(g)));return}},l=new URL(aJ,i).toString()+r,d=await a(l);if(d)return{metadata:d,discoveryUrl:l,errors:s};let c=new URL(iO,i).toString()+r;if(d=await a(c),d)return{metadata:d,discoveryUrl:c,errors:s};let u=i.endsWith("/")?i+iO.substring(1):i+iO;if(d=await a(u),d)return{metadata:d,discoveryUrl:u,errors:s};throw s.length===1?s[0]:new AggregateError(s,"Failed to fetch authorization server metadata from all attempted URLs")}var rc=class{constructor(t,e){this._onDidChangeWindowState=new T;this.onDidChangeWindowState=this._onDidChangeWindowState.event;this._state=rc.InitialState;t.handle&&(this._nativeHandle=fo(t.handle).buffer),this._proxy=e.getProxy(F.MainThreadWindow),this._proxy.$getInitialState().then(({isFocused:n,isActive:o})=>{this.onDidChangeWindowProperty("focused",n),this.onDidChangeWindowProperty("active",o)})}static{this.InitialState={focused:!0,active:!0}}getState(){let t=this._state;return{get focused(){return t.focused},get active(){return t.active}}}get nativeHandle(){return this._nativeHandle}$onDidChangeActiveNativeWindowHandle(t){this._nativeHandle=t?fo(t).buffer:void 0}$onDidChangeWindowFocus(t){this.onDidChangeWindowProperty("focused",t)}$onDidChangeWindowActive(t){this.onDidChangeWindowProperty("active",t)}onDidChangeWindowProperty(t,e){e!==this._state[t]&&(this._state={...this._state,[t]:e},this._onDidChangeWindowState.fire(this._state))}openUri(t,e){let n;if(typeof t=="string"){n=t;try{t=y.parse(t)}catch{return Promise.reject(`Invalid uri - '${t}'`)}}return fs(t.scheme)?Promise.reject("Invalid scheme - cannot be empty"):t.scheme===B.command?Promise.reject(`Invalid scheme '${t.scheme}'`):this._proxy.$openUri(t,n,e)}async asExternalUri(t,e){if(fs(t.scheme))return Promise.reject("Invalid scheme - cannot be empty");let n=await this._proxy.$asExternalUri(t,e);return y.from(n)}};rc=_([S(0,Ye),S(1,le)],rc);var sp=A("IExtHostWindow");var ic=class{constructor(t){this.handles=new $o;this.handlers=new Map;this._proxy=t.getProxy(F.MainThreadUrls)}static{this.HandlePool=0}registerUriHandler(t,e){let n=t.identifier;if(this.handles.has(n))throw new Error(`Protocol handler already registered for extension ${n}`);let o=ic.HandlePool++;return this.handles.add(n),this.handlers.set(o,e),this._proxy.$registerUriHandler(o,n,t.displayName||t.name),q(()=>{this.handles.delete(n),this.handlers.delete(o),this._proxy.$unregisterUriHandler(o)})}$handleExternalUri(t,e){let n=this.handlers.get(t);if(!n)return Promise.resolve(void 0);try{n.handleUri(y.revive(e))}catch(o){Ge(o)}return Promise.resolve(void 0)}async createAppUri(t){return y.revive(await this._proxy.$createAppUri(t))}};ic=_([S(0,le)],ic);var ap=A("IExtHostUrlsService");var lp=A("IExtHostProgress"),ff=class{constructor(t){this._handles=0;this._mapHandleToCancellationSource=new Map;this._proxy=t.getProxy(F.MainThreadProgress)}async withProgress(t,e,n){let o=this._handles++,{title:r,location:s,cancellable:a}=e,l={label:t.displayName||t.name,id:t.identifier.value};return this._proxy.$startProgress(o,{location:KE.from(s),title:r,source:l,cancellable:a},t.isUnderDevelopment?void 0:t.identifier.value).catch(ba),this._withProgress(o,n,!!a)}async withProgressFromSource(t,e,n){let o=this._handles++,{title:r,location:s,cancellable:a}=e;return this._proxy.$startProgress(o,{location:KE.from(s),title:r,source:t,cancellable:a},void 0).catch(ba),this._withProgress(o,n,!!a)}_withProgress(t,e,n){let o;n&&(o=new Ee,this._mapHandleToCancellationSource.set(t,o));let r=a=>{this._proxy.$progressEnd(a),this._mapHandleToCancellationSource.delete(a),o?.dispose()},s;try{s=e(new Lw(this._proxy,t),n&&o?o.token:pe.None)}catch(a){throw r(t),a}return s.then(a=>r(t),a=>r(t)),s}$acceptProgressCanceled(t){let e=this._mapHandleToCancellationSource.get(t);e&&(e.cancel(),this._mapHandleToCancellationSource.delete(t))}};ff=_([S(0,le)],ff);function bJ(i,t){return i.message=t.message,typeof t.increment=="number"&&(typeof i.increment=="number"?i.increment+=t.increment:i.increment=t.increment),i}var Lw=class extends Cs{constructor(e,n){super(o=>this.throttledReport(o));this._proxy=e;this._handle=n}throttledReport(e){this._proxy.$progressReport(this._handle,e)}};_([sW(100,(e,n)=>bJ(e,n),()=>Object.create(null))],Lw.prototype,"throttledReport",1);var uO=["openid","offline_access"];function _5(i,t){return i+"|"+[...t].sort().join(" ")}function IJ(i,t=Date.now()){return i.token.expires_in===void 0?!1:t>i.created_at+i.token.expires_in*1e3-6e4}function Ow(i){return class extends i{constructor(...n){super(...n);this._resourceTokens=new Map;this._resourceClientSecrets=new Map;let o=this.authorizationServer;this.id=`xaa:${o.toString(!0)}`,this._logger.trace(`[XAA] Provider constructed for issuer ${o.toString(!0)}. authorization_endpoint=${this._serverMetadata.authorization_endpoint}, token_endpoint=${this._serverMetadata.token_endpoint}`)}_resourceClientSecretKey(n,o){return`${n}|${o}`}async getSessions(n,o){let r=o.resource,s=o.audience;if(!n&&!r&&!s)return super.getSessions(n,o);if(!r||!n||!s)return[];let a=_5(r,n),l=this._resourceTokens.get(a);if(l&&!IJ(l))return[pO(l.token,l.scopes,l.account)];l&&this._resourceTokens.delete(a);let d=await this._tryGetSilentIdpSession();if(!d?.idToken)return[];try{let c=await this._mintResourceToken(d,[...n],s,r,o,!0);return c?[pO(c.token,c.scopes,c.account)]:[]}catch(c){return this._logger.warn(`[XAA] Silent token mint failed for resource=${r}; falling back to interactive. Error: ${c.message}`),[]}}async createSession(n,o){let r=o.audience,s=o.resource;if(this._logger.trace(`[XAA] createSession scopes=[${n.join(" ")}] audience=${r} resource=${s}`),!r)throw new Error("Enterprise-managed authentication requires `options.audience` (the resource's authorization server URL) but none was provided.");if(!s)throw new Error("Enterprise-managed authentication requires `options.resource` (the resource indicator / MCP server URL) but none was provided.");let a=await this._ensureIdpSession();if(!a.idToken)throw new Error("IdP session is missing an id_token; the issuer must support OpenID Connect and the `openid` scope.");let l=await this._mintResourceToken(a,n,r,s,o,!1);if(!l)throw new Error("Failed to mint a resource access token for the enterprise-managed MCP server.");return pO(l.token,l.scopes,l.account)}async _mintResourceToken(n,o,r,s,a,l){let d=await this._exchangeForIdJag(n.idToken,r,s,o),c=await this._discoverResourceTokenEndpoint(r),u=this._clientId,m=!1,g=typeof a.clientId=="string"&&a.clientId.length>0?a.clientId:void 0;if(g)u=g,m=u!==this._clientId;else try{let w=gf(d);typeof w.client_id=="string"&&w.client_id.length>0&&(u=w.client_id,m=u!==this._clientId)}catch(w){this._logger.warn(`[XAA] Could not decode ID-JAG to read resource client_id; falling back to IdP client_id. Error: ${w.message}`)}let h=this._clientSecret,f=typeof a.clientSecret=="string"&&a.clientSecret.length>0?a.clientSecret:void 0,I=this._resourceClientSecretKey(s,u);if(f)h=f,this._resourceClientSecrets.set(I,f);else if(m)if(this._resourceClientSecrets.has(I))h=this._resourceClientSecrets.get(I);else if(l){this._logger.info(`[XAA] Silent mint requires resource client_secret for '${u}' but none is cached or configured; deferring to interactive flow.`);return}else{this._logger.info(`[XAA] Resource AS requires a distinct client_id '${u}' \u2014 prompting for matching client_secret.`);let w=await this._proxy.$promptForResourceClientSecret(u,s);if(w===void 0)return;this._resourceClientSecrets.set(I,w),h=w.length>0?w:void 0}let x=await this._redeemAtResource(c,d,s,o,u,h),E={resource:s,scopes:o,token:x,account:n.account,created_at:Date.now()};return this._resourceTokens.set(_5(s,o),E),E}async _tryGetSilentIdpSession(){let n={},o=await super.getSessions(uO,n);return o.length?o[0]:void 0}async _ensureIdpSession(){this._logger.trace(`[XAA] _ensureIdpSession: scopes=[${uO.join(" ")}] authorization_endpoint=${this._serverMetadata.authorization_endpoint}`);let n=await this._tryGetSilentIdpSession();return n?.idToken?(this._logger.trace("[XAA] _ensureIdpSession: reusing existing IdP session"),n):(this._logger.trace("[XAA] _ensureIdpSession: creating new IdP session via super.createSession"),super.createSession([...uO],{}))}async _exchangeForIdJag(n,o,r,s){let a=this._serverMetadata.token_endpoint;if(!a)throw new Error("Issuer metadata is missing token_endpoint; cannot perform XAA token exchange.");let l=C5(this._clientId,this._clientSecret,n,o,r,s);this._logger.trace(`[XAA] POST ${a} (ID-JAG exchange) audience=${o} resource=${r} scope=${s.join(" ")}`);let d=await fetch(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:l.toString()});if(!d.ok)throw new Error(`XAA token exchange (IdP) failed: ${d.status} ${await R5(d)}`);let c=await d.json(),u=c&&typeof c=="object"&&typeof c.access_token=="string"?c.access_token:void 0;if(!u)throw new Error(`XAA token exchange (IdP) returned no access_token. Response: ${JSON.stringify(c)}`);return u}async _discoverResourceTokenEndpoint(n){let{metadata:o,errors:r}=await Mw(n);if(!o?.token_endpoint)throw new Error(`Failed to discover resource authorization server metadata for '${n}': ${r.map(s=>s.message).join("; ")||"no token_endpoint in metadata"}`);return o.token_endpoint}async _redeemAtResource(n,o,r,s,a,l){let d=T5(a,l,o,r,s);this._logger.trace(`[XAA] POST ${n} (ID-JAG redemption) client_id=${a} resource=${r} scope=${s.join(" ")}`);let c=await fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:d.toString()});if(!c.ok)throw new Error(`XAA token exchange (resource) failed: ${c.status} ${await R5(c)}`);let u=await c.json();if(!ip(u))throw new Error(`XAA token exchange (resource) returned an invalid token response: ${JSON.stringify(u)}`);return u}}}function pO(i,t,e){let n;if(i.id_token)try{let o=gf(i.id_token);n={id:o.sub||"unknown",label:o.preferred_username||o.name||o.email||"XAA"}}catch{}return n??=e??{id:"unknown",label:"XAA"},{id:tm(i.access_token,0).toString(),accessToken:i.access_token,account:n,scopes:[...t],idToken:i.id_token}}async function R5(i){try{return await i.text()}catch{return i.statusText}}var yf=A("IExtHostAuthentication");function hf(i){return{...i,icon:y.revive(i.icon)}}var vf=class{constructor(t,e,n,o,r,s,a){this._initData=e;this._extHostWindow=n;this._extHostUrls=o;this._extHostProgress=r;this._extHostLoggerService=s;this._logService=a;this._dynamicAuthProviderCtor=sc;this._xaaAuthProviderCtor=Ow(sc);this._authenticationProviders=new Map;this._providerOperations=new Ql;this._onDidChangeSessions=new T;this._getSessionTaskSingler=new mO;this._onDidDynamicAuthProviderTokensChange=new T;this._proxy=t.getProxy(F.MainThreadAuthentication)}getExtensionScopedSessionsEvent(t){let e=t.toLowerCase();return ye.chain(this._onDidChangeSessions.event,n=>n.filter(o=>!o.extensionIdFilter||o.extensionIdFilter.includes(e)).map(o=>({provider:o.provider})))}async getSession(t,e,n,o={}){let r=xe.toKey(t.identifier),a=Object.keys(o).map(d=>{switch(d){case"account":return`${d}:${o.account?.id}`;case"createIfNone":case"forceNewSession":{let c=typeof o[d]=="boolean"?`${o[d]}`:`'${o[d]?.detail}/${o[d]?.learnMore?.toString()}'`;return`${d}:${c}`}case"authorizationServer":return`${d}:${o.authorizationServer?.toString(!0)}`;default:return`${d}:${!!o[d]}`}}).sort().join(", "),l;if(FB(n)){let d=n,c=d.wwwAuthenticate,u=d.fallbackScopes?[...d.fallbackScopes].sort().join(" "):"";l=`${r} ${e} challenge:${c} ${u} ${a}`}else{let d=[...n].sort().join(" ");l=`${r} ${e} ${d} ${a}`}return await this._getSessionTaskSingler.getOrCreate(l,async()=>{await this._proxy.$ensureProvider(e);let d=t.displayName||t.name,c=await this._proxy.$getSession(e,n,r,d,o);return c&&{...c,account:hf(c.account)}})}async getAccounts(t){return await this._proxy.$ensureProvider(t),(await this._proxy.$getAccounts(t)).map(n=>hf(n))}registerAuthenticationProvider(t,e,n,o){return this._providerOperations.queue(t,async()=>{if(this._authenticationProviders.get(t)){this._logService.error(`An authentication provider with id '${t}' is already registered. The existing provider will not be replaced.`);return}let r=n.onDidChangeSessions(s=>this._proxy.$sendDidChangeSessions(t,s));this._authenticationProviders.set(t,{label:e,provider:n,disposable:r,options:o??{supportsMultipleAccounts:!1}}),await this._proxy.$registerAuthenticationProvider({id:t,label:e,supportsMultipleAccounts:o?.supportsMultipleAccounts??!1,supportedAuthorizationServers:o?.supportedAuthorizationServers,supportsChallenges:o?.supportsChallenges})}),new Se(()=>{this._providerOperations.queue(t,async()=>{let r=this._authenticationProviders.get(t);r&&(r.disposable?.dispose(),this._authenticationProviders.delete(t),await this._proxy.$unregisterAuthenticationProvider(t))})})}$createSession(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o)return n.authorizationServer=y.revive(n.authorizationServer),n.account&&(n.account=hf(n.account)),await o.provider.createSession(e,n);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$removeSession(t,e){return this._providerOperations.queue(t,async()=>{let n=this._authenticationProviders.get(t);if(n)return await n.provider.removeSession(e);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$getSessions(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o)return n.authorizationServer=y.revive(n.authorizationServer),n.account&&(n.account=hf(n.account)),await o.provider.getSessions(e,n);throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$getSessionsFromChallenges(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o){let r=o.provider;if(typeof r.getSessionsFromChallenges=="function")return n.authorizationServer=y.revive(n.authorizationServer),n.account&&(n.account=hf(n.account)),await r.getSessionsFromChallenges(e,n);throw new Error(`Authentication provider with handle: ${t} does not support getSessionsFromChallenges`)}throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$createSessionFromChallenges(t,e,n){return this._providerOperations.queue(t,async()=>{let o=this._authenticationProviders.get(t);if(o){let r=o.provider;if(typeof r.createSessionFromChallenges=="function")return n.authorizationServer=y.revive(n.authorizationServer),n.account&&(n.account=hf(n.account)),await r.createSessionFromChallenges(e,n);throw new Error(`Authentication provider with handle: ${t} does not support createSessionFromChallenges`)}throw new Error(`Unable to find authentication provider with handle: ${t}`)})}$onDidChangeAuthenticationSessions(t,e,n){return t.startsWith(uC)||this._onDidChangeSessions.fire({provider:{id:t,label:e},extensionIdFilter:n}),Promise.resolve()}$onDidUnregisterAuthenticationProvider(t){return this._providerOperations.queue(t,async()=>{let e=this._authenticationProviders.get(t);e&&(e.disposable?.dispose(),this._authenticationProviders.delete(t))})}async $registerDynamicAuthProvider(t,e,n,o,r,s){if(!o){let l=y.revive(t);if(e.registration_endpoint)try{let d=await dO(e,this._initData.environment.appName,n?.scopes_supported);o=d.client_id,r=d.client_secret}catch(d){this._logService.warn(`Dynamic registration failed for ${l.toString()}: ${d.message}. Prompting user for client ID and client secret...`)}if(!o){this._logService.info(`Prompting user for client registration details for ${l.toString()}`);let d=await this._proxy.$promptForClientRegistration(l.toString());if(!d)throw new Error("User did not provide client details");o=d.clientId,r=d.clientSecret,this._logService.info(`User provided client registration for ${l.toString()}`),r?this._logService.trace(`User provided client secret for ${l.toString()}`):this._logService.trace(`User did not provide client secret for ${l.toString()}`)}}let a=new this._dynamicAuthProviderCtor(this._extHostWindow,this._extHostUrls,this._initData,this._extHostProgress,this._extHostLoggerService,this._proxy,y.revive(t),e,n,o,r,this._onDidDynamicAuthProviderTokensChange,s||[]);return await this._providerOperations.queue(a.id,async()=>{this._authenticationProviders.set(a.id,{label:a.label,provider:a,disposable:Se.from(a,a.onDidChangeSessions(l=>this._proxy.$sendDidChangeSessions(a.id,l)),a.onDidChangeClientId(()=>this._proxy.$sendDidChangeDynamicProviderInfo({providerId:a.id,clientId:a.clientId,clientSecret:a.clientSecret}))),options:{supportsMultipleAccounts:!0}}),await this._proxy.$registerDynamicAuthenticationProvider({id:a.id,label:a.label,supportsMultipleAccounts:!0,authorizationServer:t,resourceServer:n?y.parse(n.resource):void 0,clientId:a.clientId,clientSecret:a.clientSecret})}),a.id}async $registerXaaAuthProvider(t,e,n,o,r){let s=y.revive(t);if(!n){this._logService.info(`Prompting user for client registration details for XAA issuer ${s.toString()}`);let l=await this._proxy.$promptForClientRegistration(s.toString());if(!l)throw new Error("User did not provide client details");n=l.clientId,o=l.clientSecret}let a=new this._xaaAuthProviderCtor(this._extHostWindow,this._extHostUrls,this._initData,this._extHostProgress,this._extHostLoggerService,this._proxy,s,e,void 0,n,o,this._onDidDynamicAuthProviderTokensChange,r||[]);return await this._providerOperations.queue(a.id,async()=>{this._authenticationProviders.set(a.id,{label:a.label,provider:a,disposable:Se.from(a,a.onDidChangeSessions(l=>this._proxy.$sendDidChangeSessions(a.id,l)),a.onDidChangeClientId(()=>this._proxy.$sendDidChangeDynamicProviderInfo({providerId:a.id,clientId:a.clientId,clientSecret:a.clientSecret}))),options:{supportsMultipleAccounts:!0}}),await this._proxy.$registerDynamicAuthenticationProvider({id:a.id,label:a.label,supportsMultipleAccounts:!0,authorizationServer:t,resourceServer:void 0,clientId:a.clientId,clientSecret:a.clientSecret})}),a.id}async $onDidChangeDynamicAuthProviderTokens(t,e,n){this._onDidDynamicAuthProviderTokensChange.fire({authProviderId:t,clientId:e,tokens:n})}};vf=_([S(0,le),S(1,Ye),S(2,sp),S(3,ap),S(4,lp),S(5,ir),S(6,te)],vf);var mO=class{constructor(){this._inFlightPromises=new Map}getOrCreate(t,e){let n=this._inFlightPromises.get(t);if(n)return n;let o=e().finally(()=>this._inFlightPromises.delete(t));return this._inFlightPromises.set(t,o),o}},sc=class{constructor(t,e,n,o,r,s,a,l,d,c,u,m,g,h=fetch){this._extHostWindow=t;this._extHostUrls=e;this._initData=n;this._extHostProgress=o;this._proxy=s;this.authorizationServer=a;this._serverMetadata=l;this._resourceMetadata=d;this._clientId=c;this._clientSecret=u;this._fetch=h;this._onDidChangeSessions=new T;this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeClientId=new T;this.onDidChangeClientId=this._onDidChangeClientId.event;let f=a.toString(!0);this.id=d?.resource?f+" "+d?.resource:f,this.label=d?.resource_name??this.authorizationServer.authority,this._logger=r.createLogger(this.id,{name:`Auth: ${this.label}`}),this._disposable=new $,this._disposable.add(this._onDidChangeSessions),this._disposable.add(this._onDidChangeClientId);let I=ye.chain(m.event,x=>x.filter(E=>E.authProviderId===this.id&&E.clientId===c).map(E=>E.tokens));this._tokenStore=this._disposable.add(new gO({onDidChange:I,set:x=>s.$setSessionsForDynamicAuthProvider(this.id,this.clientId,x)},g,this._logger)),this._disposable.add(this._tokenStore.onDidChangeSessions(x=>this._onDidChangeSessions.fire(x))),this._createFlows=[],l.authorization_endpoint&&this._createFlows.push({label:p(5875,null),handler:(x,E,w)=>this._createWithUrlHandler(x,E,w)})}get clientId(){return this._clientId}get clientSecret(){return this._clientSecret}async getSessions(t,e){if(this._logger.info(`Getting sessions for scopes: ${t?.join(" ")??"all"}`),!t)return this._tokenStore.sessions;let n=[...t].sort(),o=t.join(" "),r=this._tokenStore.sessions.filter(s=>dn([...s.scopes].sort(),n));if(this._logger.info(`Found ${r.length} sessions for scopes: ${o}`),r.length){let s=[],a=[],l=new Map(this._tokenStore.tokens.map(d=>[d.access_token,d]));for(let d of r){let c=l.get(d.accessToken);if(c&&c.expires_in){let u=Date.now(),m=c.expires_in*1e3;if(u>c.created_at+m-300*1e3){if(this._logger.info(`Token for session ${d.id} is about to expire, refreshing...`),a.push(c),!c.refresh_token){this._logger.warn(`No refresh token available for scopes ${d.scopes.join(" ")}. Throwing away token.`);continue}try{let g=await this.exchangeRefreshTokenForToken(c.refresh_token,e.silent!==!0);g.scope!==o&&(this._logger.warn(`Token scopes '${g.scope}' do not match requested scopes '${o}'. Overwriting token with what was requested...`),g.scope=o),this._logger.info(`Successfully created a new token for scopes ${d.scopes.join(" ")}.`),s.push(g)}catch(g){this._logger.error(`Failed to refresh token: ${g}`)}}}}return(s.length||a.length)&&(this._tokenStore.update({added:s,removed:a}),r=this._tokenStore.sessions.filter(d=>dn([...d.scopes].sort(),n))),this._logger.info(`Found ${r.length} sessions for scopes: ${o}`),r}return[]}async createSession(t,e){this._logger.info(`Creating session for scopes: ${t.join(" ")}`);let n;for(let r=0;r<this._createFlows.length;r++){let{handler:s}=this._createFlows[r];try{if(n=await this._extHostProgress.withProgressFromSource({label:this.label,id:this.id},{location:15,title:p(5872,null,this.label),cancellable:!0},(a,l)=>s(t,a,l)),n)break}catch(a){let l=this._createFlows[r+1]?.label;if(!l)break;let d=Yt(a)?p(5876,null,this.label,l):p(5874,null,this.label,l);if(!await this._proxy.$showContinueNotification(d))throw new Oe;this._logger.error(`Failed to create token via flow '${l}': ${a}`)}}if(!n)throw new Error("Failed to create authentication token");n.scope!==t.join(" ")&&(this._logger.warn(`Token scopes '${n.scope}' do not match requested scopes '${t.join(" ")}'. Overwriting token with what was requested...`),n.scope=t.join(" ")),this._tokenStore.update({added:[{...n,created_at:Date.now()}],removed:[]});let o=this._tokenStore.sessions.find(r=>r.accessToken===n.access_token);return this._logger.info(`Created ${n.refresh_token?"refreshable":"non-refreshable"} session for scopes: ${n.scope}${n.expires_in?` that expires in ${n.expires_in} seconds`:""}`),o}async removeSession(t){this._logger.info(`Removing session with id: ${t}`);let e=this._tokenStore.sessions.find(o=>o.id===t);if(!e){this._logger.error(`Session with id ${t} not found`);return}let n=this._tokenStore.tokens.find(o=>o.access_token===e.accessToken);if(!n){this._logger.error(`Failed to retrieve token for removed session: ${e.id}`);return}this._tokenStore.update({added:[],removed:[n]}),this._logger.info(`Removed token for session: ${e.id} with scopes: ${e.scopes.join(" ")}`)}dispose(){this._disposable.dispose()}async _createWithUrlHandler(t,e,n){if(!this._serverMetadata.authorization_endpoint)throw new Error("Authorization Endpoint required");if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=this.generateRandomString(64),r=await this.generateCodeChallenge(o),s=this.generateRandomString(32),a=y.parse(`${this._initData.environment.appUriScheme}://dynamicauthprovider/${this.authorizationServer.authority}/authorize?nonce=${s}`),l;try{l=await this._extHostUrls.createAppUri(a)}catch(I){throw new Error(`Failed to create external URI: ${I}`)}let d=new URL(this._serverMetadata.authorization_endpoint);d.searchParams.append("client_id",this._clientId),d.searchParams.append("response_type","code"),d.searchParams.append("state",l.toString()),d.searchParams.append("code_challenge",r),d.searchParams.append("code_challenge_method","S256");let c=t.join(" ");c&&d.searchParams.append("scope",c),this._resourceMetadata?.resource&&d.searchParams.append("resource",this._resourceMetadata.resource);let u="https://vscode.dev/redirect";d.searchParams.append("redirect_uri",u);let m=this.waitForAuthorizationCode(a);if(this._logger.info(`Opening authorization URL for scopes: ${c}`),this._logger.trace(`Authorization URL: ${d.toString()}`),!await this._extHostWindow.openUri(d.toString(),{}))throw new Oe;e.report({message:p(5873,null)});let h;try{h=(await ri(m,n)).code}catch(I){throw Yt(I)?(this._logger.info("Authorization code request was cancelled by the user."),I):(this._logger.error(`Failed to receive authorization code: ${I}`),new Error(`Failed to receive authorization code: ${I}`))}return this._logger.info(`Authorization code received for scopes: ${c}`),await this.exchangeCodeForToken(h,o,u)}generateRandomString(t){let e=new Uint8Array(t);return crypto.getRandomValues(e),Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("").substring(0,t)}async generateCodeChallenge(t){let n=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",n);return eo(H.wrap(new Uint8Array(o)),!1,!1).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async waitForAuthorizationCode(t){let e=await this._proxy.$waitForUriHandler(t),n=/[?&]code=([^&]+)/.exec(e.query||"");if(!n||n.length<2)throw new Error("Authentication failed: No authorization code received");return{code:n[1]}}async exchangeCodeForToken(t,e,n){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=new URLSearchParams;o.append("client_id",this._clientId),o.append("grant_type","authorization_code"),o.append("code",t),o.append("redirect_uri",n),o.append("code_verifier",e),this._resourceMetadata?.resource&&o.append("resource",this._resourceMetadata.resource),this._clientSecret&&o.append("client_secret",this._clientSecret),this._logger.info("Exchanging authorization code for token..."),this._logger.trace(`Url: ${this._serverMetadata.token_endpoint}`),this._logger.trace(`Token request body: ${o.toString()}`);let r;try{r=await this._fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:o.toString()})}catch(a){throw this._logger.error(`Failed to exchange authorization code for token: ${a}`),new Error(`Failed to exchange authorization code for token: ${a}`)}if(!r.ok){let a=await r.text();throw new Error(`Token exchange failed: ${r.status} ${r.statusText} - ${a}`)}let s=await r.json();if(ip(s))return this._logger.info("Successfully exchanged authorization code for token."),s;throw aO(s)&&s.error==="invalid_client"?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):new Error(`Invalid authorization token response: ${JSON.stringify(s)}`)}async exchangeRefreshTokenForToken(t,e){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let n=new URLSearchParams;n.append("client_id",this._clientId),n.append("grant_type","refresh_token"),n.append("refresh_token",t),this._resourceMetadata?.resource&&n.append("resource",this._resourceMetadata.resource),this._clientSecret&&n.append("client_secret",this._clientSecret);let r=await(await this._fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:n.toString()})).json();if(ip(r))return{...r,created_at:Date.now()};throw aO(r)&&r.error==="invalid_client"?e?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):(this._logger.warn(`Client ID (${this._clientId}) was invalid while silently refreshing the token.`),new Error("Client ID was invalid while silently refreshing the token.")):new Error(`Invalid authorization token response: ${JSON.stringify(r)}`)}async _generateNewClientId(){try{let t=await dO(this._serverMetadata,this._initData.environment.appName,this._resourceMetadata?.scopes_supported);this._clientId=t.client_id,this._clientSecret=t.client_secret,this._onDidChangeClientId.fire()}catch(t){this._logger.info(`Dynamic registration failed for ${this.authorizationServer.toString()}: ${t}. Prompting user for client ID and client secret.`);try{let e=await this._proxy.$promptForClientRegistration(this.authorizationServer.toString());if(!e)throw new Error("User did not provide client details");this._clientId=e.clientId,this._clientSecret=e.clientSecret,this._logger.info(`User provided client ID for ${this.authorizationServer.toString()}`),e.clientSecret?this._logger.info(`User provided client secret for ${this.authorizationServer.toString()}`):this._logger.info(`User did not provide client secret for ${this.authorizationServer.toString()} (optional)`),this._onDidChangeClientId.fire()}catch{throw this._logger.error(`Failed to fetch new client ID and user did not provide one: ${t}`),new Error(`Failed to fetch new client ID and user did not provide one: ${t}`)}}}};sc=_([S(0,sp),S(1,ap),S(2,Ye),S(3,lp),S(4,ir)],sc);var gO=class{constructor(t,e,n){this._persistence=t;this._logger=n;this._onDidChangeSessions=new T;this.onDidChangeSessions=this._onDidChangeSessions.event;this._disposable=new $,this._tokensObservable=An("tokens",e),this._sessionsObservable=my({equalsFn:(o,r)=>dn(o,r,(s,a)=>s.accessToken===a.accessToken)},o=>this._tokensObservable.read(o).map(r=>this._getSessionFromToken(r))),this._disposable.add(this._registerChangeEventAutorun()),this._disposable.add(this._persistence.onDidChange(o=>this._tokensObservable.set(o,void 0)))}get tokens(){return this._tokensObservable.get()}get sessions(){return this._sessionsObservable.get()}dispose(){this._disposable.dispose()}update({added:t,removed:e}){this._logger.trace(`Updating tokens: added ${t.length}, removed ${e.length}`);let n=[...this._tokensObservable.get()];for(let o of e){let r=n.findIndex(s=>s.access_token===o.access_token);r!==-1&&n.splice(r,1)}for(let o of t){let r=n.findIndex(s=>s.access_token===o.access_token);r===-1?n.push(o):n[r]=o}(t.length||e.length)&&(this._tokensObservable.set(n,void 0),this._persistence.set(n)),this._logger.trace(`Tokens updated: ${n.length} tokens stored.`)}_registerChangeEventAutorun(){let t=[];return Eo(e=>{this._logger.trace("Checking for session changes...");let n=this._sessionsObservable.read(e);if(t===n){this._logger.trace("No session changes detected.");return}if(!n||n.length===0){this._logger.trace("All sessions removed."),t.length>0&&(this._onDidChangeSessions.fire({added:[],removed:t,changed:[]}),t=[]);return}let o=[],r=[];for(let s of n)t.some(l=>l.accessToken===s.accessToken)||o.push(s);for(let s of t)n.some(l=>l.accessToken===s.accessToken)||r.push(s);(o.length>0||r.length>0)&&(this._logger.trace(`Sessions changed: added ${o.length}, removed ${r.length}`),this._onDidChangeSessions.fire({added:o,removed:r,changed:[]})),t=n})}_getSessionFromToken(t){let e;if(t.id_token)try{e=gf(t.id_token)}catch{}if(!e)try{e=gf(t.access_token)}catch{}let n=t.scope!==void 0?t.scope?t.scope.split(" "):[]:e?.scope?e.scope.split(" "):[];return{id:tm(t.access_token,0).toString(),accessToken:t.access_token,account:{id:e?.sub||"unknown",label:e?.preferred_username||e?.name||e?.email||"MCP"},scopes:n,idToken:t.id_token}}};var bf=A("IExtHostLanguageModels"),fO=class{constructor(){this._defaultStream=new Ox;this._isDone=!1;let t=this,[e,n]=qp.tee(t._defaultStream.asyncIterable);this.apiObject={get stream(){return e},get text(){return n.map(o=>{if(o instanceof sn)return o.value}).coalesce()}}}handleResponsePart(t){if(this._isDone)return;let e=[];for(let n of Mt.wrap(t)){let o;n.type==="text"?o=new sn(n.value,n.audience):n.type==="thinking"?o=new Yi(n.value,n.id,n.metadata):n.type==="data"?o=new Wn(n.data.buffer,n.mimeType,n.audience):o=new vi(n.toolCallId,n.name,n.parameters),e.push(o)}this._defaultStream.emitMany(e)}reject(t){this._isDone=!0,this._defaultStream.reject(t)}resolve(){this._isDone=!0,this._defaultStream.resolve()}},ac=class{constructor(t,e,n){this._logService=e;this._extHostAuthentication=n;this._onDidChangeModelAccess=new T;this._onDidChangeProviders=new T;this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeModelProxyAvailability=new T;this.onDidChangeModelProxyAvailability=this._onDidChangeModelProxyAvailability.event;this._languageModelProviders=new Map;this._localModels=new Map;this._modelAccessList=new vo;this._pendingRequest=new Map;this._pendingCancelCTS=new bn;this._ignoredFileProviders=new Map;this._languageAccessInformationExtensions=new Set;this._proxy=t.getProxy(F.MainThreadLanguageModels)}static{this._idPool=1}dispose(){this._onDidChangeModelAccess.dispose(),this._onDidChangeProviders.dispose(),this._onDidChangeModelProxyAvailability.dispose(),this._pendingRequest.clear(),this._pendingCancelCTS.dispose()}registerLanguageModelChatProvider(t,e,n){this._languageModelProviders.set(e,{extension:t,provider:n}),this._proxy.$registerLanguageModelProvider(e);let o;return n.onDidChangeLanguageModelChatInformation&&(o=n.onDidChangeLanguageModelChatInformation(()=>{this._proxy.$onLMProviderChange(e)})),q(()=>{this._languageModelProviders.delete(e),this._localModels.forEach((r,s)=>{r.metadata.vendor===e&&this._localModels.delete(s)}),o?.dispose(),this._proxy.$unregisterProvider(e)})}toModelIdentifier(t,e,n){return e?`${t}/${e}/${n}`:`${t}/${n}`}getVendorFromModelIdentifier(t){let e=t.indexOf("/");return e===-1?void 0:t.substring(0,e)}async $provideLanguageModelChatInfo(t,e,n){let o=this._languageModelProviders.get(t);if(!o)return[];let r=await o.provider.provideLanguageModelChatInformation({silent:e.silent,configuration:e.configuration},n)??[],s=r.map(a=>{let l;a.requiresAuthorization&&Le(o.extension,"chatProvider")&&(l={providerLabel:o.extension.displayName||o.extension.name,accountLabel:typeof a.requiresAuthorization=="object"?a.requiresAuthorization.label:void 0}),a.capabilities.editTools&&M(o.extension,"chatProvider");let d={};if(Le(o.extension,"chatProvider")){if(a.isDefault===!0)for(let c of Object.values(Wi))typeof c=="string"&&(d[c]=!0);else if(typeof a.isDefault=="object")for(let c of Object.keys(a.isDefault)){let u=parseInt(c);d[Vg.from(u)]=a.isDefault[u]}}return{metadata:{extension:o.extension.identifier,id:a.id,vendor:t,name:a.name??"",family:a.family??"",detail:a.detail,tooltip:a.tooltip,version:a.version,multiplierNumeric:a.multiplierNumeric,isBYOK:a.isBYOK,pricing:a.pricing,inputCost:a.inputCost,outputCost:a.outputCost,cacheCost:a.cacheCost,cacheWriteCost:a.cacheWriteCost,longContextInputCost:a.longContextInputCost,longContextOutputCost:a.longContextOutputCost,longContextCacheCost:a.longContextCacheCost,longContextCacheWriteCost:a.longContextCacheWriteCost,priceCategory:a.priceCategory,category:a.category,maxInputTokens:a.maxInputTokens,maxOutputTokens:a.maxOutputTokens,auth:l,isDefaultForLocation:d,isUserSelectable:a.isUserSelectable,statusIcon:a.statusIcon,targetChatSessionType:a.targetChatSessionType,configurationSchema:a.configurationSchema,warningText:a.warningText,infoText:a.infoText,promo:a.promo,capabilities:a.capabilities?{vision:a.capabilities.imageInput,editTools:a.capabilities.editTools,toolCalling:!!a.capabilities.toolCalling,agentMode:!!a.capabilities.toolCalling}:void 0},identifier:this.toModelIdentifier(t,e.group,a.id)}});this._localModels.forEach((a,l)=>{a.metadata.vendor===t&&a.group===e.group&&this._localModels.delete(l)});for(let a=0;a<s.length;a++)this._localModels.set(s[a].identifier,{group:e.group,metadata:s[a].metadata,info:r[a]});return s}async $startChatRequest(t,e,n,o,r,s){let a=this._localModels.get(t);if(!a)throw new Error("Model not found");let l=this._languageModelProviders.get(a.metadata.vendor);if(!l)throw new Error(`Language model provider for '${a.metadata.id}' not found.`);let d=new Ee(s);this._pendingCancelCTS.set(e,d);let c=d.token,u=[],m=()=>{u.length>0&&(this._proxy.$reportResponsePart(e,new Zt(u)),u.length=0)},g=new Pn(m,30),h=x=>{u.push(x)>30?(m(),g.cancel()):g.schedule()},f=new Cs(async x=>{if(c.isCancellationRequested){this._logService.warn(`[CHAT](${l.extension.identifier.value}) CANNOT send progress because the REQUEST IS CANCELLED`);return}let E;if(x instanceof vi?E={type:"tool_use",name:x.name,parameters:x.input,toolCallId:x.callId}:x instanceof sn?E={type:"text",value:x.value,audience:x.audience}:x instanceof Wn?E={type:"data",mimeType:x.mimeType,data:H.wrap(x.data),audience:x.audience}:x instanceof Yi&&(E={type:"thinking",value:x.value,id:x.id,metadata:x.metadata}),!E){this._logService.warn(`[CHAT](${l.extension.identifier.value}) UNKNOWN part ${JSON.stringify(x)}`);return}h(E)}),I;try{I=l.provider.provideLanguageModelChatResponse(a.info,o.value.map(QE.to),{...r,modelOptions:r.modelOptions??{},modelConfiguration:r.configuration,requestInitiator:n?xe.toKey(n):"core",toolMode:r.toolMode??1,includeEncryptedThinking:r.includeEncryptedThinking},f,c)}catch(x){throw this._pendingCancelCTS.deleteAndDispose(e),x}Promise.resolve(I).then(()=>{m(),this._pendingCancelCTS.deleteAndDispose(e),this._proxy.$reportResponseDone(e,void 0)},x=>{m(),this._pendingCancelCTS.deleteAndDispose(e),this._proxy.$reportResponseDone(e,ls(x))})}$cancelLanguageModelChatRequest(t){this._pendingCancelCTS.get(t)?.cancel()}$provideTokenLength(t,e,n){let o=this._localModels.get(t);if(!o)return Promise.resolve(0);let r=this._languageModelProviders.get(o.metadata.vendor);return r?Promise.resolve(r.provider.provideTokenCount(o.info,e,n)):Promise.resolve(0)}async getDefaultLanguageModel(t,e){let n;e&&await this.selectLanguageModels(t,{});for(let[o,r]of this._localModels)if(r.metadata.isDefaultForLocation.panel&&r.metadata.vendor===Ps){n=o;break}return!n&&!e?this.getDefaultLanguageModel(t,!0):this.getLanguageModelByIdentifier(t,n)}async getLanguageModelByIdentifier(t,e){if(e){if(!this._localModels.has(e)){let n=this.getVendorFromModelIdentifier(e);if(!n){this._logService.warn(`[LanguageModelProxy](${t.identifier.value}) Could not extract vendor from model identifier '${e}'.`);return}if(this._logService.trace(`[LanguageModelProxy](${t.identifier.value}) Could not find model '${e}' in local cache. Trying to resolve model again.`),await this._proxy.$selectChatModels({vendor:n,extension:t.identifier}),!this._localModels.has(e)){this._logService.warn(`[LanguageModelProxy](${t.identifier.value}) Could not find model '${e}' in local cache after re-resolving models.`);return}}return this._createLanguageModelChatApi(t,e)}}async _createLanguageModelChatApi(t,e){let n=this._localModels.get(e);if(!n)return;this._isUsingAuth(t.identifier,n.metadata)&&await this._fakeAuthPopulate(n.metadata);let o=this,r={id:n.info.id,vendor:n.metadata.vendor,family:n.info.family,version:n.info.version,name:n.info.name,pricing:n.metadata.pricing,inputCost:n.metadata.inputCost,outputCost:n.metadata.outputCost,cacheCost:n.metadata.cacheCost,cacheWriteCost:n.metadata.cacheWriteCost,longContextInputCost:n.metadata.longContextInputCost,longContextOutputCost:n.metadata.longContextOutputCost,longContextCacheCost:n.metadata.longContextCacheCost,longContextCacheWriteCost:n.metadata.longContextCacheWriteCost,priceCategory:n.metadata.priceCategory,category:n.metadata.category,capabilities:{supportsImageToText:n.metadata.capabilities?.vision??!1,supportsToolCalling:!!n.metadata.capabilities?.toolCalling,editToolsHint:n.metadata.capabilities?.editTools},maxInputTokens:n.metadata.maxInputTokens,countTokens(s,a){if(!o._localModels.has(e))throw Ar.NotFound(e);return o._computeTokenLength(e,s,a??pe.None)},sendRequest(s,a,l){if(!o._localModels.has(e))throw Ar.NotFound(e);return o._sendChatRequest(t,e,s,a??{},l??pe.None)}};return Object.freeze(r),r}async selectLanguageModels(t,e){let n=await this._proxy.$selectChatModels({...e,extension:t.identifier});return(await Promise.all(n.map(r=>this._createLanguageModelChatApi(t,r)))).filter(r=>!!r)}async _sendChatRequest(t,e,n,o,r){let s=this._convertMessages(t,n),a=t.identifier,l=this._localModels.get(e)?.metadata;if(!l||!this._localModels.has(e))throw Ar.NotFound(`Language model '${e}' is unknown.`);if(this._isUsingAuth(a,l)&&(!await this._getAuthAccess(t,{identifier:l.extension,displayName:l.auth.providerLabel},o.justification,!1)||!this._modelAccessList.get(a)?.has(l.extension)))throw Ar.NoPermissions(`Language model '${e}' cannot be used by '${a.value}'.`);let d=Math.random()*1e6|0,c=new fO;this._pendingRequest.set(d,{languageModelId:e,res:c});let u=new Ee(r);this._pendingCancelCTS.set(d,u),u.token.onCancellationRequested(()=>{this._proxy.$cancelLanguageModelChatRequest(d)});try{await this._proxy.$tryStartChatRequest(a,e,d,new Zt(s),o,u.token)}catch(m){throw this._pendingRequest.delete(d),this._pendingCancelCTS.deleteAndDispose(d),Ar.tryDeserialize(m)??m}return c.apiObject}_convertMessages(t,e){let n=[];for(let o of e)o.role===3&&M(t,"languageModelSystem"),n.push(QE.from(o));return n}async $acceptResponsePart(t,e){let n=this._pendingRequest.get(t);n&&n.res.handleResponsePart(e.value)}$onChatModelsChange(){this._onDidChangeProviders.fire()}async $acceptResponseDone(t,e){let n=this._pendingRequest.get(t);n&&(this._pendingRequest.delete(t),this._pendingCancelCTS.deleteAndDispose(t),e?n.res.reject(Ar.tryDeserialize(e)??uR(e)):n.res.resolve())}async _getAuthAccess(t,e,n,o){let r=uC+e.identifier.value;if(await this._extHostAuthentication.getSession(t,r,[],{silent:!0}))return this.$updateModelAccesslist([{from:t.identifier,to:e.identifier,enabled:!0}]),!0;if(o)return!1;try{let a=n?p(5882,null,e.displayName,n):void 0;return await this._extHostAuthentication.getSession(t,r,[],{forceNewSession:{detail:a}}),this.$updateModelAccesslist([{from:t.identifier,to:e.identifier,enabled:!0}]),!0}catch{return!1}}_isUsingAuth(t,e){return!!e.auth&&!xe.equals(e.extension,t)}async _fakeAuthPopulate(t){if(t.auth)for(let e of this._languageAccessInformationExtensions)try{await this._getAuthAccess(e,{identifier:t.extension,displayName:""},void 0,!0)}catch(n){this._logService.error("Fake Auth request failed"),this._logService.error(n)}}async _computeTokenLength(t,e,n){let o=this._localModels.get(t);if(!o)throw Ar.NotFound(`Language model '${t}' is unknown.`);return this._languageModelProviders.get(o.metadata.vendor)?.provider.provideTokenCount(o.info,e,n)??0}$updateModelAccesslist(t){let e=new Array;for(let{from:n,to:o,enabled:r}of t){let s=this._modelAccessList.get(n)??new $o;if(s.has(o)!==r){r?s.add(o):s.delete(o),this._modelAccessList.set(n,s);let l={from:n,to:o};e.push(l),this._onDidChangeModelAccess.fire(l)}}}createLanguageModelAccessInformation(t){this._languageAccessInformationExtensions.add(t);let e=ye.signal(ye.filter(this._onDidChangeModelAccess.event,o=>xe.equals(o.from,t.identifier))),n=ye.signal(this._onDidChangeProviders.event);return{get onDidChange(){return ye.any(e,n)},canSendRequest(o){return!0}}}fileIsIgnored(t,e,n=pe.None){return M(t,"chatParticipantAdditions"),this._proxy.$fileIsIgnored(e,n)}get isModelProxyAvailable(){return!!this._languageModelProxyProvider}async getModelProxy(t){if(M(t,"languageModelProxy"),!this._languageModelProxyProvider)throw this._logService.trace("[LanguageModelProxy] No LanguageModelProxyProvider registered"),new Error("No language model proxy provider is registered.");let e=xe.toKey(t.identifier);try{let n=await Promise.resolve(this._languageModelProxyProvider.provideModelProxy(e,pe.None));if(!n)throw this._logService.warn(`[LanguageModelProxy] Provider returned no proxy for ${e}`),new Error("Language model proxy is not available.");return n}catch(n){throw this._logService.error(`[LanguageModelProxy] Provider failed to return proxy for ${e}`,n),n}}async $isFileIgnored(t,e,n){let o=this._ignoredFileProviders.get(t);if(!o)throw new Error("Unknown LanguageModelIgnoredFileProvider");return await o.provideFileIgnored(y.revive(e),n)??!1}registerIgnoredFileProvider(t,e){M(t,"chatParticipantPrivate");let n=ac._idPool++;return this._proxy.$registerFileIgnoreProvider(n),this._ignoredFileProviders.set(n,e),q(()=>{this._proxy.$unregisterFileIgnoreProvider(n),this._ignoredFileProviders.delete(n)})}registerLanguageModelProxyProvider(t,e){return M(t,"chatParticipantPrivate"),this._languageModelProxyProvider=e,this._onDidChangeModelProxyAvailability.fire(),q(()=>{this._languageModelProxyProvider===e&&(this._languageModelProxyProvider=void 0,this._onDidChangeModelProxyAvailability.fire())})}};ac=_([S(0,le),S(1,te),S(2,yf)],ac);var SJ=60,CJ=SJ*60,hO=CJ*24,C3e=hO*7,T3e=hO*30,E3e=hO*365;function D5(i){return i.getFullYear()+"-"+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")+"T"+String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")+":"+String(i.getSeconds()).padStart(2,"0")+"."+(i.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var If={DateTimeFormat(i,t){return new mt(()=>{try{return new Intl.DateTimeFormat(i,t)}catch{return new Intl.DateTimeFormat(void 0,t)}})},Collator(i,t){return new mt(()=>{try{return new Intl.Collator(i,t)}catch{return new Intl.Collator(void 0,t)}})},Segmenter(i,t){return new mt(()=>{try{return new Intl.Segmenter(i,t)}catch{return new Intl.Segmenter(void 0,t)}})},Locale(i,t){return new mt(()=>{try{return new Intl.Locale(i,t)}catch{return new Intl.Locale(ps,t)}})},NumberFormat(i,t){return new mt(()=>{try{return new Intl.NumberFormat(i,t)}catch{return new Intl.NumberFormat(void 0,t)}})}};var xf=class i{constructor(t){let e=LR(t);this._defaultValue=e,this._asciiMap=i._createAsciiMap(e),this._map=new Map}static _createAsciiMap(t){let e=new Uint8Array(256);return e.fill(t),e}set(t,e){let n=LR(e);t>=0&&t<256?this._asciiMap[t]=n:this._map.set(t,n)}get(t){return t>=0&&t<256?this._asciiMap[t]:this._map.get(t)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}};var vO=class extends xf{constructor(e,n){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=n,this.intlSegmenterLocales.length>0?this._segmenter=If.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let o=0,r=e.length;o<r;o++)this.set(e.charCodeAt(o),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,n){let o=null;for(let r of this._getIntlSegmenterWordsOnLine(e)){if(r.index>n)break;o=r}return o}findNextIntlWordAtOrAfterOffset(e,n){for(let o of this._getIntlSegmenterWordsOnLine(e))if(!(o.index<n))return o;return null}_getIntlSegmenterWordsOnLine(e){return this._segmenter?this._cachedLine===e?this._cachedSegments:(this._cachedLine=e,this._cachedSegments=this._filterWordSegments(this._segmenter.value.segment(e)),this._cachedSegments):[]}_filterWordSegments(e){let n=[];for(let o of e)this._isWordLike(o)&&n.push(o);return n}_isWordLike(e){return!!e.isWordLike}},A5=new Xr(10);function M5(i,t){let e=`${i}/${t.join(",")}`,n=A5.get(e);return n||(n=new vO(i,t),A5.set(e,n)),n}var Wb=class{constructor(t,e,n,o){this.searchString=t,this.isRegex=e,this.matchCase=n,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let t;this.isRegex?t=yO(this.searchString):t=this.searchString.indexOf(`
`)>=0;let e=null;try{e=bx(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:t,global:!0,unicode:!0})}catch{return null}if(!e)return null;let n=!this.isRegex&&!t;return n&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(n=this.matchCase),new AS(e,this.wordSeparators?M5(this.wordSeparators,[]):null,n?this.searchString:null)}};function yO(i){if(!i||i.length===0)return!1;for(let t=0,e=i.length;t<e;t++){let n=i.charCodeAt(t);if(n===10)return!0;if(n===92){if(t++,t>=e)break;let o=i.charCodeAt(t);if(o===110||o===114||o===87)return!0}}return!1}function bO(i,t,e){if(!e)return new nu(i,null);let n=[];for(let o=0,r=t.length;o<r;o++)n[o]=t[o];return new nu(i,n)}function EJ(i,t,e,n,o){if(n===0)return!0;let r=t.charCodeAt(n-1);if(i.get(r)!==0||r===13||r===10)return!0;if(o>0){let s=t.charCodeAt(n);if(i.get(s)!==0)return!0}return!1}function wJ(i,t,e,n,o){if(n+o===e)return!0;let r=t.charCodeAt(n+o);if(i.get(r)!==0||r===13||r===10)return!0;if(o>0){let s=t.charCodeAt(n+o-1);if(i.get(s)!==0)return!0}return!1}function IO(i,t,e,n,o){return EJ(i,t,e,n,o)&&wJ(i,t,e,n,o)}var Nw=class{constructor(t,e){this._wordSeparators=t,this._searchRegex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(t){this._searchRegex.lastIndex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(t){let e=t.length,n;do{if(this._prevMatchStartIndex+this._prevMatchLength===e||(n=this._searchRegex.exec(t),!n))return null;let o=n.index,r=n[0].length;if(o===this._prevMatchStartIndex&&r===this._prevMatchLength){if(r===0){VR(t,e,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=r,!this._wordSeparators||IO(this._wordSeparators,t,e,o,r))return n}while(n);return null}};var L5=A("pathService"),Sf=class{constructor(t,e,n,o){this.localUserHome=t;this.remoteAgentService=e;this.environmentService=n;this.contextService=o;this.resolveOS=(async()=>(await this.remoteAgentService.getEnvironment())?.os||gr)(),this.resolveUserHome=(async()=>{let r=await this.remoteAgentService.getEnvironment();return this.maybeUnresolvedUserHome=r?.userHome??t})()}hasValidBasename(t,e,n){return typeof e=="string"||typeof e>"u"?this.resolveOS.then(o=>this.doHasValidBasename(t,o,e)):this.doHasValidBasename(t,e,n)}doHasValidBasename(t,e,n){return t.scheme===B.file||t.scheme===B.vscodeRemote?I2(n??Ze(t),e===1):!0}get defaultUriScheme(){return Sf.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(t,e){if(t.remoteAuthority)return B.vscodeRemote;let n=n4(e.getWorkspace());if(n)return n;let o=e.getWorkspace().folders[0];if(o)return o.uri.scheme;let r=e.getWorkspace().configuration;return r?r.scheme:B.file}userHome(t){return t?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(t=>t===1?xn:qe)}async fileURI(t){let e="";if(await this.resolveOS===1&&(t=t.replace(/\\/g,"/")),t[0]==="/"&&t[1]==="/"){let o=t.indexOf("/",2);o===-1?(e=t.substring(2),t="/"):(e=t.substring(2,o),t=t.substring(o)||"/")}return y.from({scheme:B.file,authority:e,path:t,query:"",fragment:""})}};Sf=_([S(1,Ds),S(2,md),S(3,Cr)],Sf);function PJ(i){return typeof i=="object"&&"uri"in i&&"pattern"in i}var Vb=class{constructor(t,e,n,o,r,s){this.configurationService=t;this.workspaceContextService=e;this.editorGroupsService=n;this.logService=o;this.pathService=r;this.uriIdentityService=s}aiText(t,e,n={}){return{...this.commonQuery(e?.map(Xv),n),type:3,contentPattern:t}}text(t,e,n={}){return t=this.getContentPattern(t,n),{...this.commonQuery(e?.map(Xv),n),type:2,contentPattern:t,previewOptions:n.previewOptions,maxFileSize:n.maxFileSize,surroundingContext:n.surroundingContext,userDisabledExcludesAndIgnoreFiles:n.disregardExcludeSettings&&n.disregardIgnoreFiles}}getContentPattern(t,e){let n=this.configurationService.getValue();t.isRegExp&&(t.pattern=t.pattern.replace(/\r?\n/g,"\\n"));let o={...t,wordSeparators:n.editor.wordSeparators};return this.isCaseSensitive(t,e)&&(o.isCaseSensitive=!0),this.isMultiline(t)&&(o.isMultiline=!0),e.notebookSearchConfig?.includeMarkupInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownInput=e.notebookSearchConfig.includeMarkupInput),e.notebookSearchConfig?.includeMarkupPreview&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookMarkdownPreview=e.notebookSearchConfig.includeMarkupPreview),e.notebookSearchConfig?.includeCodeInput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellInput=e.notebookSearchConfig.includeCodeInput),e.notebookSearchConfig?.includeOutput&&(o.notebookInfo||(o.notebookInfo={}),o.notebookInfo.isInNotebookCellOutput=e.notebookSearchConfig.includeOutput),o}file(t,e={}){return{...this.commonQuery(t,e),type:1,filePattern:e.filePattern?e.filePattern.trim():e.filePattern,exists:e.exists,sortByScore:e.sortByScore,cacheKey:e.cacheKey,shouldGlobMatchFilePattern:e.shouldGlobSearch}}handleIncludeExclude(t,e){if(!t)return{};if(Array.isArray(t)){if(t=t.filter(n=>n.length>0).map(Uw),!t.length)return{}}else t=Uw(t);return e?this.parseSearchPaths(t):{pattern:xO(...Array.isArray(t)?t:[t])}}commonQuery(t=[],e={}){let n=Array.isArray(e.excludePattern)?e.excludePattern.map(c=>c.pattern).flat():e.excludePattern;n=n?.length===1?n[0]:n;let o=this.handleIncludeExclude(e.includePattern,e.expandPatterns),r=this.handleIncludeExclude(n,e.expandPatterns),s=t.length>1,a=(o.searchPaths&&o.searchPaths.length?o.searchPaths.map(c=>this.getFolderQueryForSearchPath(c,e,r)):t.map(c=>this.getFolderQueryForRoot(c,e,r,s))).filter(c=>!!c),l={_reason:e._reason,folderQueries:a,usingSearchPaths:!!(o.searchPaths&&o.searchPaths.length),extraFileResources:e.extraFileResources,excludePattern:r.pattern,includePattern:o.pattern,ignoreGlobCase:e.ignoreGlobCase,onlyOpenEditors:e.onlyOpenEditors,maxResults:e.maxResults,onlyFileScheme:e.onlyFileScheme};if(e.onlyOpenEditors){let c=nt(this.editorGroupsService.groups.flatMap(g=>g.editors.map(h=>h.resource)));this.logService.trace("QueryBuilder#commonQuery - openEditor URIs",JSON.stringify(c));let u=c.filter(g=>fw(l,g.fsPath)),m=this.commonQueryFromFileList(u);return this.logService.trace("QueryBuilder#commonQuery - openEditor Query",JSON.stringify(m)),{...l,...m}}if(e.changedFileUris!==void 0){let c=e.changedFileUris.filter(m=>fw(l,m.fsPath)),u=this.commonQueryFromFileList(c);return this.logService.trace("QueryBuilder#commonQuery - changedFile Query",JSON.stringify(u)),{...l,...u}}let d=e.extraFileResources&&e.extraFileResources.filter(c=>fw(l,c.fsPath));return l.extraFileResources=d&&d.length?d:void 0,l}commonQueryFromFileList(t){let e=[],n=new Ve,o={},r=!1;return t.forEach(s=>{if(s.scheme===B.walkThrough)return;if(L2(s)){let l=this.workspaceContextService.getWorkspaceFolder(s)?.uri??this.uriIdentityService.extUri.dirname(s),d=n.get(l);d||(r=!0,d={folder:l,includePattern:{}},e.push(d),n.set(l,d));let c=_i(l.fsPath,s.fsPath);ki(d.includePattern)[O5(c.replace(/\\/g,"/"))]=!0}else s.fsPath&&(r=!0,o[O5(s.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:r?void 0:{"**/*":!0}}}isCaseSensitive(t,e){if(e.isSmartCase){if(t.isRegExp){if($R(t.pattern,!0))return!0}else if($R(t.pattern))return!0}return!!t.isCaseSensitive}isMultiline(t){return t.isMultiline||t.isRegExp&&yO(t.pattern)||t.pattern.indexOf(`
`)>=0?!0:!!t.isMultiline}parseSearchPaths(t){let e=u=>cn(u)||/^\.\.?([\/\\]|$)/.test(u),o=(Array.isArray(t)?t:RJ(t)).map(u=>{let m=this.pathService.resolvedUserHome;return m?gu(u,m.scheme===B.file?m.fsPath:m.path):u}),r=Dp(o,u=>e(u)?"searchPaths":"exprSegments"),s=(r.exprSegments||[]).map(u=>vr(u,"/")).map(u=>vr(u,"\\")).map(u=>(u[0]==="."&&(u="*"+u),DJ(u))),a={},l=this.expandSearchPathPatterns(r.searchPaths||[]);l&&l.length&&(a.searchPaths=l);let d=s.flat(),c=xO(...d);return c&&(a.pattern=c),a}getExcludesForFolder(t,e){return e.disregardExcludeSettings?void 0:Y$(t,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(t){if(!t||!t.length)return[];let e=t.flatMap(o=>{let{pathPortion:r,globPortion:s}=_J(o);return s&&(s=SO(s)),this.expandOneSearchPath(r).flatMap(l=>this.resolveOneSearchPathPattern(l,s))}),n=new Map;return e.forEach(o=>{let r=o.searchPath.toString(),s=n.get(r);s?o.pattern&&(s.pattern=s.pattern||{},s.pattern[o.pattern]=!0):n.set(r,{searchPath:o.searchPath,pattern:o.pattern?xO(o.pattern):void 0})}),Array.from(n.values())}expandOneSearchPath(t){if(cn(t)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==B.file?[{searchPath:e[0].uri.with({path:t})}]:[{searchPath:y.file(so(t))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(t=Uw(t),t.startsWith("../")||t===".."){let o=qe.resolve(e.path,t);return[{searchPath:e.with({path:o})}]}let n=SO(t);return[{searchPath:e,pattern:n}]}else{if(t==="./"||t===".\\")return[];{let e=t.replace(/^\.[\/\\]/,""),o=this.workspaceContextService.getWorkspace().folders.map(r=>{let s=e.match(new RegExp(`^${nr(r.name)}(?:/(.*)|$)`));return s?{match:s,folder:r}:null}).filter(Uo);if(o.length)return o.map(r=>{let s=r.match[1];return{searchPath:r.folder.uri,pattern:s&&SO(s)}});{let r=t.match(/\.[\/\\](.+)[\/\\]?/),s=r?r[1]:t,a=p(23436,null,s);throw new Error(a)}}}}resolveOneSearchPathPattern(t,e){let n=t.pattern&&e?`${t.pattern}/${e}`:t.pattern||e,o=[{searchPath:t.searchPath,pattern:n}];return n&&!n.endsWith("**")&&o.push({searchPath:t.searchPath,pattern:n+"/**"}),o}getFolderQueryForSearchPath(t,e,n){let o=this.getFolderQueryForRoot(Xv(t.searchPath),e,n,!1);return o?{...o,includePattern:t.pattern}:null}getFolderQueryForRoot(t,e,n,o){let r,s=y.isUri(t)?t:t.uri,a=e.excludePattern?.map(g=>{let h=e.excludePattern&&PJ(g)?g.uri:void 0;return!h||!(y.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,h))?h:void 0});if(a?.length||(a=[void 0]),n.searchPaths){let g=n.searchPaths.filter(h=>Sn(h.searchPath,s))[0];if(g&&!g.pattern)return null;g&&(r=g.pattern)}let l=this.configurationService.getValue({resource:s}),c={...this.getExcludesForFolder(l,e)||{},...r||{}},u=y.isUri(t)?Ze(t):t.name,m=a.map(g=>Object.keys(c).length>0?{folder:g,pattern:c}:void 0).filter(g=>g);return{folder:s,folderName:o?u:void 0,excludePattern:m,fileEncoding:l.files&&l.files.encoding,disregardIgnoreFiles:typeof e.disregardIgnoreFiles=="boolean"?e.disregardIgnoreFiles:!l.search?.useIgnoreFiles,disregardGlobalIgnoreFiles:typeof e.disregardGlobalIgnoreFiles=="boolean"?e.disregardGlobalIgnoreFiles:!l.search?.useGlobalIgnoreFiles,disregardParentIgnoreFiles:typeof e.disregardParentIgnoreFiles=="boolean"?e.disregardParentIgnoreFiles:!l.search?.useParentIgnoreFiles,ignoreSymlinks:typeof e.ignoreSymlinks=="boolean"?e.ignoreSymlinks:!l.search?.followSymlinks,ignoreGlobCase:e.ignoreGlobCase}}};Vb=_([S(0,$t),S(1,Cr),S(2,x$),S(3,te),S(4,L5),S(5,Vr)],Vb);function _J(i){let t=i.match(/[\*\{\}\(\)\[\]\?]/);if(t){let e=t.index,n=i.substr(0,e).match(/[/|\\][^/\\]*$/);if(n){let o=i.substr(0,n.index);return o.match(/[/\\]/)||(o+="/"),{pathPortion:o,globPortion:i.substr((n.index||0)+1)}}}return{pathPortion:i}}function xO(...i){return i.length?i.reduce((t,e)=>(t[e]=!0,t),Object.create(null)):void 0}function RJ(i){return Ba(i,",").map(t=>t.trim()).filter(t=>!!t.length)}function DJ(i){return[`**/${i}/**`,`**/${i}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function Uw(i){return i.replace(/\\/g,"/")}function SO(i){return Uw(i).replace(/^\.\//,"").replace(/\/+$/g,"")}function O5(i){return i.replace(/([?*[\]])/g,"[$1]")}var AJ=7e3;function U5(i,t){let e=t.activationEvents;if(!e)return Promise.resolve(void 0);let n=[],o=[];for(let c of e)if(/^workspaceContains:/.test(c)){let u=c.substr(18);u.indexOf("*")>=0||u.indexOf("?")>=0||i.forceUsingSearch?o.push(u):n.push(u)}if(n.length===0&&o.length===0)return Promise.resolve(void 0);let{promise:r,resolve:s}=Ev(),a=c=>s({activationEvent:c}),l=Promise.all(n.map(c=>MJ(i,c,a))).then(()=>{}),d=LJ(i,t.identifier,o,a);return Promise.all([l,d]).then(()=>{s(void 0)}),r}async function MJ(i,t,e){for(let n of i.folders)if(await i.exists(gt(y.revive(n),t))){e(`workspaceContains:${t}`);return}}async function LJ(i,t,e,n){if(e.length===0)return Promise.resolve(void 0);let o=new Ee,r=i.checkExists(i.folders,e,o.token),s=setTimeout(async()=>{o.cancel(),i.logService.info(`Not activating extension '${t.value}': Timed out while searching for 'workspaceContains' pattern ${e.join(",")}`)},AJ),a=!1;try{a=await r}catch(l){Yt(l)||Ge(l)}o.dispose(),clearTimeout(s),a&&n(`workspaceContains:${e.join(",")}`)}var Cf=class{constructor(t){this._onDidChangePassword=new T;this.onDidChangePassword=this._onDidChangePassword.event;this._proxy=t.getProxy(F.MainThreadSecretState)}async $onDidChangePassword(t){this._onDidChangePassword.fire(t)}get(t,e){return this._proxy.$getPassword(t,e)}store(t,e,n){return this._proxy.$setPassword(t,e,n)}delete(t,e){return this._proxy.$deletePassword(t,e)}keys(t){return this._proxy.$getKeys(t)}},Tf=A("IExtHostSecretState");var Fw=class{constructor(t,e){this.disposables=new $;this._id=xe.toKey(t.identifier),this.#e=e,this.onDidChange=ye.map(ye.filter(this.#e.onDidChangePassword,n=>n.extensionId===this._id),n=>({key:n.key}),this.disposables)}#e;dispose(){this.disposables.dispose()}get(t){return this.#e.get(this._id,t)}store(t,e){return this.#e.store(this._id,t,e)}delete(t){return this.#e.delete(this._id,t)}keys(){return this.#e.keys(this._id)||[]}};var Ef=class{constructor(t,e,n){this.logService=n;this.bundleCache=new Map;this._proxy=e.getProxy(F.MainThreadLocalization),this.currentLanguage=t.environment.appLanguage,this.isDefaultLanguage=this.currentLanguage===ps}getMessage(t,e){let{message:n,args:o,comment:r}=e;if(this.isDefaultLanguage)return FR(n,o??{});let s=n;r&&r.length>0&&(s+=`/${Array.isArray(r)?r.join(""):r}`);let a=this.bundleCache.get(t)?.contents[s];return a||this.logService.warn(`Using default string since no string found in i18n bundle that has the key: ${s}`),FR(a??n,o??{})}getBundle(t){return this.bundleCache.get(t)?.contents}getBundleUri(t){return this.bundleCache.get(t)?.uri}async initializeLocalizedMessages(t){if(this.isDefaultLanguage||!t.l10n&&!t.isBuiltin||this.bundleCache.has(t.identifier.value))return;let e,n=await this.getBundleLocation(t);if(!n){this.logService.error(`No bundle location found for extension ${t.identifier.value}`);return}try{let o=await this._proxy.$fetchBundleContents(n),r=JSON.parse(o);e=t.isBuiltin?r.contents?.bundle:r}catch(o){this.logService.error(`Failed to load translations for ${t.identifier.value} from ${n}: ${o.message}`);return}e&&this.bundleCache.set(t.identifier.value,{contents:e,uri:n})}async getBundleLocation(t){if(t.isBuiltin){let e=await this._proxy.$fetchBuiltInBundleUri(t.identifier.value,this.currentLanguage);return y.revive(e)}return t.l10n?y.joinPath(t.extensionLocation,t.l10n,`bundle.l10n.${this.currentLanguage}.json`):void 0}};Ef=_([S(0,Ye),S(1,le),S(2,te)],Ef);var wf=A("IExtHostLocalizationService");var lc=A("IExtHostManagedSockets"),kf=class{constructor(t){this._remoteSocketIdCounter=0;this._factory=null;this._managedRemoteSockets=new Map;this._proxy=t.getProxy(F.MainThreadManagedSockets)}setFactory(t,e){for(let n of this._managedRemoteSockets.values())n.dispose();this._factory&&this._proxy.$unregisterSocketFactory(this._factory.socketFactoryId),this._factory=new CO(t,e),this._proxy.$registerSocketFactory(this._factory.socketFactoryId)}makeConnection(){if(!this._factory)throw new Error("No managed socket factory registered");return Promise.resolve(this._factory.makeConnection())}async $openRemoteSocket(t){if(!this._factory||this._factory.socketFactoryId!==t)throw new Error(`No socket factory with id ${t}`);let e=++this._remoteSocketIdCounter,n=await this._factory.makeConnection(),o=new $;return this._managedRemoteSockets.set(e,new TO(e,n,o)),o.add(q(()=>this._managedRemoteSockets.delete(e))),o.add(n.onDidEnd(()=>{this._proxy.$onDidManagedSocketEnd(e),o.dispose()})),o.add(n.onDidClose(r=>{this._proxy.$onDidManagedSocketClose(e,r?.stack??r?.message),o.dispose()})),o.add(n.onDidReceiveMessage(r=>this._proxy.$onDidManagedSocketHaveData(e,H.wrap(r)))),e}$remoteSocketWrite(t,e){this._managedRemoteSockets.get(t)?.actual.send(e.buffer)}$remoteSocketEnd(t){let e=this._managedRemoteSockets.get(t);e&&(e.actual.end(),e.dispose())}async $remoteSocketDrain(t){await this._managedRemoteSockets.get(t)?.actual.drain?.()}};kf=_([S(0,le)],kf);var CO=class{constructor(t,e){this.socketFactoryId=t;this.makeConnection=e}},TO=class extends N{constructor(e,n,o){super();this.socketId=e;this.actual=n;this._register(o)}};var kO=A("IHostUtils"),dc=class extends N{constructor(e,n,o,r,s,a,l,d,c,u,m,g,h){super();this._extHostManagedSockets=g;this._extHostLanguageModels=h;this._onDidChangeRemoteConnectionData=this._register(new T);this.onDidChangeRemoteConnectionData=this._onDidChangeRemoteConnectionData.event;this._realPathCache=new Map;this._isTerminating=!1;this._hostUtils=n,this._extHostContext=o,this._initData=l,this._extHostWorkspace=r,this._extHostConfiguration=s,this._logService=a,this._extHostTunnelService=c,this._extHostTerminalService=u,this._extHostLocalizationService=m,this._mainThreadWorkspaceProxy=this._extHostContext.getProxy(F.MainThreadWorkspace),this._mainThreadTelemetryProxy=this._extHostContext.getProxy(F.MainThreadTelemetry),this._mainThreadExtensionsProxy=this._extHostContext.getProxy(F.MainThreadExtensionService),this._almostReadyToRunExtensions=new kn,this._readyToStartExtensionHost=new kn,this._readyToRunExtensions=new kn,this._eagerExtensionsActivated=new kn,this._activationEventsReader=new wO(this._initData.extensions.activationEvents),this._globalRegistry=new yl(this._activationEventsReader,this._initData.extensions.allExtensions);let f=new $o(this._initData.extensions.myExtensions);this._myRegistry=new yl(this._activationEventsReader,W5(this._globalRegistry,f)),$l&&(this._logService.info(`Creating extension host with the following global extensions: ${Pf(this._globalRegistry)}`),this._logService.info(`Creating extension host with the following local extensions: ${Pf(this._myRegistry)}`)),this._storage=new ef(this._extHostContext,this._logService),this._secretState=new Cf(this._extHostContext),this._storagePath=d,this._instaService=this._store.add(e.createChild(new rd([tf,this._storage],[Tf,this._secretState]))),this._activator=this._register(new Yg(this._myRegistry,this._globalRegistry,{onExtensionActivationError:(I,x,E)=>{this._mainThreadExtensionsProxy.$onExtensionActivationError(I,ls(x),E)},actualActivateExtension:async(I,x)=>{if(yl.isHostExtension(I,this._myRegistry,this._globalRegistry))return await this._mainThreadExtensionsProxy.$activateExtension(I,x),new ww;let E=this._myRegistry.getExtensionDescription(I);return this._activateExtension(E,x)}},this._logService)),this._extensionPathIndex=null,this._resolvers=Object.create(null),this._started=!1,this._remoteConnectionData=this._initData.remote.connectionData,this._register(g4(I=>this._reportProposedApiUsage(I))),this._register(f4(this._initData.enabledApiProposalsFallback,this._initData.quality))}_reportProposedApiUsage(e){this._mainThreadTelemetryProxy.$publicLog2("extensionProposedApiNotEnabled",{extensionId:e.extensionId,proposalName:e.proposalName})}getRemoteConnectionData(){return this._remoteConnectionData}async initialize(){try{await this._beforeAlmostReadyToRunExtensions(),this._almostReadyToRunExtensions.open(),await this._extHostWorkspace.waitForInitializeCall(),Bt("code/extHost/ready"),this._readyToStartExtensionHost.open(),this._initData.autoStart&&this._startExtensionHost()}catch(e){Ge(e)}}async _deactivateAll(){this._storagePath.onWillDeactivateAll();let e=[];try{e=this._myRegistry.getAllExtensionDescriptions().map(s=>s.identifier).filter(s=>this.isActivated(s)).map(s=>this._deactivate(s))}catch{}await Promise.all(e)}terminate(e,n=0){if(this._isTerminating)return;this._isTerminating=!0,this._logService.info(`Extension host terminating: ${e}`),this._logService.flush(),this._extHostTerminalService.dispose(),this._activator.dispose(),rv(r=>{this._logService.error(r)}),this._extHostContext.dispose();let o=this._deactivateAll();Promise.race([Vt(5e3),o]).finally(()=>{this._hostUtils.pid?this._logService.info(`Extension host with pid ${this._hostUtils.pid} exiting with code ${n}`):this._logService.info(`Extension host exiting with code ${n}`),this._logService.flush(),this._logService.dispose(),this._hostUtils.exit(n)})}isActivated(e){return this._readyToRunExtensions.isOpen()?this._activator.isActivated(e):!1}async getExtension(e){let n=await this._mainThreadExtensionsProxy.$getExtension(e);return n&&{...n,identifier:new xe(n.identifier.value),extensionLocation:y.revive(n.extensionLocation)}}_activateByEvent(e,n){return this._activator.activateByEvent(e,n)}_activateById(e,n){return this._activator.activateById(e,n)}activateByIdWithErrors(e,n){return this._activateById(e,n).then(()=>{let o=this._activator.getActivatedExtension(e);if(o.activationFailed)return Promise.reject(o.activationFailedError)})}getExtensionRegistry(){return this._readyToRunExtensions.wait().then(e=>this._myRegistry)}getExtensionExports(e){if(this._readyToRunExtensions.isOpen())return this._activator.getActivatedExtension(e).exports;try{return this._activator.getActivatedExtension(e).exports}catch{return null}}async _realPathExtensionUri(e){if(e.scheme===B.file&&this._hostUtils.fsRealpath){let n=e.fsPath;this._realPathCache.has(n)||this._realPathCache.set(n,this._hostUtils.fsRealpath(n));let o=await this._realPathCache.get(n);return y.file(o)}return e}async getExtensionPathIndex(){return this._extensionPathIndex||(this._extensionPathIndex=this._createExtensionPathIndex(this._myRegistry.getAllExtensionDescriptions()).then(e=>new EO(e))),this._extensionPathIndex}async _createExtensionPathIndex(e){let n=ar.forUris(o=>Nc.ignorePathCasing(o));return await Promise.all(e.map(async o=>{if(this._getEntryPoint(o)){let r=await this._realPathExtensionUri(o.extensionLocation);n.set(r,o)}})),n}_deactivate(e){let n=Promise.resolve(void 0);if(!this._readyToRunExtensions.isOpen()||!this._activator.isActivated(e))return n;let o=this._activator.getActivatedExtension(e);if(!o)return n;try{typeof o.module.deactivate=="function"&&(n=Promise.resolve(o.module.deactivate()).then(void 0,r=>(this._logService.error(r),Promise.resolve(void 0))))}catch(r){this._logService.error(`An error occurred when deactivating the extension '${e.value}':`),this._logService.error(r)}try{o.disposable.dispose()}catch(r){this._logService.error(`An error occurred when disposing the subscriptions for extension '${e.value}':`),this._logService.error(r)}return n}async _activateExtension(e,n){return this._initData.remote.isRemote?this._mainThreadExtensionsProxy.$onWillActivateExtension(e.identifier):await this._mainThreadExtensionsProxy.$onWillActivateExtension(e.identifier),this._doActivateExtension(e,n).then(o=>{let r=o.activationTimes;return this._mainThreadExtensionsProxy.$onDidActivateExtension(e.identifier,r.codeLoadingTime,r.activateCallTime,r.activateResolvedTime,n),this._logExtensionActivationTimes(e,n,"success",r),o},o=>{throw this._logExtensionActivationTimes(e,n,"failure"),o})}_logExtensionActivationTimes(e,n,o,r){let s=H5(e,n);this._mainThreadTelemetryProxy.$publicLog2("extensionActivationTimes",{...s,...r||{},outcome:o})}_doActivateExtension(e,n){let o=H5(e,n);this._mainThreadTelemetryProxy.$publicLog2("activatePlugin",o);let r=this._getEntryPoint(e);if(!r)return Promise.resolve(new Ew(ep.NONE));this._logService.info(`ExtensionService#_doActivateExtension ${e.identifier.value}, startup: ${n.startup}, activationEvent: '${n.activationEvent}'${e.identifier.value!==n.extensionId.value?`, root cause: ${n.extensionId.value}`:""}`),this._logService.flush();let s=this._isESM(e),a=new $,l=new Xg(n.startup);return Promise.all([s?this._loadESMModule(e,gt(e.extensionLocation,r),l):this._loadCommonJSModule(e,gt(e.extensionLocation,r),l),this._loadExtensionContext(e,a)]).then(d=>(Bt(`code/extHost/willActivateExtension/${e.identifier.value}`),dc._callActivate(this._logService,e.identifier,d[0],d[1],a,l))).then(d=>(Bt(`code/extHost/didActivateExtension/${e.identifier.value}`),d))}_loadExtensionContext(e,n){let o=this._extHostLanguageModels.createLanguageModelAccessInformation(e),r=n.add(new kw(e,this._storage)),s=n.add(new Nb(e.identifier.value,!1,this._storage)),a=n.add(new Fw(e,this._secretState)),l=e.isUnderDevelopment?this._initData.environment.extensionTestsLocationURI?3:2:1,d=this._initData.remote.isRemote?2:1;return this._logService.trace(`ExtensionService#loadExtensionContext ${e.identifier.value}`),Promise.all([r.whenReady,s.whenReady,this._storagePath.whenReady]).then(()=>{let c=this,u,m,g=Le(e,"ipc")?this._initData.messagePorts?.get(xe.toKey(e.identifier)):void 0;return Object.freeze({globalState:r,workspaceState:s,secrets:a,subscriptions:[],get languageModelAccessInformation(){return o},get extensionUri(){return e.extensionLocation},get extensionPath(){return e.extensionLocation.fsPath},asAbsolutePath(h){return Be(e.extensionLocation.fsPath,h)},get storagePath(){return c._storagePath.workspaceValue(e)?.fsPath},get globalStoragePath(){return c._storagePath.globalValue(e).fsPath},get logPath(){return Be(c._initData.logsLocation.fsPath,e.identifier.value)},get logUri(){return y.joinPath(c._initData.logsLocation,e.identifier.value)},get storageUri(){return c._storagePath.workspaceValue(e)},get globalStorageUri(){return c._storagePath.globalValue(e)},get extensionMode(){return l},get extension(){return u===void 0&&(u=new cc(c,e.identifier,e,d,!1)),u},get extensionRuntime(){return M(e,"extensionRuntime"),c.extensionRuntime},get environmentVariableCollection(){return c._extHostTerminalService.getEnvironmentVariableCollection(e)},get messagePassingProtocol(){if(!m){if(!g)return;let h=ye.buffer(ye.fromDOMEventEmitter(g,"message",f=>f.data),"onDidReceiveMessage");g.start(),m={onDidReceiveMessage:h,postMessage:g.postMessage.bind(g)}}return m}})})}static _callActivate(e,n,o,r,s,a){return o=o||{activate:void 0,deactivate:void 0},this._callActivateOptional(e,n,o,r,a).then(l=>new tp(!1,null,a.build(),o,l,q(()=>{s.dispose(),In(r.subscriptions)})))}static _callActivateOptional(e,n,o,r,s){if(typeof o.activate=="function")try{s.activateCallStart(),e.trace(`ExtensionService#_callActivateOptional ${n.value}`);let a=o.activate.apply(globalThis,[r]);return s.activateCallStop(),s.activateResolveStart(),Promise.resolve(a).then(l=>(s.activateResolveStop(),l))}catch(a){return Promise.reject(a)}else return Promise.resolve(o)}_activateOneStartupFinished(e,n){this._activateById(e.identifier,{startup:!1,extensionId:e.identifier,activationEvent:n}).then(void 0,o=>{this._logService.error(o)})}_activateAllStartupFinishedDeferred(e,n=0){let r=Date.now();ax(()=>{for(let s=n;s<e.length;s+=1){let a=e[s];for(let l of a.activationEvents??[])if(l==="onStartupFinished")if(Date.now()-r>50){this._activateAllStartupFinishedDeferred(e,s);break}else this._activateOneStartupFinished(a,l)}})}_activateAllStartupFinished(){this._mainThreadExtensionsProxy.$setPerformanceMarks(Q2()),this._extHostConfiguration.getConfigProvider().then(e=>{let n=e.getConfiguration("extensions.experimental").get("deferredStartupFinishedActivation"),o=this._myRegistry.getAllExtensionDescriptions();if(n)this._activateAllStartupFinishedDeferred(o);else for(let r of o)if(r.activationEvents)for(let s of r.activationEvents)s==="onStartupFinished"&&this._activateOneStartupFinished(r,s)})}_handleEagerExtensions(){let e=this._activateByEvent("*",!0).then(void 0,a=>{this._logService.error(a)});this._register(this._extHostWorkspace.onDidChangeWorkspace(a=>this._handleWorkspaceContainsEagerExtensions(a.added)));let n=this._extHostWorkspace.workspace?this._extHostWorkspace.workspace.folders:[],o=this._handleWorkspaceContainsEagerExtensions(n),r=this._handleRemoteResolverEagerExtensions(),s=Promise.all([r,e,o]).then(()=>{});return Promise.race([s,Vt(1e4)]).then(()=>{this._activateAllStartupFinished()}),s}_handleWorkspaceContainsEagerExtensions(e){return e.length===0?Promise.resolve(void 0):Promise.all(this._myRegistry.getAllExtensionDescriptions().map(n=>this._handleWorkspaceContainsEagerExtension(e,n))).then(()=>{})}async _handleWorkspaceContainsEagerExtension(e,n){if(this.isActivated(n.identifier))return;let o=!this._initData.remote.isRemote&&!!this._initData.remote.authority,r={logService:this._logService,folders:e.map(a=>a.uri),forceUsingSearch:o||!this._hostUtils.fsExists,exists:a=>this._hostUtils.fsExists(a.fsPath),checkExists:(a,l,d)=>this._mainThreadWorkspaceProxy.$checkExists(a,l,d)},s=await U5(r,n);if(s)return this._activateById(n.identifier,{startup:!0,extensionId:n.identifier,activationEvent:s.activationEvent}).then(void 0,a=>this._logService.error(a))}async _handleRemoteResolverEagerExtensions(){if(this._initData.remote.authority)return this._activateByEvent(`onResolveRemoteAuthority:${this._initData.remote.authority}`,!1)}async $extensionTestsExecute(){await this._eagerExtensionsActivated.wait();try{return await this._doHandleExtensionTests()}catch(e){throw console.error(e),e}}async _doHandleExtensionTests(){let{extensionDevelopmentLocationURI:e,extensionTestsLocationURI:n}=this._initData.environment;if(!e||!n)throw new Error(p(5879,null));let o=(await this.getExtensionPathIndex()).findSubstr(n),s=await(this._isESM(o,n.path)?this._loadESMModule(null,n,new Xg(!1)):this._loadCommonJSModule(null,n,new Xg(!1)));if(!s||typeof s.run!="function")throw new Error(p(5878,null,n.toString()));return new Promise((a,l)=>{let d=(m,g)=>{m?($l&&this._logService.error("Test runner called back with error",m),l(m)):($l&&(g?this._logService.info(`Test runner called back with ${g} failures.`):this._logService.info("Test runner called back with successful outcome.")),a(typeof g=="number"&&g>0?1:0))},c=ni(n),u=s.run(c,d);u&&u.then&&u.then(()=>{$l&&this._logService.info("Test runner finished successfully."),a(0)}).catch(m=>{$l&&this._logService.error("Test runner finished with error",m),l(m instanceof Error&&m.stack?m.stack:String(m))})})}_startExtensionHost(){if(this._started)throw new Error("Extension host is already started!");return this._started=!0,this._readyToStartExtensionHost.wait().then(()=>this._readyToRunExtensions.open()).then(()=>Promise.race([this._activator.waitForActivatingExtensions(),Vt(1e3)])).then(()=>this._handleEagerExtensions()).then(()=>{this._eagerExtensionsActivated.open(),this._logService.info("Eager extensions activated")})}registerRemoteAuthorityResolver(e,n){return this._resolvers[e]=n,q(()=>{delete this._resolvers[e]})}async getRemoteExecServer(e){let{resolver:n}=await this._activateAndGetResolver(e);return n?.resolveExecServer?.(e,{resolveAttempt:0})}async _activateAndGetResolver(e){let n=e.indexOf("+");if(n===-1)throw new zs("Not an authority that can be resolved!","InvalidAuthority");let o=e.substr(0,n);return await this._almostReadyToRunExtensions.wait(),await this._activateByEvent(`onResolveRemoteAuthority:${o}`,!1),{authorityPrefix:o,resolver:this._resolvers[o]}}async $resolveAuthority(e,n){let o=Xt.create(!1),r=()=>`[resolveAuthority(${s0(e)},${n})][${o.elapsed()}ms] `,s=w=>this._logService.info(`${r()}${w}`),a=w=>this._logService.warn(`${r()}${w}`),l=(w,R=void 0)=>this._logService.error(`${r()}${w}`,R),d=w=>{if(w instanceof zs)return{type:"error",error:{code:w._code,message:w._message,detail:w._detail}};throw w},c=async w=>{s(`activating resolver for ${w}...`);let{resolver:R,authorityPrefix:L}=await this._activateAndGetResolver(w);if(!R)throw l(`no resolver for ${L}`),new zs(`No remote extension installed to resolve ${L}.`,"NoResolverFound");return{resolver:R,authorityPrefix:L,remoteAuthority:w}},u=e.split(/@|%40/g).reverse();s(`activating remote resolvers ${u.join(" -> ")}`);let m;try{m=await Promise.all(u.map(c)).catch(async w=>{if(!(w instanceof zs)||w._code!=="InvalidAuthority")throw w;return a(`resolving nested authorities failed: ${w.message}`),[await c(e)]})}catch(w){return d(w)}let g=new $p;g.cancelAndSet(()=>s("waiting..."),1e3);let h,f;for(let[w,{authorityPrefix:R,resolver:L,remoteAuthority:U}]of m.entries())try{if(w===m.length-1)s("invoking final resolve()..."),Bt(`code/extHost/willResolveAuthority/${R}`),h=await L.resolve(U,{resolveAttempt:n,execServer:f}),Bt(`code/extHost/didResolveAuthorityOK/${R}`),s("setting tunnel factory..."),this._register(await this._extHostTunnelService.setTunnelFactory(L,Ad.isManagedResolvedAuthority(h)?h:void 0));else{if(s(`invoking resolveExecServer() for ${U}`),Bt(`code/extHost/willResolveExecServer/${R}`),f=await L.resolveExecServer?.(U,{resolveAttempt:n,execServer:f}),!f)throw new zs(`Exec server was not available for ${U}`,"NoResolverFound");Bt(`code/extHost/didResolveExecServerOK/${R}`)}}catch(z){return Bt(`code/extHost/didResolveAuthorityError/${R}`),l("returned an error",z),g.dispose(),d(z)}g.dispose();let I={environmentTunnels:h.environmentTunnels,features:h.tunnelFeatures?{elevation:h.tunnelFeatures.elevation,privacyOptions:h.tunnelFeatures.privacyOptions,protocol:h.tunnelFeatures.protocol===void 0?!0:h.tunnelFeatures.protocol}:void 0},x={extensionHostEnv:h.extensionHostEnv,isTrusted:h.isTrusted,authenticationSession:h.authenticationSessionForInitializingExtensions?{id:h.authenticationSessionForInitializingExtensions.id,providerId:h.authenticationSessionForInitializingExtensions.providerId}:void 0};s(`returned ${Ad.isManagedResolvedAuthority(h)?"managed authority":`${h.host}:${h.port}`}`);let E;if(Ad.isManagedResolvedAuthority(h)){let w=n;this._extHostManagedSockets.setFactory(w,h.makeConnection),E={authority:e,connectTo:new Bm(w),connectionToken:h.connectionToken}}else E={authority:e,connectTo:new dT(h.host,h.port),connectionToken:h.connectionToken};return{type:"ok",value:{authority:E,options:x,tunnelInformation:I}}}async $getCanonicalURI(e,n){this._logService.info(`$getCanonicalURI invoked for authority (${s0(e)})`);let{resolver:o}=await this._activateAndGetResolver(e);if(!o)return null;let r=y.revive(n);if(typeof o.getCanonicalURI>"u")return r;let s=await Cn(()=>o.getCanonicalURI(r));return s||r}async $startExtensionHost(e){e.toAdd.forEach(a=>a.extensionLocation=y.revive(a.extensionLocation));let{globalRegistry:n,myExtensions:o}=F5(this._activationEventsReader,this._globalRegistry,this._myRegistry,e),r=await this._createExtensionPathIndex(o);return(await this.getExtensionPathIndex()).setSearchTree(r),this._globalRegistry.set(n.getAllExtensionDescriptions()),this._myRegistry.set(o),$l&&(this._logService.info(`$startExtensionHost: global extensions: ${Pf(this._globalRegistry)}`),this._logService.info(`$startExtensionHost: local extensions: ${Pf(this._myRegistry)}`)),this._startExtensionHost()}$activateByEvent(e,n){return n===1?this._almostReadyToRunExtensions.wait().then(o=>this._activateByEvent(e,!1)):this._readyToRunExtensions.wait().then(o=>this._activateByEvent(e,!1))}async $activate(e,n){return await this._readyToRunExtensions.wait(),this._myRegistry.getExtensionDescription(e)?(await this._activateById(e,n),!0):!1}async $deltaExtensions(e){e.toAdd.forEach(a=>a.extensionLocation=y.revive(a.extensionLocation));let{globalRegistry:n,myExtensions:o}=F5(this._activationEventsReader,this._globalRegistry,this._myRegistry,e),r=await this._createExtensionPathIndex(o);return(await this.getExtensionPathIndex()).setSearchTree(r),this._globalRegistry.set(n.getAllExtensionDescriptions()),this._myRegistry.set(o),$l&&(this._logService.info(`$deltaExtensions: global extensions: ${Pf(this._globalRegistry)}`),this._logService.info(`$deltaExtensions: local extensions: ${Pf(this._myRegistry)}`)),Promise.resolve(void 0)}async $test_latency(e){return e}async $test_up(e){return e.byteLength}async $test_down(e){let n=H.alloc(e),o=Math.random()%256;for(let r=0;r<e;r++)n.writeUInt8(o,r);return n}async $updateRemoteConnectionData(e){this._remoteConnectionData=e,this._onDidChangeRemoteConnectionData.fire()}_isESM(e,n){return n??=e?this._getEntryPoint(e):n,n?.endsWith(".mjs")||e?.type==="module"&&!n?.endsWith(".cjs")}};dc=_([S(0,Dn),S(1,kO),S(2,le),S(3,Vn),S(4,_n),S(5,te),S(6,Ye),S(7,of),S(8,tc),S(9,Ao),S(10,wf),S(11,lc),S(12,bf)],dc);function F5(i,t,e,n){i.addActivationEvents(n.addActivationEvents);let o=new yl(i,t.getAllExtensionDescriptions());o.deltaExtensions(n.toAdd,n.toRemove);let r=new $o(e.getAllExtensionDescriptions().map(a=>a.identifier));for(let a of n.myToRemove)r.delete(a);for(let a of n.myToAdd)r.add(a);let s=W5(o,r);return{globalRegistry:o,myExtensions:s}}function H5(i,t){return{id:i.identifier.value,name:i.name,extensionVersion:i.version,publisherDisplayName:i.publisher,activationEvents:i.activationEvents?i.activationEvents.join(","):null,isBuiltin:i.isBuiltin,reason:t.activationEvent,reasonId:t.extensionId.value}}function Pf(i){return i.getAllExtensionDescriptions().map(t=>t.identifier.value).join(",")}var io=A("IExtHostExtensionService"),cc=class{#e;#t;#n;constructor(t,e,n,o,r){this.#e=t,this.#t=e,this.#n=n.identifier,this.id=n.identifier.value,this.extensionUri=n.extensionLocation,this.extensionPath=so(ni(n.extensionLocation)),this.packageJSON=n,this.extensionKind=o,this.isFromDifferentExtensionHost=r}get isActive(){return this.#e.isActivated(this.#n)}get exports(){if(!(this.packageJSON.api==="none"||this.isFromDifferentExtensionHost))return this.#e.getExtensionExports(this.#n)}async activate(){if(this.isFromDifferentExtensionHost)throw new Error("Cannot activate foreign extension");return await this.#e.activateByIdWithErrors(this.#n,{startup:!1,extensionId:this.#t,activationEvent:"api"}),this.exports}};function W5(i,t){return i.getAllExtensionDescriptions().filter(e=>t.has(e.identifier))}var EO=class{constructor(t){this._searchTree=t}setSearchTree(t){this._searchTree=t}findSubstr(t){return this._searchTree.findSubstr(t)}forEach(t){return this._searchTree.forEach(t)}},wO=class{constructor(t){this._map=new vo;this.addActivationEvents(t)}readActivationEvents(t){return this._map.get(t.identifier)??[]}addActivationEvents(t){for(let e of Object.keys(t))this._map.set(e,t[e])}};var Zi=A("IExtHostApiDeprecationService"),_f=class{constructor(t,e){this._extHostLogService=e;this._reportedUsages=new Set;this._telemetryShape=t.getProxy(F.MainThreadTelemetry)}report(t,e,n,o){let r=this.getUsageKey(t,e,o?.usageId);this._reportedUsages.has(r)||(this._reportedUsages.add(r),e.isUnderDevelopment&&this._extHostLogService.warn(`[Deprecation Warning] '${t}' is deprecated. ${n}`),this._telemetryShape.$publicLog2("extHostDeprecatedApiUsage",{extensionId:e.identifier.value,apiId:t,usageId:o?.usageId??""}))}getUsageKey(t,e,n){let o=`${t}-${e.identifier.value}`;return n?`${o}-${n}`:o}};_f=_([S(0,le),S(1,te)],_f);var Pje=Object.freeze(new class{report(i,t,e){}});var Hw=class{static async installEarlyHandler(t){Error.stackTraceLimit=100;let e=t.get(te),o=t.get(le).getProxy(F.MainThreadErrors);rv(r=>{e.error(r);let s=ls(r);o.$onUnexpectedError(s)})}static async installFullHandler(t){let e=t.get(te),n=t.get(le),o=t.get(io),r=t.get(oc),s=t.get(Zi),a=n.getProxy(F.MainThreadExtensionService),l=n.getProxy(F.MainThreadErrors),d=await o.getExtensionRegistry(),c=await o.getExtensionPathIndex(),u=new WeakMap;function m(f,I){if(u.has(f))return u.get(f).stack;let x="",E,w;for(let L of I)x+=`
	at ${L.toString()}`,w=L.getFileName(),!E&&w&&(E=c.findSubstr(y.file(w)));let R=`${f.name||"Error"}: ${f.message||""}${x}`;return u.set(f,{extensionIdentifier:E?.identifier,stack:R}),R}let g=Symbol("prepareStackTrace wrapped"),h=m;Object.defineProperty(Error,"prepareStackTrace",{configurable:!1,get(){return h},set(f){if(f===m||!f||f[g]){h=f||m;return}h=function(I,x){return m(I,x),f.call(Error,I,x)},Object.assign(h,{[g]:!0})}}),rv(f=>{ya.is(f)||e.error(f);let I=ls(f),x;if(f instanceof em?x=f.extension:x=u.get(f)?.extensionIdentifier,!!x)if(ya.is(f)){let E=d.getExtensionDescription(x);E&&s.report(f.name,E,`${f.message}
 FROM: ${f.stack}`)}else{a.$onExtensionRuntimeError(x,I);let E=r.onExtensionError(x,f);e.trace("forwarded error to extension?",E,x)}}),Ml.addListener(f=>{l.$onUnexpectedError(f)})}},Ww=class i{constructor(t,e,n,o,r){this._hostUtils=n,this._rpcProtocol=new iS(t,null,o),e=i._transform(e,this._rpcProtocol);let s=new rd(...KW());s.set(Ye,{_serviceBrand:void 0,...e,messagePorts:r}),s.set(le,new pS(this._rpcProtocol)),s.set(xs,new mS(o)),s.set(kO,n);let a=new uS(s,!0);a.invokeFunction(Hw.installEarlyHandler),this._logService=a.invokeFunction(l=>l.get(te)),Bt("code/extHost/didCreateServices"),this._hostUtils.pid?this._logService.info(`Extension host with pid ${this._hostUtils.pid} started`):this._logService.info("Extension host started"),this._logService.trace("initData",e),this._extensionService=a.invokeFunction(l=>l.get(io)),this._extensionService.initialize(),a.invokeFunction(Hw.installFullHandler)}async asBrowserUri(t){let e=this._rpcProtocol.getProxy(F.MainThreadExtensionService);return y.revive(await e.$asBrowserUri(t))}terminate(t){this._extensionService.terminate(t)}static _transform(t,e){t.extensions.allExtensions.forEach(o=>{o.extensionLocation=y.revive(e.transformIncomingURIs(o.extensionLocation))}),t.environment.appRoot=y.revive(e.transformIncomingURIs(t.environment.appRoot));let n=t.environment.extensionDevelopmentLocationURI;return n&&(t.environment.extensionDevelopmentLocationURI=n.map(o=>y.revive(e.transformIncomingURIs(o)))),t.environment.extensionTestsLocationURI=y.revive(e.transformIncomingURIs(t.environment.extensionTestsLocationURI)),t.environment.globalStorageHome=y.revive(e.transformIncomingURIs(t.environment.globalStorageHome)),t.environment.workspaceStorageHome=y.revive(e.transformIncomingURIs(t.environment.workspaceStorageHome)),t.nlsBaseUrl=y.revive(e.transformIncomingURIs(t.nlsBaseUrl)),t.logsLocation=y.revive(e.transformIncomingURIs(t.logsLocation)),t.workspace=e.transformIncomingURIs(t.workspace),t}};function OJ(i){return{transformIncoming:t=>t.scheme==="vscode-remote"?{scheme:"file",path:t.path,query:t.query,fragment:t.fragment}:t.scheme==="file"?{scheme:"vscode-local",path:t.path,query:t.query,fragment:t.fragment}:t,transformOutgoing:t=>t.scheme==="file"?{scheme:"vscode-remote",authority:i,path:t.path,query:t.query,fragment:t.fragment}:t.scheme==="vscode-local"?{scheme:"file",path:t.path,query:t.query,fragment:t.fragment}:t,transformOutgoingScheme:t=>t==="file"?"vscode-remote":t==="vscode-local"?"file":t}}function V5(i){return new oS(OJ(i))}var Rf=class i{constructor(t){this.pipeName=t;this.type=1}static{this.ENV_KEY="VSCODE_EXTHOST_IPC_HOOK"}serialize(t){t[i.ENV_KEY]=this.pipeName}},Bb=class i{constructor(){this.type=2}static{this.ENV_KEY="VSCODE_EXTHOST_WILL_SEND_SOCKET"}serialize(t){t[i.ENV_KEY]="1"}},$b=class i{constructor(){this.type=3}static{this.ENV_KEY="VSCODE_WILL_SEND_MESSAGE_PORT"}serialize(t){t[i.ENV_KEY]="1"}};function NJ(i){delete i[Rf.ENV_KEY],delete i[Bb.ENV_KEY],delete i[$b.ENV_KEY]}function B5(i){if(i[Rf.ENV_KEY])return PO(i,new Rf(i[Rf.ENV_KEY]));if(i[Bb.ENV_KEY])return PO(i,new Bb);if(i[$b.ENV_KEY])return PO(i,new $b);throw new Error("No connection information defined in environment!")}function PO(i,t){return NJ(i),t}var lGe=new k("inOutput",!1),dGe=new k("activeLogOutput",!1),cGe=new k("activeLogOutput.isLog",!1),uGe=new k("activeLogOutput.levelSettable",!1),pGe=new k("activeLogOutput.level",""),mGe=new k("activeLogOutput.levelIsDefault",!1),gGe=new k("outputView.scrollLock",!1),fGe=new k("activeOutputChannel",""),hGe=new k("output.filter.trace",!0),vGe=new k("output.filter.debug",!0),yGe=new k("output.filter.info",!0),bGe=new k("output.filter.warning",!0),IGe=new k("output.filter.error",!0),xGe=new k("outputFilterFocus",!1),SGe=new k("output.filter.categories",""),CGe=A("outputService");var UJ={OutputChannels:"workbench.contributions.outputChannels"};function FJ(i){return Array.isArray(i.source)}var _O=class extends N{constructor(){super(...arguments);this.channels=new Map;this._onDidRegisterChannel=this._register(new T);this.onDidRegisterChannel=this._onDidRegisterChannel.event;this._onDidRemoveChannel=this._register(new T);this.onDidRemoveChannel=this._onDidRemoveChannel.event;this._onDidUpdateChannelFiles=this._register(new T);this.onDidUpdateChannelSources=this._onDidUpdateChannelFiles.event}registerChannel(e){this.channels.has(e.id)||(this.channels.set(e.id,e),this._onDidRegisterChannel.fire(e.id))}getChannels(){let e=[];return this.channels.forEach(n=>e.push(n)),e}getChannel(e){return this.channels.get(e)}updateChannelSources(e,n){let o=this.channels.get(e);o&&FJ(o)&&(o.source=n,this._onDidUpdateChannelFiles.fire(o))}removeChannel(e){let n=this.channels.get(e);n&&(this.channels.delete(e),this._onDidRemoveChannel.fire(n))}};wt.add(UJ.OutputChannels,new _O);var Vw=class extends od{constructor(e,n,o,r,s){super();this.id=e;this.name=n;this.logger=o;this.proxy=r;this.extension=s;this.offset=0;this.visible=!1;this.setLevel(o.getLevel()),this._register(o.onDidChangeLogLevel(a=>this.setLevel(a))),this._register(q(()=>this.proxy.$dispose(this.id)))}get logLevel(){return this.getLevel()}appendLine(e){this.append(e+`
`)}append(e){this.info(e)}clear(){let e=this.offset;this.logger.flush(),this.proxy.$update(this.id,3,e)}replace(e){let n=this.offset;this.info(e),this.proxy.$update(this.id,2,n),this.visible&&this.logger.flush()}show(e,n){this.logger.flush(),this.proxy.$reveal(this.id,!!(typeof e=="boolean"?e:n))}hide(){this.proxy.$close(this.id)}log(e,n){this.offset+=H.fromString(n).byteLength,zW(this.logger,e,n),this.visible&&(this.logger.flush(),this.proxy.$update(this.id,1))}},RO=class extends Vw{appendLine(t){this.append(t)}},Df=class{constructor(t,e,n,o,r,s){this.initData=e;this.extHostFileSystem=n;this.extHostFileSystemInfo=o;this.loggerService=r;this.logService=s;this.extensionLogDirectoryCreationPromise=new Ve;this.logOutputChannels=new Ve;this.namePool=1;this.channels=new Map;this.visibleChannelId=null;this.proxy=t.getProxy(F.MainThreadOutputService),this.outputsLocation=this.extHostFileSystemInfo.extUri.joinPath(e.logsLocation,`output_logging_${D5(new Date).replace(/-|:|\.\d+Z$/g,"")}`)}$setVisibleChannel(t){this.visibleChannelId=t;for(let[e,n]of this.channels)n.visible=e===this.visibleChannelId}createOutputChannel(t,e,n){if(t=t.trim(),!t)throw new Error("illegal argument `name`. must not be falsy");let o=typeof e=="object"&&e.log,r=Pe(e)?e:void 0;if(Pe(r)&&!r.trim())throw new Error("illegal argument `languageId`. must not be empty");let s=new $,a,l=this.initData.environment.extensionLogLevel?.find(([c])=>xe.equals(n.identifier,c))?.[1],d;if(o){let c=this.extHostFileSystemInfo.extUri.joinPath(this.initData.logsLocation,n.identifier.value);d=this.extHostFileSystemInfo.extUri.joinPath(c,`${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);let u=this.logOutputChannels.get(d);if(u)return u;let m=this.loggerService.getRegisteredLogger(d);m?.logLevel!==void 0&&(l=m.logLevel),a=this.doCreateLogOutputChannel(t,d,l,n,s)}else a=this.doCreateOutputChannel(t,r,n,s);if(a.then(c=>{this.channels.set(c.id,c),c.visible=c.id===this.visibleChannelId,s.add(q(()=>{this.channels.delete(c.id),d&&this.logOutputChannels.delete(d)}))}),d){let c=this.createExtHostLogOutputChannel(t,l??this.logService.getLevel(),a,s);return this.logOutputChannels.set(d,c),c}return this.createExtHostOutputChannel(t,a,s)}async doCreateOutputChannel(t,e,n,o){this.outputDirectoryPromise||(this.outputDirectoryPromise=this.extHostFileSystem.value.createDirectory(this.outputsLocation).then(()=>this.outputsLocation));let r=await this.outputDirectoryPromise,s=this.extHostFileSystemInfo.extUri.joinPath(r,`${this.namePool++}-${t.replace(/[\\/:\*\?"<>\|]/g,"")}.log`),a=o.add(this.loggerService.createLogger(s,{logLevel:"always",donotRotate:!0,donotUseFormatters:!0,hidden:!0})),l=await this.proxy.$register(t,s,e,n.identifier.value);return o.add(q(()=>this.loggerService.deregisterLogger(s))),new Vw(l,t,a,this.proxy,n)}async doCreateLogOutputChannel(t,e,n,o,r){await this.createExtensionLogDirectory(e);let s=`${o.identifier.value}.${this.extHostFileSystemInfo.extUri.basename(e)}`,a=r.add(this.loggerService.createLogger(e,{id:s,name:t,logLevel:n,extensionId:o.identifier.value}));return r.add(q(()=>this.loggerService.deregisterLogger(e))),new RO(s,t,a,this.proxy,o)}createExtensionLogDirectory(t){let e=this.extHostFileSystemInfo.extUri.dirname(t),n=this.extensionLogDirectoryCreationPromise.get(e);return n||this.extensionLogDirectoryCreationPromise.set(e,n=(async()=>{try{await this.extHostFileSystem.value.createDirectory(e)}catch(o){if(im(o)!=="EntryExists")throw o}})()),n}createExtHostOutputChannel(t,e,n){let o=()=>{if(n.isDisposed)throw new Error("Channel has been closed")};return e.then(r=>n.add(r)),{get name(){return t},append(r){o(),e.then(s=>s.append(r))},appendLine(r){o(),e.then(s=>s.appendLine(r))},clear(){o(),e.then(r=>r.clear())},replace(r){o(),e.then(s=>s.replace(r))},show(r,s){o(),e.then(a=>a.show(r,s))},hide(){o(),e.then(r=>r.hide())},dispose(){n.dispose()}}}createExtHostLogOutputChannel(t,e,n,o){let r=()=>{if(o.isDisposed)throw new Error("Channel has been closed")},s=o.add(new T);function a(l){e=l,s.fire(l)}return n.then(l=>{l.logLevel!==e&&a(l.logLevel),o.add(l.onDidChangeLogLevel(d=>a(d)))}),{...this.createExtHostOutputChannel(t,n,o),get logLevel(){return e},onDidChangeLogLevel:s.event,trace(l,...d){r(),n.then(c=>c.trace(l,...d))},debug(l,...d){r(),n.then(c=>c.debug(l,...d))},info(l,...d){r(),n.then(c=>c.info(l,...d))},warn(l,...d){r(),n.then(c=>c.warn(l,...d))},error(l,...d){r(),n.then(c=>c.error(l,...d))}}}};Df=_([S(0,le),S(1,Ye),S(2,oa),S(3,ai),S(4,ir),S(5,te)],Df);var Bw=A("IExtHostOutputService");var ia=class{constructor(t,e){this._logService=e;this._provider=new Map;this._proxy=t.getProxy(F.MainThreadDecorations)}static{this._handlePool=0}static{this._maxEventSize=250}registerFileDecorationProvider(t,e){let n=ia._handlePool++;this._provider.set(n,{provider:t,extensionDescription:e}),this._proxy.$registerDecorationProvider(n,e.identifier.value);let o=t.onDidChangeFileDecorations&&t.onDidChangeFileDecorations(r=>{if(!r){this._proxy.$onDidChange(n,null);return}let s=On(r);if(s.length<=ia._maxEventSize){this._proxy.$onDidChange(n,s);return}this._logService.warn("[Decorations] CAPPING events from decorations provider",e.identifier.value,s.length);let a=s.map(c=>({uri:c,rank:d2(c.path,"/")})),l=hH(a,(c,u)=>c.rank-u.rank||Ri(c.uri.path,u.uri.path)),d=[];e:for(let c of l){let u;for(let m of c){let g=gn(m.uri.path);if(u!==g&&(u=g,d.push(m.uri)>=ia._maxEventSize))break e}}this._proxy.$onDidChange(n,d)});return new Se(()=>{o?.dispose(),this._proxy.$unregisterDecorationProvider(n),this._provider.delete(n)})}async $provideDecorations(t,e,n){if(!this._provider.has(t))return Object.create(null);let o=Object.create(null),{provider:r,extensionDescription:s}=this._provider.get(t);return await Promise.all(e.map(async a=>{try{let{uri:l,id:d}=a,c=await Promise.resolve(r.provideFileDecoration(y.revive(l),n));if(!c)return;try{Au.validate(c),c.badge&&typeof c.badge!="string"&&M(s,"codiconDecoration"),o[d]=[c.propagate,c.tooltip,c.badge,c.color]}catch(u){this._logService.warn(`INVALID decoration from extension '${s.identifier.value}': ${u}`)}}catch(l){this._logService.error(l)}})),o}};ia=_([S(0,le),S(1,te)],ia);var $w=A("IExtHostDecorations");var zw=class{constructor(t){this.values=t,this.prefixSum=new Uint32Array(t.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}getCount(){return this.values.length}insertValues(t,e){t=Dc(t);let n=this.values,o=this.prefixSum,r=e.length;return r===0?!1:(this.values=new Uint32Array(n.length+r),this.values.set(n.subarray(0,t),0),this.values.set(n.subarray(t),t+r),this.values.set(e,t),t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(t,e){return t=Dc(t),e=Dc(e),this.values[t]===e?!1:(this.values[t]=e,t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),!0)}removeValues(t,e){t=Dc(t),e=Dc(e);let n=this.values,o=this.prefixSum;if(t>=n.length)return!1;let r=n.length-t;return e>=r&&(e=r),e===0?!1:(this.values=new Uint32Array(n.length-e),this.values.set(n.subarray(0,t),0),this.values.set(n.subarray(t+e),t),this.prefixSum=new Uint32Array(this.values.length),t-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=t-1),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(t){return t<0?0:(t=Dc(t),this._getPrefixSum(t))}_getPrefixSum(t){if(t<=this.prefixSumValidIndex[0])return this.prefixSum[t];let e=this.prefixSumValidIndex[0]+1;e===0&&(this.prefixSum[0]=this.values[0],e++),t>=this.values.length&&(t=this.values.length-1);for(let n=e;n<=t;n++)this.prefixSum[n]=this.prefixSum[n-1]+this.values[n];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],t),this.prefixSum[t]}getIndexOf(t){t=Math.floor(t),this.getTotalSum();let e=0,n=this.values.length-1,o=0,r=0,s=0;for(;e<=n;)if(o=e+(n-e)/2|0,r=this.prefixSum[o],s=r-this.values[o],t<s)n=o-1;else if(t>=r)e=o+1;else break;return new DO(o,t-s)}};var DO=class{constructor(t,e){this.index=t;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=t,this.remainder=e}};var qw=class{constructor(t,e,n,o){this._uri=t,this._lines=e,this._eol=n,this._versionId=o,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(t){t.eol&&t.eol!==this._eol&&(this._eol=t.eol,this._lineStarts=null);let e=t.changes;for(let n of e)this._acceptDeleteRange(n.range),this._acceptInsertText(new Un(n.range.startLineNumber,n.range.startColumn),n.text);this._versionId=t.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let t=this._eol.length,e=this._lines.length,n=new Uint32Array(e);for(let o=0;o<e;o++)n[o]=this._lines[o].length+t;this._lineStarts=new zw(n)}}_setLineText(t,e){this._lines[t]=e,this._lineStarts&&this._lineStarts.setValue(t,this._lines[t].length+this._eol.length)}_acceptDeleteRange(t){if(t.startLineNumber===t.endLineNumber){if(t.startColumn===t.endColumn)return;this._setLineText(t.startLineNumber-1,this._lines[t.startLineNumber-1].substring(0,t.startColumn-1)+this._lines[t.startLineNumber-1].substring(t.endColumn-1));return}this._setLineText(t.startLineNumber-1,this._lines[t.startLineNumber-1].substring(0,t.startColumn-1)+this._lines[t.endLineNumber-1].substring(t.endColumn-1)),this._lines.splice(t.startLineNumber,t.endLineNumber-t.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(t.startLineNumber,t.endLineNumber-t.startLineNumber)}_acceptInsertText(t,e){if(e.length===0)return;let n=xx(e);if(n.length===1){this._setLineText(t.lineNumber-1,this._lines[t.lineNumber-1].substring(0,t.column-1)+n[0]+this._lines[t.lineNumber-1].substring(t.column-1));return}n[n.length-1]+=this._lines[t.lineNumber-1].substring(t.column-1),this._setLineText(t.lineNumber-1,this._lines[t.lineNumber-1].substring(0,t.column-1)+n[0]);let o=new Uint32Array(n.length-1);for(let r=1;r<n.length;r++)this._lines.splice(t.lineNumber+r-1,0,n[r]),o[r-1]=n[r].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(t.lineNumber,o)}};var AO=new Map;function $5(i,t){t?AO.set(i,t):AO.delete(i)}function HJ(i){return AO.get(i)}var Kw=class extends qw{constructor(e,n,o,r,s,a,l,d,c=!0){super(n,o,r,s);this._proxy=e;this._languageId=a;this._isDirty=l;this._encoding=d;this._strictInstanceofChecks=c;this._isDisposed=!1}dispose(){Xn(!this._isDisposed),this._isDisposed=!0,this._isDirty=!1}equalLines(e){return dn(this._lines,e)}get document(){if(!this._document){let e=this;this._document={get uri(){return e._uri},get fileName(){return e._uri.fsPath},get isUntitled(){return e._uri.scheme===B.untitled},get languageId(){return e._languageId},get version(){return e._versionId},get isClosed(){return e._isDisposed},get isDirty(){return e._isDirty},get encoding(){return e._encoding},save(){return e._save()},getText(n){return n?e._getTextInRange(n):e.getText()},get eol(){return e._eol===`
`?1:2},get lineCount(){return e._lines.length},lineAt(n){return e._lineAt(n)},offsetAt(n){return e._offsetAt(n)},positionAt(n){return e._positionAt(n)},validateRange(n){return e._validateRange(n)},validatePosition(n){return e._validatePosition(n)},getWordRangeAtPosition(n,o){return e._getWordRangeAtPosition(n,o)},[Symbol.for("debug.description")](){return`TextDocument(${e._uri.toString()})`}}}return Object.freeze(this._document)}_acceptLanguageId(e){Xn(!this._isDisposed),this._languageId=e}_acceptIsDirty(e){Xn(!this._isDisposed),this._isDirty=e}_acceptEncoding(e){Xn(!this._isDisposed),this._encoding=e}_save(){return this._isDisposed?Promise.reject(new Error("Document has been closed")):this._proxy.$trySaveDocument(this._uri)}_getTextInRange(e){let n=this._validateRange(e);if(n.isEmpty)return"";if(n.isSingleLine)return this._lines[n.start.line].substring(n.start.character,n.end.character);let o=this._eol,r=n.start.line,s=n.end.line,a=[];a.push(this._lines[r].substring(n.start.character));for(let l=r+1;l<s;l++)a.push(this._lines[l]);return a.push(this._lines[s].substring(0,n.end.character)),a.join(o)}_lineAt(e){let n;if(e instanceof De?n=e.line:typeof e=="number"?n=e:!this._strictInstanceofChecks&&De.isPosition(e)&&(n=e.line),typeof n!="number"||n<0||n>=this._lines.length||Math.floor(n)!==n)throw new Error("Illegal value for `line`");return new MO(n,this._lines[n],n===this._lines.length-1)}_offsetAt(e){return e=this._validatePosition(e),this._ensureLineStarts(),this._lineStarts.getPrefixSum(e.line-1)+e.character}_positionAt(e){e=Math.floor(e),e=Math.max(0,e),this._ensureLineStarts();let n=this._lineStarts.getIndexOf(e),o=this._lines[n.index].length;return new De(n.index,Math.min(n.remainder,o))}_validateRange(e){if(this._strictInstanceofChecks){if(!(e instanceof ve))throw new Error("Invalid argument")}else if(!ve.isRange(e))throw new Error("Invalid argument");let n=this._validatePosition(e.start),o=this._validatePosition(e.end);return n===e.start&&o===e.end?e:new ve(n.line,n.character,o.line,o.character)}_validatePosition(e){if(this._strictInstanceofChecks){if(!(e instanceof De))throw new Error("Invalid argument")}else if(!De.isPosition(e))throw new Error("Invalid argument");if(this._lines.length===0)return e.with(0,0);let{line:n,character:o}=e,r=!1;if(n<0)n=0,o=0,r=!0;else if(n>=this._lines.length)n=this._lines.length-1,o=this._lines[n].length,r=!0;else{let s=this._lines[n].length;o<0?(o=0,r=!0):o>s&&(o=s,r=!0)}return r?new De(n,o):e}_getWordRangeAtPosition(e,n){let o=this._validatePosition(e);if(!n)n=HJ(this._languageId);else if(Ix(n))throw new Error(`[getWordRangeAtPosition]: ignoring custom regexp '${n.source}' because it matches the empty string.`);let r=$D(o.character+1,BD(n),this._lines[o.line],0);if(r)return new ve(o.line,r.startColumn-1,o.line,r.endColumn-1)}},MO=class{constructor(t,e,n){this._line=t,this._text=e,this._isLastLine=n}get lineNumber(){return this._line}get text(){return this._text}get range(){return new ve(this._line,0,this._line,this._text.length)}get rangeIncludingLineBreak(){return this._isLastLine?this.range:new ve(this._line,0,this._line+1,0)}get firstNonWhitespaceCharacterIndex(){return/^(\s*)/.exec(this._text)[1].length}get isEmptyOrWhitespace(){return this.firstNonWhitespaceCharacterIndex===this._text.length}};var uc=class{constructor(t){this._prefix=t,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},RQe=new uc("id#");var jw=class i{static{this._Keys=new uc("TextEditorDecorationType")}constructor(t,e,n){let o=i._Keys.nextId();t.$registerTextEditorDecorationType(e.identifier,o,aL.from(n)),this.value=Object.freeze({key:o,dispose(){t.$removeTextEditorDecorationType(o)}})}},LO=class{constructor(t,e){this._collectedEdits=[];this._setEndOfLine=void 0;this._finalized=!1;this._document=t,this._documentVersionId=t.version,this._undoStopBefore=e.undoStopBefore,this._undoStopAfter=e.undoStopAfter}finalize(){return this._finalized=!0,{documentVersionId:this._documentVersionId,edits:this._collectedEdits,setEndOfLine:this._setEndOfLine,undoStopBefore:this._undoStopBefore,undoStopAfter:this._undoStopAfter}}_throwIfFinalized(){if(this._finalized)throw new Error("Edit is only valid while callback runs")}replace(t,e){this._throwIfFinalized();let n=null;if(t instanceof De)n=new ve(t,t);else if(t instanceof ve)n=t;else throw new Error("Unrecognized location");this._pushEdit(n,e,!1)}insert(t,e){this._throwIfFinalized(),this._pushEdit(new ve(t,t),e,!0)}delete(t){this._throwIfFinalized();let e=null;if(t instanceof ve)e=t;else throw new Error("Unrecognized location");this._pushEdit(e,null,!0)}_pushEdit(t,e,n){let o=this._document.validateRange(t);this._collectedEdits.push({range:o,text:e,forceMoveMarkers:n})}setEndOfLine(t){if(this._throwIfFinalized(),t!==1&&t!==2)throw $e("endOfLine");this._setEndOfLine=t}},OO=class{constructor(t,e,n,o){this._proxy=t,this._id=e,this._accept(n),this._logService=o;let r=this;this.value={get tabSize(){return r._tabSize},set tabSize(s){r._setTabSize(s)},get indentSize(){return r._indentSize},set indentSize(s){r._setIndentSize(s)},get insertSpaces(){return r._insertSpaces},set insertSpaces(s){r._setInsertSpaces(s)},get cursorStyle(){return r._cursorStyle},set cursorStyle(s){r._setCursorStyle(s)},get lineNumbers(){return r._lineNumbers},set lineNumbers(s){r._setLineNumbers(s)}}}_accept(t){this._tabSize=t.tabSize,this._indentSize=t.indentSize,this._originalIndentSize=t.originalIndentSize,this._insertSpaces=t.insertSpaces,this._cursorStyle=t.cursorStyle,this._lineNumbers=Ju.to(t.lineNumbers)}_validateTabSize(t){if(t==="auto")return"auto";if(typeof t=="number"){let e=Math.floor(t);return e>0?e:null}if(typeof t=="string"){let e=parseInt(t,10);return isNaN(e)?null:e>0?e:null}return null}_setTabSize(t){let e=this._validateTabSize(t);if(e!==null){if(typeof e=="number"){if(this._tabSize===e)return;this._tabSize=e}this._warnOnError("setTabSize",this._proxy.$trySetOptions(this._id,{tabSize:e}))}}_validateIndentSize(t){if(t==="tabSize")return"tabSize";if(typeof t=="number"){let e=Math.floor(t);return e>0?e:null}if(typeof t=="string"){let e=parseInt(t,10);return isNaN(e)?null:e>0?e:null}return null}_setIndentSize(t){let e=this._validateIndentSize(t);if(e!==null){if(typeof e=="number"){if(this._originalIndentSize===e)return;this._indentSize=e,this._originalIndentSize=e}this._warnOnError("setIndentSize",this._proxy.$trySetOptions(this._id,{indentSize:e}))}}_validateInsertSpaces(t){return t==="auto"?"auto":t==="false"?!1:!!t}_setInsertSpaces(t){let e=this._validateInsertSpaces(t);if(typeof e=="boolean"){if(this._insertSpaces===e)return;this._insertSpaces=e}this._warnOnError("setInsertSpaces",this._proxy.$trySetOptions(this._id,{insertSpaces:e}))}_setCursorStyle(t){this._cursorStyle!==t&&(this._cursorStyle=t,this._warnOnError("setCursorStyle",this._proxy.$trySetOptions(this._id,{cursorStyle:t})))}_setLineNumbers(t){this._lineNumbers!==t&&(this._lineNumbers=t,this._warnOnError("setLineNumbers",this._proxy.$trySetOptions(this._id,{lineNumbers:Ju.from(t)})))}assign(t){let e={},n=!1;if(typeof t.tabSize<"u"){let o=this._validateTabSize(t.tabSize);o==="auto"?(n=!0,e.tabSize=o):typeof o=="number"&&this._tabSize!==o&&(this._tabSize=o,n=!0,e.tabSize=o)}if(typeof t.indentSize<"u"){let o=this._validateIndentSize(t.indentSize);o==="tabSize"?(n=!0,e.indentSize=o):typeof o=="number"&&this._originalIndentSize!==o&&(this._indentSize=o,this._originalIndentSize=o,n=!0,e.indentSize=o)}if(typeof t.insertSpaces<"u"){let o=this._validateInsertSpaces(t.insertSpaces);o==="auto"?(n=!0,e.insertSpaces=o):this._insertSpaces!==o&&(this._insertSpaces=o,n=!0,e.insertSpaces=o)}typeof t.cursorStyle<"u"&&this._cursorStyle!==t.cursorStyle&&(this._cursorStyle=t.cursorStyle,n=!0,e.cursorStyle=t.cursorStyle),typeof t.lineNumbers<"u"&&this._lineNumbers!==t.lineNumbers&&(this._lineNumbers=t.lineNumbers,n=!0,e.lineNumbers=Ju.from(t.lineNumbers)),n&&this._warnOnError("setOptions",this._proxy.$trySetOptions(this._id,e))}_warnOnError(t,e){e.catch(n=>{this._logService.warn(`ExtHostTextEditorOptions '${t}' failed:'`),this._logService.warn(n)})}},Gw=class{constructor(t,e,n,o,r,s,a,l){this.id=t;this._proxy=e;this._logService=n;this._disposed=!1;this._hasDecorationsForKey=new Set;this._selections=r,this._options=new OO(this._proxy,this.id,s,n),this._visibleRanges=a,this._viewColumn=l;let d=this;this.value=Object.freeze({get document(){return o.value},set document(c){throw new wi("document")},get selection(){return d._selections&&d._selections[0]},set selection(c){if(!(c instanceof oo))throw $e("selection");d._selections=[c],d._trySetSelection()},get selections(){return d._selections},set selections(c){if(!Array.isArray(c)||c.some(u=>!(u instanceof oo)))throw $e("selections");c.length===0&&(c=[new oo(0,0,0,0)]),d._selections=c,d._trySetSelection()},get visibleRanges(){return d._visibleRanges},set visibleRanges(c){throw new wi("visibleRanges")},get diffInformation(){return d._diffInformation},get options(){return d._options.value},set options(c){d._disposed||d._options.assign(c)},get viewColumn(){return d._viewColumn},set viewColumn(c){throw new wi("viewColumn")},edit(c,u={undoStopBefore:!0,undoStopAfter:!0}){if(d._disposed)return Promise.reject(new Error("TextEditor#edit not possible on closed editors"));let m=new LO(o.value,u);return c(m),d._applyEdit(m)},insertSnippet(c,u,m={undoStopBefore:!0,undoStopAfter:!0}){if(d._disposed)return Promise.reject(new Error("TextEditor#insertSnippet not possible on closed editors"));let g;if(!u||Array.isArray(u)&&u.length===0)g=d._selections.map(h=>K.from(h));else if(u instanceof De){let{lineNumber:h,column:f}=ht.from(u);g=[{startLineNumber:h,startColumn:f,endLineNumber:h,endColumn:f}]}else if(u instanceof ve)g=[K.from(u)];else{g=[];for(let h of u)if(h instanceof ve)g.push(K.from(h));else{let{lineNumber:f,column:I}=ht.from(h);g.push({startLineNumber:f,startColumn:I,endLineNumber:f,endColumn:I})}}return m.keepWhitespace===void 0&&(m.keepWhitespace=!1),e.$tryInsertSnippet(t,o.value.version,c.value,g,m)},setDecorations(c,u){let m=u.length===0;m&&!d._hasDecorationsForKey.has(c.key)||(m?d._hasDecorationsForKey.delete(c.key):d._hasDecorationsForKey.add(c.key),d._runOnProxy(()=>{if(sL(u))return e.$trySetDecorations(t,c.key,O$(u));{let g=new Array(4*u.length);for(let h=0,f=u.length;h<f;h++){let I=u[h];g[4*h]=I.start.line+1,g[4*h+1]=I.start.character+1,g[4*h+2]=I.end.line+1,g[4*h+3]=I.end.character+1}return e.$trySetDecorationsFast(t,c.key,g)}}))},revealRange(c,u){d._runOnProxy(()=>e.$tryRevealRange(t,K.from(c),u||0))},show(c){e.$tryShowEditor(t,zt.from(c))},hide(){e.$tryHideEditor(t)},[Symbol.for("debug.description")](){return`TextEditor(${this.document.uri.toString()})`}})}dispose(){Xn(!this._disposed),this._disposed=!0}_acceptOptions(t){Xn(!this._disposed),this._options._accept(t)}_acceptVisibleRanges(t){Xn(!this._disposed),this._visibleRanges=t}_acceptViewColumn(t){Xn(!this._disposed),this._viewColumn=t}_acceptSelections(t){Xn(!this._disposed),this._selections=t}_acceptDiffInformation(t){Xn(!this._disposed),this._diffInformation=t}async _trySetSelection(){let t=this._selections.map(Do.from);return await this._runOnProxy(()=>this._proxy.$trySetSelections(this.id,t)),this.value}_applyEdit(t){let e=t.finalize();if(e.edits.length===0&&!e.setEndOfLine)return Promise.resolve(!0);let n=e.edits.map(r=>r.range);n.sort((r,s)=>r.end.line===s.end.line?r.end.character===s.end.character?r.start.line===s.start.line?r.start.character-s.start.character:r.start.line-s.start.line:r.end.character-s.end.character:r.end.line-s.end.line);for(let r=0,s=n.length-1;r<s;r++){let a=n[r].end;if(n[r+1].start.isBefore(a))return Promise.reject(new Error("Overlapping ranges are not allowed!"))}let o=e.edits.map(r=>({range:K.from(r.range),text:r.text,forceMoveMarkers:r.forceMoveMarkers}));return this._proxy.$tryApplyEdits(this.id,e.documentVersionId,o,{setEndOfLine:typeof e.setEndOfLine=="number"?qu.from(e.setEndOfLine):void 0,undoStopBefore:e.undoStopBefore,undoStopAfter:e.undoStopAfter})}_runOnProxy(t){return this._disposed?(this._logService.warn("TextEditor is closed/disposed"),Promise.resolve(void 0)):t().then(()=>this,e=>(e instanceof Error&&e.name==="DISPOSED"||this._logService.warn(e),null))}};var NO=class{constructor(t){this.value=t;this._count=0}ref(){this._count++}unref(){return--this._count===0}},Af=class{constructor(t,e){this._extHostRpc=t;this._logService=e;this._activeEditorId=null;this._editors=new Map;this._documents=new Ve;this._onDidAddDocuments=new T;this._onDidRemoveDocuments=new T;this._onDidChangeVisibleTextEditors=new T;this._onDidChangeActiveTextEditor=new T;this.onDidAddDocuments=this._onDidAddDocuments.event;this.onDidRemoveDocuments=this._onDidRemoveDocuments.event;this.onDidChangeVisibleTextEditors=this._onDidChangeVisibleTextEditors.event;this.onDidChangeActiveTextEditor=this._onDidChangeActiveTextEditor.event}$acceptDocumentsAndEditorsDelta(t){this.acceptDocumentsAndEditorsDelta(t)}acceptDocumentsAndEditorsDelta(t){let e=[],n=[],o=[];if(t.removedDocuments)for(let r of t.removedDocuments){let s=y.revive(r),a=this._documents.get(s);a?.unref()&&(this._documents.delete(s),e.push(a.value))}if(t.addedDocuments)for(let r of t.addedDocuments){let s=y.revive(r.uri),a=this._documents.get(s);if(a&&s.scheme!==B.vscodeNotebookCell&&s.scheme!==B.vscodeInteractiveInput)throw new Error(`document '${s} already exists!'`);a||(a=new NO(new Kw(this._extHostRpc.getProxy(F.MainThreadDocuments),s,r.lines,r.EOL,r.versionId,r.languageId,r.isDirty,r.encoding)),this._documents.set(s,a),n.push(a.value)),a.ref()}if(t.removedEditors)for(let r of t.removedEditors){let s=this._editors.get(r);this._editors.delete(r),s&&o.push(s)}if(t.addedEditors)for(let r of t.addedEditors){let s=y.revive(r.documentUri);Xn(this._documents.has(s),`document '${s}' does not exist`),Xn(!this._editors.has(r.id),`editor '${r.id}' already exists!`);let a=this._documents.get(s).value,l=new Gw(r.id,this._extHostRpc.getProxy(F.MainThreadTextEditors),this._logService,new mt(()=>a.document),r.selections.map(Do.to),r.options,r.visibleRanges.map(d=>K.to(d)),typeof r.editorPosition=="number"?zt.to(r.editorPosition):void 0);this._editors.set(r.id,l)}t.newActiveEditor!==void 0&&(Xn(t.newActiveEditor===null||this._editors.has(t.newActiveEditor),`active editor '${t.newActiveEditor}' does not exist`),this._activeEditorId=t.newActiveEditor),In(e),In(o),t.removedDocuments&&this._onDidRemoveDocuments.fire(e),t.addedDocuments&&this._onDidAddDocuments.fire(n),(t.removedEditors||t.addedEditors)&&this._onDidChangeVisibleTextEditors.fire(this.allEditors().map(r=>r.value)),t.newActiveEditor!==void 0&&this._onDidChangeActiveTextEditor.fire(this.activeEditor())}getDocument(t){return this._documents.get(t)?.value}allDocuments(){return Mt.map(this._documents.values(),t=>t.value)}getEditor(t){return this._editors.get(t)}activeEditor(t){if(!this._activeEditorId)return;let e=this._editors.get(this._activeEditorId);return t?e:e?.value}allEditors(){return[...this._editors.values()]}};Af=_([S(0,le),S(1,te)],Af);var Kr=A("IExtHostDocumentsAndEditors");var WJ={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:p(19995,null)},required:{type:"array",markdownDescription:p(19997,null),items:{type:"string"}},properties:{type:"object",description:p(19996,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:p(19998,null),default:""}}},z5;(t=>{function i(e,n,o){if(!e)return;let r=Pe(e.type)?e.type:void 0;if(!r||r.length===0){o.error(p(20000,null));return}let s=[];if(Array.isArray(e.required))for(let a of e.required)Pe(a)&&s.push(a);return{extensionId:n.value,taskType:r,required:s,properties:e.properties?ft(e.properties):{},when:e.when?lt.deserialize(e.when):void 0}}t.from=i})(z5||={});var VJ=TC.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(i){for(let t of i)t.type&&(yield`onTaskType:${t.type}`)},jsonSchema:{description:p(19999,null),type:"array",items:WJ}}),UO=class{constructor(){this._onDefinitionsChanged=new T;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((t,e)=>{VJ.setHandler((n,o)=>{this._schema=void 0;try{for(let r of o.removed){let s=r.value;for(let a of s)this.taskTypes&&a.type&&this.taskTypes[a.type]&&delete this.taskTypes[a.type]}for(let r of o.added){let s=r.value;for(let a of s){let l=z5.from(a,r.description.identifier,r.collector);l&&(this.taskTypes[l.taskType]=l)}}(o.removed.length>0||o.added.length>0)&&this._onDefinitionsChanged.fire()}catch{}t(void 0)})})}onReady(){return this.readyPromise}get(t){return this.taskTypes[t]}all(){return Object.keys(this.taskTypes).map(t=>this.taskTypes[t])}getJsonSchema(){if(this._schema===void 0){let t=[];for(let e of this.all()){let n={type:"object",additionalProperties:!1};e.required.length>0&&(n.required=e.required.slice(0)),e.properties!==void 0?n.properties=ft(e.properties):n.properties=Object.create(null),n.properties.type={type:"string",enum:[e.taskType]},t.push(n)}this._schema={oneOf:t}}return this._schema}},q5=new UO;var K5="settings",fJe=new k("taskRunning",!1,p(20003,null)),hJe=new k("taskTerminalActive",!1,p(20005,null)),vJe=xa(20004,"Tasks"),HO=(n=>(n[n.Escape=1]="Escape",n[n.Strong=2]="Strong",n[n.Weak=3]="Weak",n))(HO||{});(t=>{function i(e){if(!e)return 2;switch(e.toLowerCase()){case"escape":return 1;case"strong":return 2;case"weak":return 3;default:return 2}}t.from=i})(HO||={});var BJ;(t=>t.defaults={cwd:"${workspaceFolder}"})(BJ||={});var WO=(n=>(n[n.Always=1]="Always",n[n.Silent=2]="Silent",n[n.Never=3]="Never",n))(WO||{});(t=>{function i(e){switch(e.toLowerCase()){case"always":return 1;case"silent":return 2;case"never":return 3;default:return 1}}t.fromString=i})(WO||={});var VO=(n=>(n[n.Never=1]="Never",n[n.OnProblem=2]="OnProblem",n[n.Always=3]="Always",n))(VO||{});(t=>{function i(e){switch(e.toLowerCase()){case"always":return 3;case"never":return 1;case"onproblem":return 2;default:return 2}}t.fromString=i})(VO||={});var BO=(n=>(n[n.Shared=1]="Shared",n[n.Dedicated=2]="Dedicated",n[n.New=3]="New",n))(BO||{});(t=>{function i(e){switch(e.toLowerCase()){case"shared":return 1;case"dedicated":return 2;case"new":return 3;default:return 1}}t.fromString=i})(BO||={});var $J;(t=>t.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})($J||={});var $O=(n=>(n[n.Shell=1]="Shell",n[n.Process=2]="Process",n[n.CustomExecution=3]="CustomExecution",n))($O||{});(e=>{function i(n){switch(n.toLowerCase()){case"shell":return 1;case"process":return 2;case"customExecution":return 3;default:return 2}}e.fromString=i;function t(n){switch(n){case 1:return"shell";case 2:return"process";case 3:return"customExecution";default:return"process"}}e.toString=t})($O||={});var zJ;(t=>{function i(e){return Pe(e)?e:e.value}t.value=i})(zJ||={});var qJ;(s=>{s.Clean={_id:"clean",isDefault:!1},s.Build={_id:"build",isDefault:!1},s.Rebuild={_id:"rebuild",isDefault:!1},s.Test={_id:"test",isDefault:!1};function o(a){return a===s.Clean._id||a===s.Build._id||a===s.Rebuild._id||a===s.Test._id}s.is=o;function r(a){if(a!==void 0)return Pe(a)?o(a)?{_id:a,isDefault:!1}:void 0:a}s.from=r})(qJ||={});var KJ;(s=>{s.Workspace="workspace",s.Extension="extension",s.InMemory="inMemory",s.WorkspaceFile="workspaceFile",s.User="user";function r(a){switch(a){case s.User:return 2;case s.WorkspaceFile:return 5;default:return 6}}s.toConfigurationTarget=r})(KJ||={});var jJ;(t=>t.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(jJ||={});var zO=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(zO||{});(t=>t._default=2)(zO||={});var GJ;(d=>{function i(c){return{taskId:c._id,taskName:c.configurationProperties.name,runType:c.configurationProperties.isBackground?"background":"singleRun",group:c.configurationProperties.group,__task:c}}function t(c,u,m){return{...i(c),kind:"start",terminalId:u,resolvedVariables:m}}d.start=t;function e(c,u,m){return{...i(c),kind:"processStarted",terminalId:u,processId:m}}d.processStarted=e;function n(c,u,m,g){return{...i(c),kind:"processEnded",terminalId:u,exitCode:m,durationMs:g}}d.processEnded=n;function o(c,u,m){return{...i(c),kind:"inactive",terminalId:u,durationMs:m}}d.inactive=o;function r(c,u,m){return{...i(c),kind:"terminated",exitReason:m,terminalId:u}}d.terminated=r;function s(c,u,m){return{...i(u),kind:c,terminalId:m}}d.general=s;function a(c,u,m){return{...i(c),kind:"problemMatcherEnded",hasErrors:u}}d.problemMatcherEnded=a;function l(){return{kind:"changed"}}d.changed=l})(GJ||={});var FO;(e=>{function i(n){let o=Object.keys(n).sort(),r="";for(let s of o){let a=n[s];a instanceof Object?a=i(a):typeof a=="string"&&(a=a.replace(/,/g,",,")),r+=s+","+a+","}return r}function t(n){let r={_key:i(n),type:n.taskType};return Object.assign(r,n),r}e.create=t})(FO||={});var QJ;(t=>{function i(e,n){let o=q5.get(e.type);if(o===void 0){let l=ft(e);return delete l._key,FO.create(l)}let r=Object.create(null);r.type=o.taskType;let s=new Set;o.required.forEach(l=>s.add(l));let a=o.properties;for(let l of Object.keys(a)){let d=e[l];if(d!=null)r[l]=d;else if(s.has(l)){let c=a[l];if(c.default!==void 0)r[l]=ft(c.default);else switch(c.type){case"boolean":r[l]=!1;break;case"number":case"integer":r[l]=0;break;case"string":r[l]="";break;default:n.error(p(20002,null,JSON.stringify(e,void 0,0),l));return}}}return FO.create(r)}t.createTaskIdentifier=i})(QJ||={});var yJe=za("rerun-task",de.refresh,p(20001,null));var qO;(e=>{function i(n){if(n!=null)return n}e.from=i;function t(n){if(n!=null)return n}e.to=t})(qO||={});var KO;(e=>{function i(n){if(n!=null)return n}e.from=i;function t(n){if(n!=null)return n}e.to=t})(KO||={});var j5;(e=>{function i(n){if(n!=null)return n}e.from=i;function t(n){if(n!=null)return n}e.to=t})(j5||={});var Qw;(n=>{function i(o){if(o){let r=o;return r&&!!r.process}else return!1}n.is=i;function t(o){if(o==null)return;let r={process:o.process,args:o.args};return o.options&&(r.options=j5.from(o.options)),r}n.from=t;function e(o){if(o!=null)return new Hs(o.process,o.args,o.options)}n.to=e})(Qw||={});var G5;(e=>{function i(n){if(n!=null)return n}e.from=i;function t(n){if(n!=null)return n}e.to=t})(G5||={});var Jw;(n=>{function i(o){if(o){let r=o;return r&&(!!r.commandLine||!!r.command)}else return!1}n.is=i;function t(o){if(o==null)return;let r={};return o.commandLine!==void 0?r.commandLine=o.commandLine:(r.command=o.command,r.args=o.args),o.options&&(r.options=G5.from(o.options)),r}n.from=t;function e(o){if(!(o==null||o.command===void 0&&o.commandLine===void 0))return o.commandLine?new zi(o.commandLine,o.options):new zi(o.command,o.args?o.args:[],o.options)}n.to=e})(Jw||={});var es;(n=>{function i(o){if(o){let r=o;return r&&r.customExecution==="customExecution"}else return!1}n.is=i;function t(o){return{customExecution:"customExecution"}}n.from=t;function e(o,r){return r.get(o)}n.to=e})(es||={});var jO;(t=>{function i(e,n){let o;return e.scope!==void 0&&typeof e.scope!="number"?o=e.scope.uri:e.scope!==void 0&&typeof e.scope=="number"&&(e.scope===2&&n&&n.workspaceFile?o=n.workspaceFile:o=K5),{id:e._id,workspaceFolder:o}}t.from=i})(jO||={});var Q5;(t=>{function i(e){if(e!=null)return{_id:e.id,isDefault:e.isDefault}}t.from=i})(Q5||={});var sa;(n=>{function i(o,r){if(o==null)return[];let s=[];for(let a of o){let l=t(a,r);l&&s.push(l)}return s}n.fromMany=i;function t(o,r){if(o==null)return;let s;o.execution instanceof Hs?s=Qw.from(o.execution):o.execution instanceof zi?s=Jw.from(o.execution):o.execution&&o.execution instanceof Ru&&(s=es.from(o.execution));let a=qO.from(o.definition),l;return o.scope?typeof o.scope=="number"?l=o.scope:l=o.scope.uri:l=2,!a||!l?void 0:{_id:o._id,definition:a,name:o.name,source:{extensionId:r.identifier.value,label:o.source,scope:l},execution:s,isBackground:o.isBackground,group:Q5.from(o.group),presentationOptions:KO.from(o.presentationOptions),problemMatchers:On(o.problemMatchers),hasDefinedMatchers:o.hasDefinedMatchers,runOptions:o.runOptions?o.runOptions:{reevaluateOnRerun:!0},detail:o.detail}}n.from=t;async function e(o,r,s){if(o==null)return;let a;Qw.is(o.execution)?a=Qw.to(o.execution):Jw.is(o.execution)?a=Jw.to(o.execution):es.is(o.execution)&&(a=es.to(o._id,s));let l=qO.to(o.definition),d;if(o.source&&(o.source.scope!==void 0?typeof o.source.scope=="number"?d=o.source.scope:d=await r.resolveWorkspaceFolder(y.revive(o.source.scope)):d=2),!l||!d)return;let c=new Jn(l,d,o.name,o.source.label,a,o.problemMatchers);return o.isBackground!==void 0&&(c.isBackground=o.isBackground),o.group!==void 0&&(c.group=Hn.from(o.group._id),c.group&&o.group.isDefault&&(c.group=new Hn(c.group.id,c.group.label),o.group.isDefault===!0&&(c.group.isDefault=o.group.isDefault))),o.presentationOptions&&(c.presentationOptions=KO.to(o.presentationOptions)),o.runOptions&&(c.runOptions=o.runOptions),o._id&&(c._id=o._id),o.detail&&(c.detail=o.detail),c}n.to=e})(sa||={});var J5;(e=>{function i(n){return n}e.from=i;function t(n){if(n)return Object.assign(Object.create(null),n)}e.to=t})(J5||={});var zb=class{constructor(t,e,n){this._id=e;this._task=n;this.#e=t}#e;get task(){return this._task}terminate(){this.#e.terminateTask(this)}fireDidStartProcess(t){}fireDidEndProcess(t){}get terminal(){return this._terminal}set terminal(t){this._terminal=t}},dp=class{constructor(t,e,n,o,r,s,a,l){this._onDidExecuteTask=new T;this._onDidTerminateTask=new T;this._onDidTaskProcessStarted=new T;this._onDidTaskProcessEnded=new T;this._onDidStartTaskProblemMatchers=new T;this._onDidEndTaskProblemMatchers=new T;this._proxy=t.getProxy(F.MainThreadTask),this._workspaceProvider=n,this._editorService=o,this._configurationService=r,this._terminalService=s,this._handleCounter=0,this._handlers=new Map,this._taskExecutions=new Map,this._taskExecutionPromises=new Map,this._providedCustomExecutions2=new Map,this._notProvidedCustomExecutions=new Set,this._activeCustomExecutions2=new Map,this._logService=a,this._deprecationService=l,this._proxy.$registerSupportedExecutions(!0)}registerTaskProvider(t,e,n){if(!n)return new Se(()=>{});let o=this.nextHandle();return this._handlers.set(o,{type:e,provider:n,extension:t}),this._proxy.$registerTaskProvider(o,e),new Se(()=>{this._handlers.delete(o),this._proxy.$unregisterTaskProvider(o)})}registerTaskSystem(t,e){this._proxy.$registerTaskSystem(t,e)}fetchTasks(t){return this._proxy.$fetchTasks(J5.from(t)).then(async e=>{let n=[];for(let o of e){let r=await sa.to(o,this._workspaceProvider,this._providedCustomExecutions2);r&&n.push(r)}return n})}get taskExecutions(){let t=[];return this._taskExecutions.forEach(e=>t.push(e)),t}terminateTask(t){if(!(t instanceof zb))throw new Error("No valid task execution provided");return this._proxy.$terminateTask(t._id)}get onDidStartTask(){return this._onDidExecuteTask.event}async $onDidStartTask(t,e,n){let o=this._providedCustomExecutions2.get(t.id);o&&(this._activeCustomExecutions2.set(t.id,o),this._terminalService.attachPtyToTerminal(e,await o.callback(n))),this._lastStartedTask=t.id;let r=await this.getTaskExecution(t),s=this._terminalService.getTerminalById(e)?.value;r&&(r.terminal=s),this._onDidExecuteTask.fire({execution:r})}get onDidEndTask(){return this._onDidTerminateTask.event}async $OnDidEndTask(t){if(!this._taskExecutionPromises.has(t.id))return;let e=await this.getTaskExecution(t);this._taskExecutionPromises.delete(t.id),this._taskExecutions.delete(t.id),this.customExecutionComplete(t),this._onDidTerminateTask.fire({execution:e})}get onDidStartTaskProcess(){return this._onDidTaskProcessStarted.event}async $onDidStartTaskProcess(t){let e=await this.getTaskExecution(t.id);this._onDidTaskProcessStarted.fire({execution:e,processId:t.processId})}get onDidEndTaskProcess(){return this._onDidTaskProcessEnded.event}async $onDidEndTaskProcess(t){let e=await this.getTaskExecution(t.id);this._onDidTaskProcessEnded.fire({execution:e,exitCode:t.exitCode})}get onDidStartTaskProblemMatchers(){return this._onDidStartTaskProblemMatchers.event}async $onDidStartTaskProblemMatchers(t){let e;try{e=await this.getTaskExecution(t.execution.id)}catch{return}this._onDidStartTaskProblemMatchers.fire({execution:e})}get onDidEndTaskProblemMatchers(){return this._onDidEndTaskProblemMatchers.event}async $onDidEndTaskProblemMatchers(t){let e;try{e=await this.getTaskExecution(t.execution.id)}catch{return}this._onDidEndTaskProblemMatchers.fire({execution:e,hasErrors:t.hasErrors})}$provideTasks(t,e){let n=this._handlers.get(t);if(!n)return Promise.reject(new Error("no handler found"));let o=[],r=Cn(()=>n.provider.provideTasks(pe.None)).then(s=>this.provideTasksInternal(e,o,n,s));return new Promise(s=>{r.then(a=>{Promise.all(o).then(()=>{s(a)})})})}async $resolveTask(t,e){let n=this._handlers.get(t);if(!n)return Promise.reject(new Error("no handler found"));if(e.definition.type!==n.type)throw new Error(`Unexpected: Task of type [${e.definition.type}] cannot be resolved by provider of type [${n.type}].`);let o=await sa.to(e,this._workspaceProvider,this._providedCustomExecutions2);if(!o)throw new Error("Unexpected: Task cannot be resolved.");let r=await n.provider.resolveTask(o,pe.None);if(!r)return;this.checkDeprecation(r,n);let s=sa.from(r,n.extension);if(!s)throw new Error("Unexpected: Task cannot be resolved.");if(r.definition!==o.definition)throw new Error("Unexpected: The resolved task definition must be the same object as the original task definition. The task definition cannot be changed.");return es.is(s.execution)&&await this.addCustomExecution(s,r,!0),await this.resolveTaskInternal(s)}nextHandle(){return this._handleCounter++}async addCustomExecution(t,e,n){let o=await this._proxy.$createTaskId(t);!n&&!this._providedCustomExecutions2.has(o)&&(this._notProvidedCustomExecutions.add(o),this._activeCustomExecutions2.set(o,e.execution)),this._providedCustomExecutions2.set(o,e.execution)}async getTaskExecution(t,e){if(typeof t=="string"){let r=this._taskExecutionPromises.get(t);if(!r)throw new Ln("Unexpected: The specified task is missing an execution");return r}let n=this._taskExecutionPromises.get(t.id);if(n)return n;let o;return e?o=Promise.resolve(new zb(this,t.id,e)):o=sa.to(t.task,this._workspaceProvider,this._providedCustomExecutions2).then(r=>{if(!r)throw new Ln("Unexpected: Task does not exist.");return new zb(this,t.id,r)}),this._taskExecutionPromises.set(t.id,o),o.then(r=>(this._taskExecutions.set(t.id,r),r))}checkDeprecation(t,e){t._deprecated&&this._deprecationService.report("Task.constructor",e.extension,"Use the Task constructor that takes a `scope` instead.")}customExecutionComplete(t){this._activeCustomExecutions2.get(t.id)&&this._activeCustomExecutions2.delete(t.id),this._notProvidedCustomExecutions.has(t.id)&&this._lastStartedTask!==t.id&&(this._providedCustomExecutions2.delete(t.id),this._notProvidedCustomExecutions.delete(t.id));let n=this._notProvidedCustomExecutions.values(),o=n.next();for(;!o.done;)!this._activeCustomExecutions2.has(o.value)&&this._lastStartedTask!==o.value&&(this._providedCustomExecutions2.delete(o.value),this._notProvidedCustomExecutions.delete(o.value)),o=n.next()}};dp=_([S(0,le),S(1,Ye),S(2,Vn),S(3,Kr),S(4,_n),S(5,Ao),S(6,te),S(7,Zi)],dp);var Mf=class extends dp{constructor(t,e,n,o,r,s,a,l){super(t,e,n,o,r,s,a,l),this.registerTaskSystem(B.vscodeRemote,{scheme:B.vscodeRemote,authority:"",platform:sx(0)})}async executeTask(t,e){if(!e.execution)throw new Error("Tasks to execute must include an execution");let n=sa.from(e,t);if(n===void 0)throw new Error("Task is not valid");if(es.is(n.execution))await this.addCustomExecution(n,e,!1);else throw new Tc;let o=await this.getTaskExecution(await this._proxy.$getTaskExecution(n),e);return this._proxy.$executeTask(n).catch(r=>{throw new Error(r)}),o}provideTasksInternal(t,e,n,o){let r=[];if(o)for(let s of o){if(this.checkDeprecation(s,n),!s.definition||!t[s.definition.type]){let l=s.source?s.source:"No task source";this._logService.warn(`The task [${l}, ${s.name}] uses an undefined task type. The task will be ignored in the future.`)}let a=sa.from(s,n.extension);a&&es.is(a.execution)?(r.push(a),e.push(this.addCustomExecution(a,s,!0))):this._logService.warn("Only custom execution tasks supported.")}return{tasks:r,extension:n.extension}}async resolveTaskInternal(t){if(es.is(t.execution))return t;this._logService.warn("Only custom execution tasks supported.")}async $resolveVariables(t,e){return{process:void 0,variables:Object.create(null)}}async $jsonTasksSupported(){return!1}async $findExecutable(t,e,n){}};Mf=_([S(0,le),S(1,Ye),S(2,Vn),S(3,Kr),S(4,_n),S(5,Ao),S(6,te),S(7,Zi)],Mf);var Lf=A("IExtHostTask");var Of=class{constructor(){this.pendingRequests=new Map;this.pendingRequestTimers=new Map;this.queue=[];this._onError=new T;this._onExit=new T;this.sequence=1}get onError(){return this._onError.event}get onExit(){return this._onExit.event}onMessage(t){this.messageCallback&&this._onError.fire(new Error("attempt to set more than one 'Message' callback")),this.messageCallback=t}onEvent(t){this.eventCallback&&this._onError.fire(new Error("attempt to set more than one 'Event' callback")),this.eventCallback=t}onRequest(t){this.requestCallback&&this._onError.fire(new Error("attempt to set more than one 'Request' callback")),this.requestCallback=t}sendResponse(t){t.seq>0?this._onError.fire(new Error(`attempt to send more than one response for command ${t.command}`)):this.internalSend("response",t)}sendRequest(t,e,n,o){let r={command:t};if(e&&Object.keys(e).length>0&&(r.arguments=e),this.internalSend("request",r),typeof o=="number"){let s=setTimeout(()=>{this.pendingRequestTimers.delete(r.seq);let a=this.pendingRequests.get(r.seq);if(a){this.pendingRequests.delete(r.seq);let l={type:"response",seq:0,request_seq:r.seq,success:!1,command:t,message:p(14844,null,o,t)};a(l)}},o);this.pendingRequestTimers.set(r.seq,s)}return n&&this.pendingRequests.set(r.seq,n),r.seq}acceptMessage(t){this.messageCallback?this.messageCallback(t):(this.queue.push(t),this.queue.length===1&&this.processQueue())}needsTaskBoundaryBetween(t,e){return t.type!=="event"||e.type!=="event"}async processQueue(){let t;for(;this.queue.length;){if((!t||this.needsTaskBoundaryBetween(this.queue[0],t))&&await Vt(0),t=this.queue.shift(),!t)return;switch(t.type){case"event":this.eventCallback?.(t);break;case"request":this.requestCallback?.(t);break;case"response":{let e=t,n=this.pendingRequests.get(e.request_seq);n&&(this.pendingRequests.delete(e.request_seq),this.clearPendingRequestTimer(e.request_seq),n(e));break}}}}internalSend(t,e){e.type=t,e.seq=this.sequence++,this.sendMessage(e)}async cancelPendingRequests(){if(this.pendingRequests.size===0)return Promise.resolve();let t=new Map;this.pendingRequests.forEach((e,n)=>t.set(n,e)),await Vt(500),t.forEach((e,n)=>{e({type:"response",seq:0,request_seq:n,success:!1,command:"canceled",message:"canceled"}),this.pendingRequests.delete(n),this.clearPendingRequestTimer(n)})}clearPendingRequestTimer(t){clearTimeout(this.pendingRequestTimers.get(t)),this.pendingRequestTimers.delete(t)}getPendingRequestIds(){return Array.from(this.pendingRequests.keys())}dispose(){for(let t of this.pendingRequestTimers.values())clearTimeout(t);this.pendingRequestTimers.clear(),this._onError.dispose(),this._onExit.dispose(),this.queue=[]}};function Y5(i){return i.type&&(i.label||i.program||i.runtime)}var JJ=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function YJ(i){return!!(i&&i.match(JJ))}function X5(i){if(typeof i.path=="string"&&!(typeof i.sourceReference=="number"&&i.sourceReference>0)){if(YJ(i.path))return y.parse(i.path);if(cn(i.path))return y.file(i.path)}return i.path}function Z5(i){if(typeof i.path=="object"){let t=y.revive(i.path);if(t)return t.scheme===B.file?t.fsPath:t.toString()}return i.path}function ez(i,t){let e=t?X5:Z5,n=ft(i);return nz(n,(o,r)=>{o&&r&&(r.path=e(r))}),n}function tz(i,t){let e=t?X5:Z5,n=ft(i);return nz(n,(o,r)=>{!o&&r&&(r.path=e(r))}),n}function nz(i,t){switch(i.type){case"event":{let e=i;switch(e.event){case"output":t(!1,e.body.source);break;case"loadedSource":t(!1,e.body.source);break;case"breakpoint":t(!1,e.body.breakpoint.source);break;default:break}break}case"request":{let e=i;switch(e.command){case"setBreakpoints":t(!0,e.arguments.source);break;case"breakpointLocations":t(!0,e.arguments.source);break;case"source":t(!0,e.arguments.source);break;case"gotoTargets":t(!0,e.arguments.source);break;case"launchVSCode":e.arguments.args.forEach(n=>t(!1,n));break;default:break}break}case"response":{let e=i;if(e.success&&e.body)switch(e.command){case"stackTrace":e.body.stackFrames.forEach(n=>t(!1,n.source));break;case"loadedSources":e.body.sources.forEach(n=>t(!1,n));break;case"scopes":e.body.scopes.forEach(n=>t(!1,n.source));break;case"setFunctionBreakpoints":e.body.breakpoints.forEach(n=>t(!1,n.source));break;case"setBreakpoints":e.body.breakpoints.forEach(n=>t(!1,n.source));break;case"disassemble":e.body?.instructions.forEach(o=>t(!1,o.location));break;case"locations":t(!1,e.body?.source);break;default:break}break}}}var jr=A("IExtHostEditorTabs"),Yw=class{constructor(t,e,n){this._activeTabIdGetter=n,this._parentGroup=e,this.acceptDtoUpdate(t)}get apiObject(){if(!this._apiObject){let t=this,e={get isActive(){return t._dto.id===t._activeTabIdGetter()},get label(){return t._dto.label},get input(){return t._input},get isDirty(){return t._dto.isDirty},get isPinned(){return t._dto.isPinned},get isPreview(){return t._dto.isPreview},get group(){return t._parentGroup.apiObject}};this._apiObject=Object.freeze(e)}return this._apiObject}get tabId(){return this._dto.id}acceptDtoUpdate(t){this._dto=t,this._input=this._initInput()}_initInput(){switch(this._dto.input.kind){case 1:return new Ud(y.revive(this._dto.input.uri));case 2:return new el(y.revive(this._dto.input.original),y.revive(this._dto.input.modified));case 3:return new cg(y.revive(this._dto.input.base),y.revive(this._dto.input.input1),y.revive(this._dto.input.input2),y.revive(this._dto.input.result));case 6:return new Fd(y.revive(this._dto.input.uri),this._dto.input.viewType);case 7:return new ug(this._dto.input.viewType);case 4:return new Hd(y.revive(this._dto.input.uri),this._dto.input.notebookType);case 5:return new Wd(y.revive(this._dto.input.original),y.revive(this._dto.input.modified),this._dto.input.notebookType);case 8:return new pg;case 9:return new mg(y.revive(this._dto.input.uri),y.revive(this._dto.input.inputBoxUri));case 10:return new gg;case 11:return new fg(this._dto.input.diffEditors.map(t=>new el(y.revive(t.original),y.revive(t.modified))));default:return}}},GO=class{constructor(t,e){this._tabs=[];this._activeTabId="";this._dto=t,this._activeGroupIdGetter=e,this._reconcileTabs(t)}get apiObject(){if(!this._apiObject){let t=this,e={get isActive(){return t._dto.groupId===t._activeGroupIdGetter()},get viewColumn(){return zt.to(t._dto.viewColumn)},get activeTab(){return t._tabs.find(n=>n.tabId===t._activeTabId)?.apiObject},get tabs(){return Object.freeze(t._tabs.map(n=>n.apiObject))}};this._apiObject=Object.freeze(e)}return this._apiObject}get groupId(){return this._dto.groupId}get tabs(){return this._tabs}acceptGroupDtoUpdate(t){this._dto=t}acceptModelUpdate(t){this._dto=t,this._reconcileTabs(t)}_reconcileTabs(t){let e=new Map;for(let n of this._tabs)e.set(n.tabId,n);this._activeTabId="",this._tabs=t.tabs.map(n=>{n.isActive&&(this._activeTabId=n.id);let o=e.get(n.id);return o?(o.acceptDtoUpdate(n),o):new Yw(n,this,()=>this.activeTabId())})}acceptTabOperation(t){if(t.kind===0){let n=new Yw(t.tabDto,this,()=>this.activeTabId());return this._tabs.splice(t.index,0,n),t.tabDto.isActive&&(this._activeTabId=n.tabId),n}else if(t.kind===1){let n=this._tabs.splice(t.index,1)[0];if(!n)throw new Error(`Tab close updated received for index ${t.index} which does not exist`);return n.tabId===this._activeTabId&&(this._activeTabId=""),n}else if(t.kind===3){if(t.oldIndex===void 0)throw new Error("Invalid old index on move IPC");let n=this._tabs.splice(t.oldIndex,1)[0];if(!n)throw new Error(`Tab move updated received for index ${t.oldIndex} which does not exist`);return this._tabs.splice(t.index,0,n),n}let e=this._tabs.find(n=>n.tabId===t.tabDto.id);if(!e)throw new Error("INVALID tab");return t.tabDto.isActive?this._activeTabId=t.tabDto.id:this._activeTabId===t.tabDto.id&&!t.tabDto.isActive&&(this._activeTabId=""),e.acceptDtoUpdate(t.tabDto),e}activeTabId(){return this._activeTabId}},Nf=class{constructor(t){this._onDidChangeTabs=new T;this._onDidChangeTabGroups=new T;this._extHostTabGroups=[];this._proxy=t.getProxy(F.MainThreadEditorTabs)}get tabGroups(){if(!this._apiObject){let t=this,e={onDidChangeTabGroups:t._onDidChangeTabGroups.event,onDidChangeTabs:t._onDidChangeTabs.event,get all(){return Object.freeze(t._extHostTabGroups.map(n=>n.apiObject))},get activeTabGroup(){let n=t._activeGroupId;return ki(t._extHostTabGroups.find(r=>r.groupId===n)?.apiObject)},close:async(n,o)=>{let r=Array.isArray(n)?n:[n];return r.length?XJ(r[0])?this._closeGroups(r,o):this._closeTabs(r,o):!0}};this._apiObject=Object.freeze(e)}return this._apiObject}$acceptEditorTabModel(t){let e=new Set(this._extHostTabGroups.map(c=>c.groupId)),n=new Set(t.map(c=>c.groupId)),o=dR(e,n),r=this._extHostTabGroups.filter(c=>o.removed.includes(c.groupId)).map(c=>c.apiObject),s=[],a=[],l=new Map;for(let c of this._extHostTabGroups)l.set(c.groupId,c);this._extHostTabGroups=t.map(c=>{let u=l.get(c.groupId);if(u)return u.acceptModelUpdate(c),a.push(u.apiObject),u;let m=new GO(c,()=>this._activeGroupId);return s.push(m.apiObject),m});let d=ki(t.find(c=>c.isActive===!0)?.groupId);d!==void 0&&this._activeGroupId!==d&&(this._activeGroupId=d),this._onDidChangeTabGroups.fire(Object.freeze({opened:s,closed:r,changed:a}))}$acceptTabGroupUpdate(t){let e=this._extHostTabGroups.find(n=>n.groupId===t.groupId);if(!e)throw new Error("Update Group IPC call received before group creation.");e.acceptGroupDtoUpdate(t),t.isActive&&(this._activeGroupId=t.groupId),this._onDidChangeTabGroups.fire(Object.freeze({changed:[e.apiObject],opened:[],closed:[]}))}$acceptTabOperation(t){let e=this._extHostTabGroups.find(o=>o.groupId===t.groupId);if(!e)throw new Error("Update Tabs IPC call received before group creation.");let n=e.acceptTabOperation(t);switch(t.kind){case 0:this._onDidChangeTabs.fire(Object.freeze({opened:[n.apiObject],closed:[],changed:[]}));return;case 1:this._onDidChangeTabs.fire(Object.freeze({opened:[],closed:[n.apiObject],changed:[]}));return;case 3:case 2:this._onDidChangeTabs.fire(Object.freeze({opened:[],closed:[],changed:[n.apiObject]}));return}}_findExtHostTabFromApi(t){for(let e of this._extHostTabGroups)for(let n of e.tabs)if(n.apiObject===t)return n}_findExtHostTabGroupFromApi(t){return this._extHostTabGroups.find(e=>e.apiObject===t)}async _closeTabs(t,e){let n=[];for(let o of t){let r=this._findExtHostTabFromApi(o);if(!r)throw new Error("Tab close: Invalid tab not found!");n.push(r.tabId)}return this._proxy.$closeTab(n,e)}async _closeGroups(t,e){let n=[];for(let o of t){let r=this._findExtHostTabGroupFromApi(o);if(!r)throw new Error("Group close: Invalid group not found!");n.push(r.groupId)}return this._proxy.$closeGroup(n,e)}};Nf=_([S(0,le)],Nf);function XJ(i){return i.tabs!==void 0}var LYe={6:p(21420,null),4:p(21421,null),3:p(21422,null),1:p(21423,null),2:p(21424,null),5:p(21425,null),0:p(21426,null)};var OYe={4:p(21417,null),2:p(21418,null),8:p(21416,null)};var eY=0,oz=new WeakMap,Il=A("IExtHostTesting"),Uf=class extends N{constructor(e,n,o,r){super();this.logService=n;this.commands=o;this.editors=r;this.resultsChangedEmitter=this._register(new T);this.controllers=new Map;this.defaultProfilesChangedEmitter=this._register(new T);this.followupProviders=new Set;this.testFollowups=new Map;this.onResultsChanged=this.resultsChangedEmitter.event;this.results=[];this.proxy=e.getProxy(F.MainThreadTesting),this.observer=new ZO(this.proxy),this.runTracker=new JO(this.proxy,n),o.registerArgumentProcessor({processArgument:s=>{switch(s?.$mid){case 16:{let a=s,l=a.tests[a.tests.length-1].item.extId;return this.controllers.get(et.root(l))?.collection.tree.get(l)?.actual??eO(s)}case 18:{let{test:a,message:l}=s,d=a.item.extId;return{test:this.controllers.get(et.root(d))?.collection.tree.get(d)?.actual??eO({$mid:16,tests:[a]}),message:Ug.to(l)}}default:return s}}}),o.registerCommand(!1,"testing.getExplorerSelection",async()=>{let s=await o.executeCommand("_testing.getExplorerSelection"),a=l=>{let d=this.controllers.get(et.root(l));if(d)return et.isRoot(l)?d.controller:d.collection.tree.get(l)?.actual};return{include:s?.include.map(a).filter(Uo)||[],exclude:s?.exclude.map(a).filter(Uo)||[]}})}createTestController(e,n,o,r){if(this.controllers.has(n))throw new Error(`Attempt to insert a duplicate controller with ID "${n}"`);let s=new $,a=s.add(new Rw(n,o,this.editors));a.root.label=o;let l=new Map,d=new Set,c=this.proxy,u=()=>{let h=0;r&&(h|=2);let f=g.relatedCodeProvider;return f&&(f?.provideRelatedTests&&(h|=8),f?.provideRelatedCode&&(h|=4)),h},m={items:a.root.children,get label(){return o},set label(h){o=h,a.root.label=h,c.$updateController(n,{label:o})},get refreshHandler(){return r},set refreshHandler(h){r=h,c.$updateController(n,{capabilities:u()})},get id(){return n},get relatedCodeProvider(){return g.relatedCodeProvider},set relatedCodeProvider(h){M(e,"testRelatedCode"),g.relatedCodeProvider=h,c.$updateController(n,{capabilities:u()})},createRunProfile:(h,f,I,x,E,w)=>{let R=to(h);for(;l.has(R);)R++;return new Zw(this.proxy,l,d,this.defaultProfilesChangedEmitter.event,n,R,h,f,I,x,E,w)},createTestItem(h,f,I){return new bl(n,h,f,I)},createTestRun:(h,f,I=!0)=>this.runTracker.createTestRun(e,n,a,h,f,I),invalidateTestResults:h=>{if(h===void 0)this.proxy.$markTestRetired(void 0);else{let f=h instanceof Array?h:[h];this.proxy.$markTestRetired(f.map(I=>et.fromExtHostTestItem(I,n).toString()))}},set resolveHandler(h){a.resolveHandler=h},get resolveHandler(){return a.resolveHandler},dispose:()=>{s.dispose()}},g={controller:m,collection:a,profiles:l,extension:e,activeProfiles:d};return c.$registerTestController(n,o,u()),s.add(q(()=>c.$unregisterTestController(n))),this.controllers.set(n,g),s.add(q(()=>this.controllers.delete(n))),s.add(a.onDidGenerateDiff(h=>c.$publishDiff(n,h.map(aT.serialize)))),m}createTestObserver(){return this.observer.checkout()}async runTests(e,n=pe.None){let o=rz(e);if(!o)throw new Error("The request passed to `vscode.test.runTests` must include a profile");let r=this.controllers.get(o.controllerId);if(!r)throw new Error("Controller not found");await this.proxy.$runTests({preserveFocus:e.preserveFocus??!0,group:Fg.from(o.kind),targets:[{testIds:e.include?.map(s=>et.fromExtHostTestItem(s,r.collection.root.id).toString())??[r.collection.root.id],profileId:o.profileId,controllerId:o.controllerId}],exclude:e.exclude?.map(s=>s.id)},n)}registerTestFollowupProvider(e){return this.followupProviders.add(e),{dispose:()=>{this.followupProviders.delete(e)}}}async $getTestsRelatedToCode(e,n,o){let r=this.editors.getDocument(y.revive(e));if(!r)return[];let s=ht.to(n),a=[];return await Promise.all([...this.controllers.values()].map(async l=>{let d;try{d=await l.relatedCodeProvider?.provideRelatedTests?.(r.document,s,o)}catch(c){o.isCancellationRequested||this.logService.warn(`Error thrown while providing related tests for ${l.controller.label}`,c)}if(d){for(let c of d)a.push(et.fromExtHostTestItem(c,l.controller.id).toString());l.collection.flushDiff()}})),a}async $getCodeRelatedToTest(e,n){let o=this.controllers.get(et.root(e));if(!o)return[];let r=o.collection.tree.get(e);return r?(await o.relatedCodeProvider?.provideRelatedCode?.(r.actual,n))?.map(bo.from)??[]:[]}$syncTests(){for(let{collection:e}of this.controllers.values())e.flushDiff();return Promise.resolve()}async $getCoverageDetails(e,n,o){return(await this.runTracker.getCoverageDetails(e,n,o))?.map(bb.fromDetails)}async $disposeRun(e){this.runTracker.disposeTestRun(e)}$configureRunProfile(e,n){this.controllers.get(e)?.profiles.get(n)?.configureHandler?.()}$setDefaultRunProfiles(e){let n=new Map;for(let[o,r]of Object.entries(e)){let s=this.controllers.get(o);if(!s)continue;let a=new Map,l=r.filter(c=>!s.activeProfiles.has(c)),d=[...s.activeProfiles].filter(c=>!r.includes(c));for(let c of l)a.set(c,!0),s.activeProfiles.add(c);for(let c of d)a.set(c,!1),s.activeProfiles.delete(c);a.size&&n.set(o,a)}this.defaultProfilesChangedEmitter.fire(n)}async $refreshTests(e,n){await this.controllers.get(e)?.controller.refreshHandler?.(n)}$publishTestResults(e){this.results=Object.freeze(e.map(n=>{let o=CL.to(n),r=n.tasks.findIndex(s=>s.hasCoverage);return r!==-1&&(o.getDetailedCoverage=(s,a=pe.None)=>this.proxy.$getCoverageDetails(n.id,r,s,a).then(l=>l.map(bb.to))),oz.set(o,n.id),o}).concat(this.results).sort((n,o)=>o.completedAt-n.completedAt).slice(0,32)),this.resultsChangedEmitter.fire()}async $expandTest(e,n){let o=this.controllers.get(et.fromString(e).controllerId)?.collection;o&&(await o.expand(e,n<0?1/0:n),o.flushDiff())}$acceptDiff(e){this.observer.applyDiff(e.map(n=>aT.deserialize({asCanonicalUri:o=>o},n)))}async $runControllerTests(e,n){return Promise.all(e.map(o=>this.runControllerTestRequest(o,!1,n)))}async $startContinuousRun(e,n){let o=new Ee(n),r=await Promise.all(e.map(s=>this.runControllerTestRequest(s,!0,o.token)));return!n.isCancellationRequested&&!r.some(s=>s.error)&&await new Promise(s=>n.onCancellationRequested(s)),o.dispose(!0),r}async $provideTestFollowups(e,n){let o=this.results.find(a=>oz.get(a)===e.resultId),r=o&&nY(et.fromString(e.extId),o?.results);if(!r)return[];let s=[];return await Promise.all([...this.followupProviders].map(async a=>{try{let l=await a.provideFollowup(o,r,e.taskIndex,e.messageIndex,n);l&&(s=s.concat(l))}catch(l){this.logService.error("Error thrown while providing followup for test message",l)}})),n.isCancellationRequested?[]:s.map(a=>{let l=eY++;return this.testFollowups.set(l,a),{title:a.title,id:l}})}$disposeTestFollowups(e){for(let n of e)this.testFollowups.delete(n)}$executeTestFollowup(e){let n=this.testFollowups.get(e);return n?this.commands.executeCommand(n.command,...n.arguments||[]):Promise.resolve()}$cancelExtensionTestRun(e,n){e===void 0?this.runTracker.cancelAllRuns():this.runTracker.cancelRunById(e,n)}getMetadataForRun(e){for(let n of this.runTracker.trackers){let o=n.getTaskIdForRun(e);if(o)return{taskId:o,runId:n.id}}}async runControllerTestRequest(e,n,o){let r=this.controllers.get(e.controllerId);if(!r)return{};let{collection:s,profiles:a,extension:l}=r,d=a.get(e.profileId);if(!d)return{};let c=e.testIds.map(h=>s.tree.get(h)).filter(Uo),u=e.excludeExtIds.map(h=>r.collection.tree.get(h)).filter(Uo).filter(h=>c.some(f=>f.fullId.compare(h.fullId)===2));if(!c.length)return{};let m=new Dd(c.some(h=>h.actual instanceof df)?void 0:c.map(h=>h.actual),u.map(h=>h.actual),d,n),g=y$(e)&&this.runTracker.prepareForMainThreadTestRun(l,m,Xw.fromInternal(e,r.collection),d,o);try{return await d.runHandler(m,o),{}}catch(h){return{error:String(h)}}finally{g&&g.hasRunningTasks&&!o.isCancellationRequested&&await ye.toPromise(g.onEnd)}}};Uf=_([S(0,le),S(1,te),S(2,Bn),S(3,Kr)],Uf);var tY=1e4;var QO=class extends N{constructor(e,n,o,r,s,a){super();this.dto=e;this.proxy=n;this.logService=o;this.profile=r;this.extension=s;this.state=0;this.running=0;this.tasks=new Map;this.sharedTestIds=new Set;this.endEmitter=this._register(new T);this.publishedCoverage=new Map;this.onEnd=this.endEmitter.event;this.cts=this._register(new Ee(a));let l=this._register(new Pn(()=>this.forciblyEndTasks(),tY));this._register(this.cts.token.onCancellationRequested(()=>l.schedule()));let d=new T;this.onDidDispose=d.event,this._register(q(()=>{d.fire(),d.dispose()}))}get hasRunningTasks(){return this.running>0}get id(){return this.dto.id}getTaskIdForRun(e){for(let[n,{run:o}]of this.tasks)if(o===e)return n}cancel(e){e?this.tasks.get(e)?.cts.cancel():this.state===0?(this.cts.cancel(),this.state=1):this.state===1&&this.forciblyEndTasks()}async getCoverageDetails(e,n,o){let[,r]=et.fromString(e).path,s=this.publishedCoverage.get(e);if(!s)return[];let{report:a,extIds:l}=s,d=this.tasks.get(r);if(!d)throw new Error("unreachable: run task was not found");let c;if(n&&a instanceof Za){let m=l.indexOf(n);if(m===-1)return[];c=a.includesTests[m]}return await(c?this.profile?.loadDetailedCoverageForTest?.(d.run,a,c,o):this.profile?.loadDetailedCoverage?.(d.run,a,o))??[]}createRun(e){let n=this.dto.id,o=this.dto.controllerId,r=_e(),s=u=>(m,...g)=>{if(l){this.logService.warn(`Setting the state of test "${m.id}" is a no-op after the run ends.`);return}this.ensureTestIsKnown(m),u(m,...g)},a=(u,m)=>{let g=m instanceof Array?m.map(Ug.from):[Ug.from(m)];if(u.uri&&u.range){let h={range:K.from(u.range),uri:u.uri};for(let f of g)f.location=f.location||h}this.proxy.$appendTestMessagesInRun(n,r,et.fromExtHostTestItem(u,o).toString(),g)},l=!1,d=this._register(new Ee(this.cts.token)),c={isPersisted:this.dto.isPersisted,token:d.token,name:e,onDidDispose:this.onDidDispose,addCoverage:u=>{if(l)return;let m=u instanceof Za?u.includesTests:[];if(m.length)for(let f of m)this.ensureTestIsKnown(f);let g=u.uri.toString(),h=new et([n,r,g]).toString();this.publishedCoverage.set(h,{report:u,extIds:m.map(f=>et.fromExtHostTestItem(f,o).toString())}),this.proxy.$appendCoverage(n,r,bb.fromFile(o,h,u))},enqueued:s(u=>{this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,o).toString(),1)}),skipped:s(u=>{this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,o).toString(),5)}),started:s(u=>{this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,o).toString(),2)}),errored:s((u,m,g)=>{a(u,m),this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,o).toString(),6,g)}),failed:s((u,m,g)=>{a(u,m),this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,o).toString(),4,g)}),passed:s((u,m)=>{this.proxy.$updateTestStateInRun(n,r,et.fromExtHostTestItem(u,this.dto.controllerId).toString(),3,m)}),appendOutput:(u,m,g)=>{l||(g&&this.ensureTestIsKnown(g),this.proxy.$appendOutputToRun(n,r,H.fromString(u),m&&bo.from(m),g&&et.fromExtHostTestItem(g,o).toString()))},end:()=>{l||(l=!0,this.proxy.$finishedTestRunTask(n,r),--this.running||this.markEnded())}};return this.running++,this.tasks.set(r,{run:c,cts:d}),this.proxy.$startedTestRunTask(n,{id:r,ctrlId:this.dto.controllerId,name:e||this.extension.displayName||this.extension.identifier.value,running:!0}),c}forciblyEndTasks(){for(let{run:e}of this.tasks.values())e.end()}markEnded(){this.state!==2&&(this.state=2,this.endEmitter.fire())}ensureTestIsKnown(e){if(!(e instanceof bl))throw new hd(e.id);if(this.sharedTestIds.has(et.fromExtHostTestItem(e,this.dto.controllerId).toString()))return;let n=[],o=this.dto.colllection.root;for(;;){let r=ea.from(e);if(n.unshift(r),this.sharedTestIds.has(r.extId)||(this.sharedTestIds.add(r.extId),e===o))break;e=e.parent||o}this.proxy.$addTestsToRun(this.dto.controllerId,this.dto.id,n)}dispose(){this.markEnded(),super.dispose()}},JO=class{constructor(t,e){this.proxy=t;this.logService=e;this.tracked=new Map;this.trackedById=new Map}get trackers(){return this.tracked.values()}getCoverageDetails(t,e,n){let o=et.root(t);return this.trackedById.get(o)?.getCoverageDetails(t,e,n)||[]}disposeTestRun(t){this.trackedById.get(t)?.dispose(),this.trackedById.delete(t);for(let[e,{id:n}]of this.tracked)n===t&&this.tracked.delete(e)}prepareForMainThreadTestRun(t,e,n,o,r){return this.getTracker(e,n,o,t,r)}cancelRunById(t,e){this.trackedById.get(t)?.cancel(e)}cancelAllRuns(){for(let t of this.tracked.values())t.cancel()}createTestRun(t,e,n,o,r,s){let a=this.tracked.get(o);if(a)return a.createRun(r);let l=Xw.fromPublic(e,n,o,s),d=rz(o);this.proxy.$startedExtensionTestRun({controllerId:e,continuous:!!o.continuous,profile:d&&{group:Fg.from(d.kind),id:d.profileId},exclude:o.exclude?.map(u=>et.fromExtHostTestItem(u,n.root.id).toString())??[],id:l.id,include:o.include?.map(u=>et.fromExtHostTestItem(u,n.root.id).toString())??[n.root.id],preserveFocus:o.preserveFocus??!0,persist:s});let c=this.getTracker(o,l,o.profile,t);return ye.once(c.onEnd)(()=>{this.proxy.$finishedExtensionTestRun(l.id)}),c.createRun(r)}getTracker(t,e,n,o,r){let s=new QO(e,this.proxy,this.logService,n,o,r);return this.tracked.set(t,s),this.trackedById.set(s.id,s),s}},rz=i=>{if(i.profile){if(!(i.profile instanceof Zw))throw new Error("TestRunRequest.profile is not an instance created from TestController.createRunProfile");return i.profile}},Xw=class i{constructor(t,e,n,o){this.controllerId=t;this.id=e;this.isPersisted=n;this.colllection=o}static fromPublic(t,e,n,o){return new i(t,_e(),o,e)}static fromInternal(t,e){return new i(t.controllerId,t.runId,!0,e)}},YO=class{constructor(t){this.emitter=t;this.added=new Set;this.updated=new Set;this.removed=new Set;this.alreadyRemoved=new Set}get isEmpty(){return this.added.size===0&&this.removed.size===0&&this.updated.size===0}add(t){this.added.add(t)}update(t){Object.assign(t.revived,ea.toPlain(t.item)),this.added.has(t)||this.updated.add(t)}remove(t){if(this.added.delete(t))return;this.updated.delete(t);let e=et.parentId(t.item.extId);if(e&&this.alreadyRemoved.has(e.toString())){this.alreadyRemoved.add(t.item.extId);return}this.removed.add(t)}getChangeEvent(){let{added:t,updated:e,removed:n}=this;return{get added(){return[...t].map(o=>o.revived)},get updated(){return[...e].map(o=>o.revived)},get removed(){return[...n].map(o=>o.revived)}}}complete(){this.isEmpty||this.emitter.fire(this.getChangeEvent())}},XO=class extends rT{constructor(){super(...arguments);this.changeEmitter=new T;this.onDidChangeTests=this.changeEmitter.event}get rootTests(){return this.roots}getMirroredTestDataById(e){return this.items.get(e)}getMirroredTestDataByReference(e){return this.items.get(e.id)}createItem(e,n){return{...e,revived:ea.toPlain(e.item),depth:n?n.depth+1:0,children:new Set}}createChangeCollector(){return new YO(this.changeEmitter)}},ZO=class{constructor(t){this.proxy=t}checkout(){this.current||(this.current=this.createObserverData());let t=this.current;return t.observers++,{onDidChangeTest:t.tests.onDidChangeTests,get tests(){return[...t.tests.rootTests].map(e=>e.revived)},dispose:Nl(()=>{--t.observers===0&&(this.proxy.$unsubscribeFromDiffs(),this.current=void 0)})}}getMirroredTestDataByReference(t){return this.current?.tests.getMirroredTestDataByReference(t)}applyDiff(t){this.current?.tests.apply(t)}createObserverData(){let t=new XO({asCanonicalUri:e=>e});return this.proxy.$subscribeToDiffs(),{observers:0,tests:t}}},qb=(i,t,e,n)=>{e?Object.assign(e,n):t.$updateTestRunConfig(i.controllerId,i.profileId,n)},Zw=class extends sg{constructor(e,n,o,r,s,a,l,d,c,u=!1,m=void 0,g=!1){super(s,a,d);this._label=l;this.runHandler=c;this._tag=m;this._supportsContinuousRun=g;this.#e=e,this.#s=n,this.#t=o,this.#n=r,n.set(a,this);let h=Fg.from(d);u&&o.add(a),this.#o={profileId:a,controllerId:s,tag:m?Ii.namespace(this.controllerId,m.id):null,label:l,group:h,isDefault:u,hasConfigurationHandler:!1,supportsContinuousRun:g},queueMicrotask(()=>{this.#o&&(this.#e.$publishTestRunProfile(this.#o),this.#o=void 0)})}#e;#t;#n;#o;#s;get label(){return this._label}set label(e){e!==this._label&&(this._label=e,qb(this,this.#e,this.#o,{label:e}))}get supportsContinuousRun(){return this._supportsContinuousRun}set supportsContinuousRun(e){e!==this._supportsContinuousRun&&(this._supportsContinuousRun=e,qb(this,this.#e,this.#o,{supportsContinuousRun:e}))}get isDefault(){return this.#t.has(this.profileId)}set isDefault(e){e!==this.isDefault&&(e?this.#t.add(this.profileId):this.#t.delete(this.profileId),qb(this,this.#e,this.#o,{isDefault:e}))}get tag(){return this._tag}set tag(e){e?.id!==this._tag?.id&&(this._tag=e,qb(this,this.#e,this.#o,{tag:e?Ii.namespace(this.controllerId,e.id):null}))}get configureHandler(){return this._configureHandler}set configureHandler(e){e!==this._configureHandler&&(this._configureHandler=e,qb(this,this.#e,this.#o,{hasConfigurationHandler:!!e}))}get onDidChangeDefault(){return ye.chain(this.#n,e=>e.map(n=>n.get(this.controllerId)?.get(this.profileId)).filter(Uo))}dispose(){this.#s?.delete(this.profileId)&&(this.#s=void 0,this.#e.$removeTestProfile(this.controllerId,this.profileId)),this.#o=void 0}};function nY(i,t){for(let e=0;e<i.path.length;e++){let n=t.find(o=>o.id===i.path[e]);if(!n)return;if(e===i.path.length-1)return n;t=n.children}}var LXe=A("configurationResolverService"),eN=(me=>(me.Unknown="unknown",me.Env="env",me.Config="config",me.Command="command",me.Input="input",me.ExtensionInstallFolder="extensionInstallFolder",me.TaskVar="taskVar",me.WorkspaceFolder="workspaceFolder",me.Cwd="cwd",me.WorkspaceFolderBasename="workspaceFolderBasename",me.UserHome="userHome",me.LineNumber="lineNumber",me.ColumnNumber="columnNumber",me.SelectedText="selectedText",me.File="file",me.FileWorkspaceFolder="fileWorkspaceFolder",me.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",me.RelativeFile="relativeFile",me.RelativeFileDirname="relativeFileDirname",me.FileDirname="fileDirname",me.FileExtname="fileExtname",me.FileBasename="fileBasename",me.FileBasenameNoExtension="fileBasenameNoExtension",me.FileDirnameBasename="fileDirnameBasename",me.ExecPath="execPath",me.ExecInstallFolder="execInstallFolder",me.PathSeparator="pathSeparator",me.PathSeparatorAlias="/",me))(eN||{}),iz=Object.values(eN).filter(i=>typeof i=="string"),xo=class extends Ln{constructor(e,n){super(n);this.variable=e}};var Kb=class i{constructor(t){this.locations=new Map;this.newReplacementNotifiers=new Set;typeof t=="string"?(this.stringRoot=!0,this.root={value:t}):(this.stringRoot=!1,this.root=structuredClone(t))}static{this.VARIABLE_LHS="${"}static parse(t){if(t instanceof i)return t;let e=new i(t);return e.applyPlatformSpecificKeys(),e.parseObject(e.root),e}applyPlatformSpecificKeys(){let t=this.root,e=Te?"windows":St?"osx":Xe?"linux":void 0;e&&t&&typeof t=="object"&&t.hasOwnProperty(e)&&Object.keys(t[e]).forEach(n=>t[n]=t[e][n]),delete t.windows,delete t.osx,delete t.linux}parseVariable(t,e){if(t[e]!=="$"||t[e+1]!=="{")return;let n=e+2,o=1;for(;n<t.length;){if(t[n]==="{")o++;else if(t[n]==="}"&&(o--,o===0))break;n++}if(o!==0)return;let r=t.slice(e,n+1),s=t.substring(e+2,n),a=s.indexOf(":");return a===-1?{replacement:{id:r,name:s,inner:s},end:n}:{replacement:{id:r,inner:s,name:s.slice(0,a),arg:s.slice(a+1)},end:n}}parseObject(t){if(!(typeof t!="object"||t===null)){if(Array.isArray(t)){for(let e=0;e<t.length;e++){let n=t[e];typeof n=="string"?this.parseString(t,e,n):this.parseObject(n)}return}for(let[e,n]of Object.entries(t))this.parseString(t,e,e,!0),typeof n=="string"?this.parseString(t,e,n):this.parseObject(n)}}parseString(t,e,n,o,r){let s=0;for(;s<n.length;){let a=n.indexOf("${",s);if(a===-1)break;let l=this.parseVariable(n,a);if(l){if(s=l.end+1,r?.includes(l.replacement.id))continue;let d=this.locations.get(l.replacement.id)||{locations:[],replacement:l.replacement},c={object:t,propertyName:e,replaceKeyName:o};d.locations.push(c),this.locations.set(l.replacement.id,d),d.resolved?this._resolveAtLocation(l.replacement,c,d.resolved,r):this.newReplacementNotifiers.forEach(u=>u(l.replacement))}else s=a+2}}*unresolved(){let t=new Map,e=n=>{t.set(n.id,n)};for(let n of this.locations.values())n.resolved===void 0&&t.set(n.replacement.id,n.replacement);for(this.newReplacementNotifiers.add(e);;){let n=Mt.first(t);if(!n)break;let[o,r]=n;yield r,t.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return Mt.map(Mt.filter(this.locations.values(),t=>!!t.resolved),t=>[t.replacement,t.resolved])}resolve(t,e){typeof e!="object"&&(e={value:String(e)});let n=this.locations.get(t.id);if(n&&(n.resolved=e,e.value!==void 0))for(let o of n.locations||Mt.empty())this._resolveAtLocation(t,o,e)}_resolveAtLocation(t,{replaceKeyName:e,propertyName:n,object:o},r,s=[]){if(r.value!==void 0){if(s.push(t.id),e&&typeof n=="string"){let a=o[n],l=n.replaceAll(t.id,r.value);delete o[n],o[l]=a,this._renameKeyInLocations(o,n,l),this.parseString(o,l,r.value,!0,s)}else o[n]=o[n].replaceAll(t.id,r.value),this.parseString(o,n,r.value,!1,s);s.pop()}}_renameKeyInLocations(t,e,n){for(let o of this.locations.values())for(let r of o.locations)r.object===t&&r.propertyName===e&&(r.propertyName=n)}toObject(){return this.stringRoot?this.root.value:this.root}};var ek=class{constructor(t,e,n,o){this._contributedVariables=new Map;this.resolvableVariables=new Set(iz);this._context=t,this._labelService=e,this._userHomePromise=n,o&&(this._envVariablesPromise=o.then(r=>this.prepareEnv(r)))}prepareEnv(t){if(Te){let e=Object.create(null);return Object.keys(t).forEach(n=>{e[n.toLowerCase()]=t[n]}),e}return t}async resolveWithEnvironment(t,e,n){let o=Kb.parse(n);for(let r of o.unresolved()){let s=await this.evaluateSingleVariable(r,e?.uri,t);s!==void 0&&o.resolve(r,String(s))}return o.toObject()}async resolveAsync(t,e){let n=Kb.parse(e);for(let o of n.unresolved()){let r=await this.evaluateSingleVariable(o,t?.uri);r!==void 0&&n.resolve(o,String(r))}return n.toObject()}resolveWithInteractionReplace(t,e){throw new Error("resolveWithInteractionReplace not implemented.")}resolveWithInteraction(t,e){throw new Error("resolveWithInteraction not implemented.")}contributeVariable(t,e){if(this._contributedVariables.has(t))throw new Error("Variable "+t+" is contributed twice.");this.resolvableVariables.add(t),this._contributedVariables.set(t,e)}fsPath(t){return this._labelService?this._labelService.getUriLabel(t,{noPrefix:!0}):t.fsPath}async evaluateSingleVariable(t,e,n,o){let r={env:n!==void 0?this.prepareEnv(n):await this._envVariablesPromise,userHome:n!==void 0?void 0:await this._userHomePromise},{name:s,arg:a}=t,l=u=>{let m=this._context.getFilePath();if(m)return Dm(m);throw new xo(u,p(22929,null,t.id))},d=u=>{let m=l(u);if(this._context.getWorkspaceFolderPathForFile){let g=this._context.getWorkspaceFolderPathForFile();if(g)return Dm(g)}throw new xo(u,p(22930,null,t.id,ot(m)))},c=u=>{if(a){let m=this._context.getFolderUri(a);if(m)return m;throw new xo(u,p(22927,null,u,a))}if(e)return e;throw this._context.getWorkspaceFolderCount()>1?new xo(u,p(22935,null,u)):new xo(u,p(22934,null,u))};switch(s){case"env":if(a){if(r.env){let u=r.env[Te?a.toLowerCase():a];if(Pe(u))return u}return""}throw new xo("env",p(22940,null,t.id));case"config":if(a){let u=this._context.getConfigurationValue(e,a);if(Wt(u))throw new xo("config",p(22937,null,t.id,a));if(st(u))throw new xo("config",p(22936,null,t.id,a));return u}throw new xo("config",p(22939,null,t.id));case"command":return this.resolveFromMap("command",t.id,a,o,"command");case"input":return this.resolveFromMap("input",t.id,a,o,"input");case"extensionInstallFolder":if(a){let u=await this._context.getExtension(a);if(!u)throw new xo("extensionInstallFolder",p(22938,null,t.id,a));return this.fsPath(u.extensionLocation)}throw new xo("extensionInstallFolder",p(22941,null,t.id));default:switch(s){case"workspaceRoot":case"workspaceFolder":{let u=c("workspaceFolder");return u?Dm(this.fsPath(u)):void 0}case"cwd":{if(!e&&!a)return Pi();let u=c("cwd");return u?Dm(this.fsPath(u)):void 0}case"workspaceRootFolderName":case"workspaceFolderBasename":{let u=c("workspaceFolderBasename");return u?Dm(ot(this.fsPath(u))):void 0}case"userHome":if(r.userHome)return r.userHome;throw new xo("userHome",p(22933,null,t.id));case"lineNumber":{let u=this._context.getLineNumber();if(u)return u;throw new xo("lineNumber",p(22931,null,t.id))}case"columnNumber":{let u=this._context.getColumnNumber();if(u)return u;throw new Error(p(22928,null,t.id))}case"selectedText":{let u=this._context.getSelectedText();if(u)return u;throw new xo("selectedText",p(22932,null,t.id))}case"file":return l("file");case"fileWorkspaceFolder":return d("fileWorkspaceFolder");case"fileWorkspaceFolderBasename":return ot(d("fileWorkspaceFolderBasename"));case"relativeFile":return e||a?_i(this.fsPath(c("relativeFile")),l("relativeFile")):l("relativeFile");case"relativeFileDirname":{let u=gn(l("relativeFileDirname"));if(e||a){let m=_i(this.fsPath(c("relativeFileDirname")),u);return m.length===0?".":m}return u}case"fileDirname":return gn(l("fileDirname"));case"fileExtname":return zl(l("fileExtname"));case"fileBasename":return ot(l("fileBasename"));case"fileBasenameNoExtension":{let u=ot(l("fileBasenameNoExtension"));return u.slice(0,u.length-zl(u).length)}case"fileDirnameBasename":return ot(gn(l("fileDirnameBasename")));case"execPath":{let u=this._context.getExecPath();return u||t.id}case"execInstallFolder":{let u=this._context.getAppRoot();return u||t.id}case"pathSeparator":case"/":return Dt;default:try{return this.resolveFromMap("unknown",t.id,a,o,void 0)}catch{return t.id}}}}resolveFromMap(t,e,n,o,r){if(n&&o){let s=r===void 0?o[n]:o[r+":"+n];if(typeof s=="string")return s;throw new xo(t,p(22942,null,e))}return e}};var Gr=A("IExtHostVariableResolverProvider"),tN=class extends ek{constructor(t,e,n,o,r,s,a){function l(){if(n){let d=n.activeEditor();if(d)return d.document.uri;let c=o.tabGroups.all.find(u=>u.isActive)?.activeTab;if(c!==void 0){if(c.input instanceof el||c.input instanceof Wd)return c.input.modified;if(c.input instanceof Ud||c.input instanceof Hd||c.input instanceof Fd)return c.input.uri}}}super({getFolderUri:d=>{let c=s.folders.filter(u=>u.name===d);if(c&&c.length>0)return c[0].uri},getWorkspaceFolderCount:()=>s.folders.length,getConfigurationValue:(d,c)=>r.getConfiguration(void 0,d).get(c),getAppRoot:()=>Pi(),getExecPath:()=>Fo.VSCODE_EXEC_PATH,getFilePath:()=>{let d=l();if(d)return so(d.fsPath)},getWorkspaceFolderPathForFile:()=>{if(e){let d=l();if(d){let c=e.getWorkspaceFolder(d);if(c)return so(c.uri.fsPath)}}},getSelectedText:()=>{if(n){let d=n.activeEditor();if(d&&!d.selection.isEmpty)return d.document.getText(d.selection)}},getLineNumber:()=>{if(n){let d=n.activeEditor();if(d)return String(d.selection.end.line+1)}},getColumnNumber:()=>{if(n){let d=n.activeEditor();if(d)return String(d.selection.end.character+1)}},getExtension:d=>t.getExtension(d)},void 0,a?Promise.resolve(a):void 0,Promise.resolve(Fo))}},pc=class extends N{constructor(e,n,o,r,s){super();this.extensionService=e;this.workspaceService=n;this.editorService=o;this.configurationService=r;this.editorTabs=s;this._resolver=new mt(async()=>{let e=await this.configurationService.getConfigProvider(),o={folders:await this.workspaceService.getWorkspaceFolders2()||[]};return this._register(this.workspaceService.onDidChangeWorkspace(async r=>{o.folders=await this.workspaceService.getWorkspaceFolders2()||[]})),new tN(this.extensionService,this.workspaceService,this.editorService,this.editorTabs,e,o,this.homeDir())})}getResolver(){return this._resolver.value}homeDir(){}};pc=_([S(0,io),S(1,Vn),S(2,Kr),S(3,_n),S(4,jr)],pc);var Hf=A("IExtHostDebugService"),cp=class extends N{constructor(e,n,o,r,s,a,l,d){super();this._workspaceService=n;this._extensionService=o;this._configurationService=r;this._editorTabs=s;this._variableResolver=a;this._commands=l;this._testing=d;this._debugSessions=new Map;this._debugVisualizationTreeItemIdsCounter=0;this._debugVisualizationProviders=new Map;this._debugVisualizationTrees=new Map;this._debugVisualizationTreeItemIds=new WeakMap;this._debugVisualizationElements=new Map;this._visualizers=new Map;this._visualizerIdCounter=0;this._configProviderHandleCounter=0,this._configProviders=[],this._adapterFactoryHandleCounter=0,this._adapterFactories=[],this._trackerFactoryHandleCounter=0,this._trackerFactories=[],this._debugAdapters=new Map,this._debugAdaptersTrackers=new Map,this._onDidStartDebugSession=this._register(new T),this._onDidTerminateDebugSession=this._register(new T),this._onDidChangeActiveDebugSession=this._register(new T),this._onDidReceiveDebugSessionCustomEvent=this._register(new T),this._debugServiceProxy=e.getProxy(F.MainThreadDebugService),this._onDidChangeBreakpoints=this._register(new T),this._onDidChangeActiveStackItem=this._register(new T),this._activeDebugConsole=new oN(this._debugServiceProxy),this._breakpoints=new Map,this._extensionService.getExtensionRegistry().then(c=>{this._register(c.onDidChange(u=>{this.registerAllDebugTypes(c)})),this.registerAllDebugTypes(c)}),this._telemetryProxy=e.getProxy(F.MainThreadTelemetry)}get onDidStartDebugSession(){return this._onDidStartDebugSession.event}get onDidTerminateDebugSession(){return this._onDidTerminateDebugSession.event}get onDidChangeActiveDebugSession(){return this._onDidChangeActiveDebugSession.event}get activeDebugSession(){return this._activeDebugSession?.api}get onDidReceiveDebugSessionCustomEvent(){return this._onDidReceiveDebugSessionCustomEvent.event}get activeDebugConsole(){return this._activeDebugConsole.value}async $getVisualizerTreeItem(e,n){let o=this.hydrateVisualizationContext(n);if(!o)return;let r=await this._debugVisualizationTrees.get(e)?.getTreeItem?.(o);return r?this.convertVisualizerTreeItem(e,r):void 0}registerDebugVisualizationTree(e,n,o){let r=xe.toKey(e.identifier),s=this.extensionVisKey(r,n);if(this._debugVisualizationProviders.has(s))throw new Error(`A debug visualization provider with id '${n}' is already registered`);return this._debugVisualizationTrees.set(s,o),this._debugServiceProxy.$registerDebugVisualizerTree(s,!!o.editItem),q(()=>{this._debugServiceProxy.$unregisterDebugVisualizerTree(s),this._debugVisualizationTrees.delete(n)})}async $getVisualizerTreeItemChildren(e,n){let o=this._debugVisualizationElements.get(n)?.item;return o?(await this._debugVisualizationTrees.get(e)?.getChildren?.(o))?.map(s=>this.convertVisualizerTreeItem(e,s))||[]:[]}async $editVisualizerTreeItem(e,n){let o=this._debugVisualizationElements.get(e);if(!o)return;let r=await this._debugVisualizationTrees.get(o.provider)?.editItem?.(o.item,n);return this.convertVisualizerTreeItem(o.provider,r||o.item)}$disposeVisualizedTree(e){let n=this._debugVisualizationElements.get(e);if(!n)return;let o=[n.children];for(let r of o)if(r)for(let s of r)o.push(this._debugVisualizationElements.get(s)?.children),this._debugVisualizationElements.delete(s)}convertVisualizerTreeItem(e,n){let o=this._debugVisualizationTreeItemIds.get(n);return o||(o=this._debugVisualizationTreeItemIdsCounter++,this._debugVisualizationTreeItemIds.set(n,o),this._debugVisualizationElements.set(o,{provider:e,item:n})),ML.from(n,o)}asDebugSourceUri(e,n){let o=e;if(typeof o.sourceReference=="number"&&o.sourceReference>0){let r=`debug:${encodeURIComponent(o.path||"")}`,s="?";return n&&(r+=`${s}session=${encodeURIComponent(n.id)}`,s="&"),r+=`${s}ref=${o.sourceReference}`,y.parse(r)}else{if(o.path)return y.file(o.path);throw new Error("cannot create uri from DAP 'source' object; properties 'path' and 'sourceReference' are both missing.")}}registerAllDebugTypes(e){let n=[];for(let o of e.getAllExtensionDescriptions())if(o.contributes){let r=o.contributes.debuggers;if(r&&r.length>0)for(let s of r)Y5(s)&&n.push(s.type)}this._debugServiceProxy.$registerDebugTypes(n)}get activeStackItem(){return this._activeStackItem}get onDidChangeActiveStackItem(){return this._onDidChangeActiveStackItem.event}get onDidChangeBreakpoints(){return this._onDidChangeBreakpoints.event}get breakpoints(){let e=[];return this._breakpoints.forEach(n=>e.push(n)),e}async $resolveDebugVisualizer(e,n){let o=this._visualizers.get(e);if(!o)throw new Error(`No debug visualizer found with id '${e}'`);let{v:r,provider:s,extensionId:a}=o;if(r.visualization||(r=await s.resolveDebugVisualization?.(r,n)||r,o.v=r),!r.visualization)throw new Error(`No visualization returned from resolveDebugVisualization in '${s}'`);return this.serializeVisualization(a,r.visualization)}async $executeDebugVisualizerCommand(e){let n=this._visualizers.get(e);if(!n)throw new Error(`No debug visualizer found with id '${e}'`);let o=n.v.visualization;o&&"command"in o&&this._commands.executeCommand(o.command,...o.arguments||[])}hydrateVisualizationContext(e){let n=this._debugSessions.get(e.sessionId);return n&&{session:n.api,variable:e.variable,containerId:e.containerId,frameId:e.frameId,threadId:e.threadId}}async $provideDebugVisualizers(e,n,o,r){let s=this.hydrateVisualizationContext(o),a=this.extensionVisKey(e,n),l=this._debugVisualizationProviders.get(a);if(!s||!l)return[];let d=await l.provideDebugVisualization(s,r);return d?d.map(c=>{let u=++this._visualizerIdCounter;this._visualizers.set(u,{v:c,provider:l,extensionId:e});let m=c.iconPath?this.getIconPathOrClass(c.iconPath):void 0;return{id:u,name:c.name,iconClass:m?.iconClass,iconPath:m?.iconPath,visualization:this.serializeVisualization(e,c.visualization)}}):[]}$disposeDebugVisualizers(e){for(let n of e)this._visualizers.delete(n)}registerDebugVisualizationProvider(e,n,o){if(!e.contributes?.debugVisualizers?.some(a=>a.id===n))throw new Error(`Extensions may only call registerDebugVisualizationProvider() for renderers they contribute (got ${n})`);let r=xe.toKey(e.identifier),s=this.extensionVisKey(r,n);if(this._debugVisualizationProviders.has(s))throw new Error(`A debug visualization provider with id '${n}' is already registered`);return this._debugVisualizationProviders.set(s,o),this._debugServiceProxy.$registerDebugVisualizer(r,n),q(()=>{this._debugServiceProxy.$unregisterDebugVisualizer(r,n),this._debugVisualizationProviders.delete(n)})}addBreakpoints(e){let n=e.filter(s=>{let a=s.id;return this._breakpoints.has(a)?!1:(this._breakpoints.set(a,s),!0)});this.fireBreakpointChanges(n,[],[]);let o=[],r=new Map;for(let s of n)if(s instanceof qi){let a=r.get(s.location.uri.toString());a||(a={type:"sourceMulti",uri:s.location.uri,lines:[]},r.set(s.location.uri.toString(),a),o.push(a)),a.lines.push({id:s.id,enabled:s.enabled,condition:s.condition,hitCondition:s.hitCondition,logMessage:s.logMessage,line:s.location.range.start.line,character:s.location.range.start.character,mode:s.mode})}else s instanceof Ki&&o.push({type:"function",id:s.id,enabled:s.enabled,hitCondition:s.hitCondition,logMessage:s.logMessage,condition:s.condition,functionName:s.functionName,mode:s.mode});return this._debugServiceProxy.$registerBreakpoints(o)}removeBreakpoints(e){let n=e.filter(a=>this._breakpoints.delete(a.id));this.fireBreakpointChanges([],n,[]);let o=n.filter(a=>a instanceof qi).map(a=>a.id),r=n.filter(a=>a instanceof Ki).map(a=>a.id),s=n.filter(a=>a instanceof Eu).map(a=>a.id);return this._debugServiceProxy.$unregisterBreakpoints(o,r,s)}startDebugging(e,n,o){let r=o.testRun&&this._testing.getMetadataForRun(o.testRun);return this._debugServiceProxy.$startDebugging(e?e.uri:void 0,n,{parentSessionID:o.parentSession?o.parentSession.id:void 0,lifecycleManagedByParent:o.lifecycleManagedByParent,repl:o.consoleMode===1?"mergeWithParent":"separate",noDebug:o.noDebug,compact:o.compact,suppressSaveBeforeStart:o.suppressSaveBeforeStart,testRun:r&&{runId:r.runId,taskId:r.taskId},suppressDebugStatusbar:o.suppressDebugStatusbar??o.debugUI?.simple,suppressDebugToolbar:o.suppressDebugToolbar??o.debugUI?.simple,suppressDebugView:o.suppressDebugView??o.debugUI?.simple})}stopDebugging(e){return this._debugServiceProxy.$stopDebugging(e?e.id:void 0)}registerDebugConfigurationProvider(e,n,o){if(!n)return new Se(()=>{});let r=this._configProviderHandleCounter++;return this._configProviders.push({type:e,handle:r,provider:n}),this._debugServiceProxy.$registerDebugConfigurationProvider(e,o,!!n.provideDebugConfigurations,!!n.resolveDebugConfiguration,!!n.resolveDebugConfigurationWithSubstitutedVariables,r),new Se(()=>{this._configProviders=this._configProviders.filter(s=>s.provider!==n),this._debugServiceProxy.$unregisterDebugConfigurationProvider(r)})}registerDebugAdapterDescriptorFactory(e,n,o){if(!o)return new Se(()=>{});if(!this.definesDebugType(e,n))throw new Error(`a DebugAdapterDescriptorFactory can only be registered from the extension that defines the '${n}' debugger.`);if(this.getAdapterDescriptorFactoryByType(n))throw new Error("a DebugAdapterDescriptorFactory can only be registered once per a type.");let r=this._adapterFactoryHandleCounter++;return this._adapterFactories.push({type:n,handle:r,factory:o}),this._debugServiceProxy.$registerDebugAdapterDescriptorFactory(n,r),new Se(()=>{this._adapterFactories=this._adapterFactories.filter(s=>s.factory!==o),this._debugServiceProxy.$unregisterDebugAdapterDescriptorFactory(r)})}registerDebugAdapterTrackerFactory(e,n){if(!n)return new Se(()=>{});let o=this._trackerFactoryHandleCounter++;return this._trackerFactories.push({type:e,handle:o,factory:n}),new Se(()=>{this._trackerFactories=this._trackerFactories.filter(r=>r.factory!==n)})}async $runInTerminal(e,n){return Promise.resolve(void 0)}async $substituteVariables(e,n){let o,r=await this.getFolder(e);return r&&(o={uri:r.uri,name:r.name,index:r.index}),(await this._variableResolver.getResolver()).resolveAsync(o,n)}createDebugAdapter(e,n){if(e instanceof Ya)return new iN(e.implementation)}createSignService(){}async $startDASession(e,n){let o=this,r=await this.getSession(n);return this.getAdapterDescriptor(this.getAdapterDescriptorFactoryByType(r.type),r).then(s=>{if(!s)throw new Error(`Couldn't find a debug adapter descriptor for debug type '${r.type}' (extension might have failed to activate)`);let a=this.createDebugAdapter(s,r);if(!a)throw new Error(`Couldn't create a debug adapter for type '${r.type}'.`);let l=a;return this._debugAdapters.set(e,l),this.getDebugAdapterTrackers(r).then(d=>(d&&this._debugAdaptersTrackers.set(e,d),l.onMessage(async c=>{if(c.type==="request"&&c.command==="handshake"){let u=c,m={type:"response",seq:0,command:u.command,request_seq:u.seq,success:!0};this._signService||(this._signService=this.createSignService());try{if(this._signService){let g=await this._signService.sign(u.arguments.value);m.body={signature:g},l.sendResponse(m)}else throw new Error("no signer")}catch(g){m.success=!1,m.message=g.message,l.sendResponse(m)}}else{d&&d.onDidSendMessage&&d.onDidSendMessage(c);try{c=tz(c,!0)}catch(u){let m=c.type+"_"+(c.command??c.event??"");throw this._telemetryProxy.$publicLog2("debugProtocolMessageError",{type:m,from:r.type}),u}o._debugServiceProxy.$acceptDAMessage(e,c)}}),l.onError(c=>{d&&d.onError&&d.onError(c),this._debugServiceProxy.$acceptDAError(e,c.name,c.message,c.stack)}),l.onExit(c=>{d&&d.onExit&&d.onExit(c??void 0,void 0),this._debugServiceProxy.$acceptDAExit(e,c??void 0,void 0)}),d&&d.onWillStartSession&&d.onWillStartSession(),l.startSession()))})}$sendDAMessage(e,n){n=ez(n,!1);let o=this._debugAdaptersTrackers.get(e);o&&o.onWillReceiveMessage&&o.onWillReceiveMessage(n),this._debugAdapters.get(e)?.sendMessage(n)}$stopDASession(e){let n=this._debugAdaptersTrackers.get(e);this._debugAdaptersTrackers.delete(e),n&&n.onWillStopSession&&n.onWillStopSession();let o=this._debugAdapters.get(e);return this._debugAdapters.delete(e),o?o.stopSession():Promise.resolve(void 0)}$acceptBreakpointsDelta(e){let n=[],o=[],r=[];if(e.added)for(let s of e.added){let a=s.id;if(a&&!this._breakpoints.has(a)){let l;if(s.type==="function")l=new Ki(s.functionName,s.enabled,s.condition,s.hitCondition,s.logMessage,s.mode);else if(s.type==="data")l=new Eu(s.label,s.dataId,s.canPersist,s.enabled,s.hitCondition,s.condition,s.logMessage,s.mode);else{let d=y.revive(s.uri);l=new qi(new rn(d,new De(s.line,s.character)),s.enabled,s.condition,s.hitCondition,s.logMessage,s.mode)}M$(l,a),this._breakpoints.set(a,l),n.push(l)}}if(e.removed)for(let s of e.removed){let a=this._breakpoints.get(s);a&&(this._breakpoints.delete(s),o.push(a))}if(e.changed){for(let s of e.changed)if(s.id){let a=this._breakpoints.get(s.id);if(a){if(a instanceof Ki&&s.type==="function"){let l=a;l.enabled=s.enabled,l.condition=s.condition,l.hitCondition=s.hitCondition,l.logMessage=s.logMessage,l.functionName=s.functionName}else if(a instanceof qi&&s.type==="source"){let l=a;l.enabled=s.enabled,l.condition=s.condition,l.hitCondition=s.hitCondition,l.logMessage=s.logMessage,l.location=new rn(y.revive(s.uri),new De(s.line,s.character))}r.push(a)}}}this.fireBreakpointChanges(n,o,r)}async $acceptStackFrameFocus(e){let n;if(e){let o=await this.getSession(e.sessionId);e.kind==="thread"?n=new og(o.api,e.threadId):n=new ng(o.api,e.threadId,e.frameId)}this._activeStackItem=n,this._onDidChangeActiveStackItem.fire(this._activeStackItem)}$provideDebugConfigurations(e,n,o){return Cn(async()=>{let r=this.getConfigProviderByHandle(e);if(!r)throw new Error("no DebugConfigurationProvider found");if(!r.provideDebugConfigurations)throw new Error("DebugConfigurationProvider has no method provideDebugConfigurations");let s=await this.getFolder(n);return r.provideDebugConfigurations(s,o)}).then(r=>{if(!r)throw new Error("nothing returned from DebugConfigurationProvider.provideDebugConfigurations");return r})}$resolveDebugConfiguration(e,n,o,r){return Cn(async()=>{let s=this.getConfigProviderByHandle(e);if(!s)throw new Error("no DebugConfigurationProvider found");if(!s.resolveDebugConfiguration)throw new Error("DebugConfigurationProvider has no method resolveDebugConfiguration");let a=await this.getFolder(n);return s.resolveDebugConfiguration(a,o,r)})}$resolveDebugConfigurationWithSubstitutedVariables(e,n,o,r){return Cn(async()=>{let s=this.getConfigProviderByHandle(e);if(!s)throw new Error("no DebugConfigurationProvider found");if(!s.resolveDebugConfigurationWithSubstitutedVariables)throw new Error("DebugConfigurationProvider has no method resolveDebugConfigurationWithSubstitutedVariables");let a=await this.getFolder(n);return s.resolveDebugConfigurationWithSubstitutedVariables(a,o,r)})}async $provideDebugAdapter(e,n){let o=this.getAdapterDescriptorFactoryByHandle(e);if(!o)return Promise.reject(new Error("no adapter descriptor factory found for handle"));let r=await this.getSession(n);return this.getAdapterDescriptor(o,r).then(s=>{if(!s)throw new Error(`Couldn't find a debug adapter descriptor for debug type '${r.type}'`);return this.convertToDto(s)})}async $acceptDebugSessionStarted(e){let n=await this.getSession(e);this._onDidStartDebugSession.fire(n.api)}async $acceptDebugSessionTerminated(e){let n=await this.getSession(e);n&&(this._onDidTerminateDebugSession.fire(n.api),this._debugSessions.delete(n.id))}async $acceptDebugSessionActiveChanged(e){this._activeDebugSession=e?await this.getSession(e):void 0,this._onDidChangeActiveDebugSession.fire(this._activeDebugSession?.api)}async $acceptDebugSessionNameChanged(e,n){(await this.getSession(e))?._acceptNameChanged(n)}async $acceptDebugSessionCustomEvent(e,n){let r={session:(await this.getSession(e)).api,event:n.event,body:n.body};this._onDidReceiveDebugSessionCustomEvent.fire(r)}convertToDto(e){if(e instanceof ji)return this.convertExecutableToDto(e);if(e instanceof Gi)return this.convertServerToDto(e);if(e instanceof Bs)return this.convertPipeServerToDto(e);if(e instanceof Ya)return this.convertImplementationToDto(e);throw new Error("convertToDto unexpected type")}convertExecutableToDto(e){return{type:"executable",command:e.command,args:e.args,options:e.options}}convertServerToDto(e){return{type:"server",port:e.port,host:e.host}}convertPipeServerToDto(e){return{type:"pipeServer",path:e.path}}convertImplementationToDto(e){return{type:"implementation"}}getAdapterDescriptorFactoryByType(e){let n=this._adapterFactories.filter(o=>o.type===e);if(n.length>0)return n[0].factory}getAdapterDescriptorFactoryByHandle(e){let n=this._adapterFactories.filter(o=>o.handle===e);if(n.length>0)return n[0].factory}getConfigProviderByHandle(e){let n=this._configProviders.filter(o=>o.handle===e);if(n.length>0)return n[0].provider}definesDebugType(e,n){if(e.contributes){let o=e.contributes.debuggers;if(o&&o.length>0){for(let r of o)if(r.label&&r.type&&r.type===n)return!0}}return!1}getDebugAdapterTrackers(e){let o=e.configuration.type,r=this._trackerFactories.filter(s=>s.type===o||s.type==="*").map(s=>Cn(()=>s.factory.createDebugAdapterTracker(e.api)).then(a=>a,a=>null));return Promise.race([Promise.all(r).then(s=>{let a=nt(s);if(a.length>0)return new rN(a)}),new Promise(s=>setTimeout(()=>s(void 0),1e3))]).catch(s=>{})}async getAdapterDescriptor(e,n){let o=n.configuration.debugServer;if(typeof o=="number")return Promise.resolve(new Gi(o));if(e){let s=await this._extensionService.getExtensionRegistry();return Cn(()=>e.createDebugAdapterDescriptor(n.api,this.daExecutableFromPackage(n,s))).then(a=>{if(a)return a})}let r=await this._extensionService.getExtensionRegistry();return Promise.resolve(this.daExecutableFromPackage(n,r))}daExecutableFromPackage(e,n){}fireBreakpointChanges(e,n,o){(e.length>0||n.length>0||o.length>0)&&this._onDidChangeBreakpoints.fire(Object.freeze({added:e,removed:n,changed:o}))}async getSession(e){if(e)if(typeof e=="string"){let n=this._debugSessions.get(e);if(n)return n}else{let n=this._debugSessions.get(e.id);if(!n){let o=await this.getFolder(e.folderUri),r=e.parent?this._debugSessions.get(e.parent):void 0;n=new nN(this._debugServiceProxy,e.id,e.type,e.name,o,e.configuration,r?.api),this._debugSessions.set(n.id,n),this._debugServiceProxy.$sessionCached(n.id)}return n}throw new Error("cannot find session")}getFolder(e){if(e){let n=y.revive(e);return this._workspaceService.resolveWorkspaceFolder(n)}return Promise.resolve(void 0)}extensionVisKey(e,n){return`${e}\0${n}`}serializeVisualization(e,n){if(n){if("title"in n&&"command"in n)return{type:0};if("treeId"in n)return{type:1,id:`${e}\0${n.treeId}`};throw new Error("Unsupported debug visualization type")}}getIconPathOrClass(e){let n=this.getIconUris(e),o,r;return"id"in n?r=ct.asClassName(n):o=n,{iconPath:o,iconClass:r}}getIconUris(e){if(e instanceof fn)return{id:e.id};let n=typeof e=="object"&&"dark"in e?e.dark:e,o=typeof e=="object"&&"light"in e?e.light:e;return{dark:typeof n=="string"?y.file(n):n,light:typeof o=="string"?y.file(o):o}}};cp=_([S(0,le),S(1,Vn),S(2,io),S(3,_n),S(4,jr),S(5,Gr),S(6,Bn),S(7,Il)],cp);var nN=class{constructor(t,e,n,o,r,s,a){this._debugServiceProxy=t;this._id=e;this._type=n;this._name=o;this._workspaceFolder=r;this._configuration=s;this._parentSession=a}get api(){let t=this;return this.apiSession??=Object.freeze({id:t._id,type:t._type,get name(){return t._name},set name(e){t._name=e,t._debugServiceProxy.$setDebugSessionName(t._id,e)},parentSession:t._parentSession,workspaceFolder:t._workspaceFolder,configuration:t._configuration,customRequest(e,n){return t._debugServiceProxy.$customDebugAdapterRequest(t._id,e,n)},getDebugProtocolBreakpoint(e){return t._debugServiceProxy.$getDebugProtocolBreakpoint(t._id,e.id)}})}get id(){return this._id}get type(){return this._type}_acceptNameChanged(t){this._name=t}get configuration(){return this._configuration}},oN=class{constructor(t){this.value=Object.freeze({append(e){t.$appendDebugConsole(e)},appendLine(e){this.append(e+`
`)}})}},rN=class{constructor(t){this.trackers=t}onWillStartSession(){this.trackers.forEach(t=>t.onWillStartSession?t.onWillStartSession():void 0)}onWillReceiveMessage(t){this.trackers.forEach(e=>e.onWillReceiveMessage?e.onWillReceiveMessage(t):void 0)}onDidSendMessage(t){this.trackers.forEach(e=>e.onDidSendMessage?e.onDidSendMessage(t):void 0)}onWillStopSession(){this.trackers.forEach(t=>t.onWillStopSession?t.onWillStopSession():void 0)}onError(t){this.trackers.forEach(e=>e.onError?e.onError(t):void 0)}onExit(t,e){this.trackers.forEach(n=>n.onExit?n.onExit(t,e):void 0)}},iN=class extends Of{constructor(e){super();this.implementation=e;e.onDidSendMessage(n=>{this.acceptMessage(n)})}startSession(){return Promise.resolve(void 0)}sendMessage(e){this.implementation.handleMessage(e)}stopSession(){return this.implementation.dispose(),Promise.resolve(void 0)}},Ff=class extends cp{constructor(t,e,n,o,r,s,a,l){super(t,e,n,o,r,s,a,l)}};Ff=_([S(0,le),S(1,Vn),S(2,io),S(3,_n),S(4,jr),S(5,Gr),S(6,Bn),S(7,Il)],Ff);function oY(i){return"uri"in i&&"ranges"in i&&"preview"in i}function rY(i){return i.folderOptions.map(t=>({folder:t.folder,excludes:t.excludes.map(e=>typeof e=="string"?e:e.pattern),includes:t.includes,useGlobalIgnoreFiles:t.useIgnoreFiles.global,useIgnoreFiles:t.useIgnoreFiles.local,useParentIgnoreFiles:t.useIgnoreFiles.parent,followSymlinks:t.followSymlinks,maxResults:i.maxResults,session:i.session}))}var Wf=class{constructor(t){this.provider=t}provideFileSearchResults(t,e,n){return(async()=>{let r=rY(e);return Promise.all(r.map(s=>this.provider.provideFileSearchResults({pattern:t},s,n)))})().then(r=>nt(r).flat())}};function iY(i){return i.folderOptions.map(t=>({folder:t.folder,excludes:t.excludes.map(e=>typeof e=="string"?e:e.pattern),includes:t.includes,useGlobalIgnoreFiles:t.useIgnoreFiles.global,useIgnoreFiles:t.useIgnoreFiles.local,useParentIgnoreFiles:t.useIgnoreFiles.parent,followSymlinks:t.followSymlinks,maxResults:i.maxResults,previewOptions:sN(i.previewOptions),maxFileSize:i.maxFileSize,encoding:t.encoding,afterContext:i.surroundingContext,beforeContext:i.surroundingContext}))}function sN(i){return{matchLines:i?.matchLines??_b.matchLines,charsPerLine:i?.charsPerLine??_b.charsPerLine}}function sY(i){if(oY(i)){let t=On(i.ranges).map((e,n)=>{let r=On(i.preview.matches)[n];return{sourceRange:e,previewRange:r}});return new Yo(i.uri,t,i.preview.text)}else return new ta(i.uri,i.text,i.lineNumber)}var tk=class{constructor(t){this.provider=t}provideTextSearchResults(t,e,n,o){let r=l=>{aY(l)&&n.report(sY(l))};return(async()=>nt(await Promise.all(iY(e).map(l=>this.provider.provideTextSearchResults(t,l,{report:d=>r(d)},o)))).reduce((l,d)=>({limitHit:l.limitHit||d.limitHit}),{limitHit:!1}))().then(l=>({limitHit:l.limitHit,message:nt(On(l.message))}))}};function aY(i){if(lY(i)){if(Array.isArray(i.ranges)){if(!Array.isArray(i.preview.matches))return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same type."),!1;if(i.preview.matches.length!==i.ranges.length)return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same length."),!1}else if(Array.isArray(i.preview.matches))return console.warn("INVALID - A text search provider match's`ranges` and`matches` properties must have the same length."),!1}return!0}function lY(i){return!!i.preview}var Vf=class extends ar{constructor(t,e,n=()=>!1){let o=new Yv(n,()=>!1);super(o);let r=new Ve;t.forEach((s,a)=>{let l=s.folder.with({query:"",fragment:""});r.has(l)?r.get(l).push({fq:s,i:a}):r.set(l,[{fq:s,i:a}])}),r.forEach((s,a)=>{let l=new Map;for(let d of s){let c=e(d.fq,d.i);l.set(this.encodeKey(d.fq.folder),c)}super.set(a,l)})}findQueryFragmentAwareSubstr(t){let e=super.findSubstr(t.with({query:"",fragment:""}));if(!e)return;let n=this.encodeKey(t);return e.get(n)}forEachFolderQueryInfo(t){return this.forEach(e=>e.forEach(n=>t(n)))}encodeKey(t){let e="";return t.query&&(e+=t.query),t.fragment&&(e+="#"+t.fragment),e}};var aN=class{constructor(t,e,n){this.config=t;this.provider=e;this.sessionLifecycle=n;this.isLimitHit=!1;this.resultCount=0;this.isCanceled=!1;this.filePattern=t.filePattern;let o=t.ignoreGlobCase?{ignoreCase:!0}:void 0;this.includePattern=t.includePattern&&Po(t.includePattern,o),this.maxResults=t.maxResults||void 0,this.exists=t.exists,this.activeCancellationTokens=new Set,this.globalExcludePattern=t.excludePattern&&Po(t.excludePattern,o)}cancel(){this.isCanceled=!0,this.activeCancellationTokens.forEach(t=>t.cancel()),this.activeCancellationTokens=new Set}search(t){let e=this.config.folderQueries||[];return new Promise((n,o)=>{let r=s=>{this.resultCount++,t(s)};if(this.isCanceled)return n({limitHit:this.isLimitHit});this.config.extraFileResources&&this.config.extraFileResources.forEach(s=>{let a=s.toString(),l=ot(a);this.globalExcludePattern&&this.globalExcludePattern(a,l)||this.matchFile(r,{base:s,basename:l})}),this.doSearch(e,r).then(s=>{n({limitHit:this.isLimitHit,stats:s||void 0})},s=>{o(new Error(To(s)))})})}async doSearch(t,e){let n=new Ee,o=t.map(c=>this.getSearchOptionsForFolder(c)),r=this.provider instanceof Wf?this.sessionLifecycle?.tokenSource.token:this.sessionLifecycle?.obj,s={folderOptions:o,maxResults:this.config.maxResults??Jd,session:r},a=c=>{let u=new jg(this.config,c),m=!u.hasSiblingExcludeClauses();return{queryTester:u,noSiblingsClauses:m,folder:c.folder,tree:this.initDirectoryTree()}},l=new Vf(t,a),d;try{this.activeCancellationTokens.add(n),d=Xt.create();let c=await this.provider.provideFileSearchResults(this.config.filePattern||"",s,n.token),u=d.elapsed(),m=Xt.create();return this.isCanceled&&!this.isLimitHit||(c&&c.forEach(g=>{let h=l.findQueryFragmentAwareSubstr(g),f=qe.relative(h.folder.path,g.path);if(h.noSiblingsClauses){let I=ot(g.path);this.matchFile(e,{base:h.folder,relativePath:f,basename:I});return}this.addDirectoryEntries(h.tree,h.folder,f,e)}),this.isCanceled&&!this.isLimitHit)?null:(l.forEachFolderQueryInfo(g=>{this.matchDirectoryTree(g.tree,g.queryTester,e)}),{providerTime:u,postProcessTime:m.elapsed()})}finally{n.dispose(),this.activeCancellationTokens.delete(n)}}getSearchOptionsForFolder(t){let e=Yd(this.config.includePattern,t.includePattern),n=t.excludePattern?.map(r=>({folder:r.folder,patterns:Yd(this.config.excludePattern,r.pattern)}));n?.length||(n=[{folder:void 0,patterns:Yd(this.config.excludePattern,void 0)}]);let o=hw(n);return{folder:t.folder,excludes:o,includes:e,useIgnoreFiles:{local:!t.disregardIgnoreFiles,parent:!t.disregardParentIgnoreFiles,global:!t.disregardGlobalIgnoreFiles},followSymlinks:!t.ignoreSymlinks}}initDirectoryTree(){let t={rootEntries:[],pathToEntries:Object.create(null)};return t.pathToEntries["."]=t.rootEntries,t}addDirectoryEntries({pathToEntries:t},e,n,o){if(this.filePattern&&hs(n,this.filePattern,this.config.ignoreGlobCase)){let s=ot(this.filePattern);this.matchFile(o,{base:e,relativePath:this.filePattern,basename:s})}function r(s){let a=ot(s),l=gn(s),d=t[l];d||(d=t[l]=[],r(l)),d.push({base:e,relativePath:s,basename:a})}r(n)}matchDirectoryTree({rootEntries:t,pathToEntries:e},n,o){let r=this,s=this.filePattern,a=this.config.ignoreGlobCase;function l(d){let c=Pb(()=>d.map(u=>u.basename));for(let u=0,m=d.length;u<m;u++){let g=d[u],{relativePath:h,basename:f}=g;if(n.matchesExcludesSync(h,f,hs(s,f,a)?void 0:c))continue;let I=e[h];if(I)l(I);else{if(hs(h,s,a))continue;r.matchFile(o,g)}if(r.isLimitHit)break}}l(t)}matchFile(t,e){(!this.includePattern||e.relativePath&&this.includePattern(e.relativePath,e.basename))&&((this.exists||this.maxResults&&this.resultCount>=this.maxResults)&&(this.isLimitHit=!0,this.cancel()),this.isLimitHit||t(e))}},lN=class{constructor(){this._obj=new Object,this.tokenSource=new Ee}get obj(){if(this._obj)return this._obj;throw new Error("Session object has been dereferenced.")}cancel(){this.tokenSource.cancel(),this._obj=void 0}},nk=class i{constructor(){this.sessions=new Map}static{this.BATCH_SIZE=512}fileSearch(t,e,n,o){let r=this.getSessionTokenSource(t.cacheKey),s=new aN(t,e,r),a=0,l=d=>{a+=d.length,n(d.map(c=>this.rawMatchToSearchItem(c)))};return this.doSearch(s,i.BATCH_SIZE,l,o).then(d=>({limitHit:d.limitHit,stats:d.stats?{fromCache:!1,type:"fileSearchProvider",resultCount:a,detailStats:d.stats}:void 0,messages:[]}))}clearCache(t){this.sessions.get(t)?.cancel(),this.sessions.delete(t)}getSessionTokenSource(t){if(t)return this.sessions.has(t)||this.sessions.set(t,new lN),this.sessions.get(t)}rawMatchToSearchItem(t){return t.relativePath?{resource:gt(t.base,t.relativePath)}:{resource:t.base}}doSearch(t,e,n,o){let r=o.onCancellationRequested(()=>{t.cancel()}),s=l=>{l&&(a.push(l),e>0&&a.length>=e&&(n(a),a=[]))},a=[];return t.search(s).then(l=>(a.length&&n(a),r.dispose(),l),l=>(a.length&&n(a),r.dispose(),Promise.reject(l)))}};var up=class{constructor(t,e,n){this.queryProviderPair=t;this.fileUtils=e;this.processType=n;this.collector=null;this.isLimitHit=!1;this.resultCount=0}get query(){return this.queryProviderPair.query}search(t,e,n){let o=this.query.folderQueries||[],r=new Ee(e);return new Promise((s,a)=>{this.collector=new dN(t);let l=!1,d=(c,u)=>{if(!(c instanceof Zu)&&!l&&!this.isLimitHit){let m=this.resultSize(c);c instanceof Yo&&typeof this.query.maxResults=="number"&&this.resultCount+m>this.query.maxResults&&(this.isLimitHit=!0,l=!0,r.cancel(),c=this.trimResultToSize(c,this.query.maxResults-this.resultCount));let g=this.resultSize(c);this.resultCount+=g;let h=c instanceof Yo;(g>0||!h)&&this.collector.add(c,u)}};this.doSearch(o,d,r.token,n).then(c=>{r.dispose(),this.collector.flush(),s({limitHit:this.isLimitHit||c?.limitHit,messages:this.getMessagesFromResults(c),stats:{type:this.processType}})},c=>{r.dispose();let u=To(c);a(new Error(u))})})}getMessagesFromResults(t){return t?.message?Array.isArray(t.message)?t.message:[t.message]:[]}resultSize(t){return t instanceof Yo?Array.isArray(t.ranges)?t.ranges.length:1:0}trimResultToSize(t,e){return new Yo(t.uri,t.ranges.slice(0,e),t.previewText)}async doSearch(t,e,n,o){let r=new Vf(t,(u,m)=>({queryTester:new jg(this.query,u),folder:u.folder,folderIdx:m}),()=>!0),s=[],a={report:u=>{if(u instanceof Zu)o?.(u);else{if(u.uri===void 0)throw Error("Text search result URI is undefined. Please check provider implementation.");let m=r.findQueryFragmentAwareSubstr(u.uri);if(m?.folder?.scheme){let g=m.folder.scheme===B.file?Z$(()=>this.fileUtils.readdir(Ho(u.uri))):void 0,h=bv(m.folder,u.uri);if(h){let f=m.queryTester.includedInQuery(h,ot(h),g);oi(f)?s.push(f.then(I=>{I&&e(u,m.folderIdx)})):f&&e(u,m.folderIdx)}}}}},d={folderOptions:t.map(u=>this.getSearchOptionsForFolder(u)),maxFileSize:this.query.maxFileSize,maxResults:this.query.maxResults??Jd,previewOptions:this.query.previewOptions??_b,surroundingContext:this.query.surroundingContext??0},c;return this.queryProviderPair.query.type===3?c=await this.queryProviderPair.provider.provideAITextSearchResults(this.queryProviderPair.query.contentPattern,d,a,n):c=await this.queryProviderPair.provider.provideTextSearchResults(dY(this.queryProviderPair.query.contentPattern),d,a,n),s.length&&await Promise.all(s),c}getSearchOptionsForFolder(t){let e=Yd(this.query.includePattern,t.includePattern),n=t.excludePattern?.map(s=>({folder:s.folder,patterns:Yd(this.query.excludePattern,s.pattern)}));(!n||n.length===0)&&(n=[{folder:void 0,patterns:Yd(this.query.excludePattern,void 0)}]);let o=hw(n);return{folder:y.from(t.folder),excludes:o,includes:e,useIgnoreFiles:{local:!t.disregardIgnoreFiles,parent:!t.disregardParentIgnoreFiles,global:!t.disregardGlobalIgnoreFiles},followSymlinks:!t.ignoreSymlinks,encoding:(t.fileEncoding&&this.fileUtils.toCanonicalName(t.fileEncoding))??"",ignoreGlobCase:this.query.ignoreGlobCase||t.ignoreGlobCase}}};function dY(i){return{isCaseSensitive:i.isCaseSensitive||!1,isRegExp:i.isRegExp||!1,isWordMatch:i.isWordMatch||!1,isMultiline:i.isMultiline||!1,pattern:i.pattern}}var dN=class{constructor(t){this._onResult=t;this._currentFolderIdx=-1;this._currentFileMatch=null;this._batchedCollector=new cN(512,e=>this.sendItems(e))}add(t,e){this._currentFileMatch&&(this._currentFolderIdx!==e||!Sn(this._currentUri,t.uri))&&(this.pushToCollector(),this._currentFileMatch=null),this._currentFileMatch||(this._currentFolderIdx=e,this._currentUri=t.uri,this._currentFileMatch={resource:t.uri,results:[]}),this._currentFileMatch.results.push(cY(t))}pushToCollector(){let t=this._currentFileMatch&&this._currentFileMatch.results?this._currentFileMatch.results.length:0;this._batchedCollector.addItem(this._currentFileMatch,t)}flush(){this.pushToCollector(),this._batchedCollector.flush()}sendItems(t){this._onResult(t)}};function cY(i){return i instanceof Yo?{previewText:i.previewText,rangeLocations:i.ranges.map(t=>({preview:{startLineNumber:t.previewRange.start.line,startColumn:t.previewRange.start.character,endLineNumber:t.previewRange.end.line,endColumn:t.previewRange.end.character},source:{startLineNumber:t.sourceRange.start.line,startColumn:t.sourceRange.start.character,endLineNumber:t.sourceRange.end.line,endColumn:t.sourceRange.end.character}}))}:{text:i.text,lineNumber:i.lineNumber}}var cN=class i{constructor(t,e){this.maxBatchSize=t;this.cb=e;this.totalNumberCompleted=0;this.batch=[];this.batchSize=0}static{this.TIMEOUT=4e3}static{this.START_BATCH_AFTER_COUNT=50}addItem(t,e){t&&this.addItemToBatch(t,e)}addItems(t,e){t&&this.addItemsToBatch(t,e)}addItemToBatch(t,e){this.batch.push(t),this.batchSize+=e,this.onUpdate()}addItemsToBatch(t,e){this.batch=this.batch.concat(t),this.batchSize+=e,this.onUpdate()}onUpdate(){this.totalNumberCompleted<i.START_BATCH_AFTER_COUNT?this.flush():this.batchSize>=this.maxBatchSize?this.flush():this.timeoutHandle||(this.timeoutHandle=setTimeout(()=>{this.flush()},i.TIMEOUT))}flush(){this.batchSize&&(this.totalNumberCompleted+=this.batchSize,this.cb(this.batch),this.batch=[],this.batchSize=0,this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0))}};var Bf=A("IExtHostSearch"),mc=class{constructor(t,e,n){this.extHostRpc=t;this._uriTransformer=e;this._logService=n;this._proxy=this.extHostRpc.getProxy(F.MainThreadSearch),this._handlePool=0,this._textSearchProvider=new Map,this._textSearchUsedSchemes=new Set,this._aiTextSearchProvider=new Map,this._aiTextSearchUsedSchemes=new Set,this._fileSearchProvider=new Map,this._fileSearchUsedSchemes=new Set,this._fileSearchManager=new nk}_transformScheme(t){return this._uriTransformer.transformOutgoingScheme(t)}registerTextSearchProviderOld(t,e){if(this._textSearchUsedSchemes.has(t))throw new Error(`a text search provider for the scheme '${t}' is already registered`);this._textSearchUsedSchemes.add(t);let n=this._handlePool++;return this._textSearchProvider.set(n,new tk(e)),this._proxy.$registerTextSearchProvider(n,this._transformScheme(t)),q(()=>{this._textSearchUsedSchemes.delete(t),this._textSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerTextSearchProvider(t,e){if(this._textSearchUsedSchemes.has(t))throw new Error(`a text search provider for the scheme '${t}' is already registered`);this._textSearchUsedSchemes.add(t);let n=this._handlePool++;return this._textSearchProvider.set(n,e),this._proxy.$registerTextSearchProvider(n,this._transformScheme(t)),q(()=>{this._textSearchUsedSchemes.delete(t),this._textSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerAITextSearchProvider(t,e){if(this._aiTextSearchUsedSchemes.has(t))throw new Error(`an AI text search provider for the scheme '${t}'is already registered`);this._aiTextSearchUsedSchemes.add(t);let n=this._handlePool++;return this._aiTextSearchProvider.set(n,e),this._proxy.$registerAITextSearchProvider(n,this._transformScheme(t)),q(()=>{this._aiTextSearchUsedSchemes.delete(t),this._aiTextSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerFileSearchProviderOld(t,e){if(this._fileSearchUsedSchemes.has(t))throw new Error(`a file search provider for the scheme '${t}' is already registered`);this._fileSearchUsedSchemes.add(t);let n=this._handlePool++;return this._fileSearchProvider.set(n,new Wf(e)),this._proxy.$registerFileSearchProvider(n,this._transformScheme(t)),q(()=>{this._fileSearchUsedSchemes.delete(t),this._fileSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}registerFileSearchProvider(t,e){if(this._fileSearchUsedSchemes.has(t))throw new Error(`a file search provider for the scheme '${t}' is already registered`);this._fileSearchUsedSchemes.add(t);let n=this._handlePool++;return this._fileSearchProvider.set(n,e),this._proxy.$registerFileSearchProvider(n,this._transformScheme(t)),q(()=>{this._fileSearchUsedSchemes.delete(t),this._fileSearchProvider.delete(n),this._proxy.$unregisterProvider(n)})}$provideFileSearchResults(t,e,n,o){let r=jb(n),s=this._fileSearchProvider.get(t);if(s)return this._fileSearchManager.fileSearch(r,s,a=>{this._proxy.$handleFileMatch(t,e,a.map(l=>l.resource))},o);throw new Error("unknown provider: "+t)}async doInternalFileSearchWithCustomCallback(t,e,n){return{messages:[]}}$clearCache(t){return this._fileSearchManager.clearCache(t),Promise.resolve(void 0)}$provideTextSearchResults(t,e,n,o){let r=this._textSearchProvider.get(t);if(!r||!r.provideTextSearchResults)throw new Error(`Unknown Text Search Provider ${t}`);let s=jb(n);return this.createTextSearchManager(s,r).search(l=>this._proxy.$handleTextMatch(t,e,l),o)}$provideAITextSearchResults(t,e,n,o){let r=this._aiTextSearchProvider.get(t);if(!r||!r.provideAITextSearchResults)throw new Error(`Unknown AI Text Search Provider ${t}`);let s=jb(n);return this.createAITextSearchManager(s,r).search(l=>this._proxy.$handleTextMatch(t,e,l),o,l=>this._proxy.$handleKeywordResult(t,e,l))}$enableExtensionHostSearch(){}async $getAIName(t){let e=this._aiTextSearchProvider.get(t);if(!(!e||!e.provideAITextSearchResults))return e.name??"AI"}createTextSearchManager(t,e){return new up({query:t,provider:e},{readdir:n=>Promise.resolve([]),toCanonicalName:n=>n},"textSearchProvider")}createAITextSearchManager(t,e){return new up({query:t,provider:e},{readdir:n=>Promise.resolve([]),toCanonicalName:n=>n},"aiTextSearchProvider")}};mc=_([S(0,le),S(1,xs),S(2,te)],mc);function jb(i){return{...i,folderQueries:i.folderQueries&&i.folderQueries.map(uY),extraFileResources:i.extraFileResources&&i.extraFileResources.map(t=>y.revive(t))}}function uY(i){return Tt(i)}var $f=class extends N{constructor(e){super();this._onDidSuspend=this._register(new T);this.onDidSuspend=this._onDidSuspend.event;this._onDidResume=this._register(new T);this.onDidResume=this._onDidResume.event;this._onDidChangeOnBatteryPower=this._register(new T);this.onDidChangeOnBatteryPower=this._onDidChangeOnBatteryPower.event;this._onDidChangeThermalState=this._register(new T);this.onDidChangeThermalState=this._onDidChangeThermalState.event;this._onDidChangeSpeedLimit=this._register(new T);this.onDidChangeSpeedLimit=this._onDidChangeSpeedLimit.event;this._onWillShutdown=this._register(new T);this.onWillShutdown=this._onWillShutdown.event;this._onDidLockScreen=this._register(new T);this.onDidLockScreen=this._onDidLockScreen.event;this._onDidUnlockScreen=this._register(new T);this.onDidUnlockScreen=this._onDidUnlockScreen.event;this._proxy=e.getProxy(F.MainThreadPower)}$onDidSuspend(){this._onDidSuspend.fire()}$onDidResume(){this._onDidResume.fire()}$onDidChangeOnBatteryPower(e){this._onDidChangeOnBatteryPower.fire(e)}$onDidChangeThermalState(e){this._onDidChangeThermalState.fire(e)}$onDidChangeSpeedLimit(e){this._onDidChangeSpeedLimit.fire(e)}$onWillShutdown(){this._onWillShutdown.fire()}$onDidLockScreen(){this._onDidLockScreen.fire()}$onDidUnlockScreen(){this._onDidUnlockScreen.fire()}getSystemIdleState(e){return this._proxy.$getSystemIdleState(e)}getSystemIdleTime(){return this._proxy.$getSystemIdleTime()}getCurrentThermalState(){return this._proxy.$getCurrentThermalState()}isOnBatteryPower(){return this._proxy.$isOnBatteryPower()}async startPowerSaveBlocker(e){let n=await this._proxy.$startPowerSaveBlocker(e),o=this._proxy,r=n>=0,s=!1;return{id:n,get isStarted(){return r&&!s},dispose:()=>{r&&!s&&(s=!0,o.$stopPowerSaveBlocker(n))}}}};$f=_([S(0,le)],$f);var ok=A("IExtHostPower");var gc=class extends dS{constructor(t,e){super(e.logLevel,e.logsLocation,e.loggers.map(n=>Tt(n))),this._proxy=t.getProxy(F.MainThreadLogger)}$setLogLevel(t,e){e?this.setLogLevel(y.revive(e),t):this.setLogLevel(t)}setVisibility(t,e){super.setVisibility(t,e),this._proxy.$setVisibility(t,e)}doCreateLogger(t,e,n){return new uN(this._proxy,t,e,n)}};gc=_([S(0,le),S(1,Ye)],gc);var uN=class extends od{constructor(e,n,o,r){super(r?.logLevel==="always");this.proxy=e;this.file=n;this.isLoggerCreated=!1;this.buffer=[];this.setLevel(o),this.proxy.$createLogger(n,r).then(()=>{this.doLog(this.buffer),this.isLoggerCreated=!0})}log(e,n){let o=[[e,n]];this.isLoggerCreated?this.doLog(o):this.buffer.push(...o)}doLog(e){this.proxy.$log(this.file,e)}flush(){this.proxy.$flush(this.file)}};var zf=A("IExtHostBrowserTunnelProxy"),rk=class{$setEnabled(t){}};var Kf=A("IExtHostTerminalShellIntegration"),qf=class extends N{constructor(e,n){super();this._extHostTerminalService=n;this._activeShellIntegrations=new Map;this._onDidChangeTerminalShellIntegration=this._register(new T);this.onDidChangeTerminalShellIntegration=this._onDidChangeTerminalShellIntegration.event;this._onDidStartTerminalShellExecution=this._register(new T);this.onDidStartTerminalShellExecution=this._onDidStartTerminalShellExecution.event;this._onDidEndTerminalShellExecution=this._register(new T);this.onDidEndTerminalShellExecution=this._onDidEndTerminalShellExecution.event;this._proxy=e.getProxy(F.MainThreadTerminalShellIntegration),this._register(q(()=>{for(let[o,r]of this._activeShellIntegrations)r.dispose();this._activeShellIntegrations.clear()}))}$shellIntegrationChange(e,n){let o=this._extHostTerminalService.getTerminalById(e);if(!o)return;let r=o.value,s=this._activeShellIntegrations.get(e);s||(s=new pN(o.value,n,this._onDidStartTerminalShellExecution),this._activeShellIntegrations.set(e,s),s.store.add(o.onWillDispose(()=>this._activeShellIntegrations.get(e)?.dispose())),s.store.add(s.onDidRequestShellExecution(a=>this._proxy.$executeCommand(e,a))),s.store.add(s.onDidRequestEndExecution(a=>this._onDidEndTerminalShellExecution.fire(a))),s.store.add(s.onDidRequestChangeShellIntegration(a=>this._onDidChangeTerminalShellIntegration.fire(a))),o.shellIntegration=s.value),this._onDidChangeTerminalShellIntegration.fire({terminal:r,shellIntegration:s.value})}$shellExecutionStart(e,n,o,r,s,a){this._activeShellIntegrations.has(e)||this.$shellIntegrationChange(e,n);let l={value:o,confidence:r,isTrusted:s};this._activeShellIntegrations.get(e)?.startShellExecution(l,this._convertCwdToUri(a))}$shellExecutionEnd(e,n,o,r,s){let a={value:n,confidence:o,isTrusted:r};this._activeShellIntegrations.get(e)?.endShellExecution(a,s)}$shellExecutionData(e,n){this._activeShellIntegrations.get(e)?.emitData(n)}$shellEnvChange(e,n,o,r){this._activeShellIntegrations.get(e)?.setEnv(n,o,r)}$cwdChange(e,n){this._activeShellIntegrations.get(e)?.setCwd(this._convertCwdToUri(n))}$closeTerminal(e){this._activeShellIntegrations.get(e)?.dispose(),this._activeShellIntegrations.delete(e)}_convertCwdToUri(e){return e?y.file(e):void 0}};qf=_([S(0,le),S(1,Ao)],qf);var pN=class extends N{constructor(e,n,o){super();this._terminal=e;this._onDidStartTerminalShellExecution=o;this._pendingExecutions=[];this.store=this._register(new $);this._onDidRequestChangeShellIntegration=this._register(new T);this.onDidRequestChangeShellIntegration=this._onDidRequestChangeShellIntegration.event;this._onDidRequestShellExecution=this._register(new T);this.onDidRequestShellExecution=this._onDidRequestShellExecution.event;this._onDidRequestEndExecution=this._register(new T);this.onDidRequestEndExecution=this._onDidRequestEndExecution.event;this._onDidRequestNewExecution=this._register(new T);this.onDidRequestNewExecution=this._onDidRequestNewExecution.event;let r=this;this.value={get cwd(){return r._cwd},get env(){if(r._env)return Object.freeze({isTrusted:r._env.isTrusted,value:Object.freeze({...r._env.value})})},executeCommand(s,a){if(!n)throw new Error("This terminal does not support the executeCommand API.");let l=s;if(a)for(let u of a)!u.match(/["'`]/)&&u.match(/\s/)?l+=` "${u}"`:l+=` ${u}`;r._onDidRequestShellExecution.fire(l);let d={value:l,confidence:2,isTrusted:!0};return r.requestNewShellExecution(d,r._cwd).value}}}get currentExecution(){return this._currentExecution}requestNewShellExecution(e,n){let o=new sk(e,n??this._cwd);return ik(e.value).length>1&&(this._currentExecutionProperties={isMultiLine:!0,unresolvedCommandLines:ik(e.value)}),this._pendingExecutions.push(o),this._onDidRequestNewExecution.fire(e.value),o}startShellExecution(e,n){if(this._pendingEndingExecution&&(this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._pendingEndingExecution.value,exitCode:void 0}),this._pendingEndingExecution=void 0),this._currentExecution){if(this._currentExecutionProperties?.isMultiLine&&this._currentExecutionProperties.unresolvedCommandLines){let r=sz(this._currentExecutionProperties.unresolvedCommandLines,e);if(r){this._currentExecutionProperties.unresolvedCommandLines=r.unresolvedCommandLines;return}}this._currentExecution.endExecution(void 0),this._currentExecution.flush(),this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._currentExecution.value,exitCode:void 0})}let o;if(e.confidence===2)for(let[r,s]of this._pendingExecutions.entries())if(s.value.commandLine.value===e.value){o=s,this._currentExecutionProperties={isMultiLine:!1,unresolvedCommandLines:void 0},o=s,this._pendingExecutions.splice(r,1);break}else{let a=sz(ik(s.value.commandLine.value),e);if(a){this._currentExecutionProperties={isMultiLine:!0,unresolvedCommandLines:a.unresolvedCommandLines},o=s,this._pendingExecutions.splice(r,1);break}}else o=this._pendingExecutions.shift();o||(o=new sk(e,n??this._cwd)),this._currentExecution=o,this._onDidStartTerminalShellExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:this._currentExecution.value})}emitData(e){this.currentExecution?.emitData(e)}endShellExecution(e,n){if(!(this._currentExecutionProperties?.isMultiLine&&this._currentExecutionProperties.unresolvedCommandLines&&this._currentExecutionProperties.unresolvedCommandLines.length>0)&&this._currentExecution){let o=this._currentExecutionProperties?.isMultiLine?this._currentExecution.value.commandLine:e;this._currentExecution.endExecution(o);let r=this._currentExecution;this._pendingEndingExecution=r,this._currentExecution=void 0,r.flush().then(()=>{this._pendingEndingExecution===r&&(this._onDidRequestEndExecution.fire({terminal:this._terminal,shellIntegration:this.value,execution:r.value,exitCode:n}),this._pendingEndingExecution=void 0)})}}setEnv(e,n,o){let r={};for(let s=0;s<e.length;s++)r[e[s]]=n[s];this._env={value:r,isTrusted:o},this._fireChangeEvent()}setCwd(e){let n=!1;y.isUri(this._cwd)?n=!y.isUri(e)||this._cwd.toString()!==e.toString():this._cwd!==e&&(n=!0),n&&(this._cwd=e,this._fireChangeEvent())}_fireChangeEvent(){this._onDidRequestChangeShellIntegration.fire({terminal:this._terminal,shellIntegration:this.value})}},sk=class{constructor(t,e){this._commandLine=t;this.cwd=e;this._isEnded=!1;let n=this;this.value={get commandLine(){return n._commandLine},get cwd(){return n.cwd},read(){return n._createDataStream()}}}_createDataStream(){if(!this._dataStream){if(this._isEnded)return _a.EMPTY;this._dataStream=new mN}return this._dataStream.createIterable()}emitData(t){this._isEnded||this._dataStream?.emitData(t)}endExecution(t){t&&(this._commandLine=t),this._dataStream?.endExecution(),this._isEnded=!0}async flush(){this._dataStream&&(await this._dataStream.flush(),this._dataStream.dispose(),this._dataStream=void 0)}},mN=class extends N{constructor(){super(...arguments);this._iterables=[];this._emitters=[]}createIterable(){this._barrier||(this._barrier=new kn);let e=this._barrier,n=new _a(async o=>{this._emitters.push(o),await e.wait()});return this._iterables.push(n),n}emitData(e){for(let n of this._emitters)n.emitOne(e)}endExecution(){this._barrier?.open()}async flush(){await Promise.all(this._iterables.map(e=>e.toPromise()))}};function ik(i){return i.split(`
`).map(t=>t.trim()).filter(t=>t.length>0)}function sz(i,t){if(i.length===0)return!1;let e=[...i],n=ik(t.value);if(e&&e.length>0){for(;e.length>0&&e[0]===n[0];)e.shift(),n.shift();if(n.length===0)return{unresolvedCommandLines:e}}return!1}var jf=class{constructor(t){this.dataBuffer="";this.eventTypeBuffer="";this.buffer=[];this.endedOnCR=!1;this.onEventHandler=t,this.decoder=new TextDecoder("utf-8")}getLastEventId(){return this.lastEventIdBuffer}getReconnectionTime(){return this.reconnectionTime}feed(t){if(t.length===0)return;let e=0;for(this.endedOnCR&&t[0]===10&&e++,this.endedOnCR=!1;e<t.length;){let n=t.indexOf(13,e),o=t.indexOf(10,e),r=n===-1?o:o===-1?n:Math.min(n,o);if(r===-1)break;let s="";for(let a of this.buffer)s+=this.decoder.decode(a,{stream:!0});s+=this.decoder.decode(t.subarray(e,r)),this.processLine(s),this.buffer.length=0,e=r+(t[r]===13&&t[r+1]===10?2:1)}e<t.length?this.buffer.push(t.subarray(e)):this.endedOnCR=t[t.length-1]===13}processLine(t){if(!t.length){this.dispatchEvent();return}if(t.startsWith(":"))return;let e,n,o=t.indexOf(":");o===-1?(e=t,n=""):(e=t.substring(0,o),n=t.substring(o+1),n.startsWith(" ")&&(n=n.substring(1))),this.processField(e,n)}processField(t,e){switch(t){case"event":this.eventTypeBuffer=e;break;case"data":this.dataBuffer+=e,this.dataBuffer+=`
`;break;case"id":e.includes("\0")?this.currentEventId=void 0:this.currentEventId=this.lastEventIdBuffer=e;break;case"retry":/^\d+$/.test(e)&&(this.reconnectionTime=parseInt(e,10));break}}dispatchEvent(){if(this.dataBuffer===""){this.dataBuffer="",this.eventTypeBuffer="";return}this.dataBuffer.endsWith(`
`)&&(this.dataBuffer=this.dataBuffer.substring(0,this.dataBuffer.length-1));let t={type:this.eventTypeBuffer||"message",data:this.dataBuffer};this.currentEventId!==void 0&&(t.id=this.currentEventId),this.reconnectionTime!==void 0&&(t.retry=this.reconnectionTime),this.onEventHandler(t),this.reset()}reset(){this.dataBuffer="",this.eventTypeBuffer="",this.currentEventId=void 0}};var Gb=class{validateOrThrow(t){let e=this.validate(t);if(e.error)throw new Error(e.error.message);return e.content}},Gf=class extends Gb{constructor(e){super();this.type=e}validate(e){return typeof e!==this.type?{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof e}`}}:{content:e,error:void 0}}getJSONSchema(){return{type:this.type}}},pY=new Gf("string");function Jb(){return pY}var mY=new Gf("number");function az(){return mY}var vnt=new Gf("boolean");var gY=new Gf("object");function ak(){return gY}var Qb=class{constructor(t){this.validator=t}};function pp(i){return new Qb(i)}var gN=class extends Gb{constructor(e){super();this.properties=e}validate(e){if(typeof e!="object"||e===null)return{content:void 0,error:{message:"Expected object"}};let n={};for(let o in this.properties){let r=this.properties[o],s=e[o],a=r instanceof Qb,l=a?r.validator:r;if(a&&s===void 0)continue;let{content:d,error:c}=l.validate(s);if(c)return{content:void 0,error:{message:`Error in property '${o}': ${c.message}`}};n[o]=d}return{content:n,error:void 0}}getJSONSchema(){let e=[],n={};for(let[r,s]of Object.entries(this.properties)){let a=s instanceof Qb,l=a?s.validator:s;n[r]=l.getJSONSchema(),a||e.push(r)}return{type:"object",properties:n,...e.length>0?{required:e}:{}}}};function Yb(i){return new gN(i)}var fN=class extends Gb{constructor(e){super();this.validator=e}validate(e){if(!Array.isArray(e))return{content:void 0,error:{message:"Expected array"}};let n=[];for(let o=0;o<e.length;o++){let{content:r,error:s}=this.validator.validate(e[o]);if(s)return{content:void 0,error:{message:`Error in element ${o}: ${s.message}`}};n.push(r)}return{content:n,error:void 0}}getJSONSchema(){return{type:"array",items:this.validator.getJSONSchema()}}};function hN(i){return new fN(i)}var mp=A("IExtHostMpcService"),fY=Yb({label:Jb(),version:pp(Jb()),metadata:pp(Yb({capabilities:pp(ak()),serverInfo:pp(ak()),tools:pp(hN(Yb({availability:az(),definition:ak()})))})),authentication:pp(Yb({providerId:Jb(),scopes:hN(Jb())}))}),fc=class extends N{constructor(e,n,o,r,s){super();this._logService=n;this._extHostInitData=o;this._workspaceService=r;this._variableResolver=s;this._initialProviderPromises=new Set;this._sseEventSources=this._register(new bn);this._unresolvedMcpServers=new Map;this._onDidChangeMcpServerDefinitions=this._register(new T);this.onDidChangeMcpServerDefinitions=this._onDidChangeMcpServerDefinitions.event;this._mcpServerDefinitions=[];this._activeGateways=new Map;this._proxy=e.getProxy(F.MainThreadMcp)}get mcpServerDefinitions(){return this._mcpServerDefinitions}$onDidChangeMcpServerDefinitions(e){this._mcpServerDefinitions=e.map(n=>$g.to(n)),this._onDidChangeMcpServerDefinitions.fire()}$startMcp(e,n){this._startMcp(e,vu.fromSerialized(n.launch),n.defaultCwd&&y.revive(n.defaultCwd),n.errorOnUserInteraction)}_startMcp(e,n,o,r){if(n.type===2){this._sseEventSources.set(e,new Xb(e,n,this._proxy,this._logService,r));return}throw new Error("not implemented")}async $substituteVariables(e,n){let o=y.revive(e),r=o&&await this._workspaceService.resolveWorkspaceFolder(o);return(await this._variableResolver.getResolver()).resolveAsync(r&&{uri:r.uri,name:r.name,index:r.index},n)}$stopMcp(e){this._sseEventSources.get(e)?.close().then(()=>this._didClose(e))}_didClose(e){this._sseEventSources.deleteAndDispose(e)}$sendMessage(e,n){this._sseEventSources.get(e)?.send(n)}async $waitForInitialCollectionProviders(){await Promise.all(this._initialProviderPromises)}async $resolveMcpLaunch(e,n){let o=this._unresolvedMcpServers.get(e);if(!o)return;let r=o.servers.find(a=>a.label===n);if(!r)return;if(!o.provider.resolveMcpServerDefinition)return $g.from(r);let s=await o.provider.resolveMcpServerDefinition(r,pe.None);return s?$g.from(s):void 0}registerMcpConfigurationProvider(e,n,o){let r=new $,s=e.contributes?.mcpServerDefinitionProviders?.find(c=>c.id===n);if(!s)throw new Error(`MCP configuration providers must be registered in the contributes.mcpServerDefinitionProviders array within your package.json, but "${n}" was not`);let a={id:h$(e.identifier,n),isTrustedByDefault:!0,label:s?.label??e.displayName??e.name,scope:1,canResolveLaunch:typeof o.resolveMcpServerDefinition=="function",extensionId:e.identifier.value,configTarget:this._extHostInitData.remote.isRemote?4:2},l=async()=>{let c=await o.provideMcpServerDefinitions(pe.None);this._unresolvedMcpServers.set(a.id,{servers:c??[],provider:o});let u=[];for(let m of c??[]){let g=xe.toKey(e.identifier)+"/"+m.label;if(u.some(I=>I.id===g)){let I=2;for(;u.some(x=>x.id===g+I);)I++;g=g+I}fY.validateOrThrow(m),m.authentication&&M(e,"mcpToolDefinitions");let h,f=m;Le(e,"mcpToolDefinitions")&&f.metadata&&(h={capabilities:f.metadata.capabilities,instructions:f.metadata.instructions,serverInfo:f.metadata.serverInfo,tools:f.metadata.tools?.map(I=>({availability:I.availability===1?1:0,definition:I.definition}))}),u.push({id:g,label:m.label,cacheNonce:m.version||"$$NONE",staticMetadata:h,launch:$g.from(m)})}this._proxy.$upsertMcpCollection(a,u)};r.add(q(()=>{this._unresolvedMcpServers.delete(a.id),this._proxy.$deleteMcpCollection(a.id)})),o.onDidChangeMcpServerDefinitions&&r.add(o.onDidChangeMcpServerDefinitions(l)),o.onDidChangeServerDefinitions&&r.add(o.onDidChangeServerDefinitions(l)),o.onDidChange&&r.add(o.onDidChange(l));let d=new Promise(c=>{setTimeout(()=>l().finally(()=>{this._initialProviderPromises.delete(d),c()}),0)});return this._initialProviderPromises.add(d),r}async startMcpGateway(e){let n=await this._proxy.$startMcpGateway(e?.toJSON());if(!n)return;let o=n.gatewayId,r=n.servers.map(a=>({label:a.label,address:y.revive(a.address)})),s=new T;return this._activeGateways.set(o,{servers:r,onDidChangeServers:s}),{get servers(){return r},onDidChangeServers:s.event,dispose:()=>{this._activeGateways.delete(o),s.dispose(),this._proxy.$disposeMcpGateway(o)}}}$onDidChangeGatewayServers(e,n){let o=this._activeGateways.get(e);if(!o)return;let r=n.map(s=>({label:s.label,address:y.revive(s.address)}));o.servers.length=0,o.servers.push(...r),o.onDidChangeServers.fire(r)}};fc=_([S(0,le),S(1,te),S(2,Ye),S(3,Vn),S(4,Gr)],fc);function vN(i){if(!(i instanceof Error))return String(i);let t=String(i),e=i.cause;for(let n=0;e!==void 0&&n<5;n++)t+=`: ${e instanceof Error&&e.message||String(e)}`,e=e instanceof Error?e.cause:void 0;return t}var hY=5,vY=[301,302,303,307,308],yY=new Set(["http:","https:"]),bY=new Set(["authorization","cookie","proxy-authorization","mcp-session-id"]);function yN(i,t,e){for(let n of Object.keys(i))n.toLowerCase()===t.toLowerCase()&&delete i[n];i[t]=e}var Xb=class extends N{constructor(e,n,o,r,s){super();this._id=e;this._launch=n;this._proxy=o;this._logService=r;this._errorOnUserInteraction=s;this._requestSequencer=new Ax;this._postEndpoint=new jt;this._mode={value:0};this._cts=new Ee;this._abortCtrl=new AbortController;this._didSendClose=!1;this._register(q(()=>{this._abortCtrl.abort(),this._cts.dispose(!0)})),this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Running})}async send(e){try{this._mode.value===0?await this._requestSequencer.queue(()=>this._send(e)):await this._send(e)}catch(n){let o=`Error sending message to ${this._launch.uri}: ${vN(n)}`;this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Error,message:o})}}async close(){if(this._mode.value===1&&this._mode.sessionId&&!this._didSendClose){this._didSendClose=!0;try{await this._closeSession(this._mode.sessionId)}catch{}}this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Stopped})}async _closeSession(e){let n={...Object.fromEntries(this._launch.headers),"Mcp-Session-Id":e};try{await this._addAuthHeader(n,{errorOnUserInteraction:!0})}catch{this._log(2,"Skipping session close: authentication no longer available");return}await this._fetch(this._launch.uri.toString(!0),{method:"DELETE",headers:n})}_send(e){return this._mode.value===2?this._sendLegacySSE(this._mode.endpoint,e):this._sendStreamableHttp(e,this._mode.value===1?this._mode.sessionId:void 0)}async _sendStreamableHttp(e,n){let o=new TextEncoder().encode(e),r={...Object.fromEntries(this._launch.headers),"Content-Type":"application/json",Accept:"text/event-stream, application/json"};n&&(r["Mcp-Session-Id"]=n),await this._addAuthHeader(r);let s=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"POST",headers:r,body:o},r),a=this._mode.value===0,l=s.headers.get("Mcp-Session-Id");if(l&&(this._mode={value:1,sessionId:l}),this._mode.value===0&&s.status>=400&&s.status<500&&!bN(s.status)){this._log(3,`${s.status} status sending message to ${this._launch.uri}, will attempt to fall back to legacy SSE`),this._sseFallbackWithMessage(e);return}if(s.status>=300){let d=this._mode.value===1&&!!this._mode.sessionId&&(s.status===400||s.status===404);this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Error,message:`${s.status} status sending message to ${this._launch.uri}: ${await this._getErrText(s)}`+(d?"; will retry with new session ID":""),shouldRetry:d});return}this._mode.value===0&&(this._mode={value:1,sessionId:void 0}),a&&this._attachStreamableBackchannel(),await this._handleSuccessfulStreamableHttp(s,e)}async _sseFallbackWithMessage(e){let n=await this._attachSSE();n&&(this._mode={value:2,endpoint:n},await this._sendLegacySSE(n,e))}async _handleSuccessfulStreamableHttp(e,n){if(e.status===202)return;let o=e.headers.get("Content-Type")?.toLowerCase()||"";if(o.startsWith("text/event-stream")){let r=new jf(s=>{if(s.type==="message")this._proxy.$onDidReceiveMessage(this._id,s.data);else if(s.type==="endpoint")throw this._log(4,`Received SSE endpoint from a POST to ${this._launch.uri}, will fall back to legacy SSE`),this._sseFallbackWithMessage(n),new Oe});try{await this._doSSE(r,e)}catch(s){this._log(4,`Error reading SSE stream: ${vN(s)}`)}}else if(o.startsWith("application/json"))this._proxy.$onDidReceiveMessage(this._id,await e.text());else{let r=await e.text();IY(r)?this._proxy.$onDidReceiveMessage(this._id,r):this._log(4,`Unexpected ${e.status} response for request: ${r}`)}}async _attachStreamableBackchannel(){let e,n;for(let o=0;!this._store.isDisposed;o++){n!==void 0?(await Vt(Math.max(0,n-Date.now()),this._cts.token),n=void 0):await Vt(Math.min(o*1e3,3e4),this._cts.token);let r;try{let a={...Object.fromEntries(this._launch.headers),Accept:"text/event-stream"};await this._addAuthHeader(a),this._mode.value===1&&this._mode.sessionId!==void 0&&(a["Mcp-Session-Id"]=this._mode.sessionId),e&&(a["Last-Event-ID"]=e),r=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"GET",headers:a},a)}catch{this._log(3,`Error connecting to ${this._launch.uri} for async notifications, will retry`);continue}if(r.status>=400){this._log(2,`${r.status} status connecting to ${this._launch.uri} for async notifications; they will be disabled: ${await this._getErrText(r)}`);return}r.headers.get("content-type")?.toLowerCase().includes("text/event-stream")&&(o=0);let s=new jf(a=>{a.retry&&(n=Date.now()+a.retry),a.type==="message"&&a.data&&this._proxy.$onDidReceiveMessage(this._id,a.data),a.id&&(e=a.id)});try{await this._doSSE(s,r)}catch(a){this._log(3,`Error reading from async stream, we will reconnect: ${a}`)}}}async _attachSSE(){let e=new jt,n={...Object.fromEntries(this._launch.headers),Accept:"text/event-stream"};await this._addAuthHeader(n);let o;try{if(o=await this._fetchWithAuthRetry(this._launch.uri.toString(!0),{method:"GET",headers:n},n),o.status>=300){this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Error,message:`${o.status} status connecting to ${this._launch.uri} as SSE: ${await this._getErrText(o)}`});return}}catch(s){this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Error,message:`Error connecting to ${this._launch.uri} as SSE: ${s}`});return}let r=new jf(s=>{s.type==="message"?this._proxy.$onDidReceiveMessage(this._id,s.data):s.type==="endpoint"&&e.complete(new URL(s.data,this._launch.uri.toString(!0)).toString())});return this._register(q(()=>e.cancel())),this._doSSE(r,o).catch(s=>{this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Error,message:`Error reading SSE stream: ${vN(s)}`})}),e.p}async _sendLegacySSE(e,n){let o=new TextEncoder().encode(n),r={...Object.fromEntries(this._launch.headers),"Content-Type":"application/json"};await this._addAuthHeader(r);let s=await this._fetch(e,{method:"POST",headers:r,body:o});s.status>=300&&this._log(4,`${s.status} status sending message to ${this._postEndpoint}: ${await this._getErrText(s)}`)}async _doSSE(e,n){if(!n.body)return;let o=n.body.getReader(),r;do{try{r=await ri(o.read(),this._cts.token)}catch(s){if(o.cancel(),this._store.isDisposed)return;throw s}r.value&&e.feed(r.value)}while(!r.done)}async _addAuthHeader(e,n){let o=n?.errorOnUserInteraction??this._errorOnUserInteraction;if(this._authMetadata)try{let r={authorizationServer:this._authMetadata.authorizationServer.toJSON(),authorizationServerMetadata:this._authMetadata.serverMetadata,resourceMetadata:this._authMetadata.resourceMetadata,scopes:this._authMetadata.scopes,clientId:this._launch.oauth?.clientId,enterpriseManaged:this._launch.oauth?.enterpriseManaged},s=await this._proxy.$getTokenFromServerMetadata(this._id,r,{errorOnUserInteraction:o,forceNewRegistration:n?.forceNewRegistration});s&&yN(e,"Authorization",`Bearer ${s}`)}catch(r){if(qy.is(r))throw this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Stopped,reason:"needs-user-interaction"}),new Oe;this._log(4,`Error getting token from server metadata: ${String(r)}`)}if(this._launch.authentication)try{this._log(2,`Using provided authentication config: providerId=${this._launch.authentication.providerId}, scopes=${this._launch.authentication.scopes.join(", ")}`);let r=await this._proxy.$getTokenForProviderId(this._id,this._launch.authentication.providerId,this._launch.authentication.scopes,{errorOnUserInteraction:o,forceNewRegistration:n?.forceNewRegistration,clientId:this._launch.oauth?.clientId});r&&(yN(e,"Authorization",`Bearer ${r}`),this._log(3,"Successfully obtained token from provided authentication config"))}catch(r){if(qy.is(r))throw this._proxy.$onDidChangeState(this._id,{state:_o.Kind.Stopped,reason:"needs-user-interaction"}),new Oe;this._log(4,`Error getting token from provided authentication config: ${String(r)}`)}return e}_log(e,n){this._store.isDisposed||this._proxy.$onDidPublishLog(this._id,e,n)}async _getErrText(e){try{return await e.text()}catch{return e.statusText}}async _fetchWithAuthRetry(e,n,o){let r=()=>this._fetch(e,n),s=await r();if(bN(s.status)&&(this._authMetadata?this._authMetadata.update(s.headers)&&(await this._addAuthHeader(o),o.Authorization&&(n.headers=o,s=await r())):(this._authMetadata=await xY(e,s.headers,{sameOriginHeaders:{...Object.fromEntries(this._launch.headers),"MCP-Protocol-Version":zy.LATEST_PROTOCOL_VERSION},fetch:(a,l)=>this._fetch(a,l),log:(a,l)=>this._log(a,l)}),this._proxy.$logMcpAuthSetup(this._authMetadata.telemetry),await this._addAuthHeader(o),o.Authorization&&(n.headers=o,s=await r()))),o.Authorization&&bN(s.status)){let a=await this._getErrText(s);this._log(3,`Received ${s.status} status with Authorization header, retrying with new auth registration. Error details: ${a||"no additional details"}`),await this._addAuthHeader(o,{forceNewRegistration:!0}),s=await r()}return s}async _fetch(e,n){if(yN(n.headers,"user-agent",`${rr.nameLong}/${rr.version}`),om(this._logService.getLevel(),1)){let s={...n,headers:{...n.headers}};s.body&&(s.body=new TextDecoder().decode(s.body)),s.headers?.Authorization&&(s.headers.Authorization="***"),this._log(1,`Fetching ${e} with options: ${JSON.stringify(s)}`)}let o=e,r;for(let s=0;s<hY&&(r=await this._fetchInternal(o,{...n,signal:this._abortCtrl.signal,redirect:"manual"}),!!vY.includes(r.status));s++){let a=r.headers.get("location");if(!a)break;let l=new URL(o),d=new URL(a,o);if(!yY.has(d.protocol))throw new Error(`MCP server redirected to a non-http(s) target (${d.protocol}), which is not allowed`);if(l.origin!==d.origin)for(let u of Object.keys(n.headers))bY.has(u.toLowerCase())&&delete n.headers[u];let c=d.toString();this._log(1,`Redirect (${r.status}) from ${o} to ${c}`),o=c,(r.status===303||(r.status===301||r.status===302)&&n.method==="POST")&&(n.method="GET",delete n.body)}if(om(this._logService.getLevel(),1)){let s={};r.headers.forEach((a,l)=>{s[l]=a}),this._log(1,`Fetched ${o}: ${JSON.stringify({status:r.status,headers:s})}`)}return r}_fetchInternal(e,n){return fetch(e,n)}};function IY(i){try{return JSON.parse(i),!0}catch{return!1}}function bN(i){return i===401||i===403}var lk=class{constructor(t,e,n,o,r,s){this.authorizationServer=t;this.serverMetadata=e;this.resourceMetadata=n;this.telemetry=r;this._log=s;this._scopes=o}get scopes(){return this._scopes}update(t){let e=this._parseScopesFromResponse(t);return k5(e,this._scopes)?!1:(this._log(3,`Scopes changed from ${JSON.stringify(this._scopes)} to ${JSON.stringify(e)}, updating`),this._scopes=e,!0)}_parseScopesFromResponse(t){let e=t.get("WWW-Authenticate");if(!e)return;let n=cO(e);for(let o of n)if(o.scheme==="Bearer"&&o.params.scope){let r=o.params.scope.split(mf).filter(s=>s.trim().length);if(r.length)return this._log(3,`Found scope challenge in WWW-Authenticate header: ${o.params.scope}`),r}}};async function xY(i,t,e){let{sameOriginHeaders:n,fetch:o,log:r}=e,s="none",a,{resourceMetadataChallenge:l,scopesChallenge:d}=SY(t.get("WWW-Authenticate")??void 0,r),c,u,m=d;try{let{metadata:I,discoveryUrl:x,errors:E}=await P5(i,l,{sameOriginHeaders:n,fetch:(w,R)=>o(w,R)});for(let w of E)r(4,`Error fetching resource metadata: ${w}`);r(3,`Discovered resource metadata at ${x}`),s=l?"header":"wellKnown",c=I.authorization_servers?.[0],c?(r(3,`Using auth server metadata url: ${c}`),a="resourceMetadata"):r(4,`No authorization_servers found in resource metadata ${x} - Is this resource metadata configured correctly?`),m??=I.scopes_supported,u=I}catch(I){r(4,`Could not fetch resource metadata: ${String(I)}`)}let g=new URL(i).origin,h={};c||(c=g,n&&(h=n));try{r(2,`Fetching auth server metadata for: ${c} ...`);let{metadata:I,discoveryUrl:x,errors:E}=await Mw(c,{additionalHeaders:h,fetch:(w,R)=>o(w,R)});for(let w of E)r(4,`Error fetching authorization server metadata: ${w}`);return r(3,`Discovered authorization server metadata at ${x}`),a??="wellKnown",new lk(y.parse(c),I,u,m,{resourceMetadataSource:s,serverMetadataSource:a},r)}catch(I){r(4,`Error populating auth server metadata for ${c}: ${String(I)}`)}let f=w5(new URL(g));return r(3,"Using default auth metadata"),new lk(y.parse(g),f,u,m,{resourceMetadataSource:s,serverMetadataSource:"default"},r)}function SY(i,t){if(!i)return{};let e,n,o=cO(i);for(let r of o)if(r.scheme==="Bearer"){if(!e&&r.params.resource_metadata&&(e=r.params.resource_metadata,t(2,`Found resource_metadata challenge in WWW-Authenticate header: ${e}`)),!n&&r.params.scope){let s=r.params.scope.split(mf).filter(a=>a.trim().length);s.length&&(t(2,`Found scope challenge in WWW-Authenticate header: ${r.params.scope}`),n=s)}if(e&&n)break}return{resourceMetadataChallenge:e,scopesChallenge:n}}var mot=A("dataChannelService"),got=A("linkPresentationService");function dz(i){if(!IN(i)||!TY(i.kind))throw new Error("Invalid link presentation payload");let t=lz(i.status),e=lz(i.secondaryStatus),n=CY(i.changes);return{kind:i.kind,...typeof i.title=="string"?{title:i.title}:{},...typeof i.detail=="string"?{detail:i.detail}:{},...typeof i.reference=="string"?{reference:i.reference}:{},...t?{status:t}:{},...e?{secondaryStatus:e}:{},...n?{changes:n}:{},...typeof i.tooltip=="string"?{tooltip:i.tooltip}:{},...typeof i.ariaLabel=="string"?{ariaLabel:i.ariaLabel}:{},...i.isLoading===!0?{isLoading:!0}:{}}}function lz(i){if(i!==void 0){if(!IN(i)||!EY(i.kind)||typeof i.label!="string")throw new Error("Invalid link presentation status");return{kind:i.kind,label:i.label}}}function CY(i){if(i!==void 0){if(!IN(i)||typeof i.insertions!="number"||typeof i.deletions!="number")throw new Error("Invalid link presentation changes");return{insertions:i.insertions,deletions:i.deletions}}}function TY(i){return i==="resource"||i==="issue"||i==="pullRequest"||i==="commit"||i==="file"||i==="folder"||i==="session"||i==="chat"||i==="repository"||i==="branch"}function EY(i){return i==="neutral"||i==="pending"||i==="success"||i==="warning"||i==="error"||i==="open"||i==="closed"||i==="merged"||i==="draft"||i==="notPlanned"}function IN(i){return typeof i=="object"&&i!==null}var dk=A("IExtHostDataChannels"),xl=class{constructor(t){this._channels=new Map;this._linkPresentationWatchers=new Map;this._linkPresentationProviders=new Map;this._providedLinkPresentationWatchers=new Map;this._linkPresentationCache=new Map;this._onDidChangeLinkPresentationRules=new T;this.onDidChangeLinkPresentationRules=this._onDidChangeLinkPresentationRules.event;this._linkPresentationRules=[];this._proxy=t.getProxy(F.MainThreadDataChannels)}static{this._linkPresentationWatcherHandlePool=0}static{this._linkPresentationProviderHandlePool=0}get linkPresentationRules(){return this._linkPresentationRules}createDataChannel(t,e){M(t,"dataChannels");let n=this._channels.get(e);return n||(n=new xN(e),this._channels.set(e,n)),n}createLinkPresentationWatcher(t,e,n){M(t,"linkPresentation");let o=n.toString(!0),r=this._linkPresentationRules.find(u=>u.id===e&&wY(u.uriPattern,o));if(!r)throw new Error(`Link presentation provider '${e}' does not accept '${o}'.`);let s=`${e}\0${o}`,l={...this._getCachedLinkPresentation(s,r.kind)??{kind:r.kind},isLoading:!0},d=xl._linkPresentationWatcherHandlePool++,c=new SN(d,l,this._proxy,u=>this._linkPresentationWatchers.delete(u),u=>this._cacheLinkPresentation(s,u));return this._linkPresentationWatchers.set(d,c),this._proxy.$createLinkPresentationWatcher(d,e,r.kind,n),c}registerLinkPresentationProvider(t,e,n){if(M(t,"linkPresentation"),!e.trim())throw new Error("Link presentation provider id must not be empty.");let o=xl._linkPresentationProviderHandlePool++;return this._linkPresentationProviders.set(o,n),this._proxy.$registerLinkPresentationProvider(o,t.identifier.value,e),q(()=>{this._proxy.$unregisterLinkPresentationProvider(o),this._linkPresentationProviders.delete(o);for(let[r,s]of this._providedLinkPresentationWatchers)s.providerHandle===o&&(s.store.dispose(),this._providedLinkPresentationWatchers.delete(r))})}$onDidReceiveData(t,e){this._channels.get(t)?._fireDidReceiveData(e)}$acceptLinkPresentationRules(t){this._linkPresentationRules=t.map(e=>({id:e.id,uriPattern:new RegExp(e.source,e.flags),kind:e.kind})),this._onDidChangeLinkPresentationRules.fire()}$acceptLinkPresentation(t,e){this._linkPresentationWatchers.get(t)?.acceptPresentation(e)}async $createLinkPresentationWatcher(t,e,n){let o=this._linkPresentationProviders.get(e);if(!o)throw new Error(`Link presentation provider handle '${e}' is not registered.`);let r=o.provideLinkPresentationWatcher(y.revive(n),pe.None),s=new $;return s.add(r),s.add(r.onDidChangePresentation(()=>{this._proxy.$acceptLinkPresentationProviderData(t,r.presentation)})),this._providedLinkPresentationWatchers.set(t,{providerHandle:e,store:s}),r.presentation}$disposeLinkPresentationWatcher(t){let e=this._providedLinkPresentationWatchers.get(t);e&&(this._providedLinkPresentationWatchers.delete(t),e.store.dispose())}_getCachedLinkPresentation(t,e){let n=this._linkPresentationCache.get(t);if(n?.kind!==e){this._linkPresentationCache.delete(t);return}return n&&(this._linkPresentationCache.delete(t),this._linkPresentationCache.set(t,n)),n}_cacheLinkPresentation(t,e){for(this._linkPresentationCache.delete(t),this._linkPresentationCache.set(t,e);this._linkPresentationCache.size>100;){let n=this._linkPresentationCache.keys().next().value;if(n===void 0)break;this._linkPresentationCache.delete(n)}}};xl=_([S(0,le)],xl);var xN=class extends N{constructor(e){super();this.channelId=e;this._onDidReceiveData=this._register(new T);this.onDidReceiveData=this._onDidReceiveData.event}_fireDidReceiveData(e){this._onDidReceiveData.fire({data:e})}toString(){return`DataChannel(${this.channelId})`}},SN=class extends N{constructor(e,n,o,r,s){super();this._onDidAcceptPresentation=s;this._onDidChangePresentation=this._register(new T);this.onDidChangePresentation=this._onDidChangePresentation.event;this._presentation=n,this._register({dispose:()=>{o.$disposeLinkPresentationWatcher(e),r(e)}})}get presentation(){return this._presentation}acceptPresentation(e){this._presentation=dz(e),this._onDidAcceptPresentation(this._presentation),this._onDidChangePresentation.fire()}};function wY(i,t){return i.lastIndex=0,i.test(t)}var uk=A("IExtHostMeteredConnection"),ck=class extends N{constructor(){super();this._isConnectionMetered=!1;this._onDidChangeIsConnectionMetered=this._register(new T);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event}get isConnectionMetered(){return this._isConnectionMetered}$initializeIsConnectionMetered(e){this._isConnectionMetered=e}$onDidChangeIsConnectionMetered(e){this._isConnectionMetered!==e&&(this._isConnectionMetered=e,this._onDidChangeIsConnectionMetered.fire(e))}};var pk="vscode.git";function cz(i){switch(i){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${i}`)}}function kY(i){return{name:i.name,commit:i.commit,type:cz(i.type),remote:i.remote,upstream:i.upstream?PY(i.upstream):void 0,ahead:i.ahead,behind:i.behind}}function PY(i){return{remote:i.remote,name:i.name,commit:i.commit}}function Qf(i){switch(i.status){case 1:case 7:case 9:return{uri:i.uri,originalUri:void 0,modifiedUri:i.uri};case 2:case 6:return{uri:i.uri,originalUri:i.uri,modifiedUri:void 0};case 3:case 10:return{uri:i.uri,originalUri:i.originalUri,modifiedUri:i.renameUri};default:return{uri:i.uri,originalUri:i.originalUri,modifiedUri:i.uri}}}var mk=A("IExtHostGitExtensionService"),hc=class extends N{constructor(e,n){super();this._extHostExtensionService=n;this._repositories=new Map;this._repositoryByUri=new Ve;this._repositoryStateChangeListeners=new bn;this._proxy=e.getProxy(F.MainThreadGitExtension)}static{this._handlePool=0}async $isGitExtensionAvailable(){return!!(await this._extHostExtensionService.getExtensionRegistry()).getExtensionDescription(pk)}async $openRepository(e){let n=await this._ensureGitApi();if(!n)return;let o=await n.openRepository(y.revive(e));if(!o)return;let r=this._repositoryByUri.get(o.rootUri);if(r!==void 0){this._repositories.get(r)!==o&&(this._repositories.set(r,o),this._repositoryByUri.set(o.rootUri,r),this._setRepositoryStateChangeListener(r,o));let l=this._getRepositoryState(o);return{handle:r,rootUri:o.rootUri,state:l}}let s=hc._handlePool++;this._repositories.set(s,o),this._repositoryByUri.set(o.rootUri,s),this._setRepositoryStateChangeListener(s,o);let a=this._getRepositoryState(o);return{handle:s,rootUri:o.rootUri,state:a}}async $getRefs(e,n,o){let r=this._repositories.get(e);if(!r)return[];try{return(await r.getRefs(n,o)).map(l=>!l.name||!l.commit?void 0:{id:l.type===0?`refs/heads/${l.name}`:l.type===1?`refs/remotes/${l.remote}/${l.name}`:`refs/tags/${l.name}`,name:l.name,type:cz(l.type),revision:l.commit}).filter(l=>!!l)}catch{return[]}}async $getRepositoryState(e){let n=this._repositories.get(e);if(n)return this._getRepositoryState(n)}_getRepositoryState(e){let n=e.state;return{HEAD:n.HEAD?kY(n.HEAD):void 0,remotes:n.remotes,mergeChanges:n.mergeChanges.map(Qf),indexChanges:n.indexChanges.map(Qf),workingTreeChanges:n.workingTreeChanges.map(Qf),untrackedChanges:n.untrackedChanges.map(Qf)}}_setRepositoryStateChangeListener(e,n){this._repositoryStateChangeListeners.set(e,n.state.onDidChange(()=>{this._proxy.$onDidChangeRepository(e)}))}async $diffBetweenWithStats(e,n,o,r){let s=this._repositories.get(e);if(!s)return[];try{return(await s.diffBetweenWithStats(n,o,r)).map(l=>({...Qf(l),insertions:l.insertions,deletions:l.deletions}))}catch{return[]}}async $diffBetweenWithStats2(e,n,o){let r=this._repositories.get(e);if(!r)return[];try{return(await r.diffBetweenWithStats2(n,o)).map(a=>({...Qf(a),insertions:a.insertions,deletions:a.deletions}))}catch{return[]}}async _ensureGitApi(){if(this._gitApi)return this._gitApi;try{await this._extHostExtensionService.activateByIdWithErrors(new xe(pk),{startup:!1,extensionId:new xe(pk),activationEvent:"api"});let e=this._extHostExtensionService.getExtensionExports(new xe(pk));e&&typeof e.getAPI=="function"&&(this._gitApi=e.getAPI(1))}catch{}return this._gitApi}dispose(){this._repositoryStateChangeListeners.dispose(),super.dispose()}};hc=_([S(0,le),S(1,io)],hc);Ue(wf,Ef,1);Ue(ir,gc,1);Ue(Zi,_f,1);Ue(Bn,uf,0);Ue(lp,ff,0);Ue(bf,ac,0);Ue(_n,Jg,0);Ue(oa,dr,0);Ue(Il,Uf,0);Ue(Hf,Ff,0);Ue($w,ia,0);Ue(Kr,Af,0);Ue(lc,kf,0);Ue(zf,rk,0);Ue(ai,IS,0);Ue(Bw,Df,1);Ue(Bf,mc,0);Ue(tf,ef,0);Ue(Lf,Mf,0);Ue(Ao,pf,0);Ue(Kf,qf,0);Ue(tc,ec,0);Ue(sp,rc,0);Ue(ok,$f,0);Ue(ap,ic,0);Ue(Vn,Gg,0);Ue(Tf,Cf,0);Ue(jr,Nf,0);Ue(Gr,pc,0);Ue(mp,fc,0);Ue(dk,xl,0);Ue(uk,ck,0);Ue(mk,hc,1);var Jf=class extends op{constructor(t,e){super(!0,t,e)}createTerminal(t,e,n){return this.createTerminalFromOptions({name:t,shellPath:e,shellArgs:n})}createTerminalFromOptions(t,e){let n=new rp(this._proxy,_e(),t,t.name);return this._terminals.push(n),n.create(t,this._serializeParentTerminal(t,e)),n.value}};Jf=_([S(0,Bn),S(1,le)],Jf);import*as CN from"child_process";import{promises as mz}from"fs";function uz(i,...t){let e=t.reduce((r,s)=>(r[s]=!0,r),{}),n=[/^ELECTRON_.+$/,/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,/^SNAP(|_.*)$/,/^GDK_PIXBUF_.+$/];Object.keys(i).filter(r=>!e[r]).forEach(r=>{for(let s=0;s<n.length;s++)if(r.search(n[s])!==-1){delete i[r];break}})}function pz(i){if(!i)return;let t=new Set(["DEBUG","NODE_OPTIONS","VSCODE_NODE_OPTIONS","LD_PRELOAD","DYLD_INSERT_LIBRARIES"]);for(let e of Object.keys(i))t.has(e.toUpperCase())&&delete i[e]}function gk(i=Fo){return i.comspec||"cmd.exe"}function gz(i){let t=[],e=!1,n=function(o){if(e){t.push(o);return}(!i.send(o,s=>{if(s&&console.error(s),e=!1,t.length>0){let a=t.slice(0);t=[],a.forEach(l=>n(l))}})||Te)&&(e=!0)};return{send:n}}async function _Y(i){if(await at.exists(i)){let t;try{t=await mz.stat(i)}catch(e){e.message.startsWith("EACCES")&&(t=await mz.lstat(i))}return t?!t.isDirectory():!1}return!1}async function gp(i,t,e,n=Fo,o=_Y){if(cn(i))return await o(i)?i:void 0;if(t===void 0&&(t=Pi()),gn(i)!=="."){let l=Be(t,i);return await o(l)?l:void 0}let s=LD(n,"PATH");if(e===void 0&&Pe(s)&&(e=s.split(Wp)),e===void 0||e.length===0){let l=Be(t,i);return await o(l)?l:void 0}for(let l of e){let d;if(cn(l)?d=Be(l,i):d=Be(t,l,i),Te){let u=(LD(n,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async m=>{let g=d+m;return await o(g)?g:void 0});for(let m of u){let g=await m;if(g)return g}}if(await o(d))return d}let a=Be(t,i);return await o(a)?a:void 0}async function Zb(i,t=!1){let e;if(Te){let n=process.env.WINDIR||"C:\\Windows",o=Be(n,"System32","taskkill.exe"),r=["/T"];t&&r.push("/F"),r.push("/PID",String(i)),e=CN.spawn(o,r,{stdio:["ignore","pipe","pipe"]})}else{let n=Gl.asFileUri("vs/base/node/terminateProcess.sh").fsPath;e=CN.spawn("/bin/sh",[n,String(i),t?"9":"15"],{stdio:["ignore","pipe","pipe"]})}return new Promise((n,o)=>{let r=[];e.stdout.on("data",s=>r.push(s)),e.stderr.on("data",s=>r.push(s)),e.on("error",o),e.on("exit",s=>{s===0?n():o(new Error(`taskkill exited with code ${s}: ${Buffer.concat(r).toString()}`))})})}import{homedir as RY}from"os";var Yf=class extends dp{constructor(e,n,o,r,s,a,l,d,c){super(e,n,o,r,s,a,l,d);this.workspaceService=o;this.variableResolver=c;n.remote.isRemote&&n.remote.authority?this.registerTaskSystem(B.vscodeRemote,{scheme:B.vscodeRemote,authority:n.remote.authority,platform:process.platform}):this.registerTaskSystem(B.file,{scheme:B.file,authority:"",platform:process.platform}),this._proxy.$registerSupportedExecutions(!0,!0,!0)}async executeTask(e,n){let o=n;if(!n.execution&&o._id===void 0)throw new Error("Tasks to execute must include an execution");if(o._id!==void 0){let r=jO.from(o,this.workspaceService),s=await this._proxy.$getTaskExecution(r);if(s.task===void 0)throw new Error("Task from execution DTO is undefined");let a=await this.getTaskExecution(s,n);return this._proxy.$executeTask(r).catch(()=>{}),a}else{let r=sa.from(n,e);if(r===void 0)return Promise.reject(new Error("Task is not valid"));es.is(r.execution)&&await this.addCustomExecution(r,n,!1);let s=await this.getTaskExecution(await this._proxy.$getTaskExecution(r),n);return this._proxy.$executeTask(r).catch(()=>{}),s}}provideTasksInternal(e,n,o,r){let s=[];if(r)for(let a of r){this.checkDeprecation(a,o),(!a.definition||!e[a.definition.type])&&this._logService.warn(`The task [${a.source}, ${a.name}] uses an undefined task type. The task will be ignored in the future.`);let l=sa.from(a,o.extension);l&&(s.push(l),es.is(l.execution)&&n.push(this.addCustomExecution(l,a,!0)))}return{tasks:s,extension:o.extension}}async resolveTaskInternal(e){return e}async getAFolder(e){let n=e&&e.length>0?e[0]:void 0;if(!n){let o=y.file(RY());n=new Zc({uri:o,name:Ze(o),index:0})}return{uri:n.uri,name:n.name,index:n.index,toResource:()=>{throw new Error("Not implemented")}}}async $resolveVariables(e,n){let o=y.revive(e),r={process:void 0,variables:Object.create(null)},s=await this._workspaceProvider.resolveWorkspaceFolder(o),a=await this._workspaceProvider.getWorkspaceFolders2()??[],l=await this.variableResolver.getResolver(),d=s?{uri:s.uri,name:s.name,index:s.index,toResource:()=>{throw new Error("Not implemented")}}:await this.getAFolder(a);for(let c of n.variables)r.variables[c]=await l.resolveAsync(d,c);if(n.process!==void 0){let c;if(n.process.path!==void 0){c=n.process.path.split(Wp);for(let h=0;h<c.length;h++)c[h]=await l.resolveAsync(d,c[h])}let u=await l.resolveAsync(d,n.process.name),m=n.process.cwd!==void 0?await l.resolveAsync(d,n.process.cwd):void 0,g=await gp(u,m,c);g?r.process=g:cn(u)?r.process=u:r.process=Be(m??"",u)}return r}async $jsonTasksSupported(){return!0}async $findExecutable(e,n,o){return gp(e,n,o)}};Yf=_([S(0,le),S(1,Ye),S(2,Vn),S(3,Kr),S(4,_n),S(5,Ao),S(6,te),S(7,Zi),S(8,Gr)],Yf);import*as vc from"child_process";var Eit=A("externalTerminal"),Xf="Terminal.app";var hz=p(3005,null),eI=class{async getDefaultTerminalForPlatforms(){return{windows:tI.getDefaultTerminalWindows(),linux:await nI.getDefaultTerminalLinuxReady(),osx:Xf}}},ts=class ts extends eI{static{this.CMD="cmd.exe"}openTerminal(t,e){return this.spawnTerminal(vc,t,gk(),e)}spawnTerminal(t,e,n,o){let r=e.windowsExec||ts.getDefaultTerminalWindows();o&&o[1]===":"&&(o=o[0].toUpperCase()+o.substr(1));let s=ot(r,".exe").toLowerCase();if(s==="cmder")return t.spawn(r,o?[o]:void 0),Promise.resolve(void 0);let a=["/c","start","/wait"];return r.indexOf(" ")>=0&&a.push(r),a.push(r),s==="wt"&&a.push("-d ."),new Promise((l,d)=>{let c=fp(process),u=t.spawn(n,a,{cwd:o,env:c,detached:!0});u.on("error",d),u.on("exit",()=>l())})}async runInTerminal(t,e,n,o,r){let s=r.windowsExec||ts.getDefaultTerminalWindows(),a=await ts.getWtExePath();return new Promise((l,d)=>{let c=`"${e} - ${hz}"`,u=`"${n.join('" "')}" & pause`,m=Object.assign({},fp(process),o);Object.keys(m).filter(x=>m[x]===null).forEach(x=>delete m[x]);let g={cwd:e,env:m,windowsVerbatimArguments:!0},h,f;ot(s,".exe")==="wt"?(h=s,f=["-d",".",ts.CMD,"/c",u]):a?(h=a,f=["-d",".",s,"/c",u]):(h=ts.CMD,f=["/c","start",c,"/wait",s,"/c",`"${u}"`]),vc.spawn(h,f,g).on("error",x=>{d(vz(x))}),l(void 0)})}static getDefaultTerminalWindows(){if(!ts._DEFAULT_TERMINAL_WINDOWS){let t=!!process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432");ts._DEFAULT_TERMINAL_WINDOWS=`${process.env.windir?process.env.windir:"C:\\Windows"}\\${t?"Sysnative":"System32"}\\cmd.exe`}return ts._DEFAULT_TERMINAL_WINDOWS}static async getWtExePath(){try{return await gp("wt")}catch{return}}};_([Wx],ts,"getWtExePath",1);var tI=ts,fk=class i extends eI{static{this.OSASCRIPT="/usr/bin/osascript"}openTerminal(t,e){return this.spawnTerminal(vc,t,e)}runInTerminal(t,e,n,o,r){let s=r.osxExec||Xf;return new Promise((a,l)=>{if(s===Xf||s==="iTerm.app"){let d=s===Xf?"TerminalHelper":"iTermHelper",u=[Gl.asFileUri(`vs/workbench/contrib/externalTerminal/node/${d}.scpt`).fsPath,"-t",t||hz,"-w",e];for(let g of n)u.push("-a"),u.push(g);if(o){let g=Object.assign({},fp(process),o);for(let h in g){let f=g[h];f===null?(u.push("-u"),u.push(h)):(u.push("-e"),u.push(`${h}=${f}`))}}let m=vc.spawn(i.OSASCRIPT,u);TN(m,a,l,s)}else if(s==="Ghostty.app"){let d=Object.assign({},fp(process),o),c=["-na","Ghostty.app","--args"];c.push("--working-directory="+e),c.push("--wait-after-command=true"),c.push("-e",...n);let u=vc.spawn("/usr/bin/open",c,{env:d});TN(u,a,l,s)}else l(new Error(p(3007,null,s)))})}spawnTerminal(t,e,n){let o=e.osxExec||Xf;return new Promise((r,s)=>{let a=["-a",o];n&&a.push(n);let l=fp(process),d=t.spawn("/usr/bin/open",a,{cwd:n,env:l});d.on("error",s),d.on("exit",()=>r())})}},nI=class i extends eI{static{this.WAIT_MESSAGE=p(3008,null)}openTerminal(t,e){return this.spawnTerminal(vc,t,e)}runInTerminal(t,e,n,o,r){let s=r.linuxExec?Promise.resolve(r.linuxExec):i.getDefaultTerminalLinuxReady();return new Promise((a,l)=>{s.then(d=>{if(ot(d).toLowerCase()==="ghostty"){let g=[];e&&g.push(`--working-directory=${e}`),g.push("--wait-after-command=true"),n.length&&g.push("-e",...n),i.spawnTerminalWithEnv(d,g,e,o,a,l);return}let u=[];d.indexOf("gnome-terminal")>=0?u.push("-x"):u.push("-e"),u.push("bash"),u.push("-c");let m=`${DY(n)}; echo; read -p "${i.WAIT_MESSAGE}" -n1;`;u.push(`''${m}''`),i.spawnTerminalWithEnv(d,u,e,o,a,l)})})}static spawnTerminalWithEnv(t,e,n,o,r,s){let a=Object.assign({},fp(process),o);Object.keys(a).filter(d=>a[d]===null).forEach(d=>delete a[d]);let l=vc.spawn(t,e,{cwd:n,env:a});TN(l,r,s,t)}static async getDefaultTerminalLinuxReady(){if(!i._DEFAULT_TERMINAL_LINUX_READY)if(!Xe)i._DEFAULT_TERMINAL_LINUX_READY=Promise.resolve("xterm");else{let t=await at.exists("/etc/debian_version");i._DEFAULT_TERMINAL_LINUX_READY=new Promise(e=>{t?e("x-terminal-emulator"):process.env.DESKTOP_SESSION==="gnome"||process.env.DESKTOP_SESSION==="gnome-classic"?e("gnome-terminal"):process.env.DESKTOP_SESSION==="kde-plasma"?e("konsole"):process.env.COLORTERM?e(process.env.COLORTERM):process.env.TERM?e(process.env.TERM):e("xterm")})}return i._DEFAULT_TERMINAL_LINUX_READY}spawnTerminal(t,e,n){let o=e.linuxExec?Promise.resolve(e.linuxExec):i.getDefaultTerminalLinuxReady();return new Promise((r,s)=>{o.then(a=>{let l=fp(process),c=ot(a).toLowerCase()==="ghostty"&&n?[`--working-directory=${n}`]:[],u=t.spawn(a,c,{cwd:n,env:l});u.on("error",s),u.on("exit",()=>r())})})}};function fp(i){let t={...i.env};return uz(t),t}function vz(i){return i.errno==="ENOENT"&&i.path?new Error(p(3006,null,i.path)):i}function TN(i,t,e,n){let o="";i.on("error",r=>{e(vz(r))}),i.stderr?.on("data",r=>{o+=r.toString()}),i.on("exit",r=>{if(r===0)t(void 0);else if(o){let s=o.split(`
`,1);e(new Error(s[0]))}else e(new Error(p(3009,null,n,r)))})}function DY(i){let t="";for(let e of i)e.indexOf(" ")>=0?t+='"'+e+'"':t+=e,t+=" ";return t}var hk=class i{constructor(){this.validators=new Map}static{this._nextId=1}async createNewMessage(t){try{let e=await this.getValidator();if(e){let n=String(i._nextId++);return this.validators.set(n,e),{id:n,data:e.createNewMessage(t)}}}catch{}return{id:"",data:t}}async validate(t,e){if(!t.id)return!0;let n=this.validators.get(t.id);if(!n)return!1;this.validators.delete(t.id);try{return n.validate(e)==="ok"}catch{return!1}finally{n.dispose?.()}}async sign(t){try{return await this.signValue(t)}catch{}return t}};var Zf=class extends hk{getValidator(){return this.vsda().then(t=>new t.validator)}signValue(t){return this.vsda().then(e=>new e.signer().sign(t))}async vsda(){let t="vsda",{default:e}=await import(t);return e}};import*as xk from"child_process";import*as EN from"net";var AY="#$*+-./:?@\\_",yz=/[\0\r\n]/,MY=/\p{Cc}/u;function LY(i){if(!i||i.endsWith("\\"))return!0;for(let t of i){let e=t.codePointAt(0),n=e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122;if(e<=127&&!n&&!AY.includes(t)||MY.test(t))return!0}return!1}function bz(i,t=!1){let e=t||LY(i),n=e?'"':"",o=0;for(let r of i)r==="\\"?o++:(r==='"'?(n+="\\".repeat(o),n+='"'):r==="%"&&(n+="%%cd:~,"),o=0),n+=r;return e&&(n+="\\".repeat(o),n+='"'),n}function OY(i,t){if(i.includes('"')||yz.test(i)||t.some(n=>yz.test(n)))throw new Error(p(14984,null));return["/e:ON","/v:OFF","/d","/c",`"${[bz(i,!0),...t.map(n=>bz(n))].join(" ")}"`]}var vk=class i extends Of{constructor(){super();this.rawData=Buffer.allocUnsafe(0);this.contentLength=-1}static{this.TWO_CRLF=`\r
\r
`}static{this.HEADER_LINESEPARATOR=/\r?\n/}static{this.HEADER_FIELDSEPARATOR=/: */}connect(e,n){this.outputStream=n,this.rawData=Buffer.allocUnsafe(0),this.contentLength=-1,e.on("data",o=>this.handleData(o))}sendMessage(e){if(this.outputStream){let n=JSON.stringify(e);this.outputStream.write(`Content-Length: ${Buffer.byteLength(n,"utf8")}${i.TWO_CRLF}${n}`,"utf8")}}handleData(e){for(this.rawData=Buffer.concat([this.rawData,e]);;){if(this.contentLength>=0){if(this.rawData.length>=this.contentLength){let n=this.rawData.toString("utf8",0,this.contentLength);if(this.rawData=this.rawData.slice(this.contentLength),this.contentLength=-1,n.length>0)try{this.acceptMessage(JSON.parse(n))}catch(o){this._onError.fire(new Error((o.message||o)+`
`+n))}continue}}else{let n=this.rawData.indexOf(i.TWO_CRLF);if(n!==-1){let r=this.rawData.toString("utf8",0,n).split(i.HEADER_LINESEPARATOR);for(let s of r){let a=s.split(i.HEADER_FIELDSEPARATOR);a[0]==="Content-Length"&&(this.contentLength=Number(a[1]))}this.rawData=this.rawData.slice(n+i.TWO_CRLF.length);continue}}break}}},yk=class extends vk{startSession(){return new Promise((t,e)=>{let n=!1;this.socket=this.createConnection(()=>{this.connect(this.socket,this.socket),t(),n=!0}),this.socket.on("close",()=>{n?this._onError.fire(new Error("connection closed")):e(new Error("connection closed"))}),this.socket.on("error",o=>{o instanceof AggregateError&&(o=o.errors[0]),n?this._onError.fire(o):e(o)})})}async stopSession(){await this.cancelPendingRequests(),this.socket&&(this.socket.end(),this.socket=void 0)}},bk=class extends yk{constructor(e){super();this.adapterServer=e}createConnection(e){return EN.createConnection(this.adapterServer.port,this.adapterServer.host||"127.0.0.1",e)}},Ik=class extends yk{constructor(e){super();this.adapterServer=e}createConnection(e){return EN.createConnection(this.adapterServer.path,e)}},oI=class i extends vk{constructor(e,n){super();this.adapterExecutable=e;this.debugType=n}async startSession(){let e=this.adapterExecutable.command,n=this.adapterExecutable.args,o=this.adapterExecutable.options||{};try{if(e)if(cn(e)){if(!await at.exists(e))throw new Error(p(14982,null,e))}else e.indexOf("/")<0&&e.indexOf("\\")<0;else throw new Error(p(14983,null,this.debugType));let r=process.env;if(o.env&&Object.keys(o.env).length>0&&(r=or(ft(process.env),o.env)),e==="node")if(Array.isArray(n)&&n.length>0){let s=!!process.env.ELECTRON_RUN_AS_NODE||!!process.versions.electron,a={env:r,execArgv:s?["-e","delete process.env.ELECTRON_RUN_AS_NODE;require(process.argv[1])"]:[],silent:!0};o.cwd&&(a.cwd=o.cwd);let l=xk.fork(n[0],n.slice(1),a);if(!l.pid)throw new Error(p(14985,null,n[0]));this.serverProcess=l}else throw new Error(p(14986,null));else{let s=e,a=n,l={env:r};o.cwd&&(l.cwd=o.cwd),Te&&/\.(bat|cmd)$/i.test(e)&&(l.windowsVerbatimArguments=!0,s=process.env.ComSpec||"cmd.exe",a=OY(e,n)),this.serverProcess=xk.spawn(s,a,l)}this.serverProcess.on("error",s=>{this._onError.fire(s)}),this.serverProcess.on("exit",(s,a)=>{this._onExit.fire(s)}),this.serverProcess.stdout.on("close",()=>{this._onError.fire(new Error("read error"))}),this.serverProcess.stdout.on("error",s=>{this._onError.fire(s)}),this.serverProcess.stdin.on("error",s=>{this._onError.fire(s)}),this.serverProcess.stderr.resume(),this.connect(this.serverProcess.stdout,this.serverProcess.stdin)}catch(r){this._onError.fire(r)}}async stopSession(){return this.serverProcess?(await this.cancelPendingRequests(),Te?Zb(this.serverProcess.pid,!0).catch(()=>{this.serverProcess?.kill()}):(this.serverProcess.kill("SIGTERM"),Promise.resolve(void 0))):Promise.resolve(void 0)}static extract(e,n){if(!e)return;let o=Object.create(null);e.runtime&&(e.runtime.indexOf("./")===0?o.runtime=Be(n,e.runtime):o.runtime=e.runtime),e.runtimeArgs&&(o.runtimeArgs=e.runtimeArgs),e.program&&(cn(e.program)?o.program=e.program:o.program=Be(n,e.program)),e.args&&(o.args=e.args);let r=e;return r.win&&(o.win=i.extract(r.win,n)),r.winx86&&(o.winx86=i.extract(r.winx86,n)),r.windows&&(o.windows=i.extract(r.windows,n)),r.osx&&(o.osx=i.extract(r.osx,n)),r.linux&&(o.linux=i.extract(r.linux,n)),o}static platformAdapterExecutable(e,n){let o=Object.create(null);n=n.toLowerCase();for(let c of e)if(c.contributes){let u=c.contributes.debuggers;u&&u.length>0&&u.filter(m=>typeof m.type=="string"&&wn(m.type,n)).forEach(m=>{let g=i.extract(m,c.extensionLocation.fsPath);o=or(o,g,c.isBuiltin)})}let r;Te&&!process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?r=o.winx86||o.win||o.windows:Te?r=o.win||o.windows:St?r=o.osx:Xe&&(r=o.linux),r=r||o;let s=r.program||o.program,a=r.args||o.args,l=r.runtime||o.runtime,d=r.runtimeArgs||o.runtimeArgs;if(l)return{type:"executable",command:l,args:(d||[]).concat(typeof s=="string"?[s]:[]).concat(a||[])};if(s)return{type:"executable",command:s,args:a||[]}}};import*as Iz from"child_process";function NY(i,t){return new Promise((e,n)=>{let o="",r=Iz.spawn(i,t);r.pid&&r.stdout.on("data",s=>{o+=s.toString()}),r.on("error",s=>{n(s)}),r.on("close",s=>{e(o)})})}async function xz(i){if(i)if(Te){let t=await import("@vscode/windows-process-tree");return new Promise(e=>{t.getProcessTree(i,n=>{e(!!n&&n.children.length>0)})})}else return NY("/usr/bin/pgrep",["-lP",String(i)]).then(t=>{let e=t.trim();return!(e.length===0||e.indexOf(" tmux")>=0)},t=>!0);return Promise.resolve(!0)}function Sz(i,t,e,n,o){i=i.trim().toLowerCase();let r;i.indexOf("powershell")>=0||i.indexOf("pwsh")>=0?r=1:i.indexOf("cmd.exe")>=0?r=0:i.indexOf("bash")>=0?r=2:Te?r=0:r=2;let s,a=" ";switch(r){case 1:if(s=l=>(l=l.replace(/\'/g,"''"),l.length>0&&l.charAt(l.length-1)==="\\"?`'${l}\\'`:`'${l}'`),n){let l=qR(n);l&&(a+=`${l}:; `),a+=`cd ${s(n)}; `}if(o)for(let l in o){let d=o[l];d===null?a+=`Remove-Item env:${l}; `:a+=`\${env:${l}}='${d.replace(/['\u2018\u2019]/g,c=>c+c)}'; `}if(t.length>0){let l=t.shift(),d=e?l:s(l);a+=d[0]==="'"?`& ${d} `:`${d} `;for(let c of t)a+=c==="<"||c===">"||e?c:s(c),a+=" "}break;case 0:if(s=l=>(l=l.replace(/\"/g,'""'),l=l.replace(/([><!^&|])/g,"^$1"),' "'.split("").some(d=>l.includes(d))||l.length===0?`"${l}"`:l),n){let l=qR(n);l&&(a+=`${l}: && `),a+=`cd ${s(n)} && `}if(o){a+='cmd /C "';for(let l in o){let d=o[l];d===null?a+=`set "${l}=" && `:(d=d.replace(/[&^|<>]/g,c=>`^${c}`),a+=`set "${l}=${d}" && `)}}for(let l of t)a+=l==="<"||l===">"||e?l:s(l),a+=" ";o&&(a+='"');break;case 2:{s=d=>(d=d.replace(/(["'\\\$!><#()\[\]*&^| ;{}?`])/g,"\\$1"),d.length===0?'""':d);let l=d=>/[^\w@%\/+=,.:^-]/.test(d)?`'${d.replace(/'/g,"'\\''")}'`:d;if(n&&(a+=`cd ${s(n)} ; `),o){a+="/usr/bin/env";for(let d in o){let c=o[d];c===null?a+=` -u ${l(d)}`:a+=` ${l(`${d}=${c}`)}`}a+=" "}for(let d of t)a+=d==="<"||d===">"||e?d:s(d),a+=" ";break}}return a}var eh=class extends cp{constructor(e,n,o,r,s,a,l,d,c,u){super(e,n,o,r,l,d,c,u);this._terminalService=s;this._terminalShellIntegrationService=a;this._integratedTerminalInstances=new wN}createDebugAdapter(e,n){return e instanceof ji?new oI(this.convertExecutableToDto(e),n.type):e instanceof Gi?new bk(this.convertServerToDto(e)):e instanceof Bs?new Ik(this.convertPipeServerToDto(e)):super.createDebugAdapter(e,n)}daExecutableFromPackage(e,n){let o=oI.platformAdapterExecutable(n.getAllExtensionDescriptions(),e.type);if(o)return new ji(o.command,o.args,o.options)}createSignService(){return new Zf}async $runInTerminal(e,n){if(e.kind==="integrated"){this._terminalDisposedListener||(this._terminalDisposedListener=this._register(this._terminalService.onDidCloseTerminal(f=>{this._integratedTerminalInstances.onTerminalClosed(f)})));let o=await this._configurationService.getConfigProvider(),r=this._terminalService.getDefaultShell(!0),s=this._terminalService.getDefaultShellArgs(!0),a=e.title||p(5918,null),l=JSON.stringify({shell:r,shellArgs:s,cwd:e.cwd}),d=await this._integratedTerminalInstances.checkout(l,a),c,u=!1;if(d)c=e.cwd;else{let f={shellPath:r,shellArgs:s,cwd:e.cwd,name:a,iconPath:new fn("debug")};u=!0,d=this._terminalService.createTerminalFromOptions(f,{isFeatureTerminal:!0,forceShellIntegration:!0,useShellEnvironment:!0}),this._integratedTerminalInstances.insert(d,l)}d.show(!0);let m=await d.processId;if(u){let f;(w=>(w[w.DataDebounce=500]="DataDebounce",w[w.MaxDelay=5e3]="MaxDelay"))(f||={});let I=new $;await new Promise(x=>{let E=I.add(new Pn(x,500));I.add(this._terminalService.onDidWriteTerminalData(w=>{w.terminal===d&&E.schedule()})),I.add(this._terminalShellIntegrationService.onDidChangeTerminalShellIntegration(w=>{w.terminal===d&&x()})),I.add(wv(x,5e3))}),I.dispose()}else if(d.state.isInteractedWith&&!d.shellIntegration&&(d.sendText(""),await Vt(200)),o.getConfiguration("debug.terminal").get("clearBeforeReusing")){let f;if(r.indexOf("powershell")>=0||r.indexOf("pwsh")>=0||r.indexOf("cmd.exe")>=0?f="cls":r.indexOf("bash")>=0?f="clear":Te?f="cls":f="clear",d.shellIntegration){let I=new $,x=d.shellIntegration.executeCommand(f);await new Promise(E=>{I.add(this._terminalShellIntegrationService.onDidEndTerminalShellExecution(w=>{w.execution===x&&E()})),I.add(wv(E,500))}),I.dispose()}else d.sendText(f),await Vt(200)}let g=Sz(r,e.args,!!e.argsCanBeInterpretedByShell,c,e.env);d.shellIntegration?d.shellIntegration.executeCommand(g):d.sendText(g);let h=this.onDidTerminateDebugSession(f=>{f.id===n&&(this._integratedTerminalInstances.free(d),h.dispose())});return m}else if(e.kind==="external")return UY(e,await this._configurationService.getConfigProvider());return super.$runInTerminal(e,n)}};eh=_([S(0,le),S(1,Vn),S(2,io),S(3,_n),S(4,Ao),S(5,Kf),S(6,jr),S(7,Gr),S(8,Bn),S(9,Il)],eh);var rI;function UY(i,t){if(!rI)if(Te)rI=new tI;else if(St)rI=new fk;else if(Xe)rI=new nI;else throw new Error("external terminals not supported on this platform");let e=t.getConfiguration("terminal");return rI.runInTerminal(i.title,i.cwd,i.args,i.env||{},e.external||{})}var wN=class i{constructor(){this._terminalInstances=new Map}static{this.minUseDelay=1e3}async checkout(t,e,n=!1){let r=[...this._terminalInstances.entries()].map(([s,a])=>br(async l=>{if(s.name!==e||a.lastUsedAt!==-1&&await xz(await s.processId))return null;let d=Date.now();return a.lastUsedAt+i.minUseDelay>d||l.isCancellationRequested?null:a.config!==t?(n&&s.dispose(),null):(a.lastUsedAt=d,s)}));return await N2(r,s=>!!s)}insert(t,e){this._terminalInstances.set(t,{lastUsedAt:Date.now(),config:e})}free(t){let e=this._terminalInstances.get(t);e&&(e.lastUsedAt=-1)}onTerminalClosed(t){this._terminalInstances.delete(t)}};var Cz=new mt(()=>{let i=If.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:i,collatorIsNumeric:i.resolvedOptions().numeric}}),yst=new mt(()=>({collator:If.Collator(void 0,{numeric:!0}).value})),bst=new mt(()=>({collator:If.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function Tz(i,t,e=!1){let n=i||"",o=t||"",r=Cz.value.collator.compare(n,o);return Cz.value.collatorIsNumeric&&r===0&&n!==o?n<o?-1:1:r}function FY(i,t,e=!1){return e||(i=i&&i.toLowerCase(),t=t&&t.toLowerCase()),i===t?0:i<t?-1:1}function iI(i,t,e=!1){let n=i.split(Dt),o=t.split(Dt),r=n.length-1,s=o.length-1,a,l;for(let d=0;;d++){if(a=r===d,l=s===d,a&&l)return Tz(n[d],o[d],e);if(a)return-1;if(l)return 1;let c=FY(n[d],o[d],e);if(c!==0)return c}}function Sk(i,t,e){let n=i.toLowerCase(),o=t.toLowerCase(),r=HY(i,t,e);if(r)return r;let s=n.endsWith(e),a=o.endsWith(e);if(s!==a)return s?-1:1;let l=Tz(n,o);return l!==0?l:n.localeCompare(o)}function HY(i,t,e){let n=i.toLowerCase(),o=t.toLowerCase(),r=n.startsWith(e),s=o.startsWith(e);if(r!==s)return r?-1:1;if(r&&s){if(n.length<o.length)return-1;if(n.length>o.length)return 1}return 0}var Tk=0,Ez=[Tk,[]];function wz(i,t,e,n){if(!i||!t)return Ez;let o=i.length,r=t.length;if(o<r)return Ez;let s=i.toLowerCase();return WY(t,e,r,i,s,o,n)}function WY(i,t,e,n,o,r,s){let a=[],l=[];for(let m=0;m<e;m++){let g=m*r,h=g-r,f=m>0,I=i[m],x=t[m];for(let E=0;E<r;E++){let w=E>0,R=g+E,L=R-1,U=h+E-1,z=w?a[L]:0,Y=f&&w?a[U]:0,j=f&&w?l[U]:0,Q;!Y&&f?Q=0:Q=VY(I,x,n,o,E,j),Q&&Y+Q>=z&&(s||f||o.startsWith(t,E))?(l[R]=j+1,a[R]=Y+Q):(l[R]=Tk,a[R]=z)}}let d=[],c=e-1,u=r-1;for(;c>=0&&u>=0;){let m=c*r+u;l[m]===Tk||(d.push(u),c--),u--}return[a[e*r-1],d.reverse()]}function VY(i,t,e,n,o,r){let s=0;if(!BY(t,n[o]))return s;if(s+=1,r>0&&(s+=Math.min(r,3)*6+Math.max(0,r-3)*3),i===e[o]&&(s+=1),o===0)s+=8;else{let a=$Y(e.charCodeAt(o-1));a?s+=a:sm(e.charCodeAt(o))&&r===0&&(s+=2)}return s}function BY(i,t){return i===t?!0:i==="/"||i==="\\"?t==="/"||t==="\\":!1}function $Y(i){switch(i){case 47:case 92:return 5;case 95:case 45:case 46:case 32:case 39:case 34:case 58:return 4;default:return 0}}var Ek=Object.freeze({score:0}),Ck=1<<18,kN=1<<17,PN=65536;function zY(i,t,e,n){let o=n.values?n.values:[n];return to({[n.normalized]:{values:o.map(s=>({value:s.normalized,expectContiguousMatch:s.expectContiguousMatch})),label:i,description:t,allowNonContiguousMatches:e}})}function kz(i,t,e,n,o){if(!i||!t.normalized)return Ek;let r=n.getItemLabel(i);if(!r)return Ek;let s=n.getItemDescription(i),a=zY(r,s,e,t),l=o[a];if(l)return l;let d=qY(r,s,n.getItemPath(i),t,e);return o[a]=d,d}function qY(i,t,e,n,o){let r=!e||!n.containsPathSeparator;return e&&(Xe?n.pathNormalized===e:wn(n.pathNormalized,e))?{score:Ck,labelMatch:[{start:0,end:i.length}],descriptionMatch:t?[{start:0,end:t.length}]:void 0}:n.values&&n.values.length>1?KY(i,t,e,n.values,r,o):Mz(i,t,e,n,r,o)}function KY(i,t,e,n,o,r){let s=0,a=[],l=[];for(let d of n){let{score:c,labelMatch:u,descriptionMatch:m}=Mz(i,t,e,d,o,r);if(c===Tk)return Ek;s+=c,u&&a.push(...u),m&&l.push(...m)}return{score:s,labelMatch:_z(a),descriptionMatch:_z(l)}}function Mz(i,t,e,n,o,r){if(o||!t){let[s,a]=wz(i,n.normalized,n.normalizedLowercase,r&&!n.expectContiguousMatch);if(s){let l=CS(n.normalized,i),d;if(l){d=kN;let c=Math.round(n.normalized.length/i.length*100);d+=c}else d=PN;return{score:d+s,labelMatch:l||Pz(a)}}}if(t){let s=t;e&&(s=`${t}${Dt}`);let a=s.length,l=`${s}${i}`,[d,c]=wz(l,n.normalized,n.normalizedLowercase,r&&!n.expectContiguousMatch);if(d){let u=Pz(c),m=[],g=[];return u.forEach(h=>{h.start<a&&h.end>a?(m.push({start:0,end:h.end-a}),g.push({start:h.start,end:a})):h.start>=a?m.push({start:h.start-a,end:h.end-a}):g.push(h)}),{score:d,labelMatch:m,descriptionMatch:g}}}return Ek}function Pz(i){let t=[];if(!i)return t;let e;for(let n of i)e&&e.end===n?e.end+=1:(e={start:n,end:n+1},t.push(e));return t}function _z(i){let t=i.sort((o,r)=>o.start-r.start),e=[],n;for(let o of t)!n||!jY(n,o)?(n=o,e.push(o)):(n.start=Math.min(n.start,o.start),n.end=Math.max(n.end,o.end));return e}function jY(i,t){return!(i.end<t.start||t.end<i.start)}function Lz(i,t,e,n,o,r){let s=kz(i,e,n,o,r),a=kz(t,e,n,o,r),l=s.score,d=a.score;if((l===Ck||d===Ck)&&l!==d)return l===Ck?-1:1;if(l>PN||d>PN){if(l!==d)return l>d?-1:1;if(l<kN&&d<kN){let I=GY(s.labelMatch,a.labelMatch);if(I!==0)return I}let h=o.getItemLabel(i)||"",f=o.getItemLabel(t)||"";if(h.length!==f.length)return h.length-f.length}if(l!==d)return l>d?-1:1;let c=Array.isArray(s.labelMatch)&&s.labelMatch.length>0,u=Array.isArray(a.labelMatch)&&a.labelMatch.length>0;if(c&&!u)return-1;if(u&&!c)return 1;let m=Rz(i,s,o),g=Rz(t,a,o);return m&&g&&m!==g?g>m?-1:1:QY(i,t,e,o)}function Rz(i,t,e){let n=-1,o=-1;if(t.descriptionMatch?.length?n=t.descriptionMatch[0].start:t.labelMatch?.length&&(n=t.labelMatch[0].start),t.labelMatch?.length){if(o=t.labelMatch[t.labelMatch.length-1].end,t.descriptionMatch?.length){let r=e.getItemDescription(i);r&&(o+=r.length)}}else t.descriptionMatch?.length&&(o=t.descriptionMatch[t.descriptionMatch.length-1].end);return o-n}function GY(i,t){if(!i&&!t||!i?.length&&!t?.length)return 0;if(!t?.length)return-1;if(!i?.length)return 1;let e=i[0].start,o=i[i.length-1].end-e,r=t[0].start,a=t[t.length-1].end-r;return o===a?0:a<o?1:-1}function QY(i,t,e,n){let o=n.getItemLabel(i)||"",r=n.getItemLabel(t)||"",s=n.getItemDescription(i),a=n.getItemDescription(t),l=o.length+(s?s.length:0),d=r.length+(a?a.length:0);if(l!==d)return l-d;let c=n.getItemPath(i),u=n.getItemPath(t);return c&&u&&c.length!==u.length?c.length-u.length:o!==r?Sk(o,r,e.normalized):s&&a&&s!==a?Sk(s,a,e.normalized):c&&u&&c!==u?Sk(c,u,e.normalized):0}function Dz(i){return i.startsWith('"')&&i.endsWith('"')}var JY=" ";function sI(i){typeof i!="string"&&(i="");let t=i.toLowerCase(),{pathNormalized:e,normalized:n,normalizedLowercase:o}=Az(i),r=e.indexOf(Dt)>=0,s=Dz(i),a,l=i.split(JY);if(l.length>1)for(let d of l){let c=Dz(d),{pathNormalized:u,normalized:m,normalizedLowercase:g}=Az(d);m&&(a||(a=[]),a.push({original:d,originalLowercase:d.toLowerCase(),pathNormalized:u,normalized:m,normalizedLowercase:g,expectContiguousMatch:c}))}return{original:i,originalLowercase:t,pathNormalized:e,normalized:n,normalizedLowercase:o,values:a,containsPathSeparator:r,expectContiguousMatch:s}}function Az(i){let t;Te?t=i.replace(/\//g,Dt):t=i.replace(/\\/g,Dt);let e=t.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:t,normalized:e,normalizedLowercase:e.toLowerCase()}}import*as Wz from"child_process";import*as nh from"fs";import{StringDecoder as Hz}from"string_decoder";import*as Nz from"child_process";function th(i){return i.startsWith("**")||i.startsWith("/")?i:`/${i}`}function Oz(i){return new Kg(i.start.line,i.start.character,i.end.line,i.end.character)}function _N(i){return new zg(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)}var hp=class{constructor(t,e){this.prefix=t;this.logService=e}appendLine(t){this.logService.debug(`${this.prefix}#search`,t)}};hp=_([S(1,te)],hp);var YY=new mt(async()=>(await import("@vscode/ripgrep-universal")).rgPath.replace(/\bnode_modules\.asar\b/,"node_modules.asar.unpacked"));function wk(){return YY.value}async function Uz(i,t,e,n,o){let r=XY(i,t,e,n,o),s=t.folder.fsPath,a=await wk();return{cmd:Nz.spawn(a,r.args,{cwd:s}),rgDiskPath:a,siblingClauses:r.siblingClauses,rgArgs:r,cwd:s}}function XY(i,t,e,n,o){let r=["--files","--hidden","--case-sensitive","--no-require-git"];(i.ignoreGlobCase||t.ignoreGlobCase)&&(r.push("--glob-case-insensitive"),r.push("--ignore-file-case-insensitive")),eX([t],e,!1).forEach(a=>{let l=th(a);if(r.push("-g",l),St){let d=Fx(l);d!==l&&r.push("-g",d)}});let s=ZY([t],n,void 0,!1);return s.globArgs.forEach(a=>{let l=`!${th(a)}`;if(r.push("-g",l),St){let d=Fx(l);d!==l&&r.push("-g",d)}}),t.disregardIgnoreFiles!==!1?r.push("--no-ignore"):t.disregardParentIgnoreFiles!==!1&&r.push("--no-ignore-parent"),t.ignoreSymlinks||r.push("--follow"),i.exists&&r.push("--quiet"),o&&r.push("--threads",`${o}`),r.push("--no-config"),t.disregardGlobalIgnoreFiles&&r.push("--no-ignore-global"),{args:r,siblingClauses:s.siblingClauses}}function ZY(i,t,e,n=!0){let o=[],r={};return i.forEach(s=>{let a=Object.assign({},s.excludePattern||{},t||{}),l=Fz(a,n?s.folder.fsPath:void 0,e);o.push(...l.globArgs),l.siblingClauses&&(r=Object.assign(r,l.siblingClauses))}),{globArgs:o,siblingClauses:r}}function eX(i,t,e=!0){let n=[];return i.forEach(o=>{let r=Object.assign({},t||{},o.includePattern||{}),s=Fz(r,e?o.folder.fsPath:void 0);n.push(...s.globArgs)}),n}function Fz(i,t,e){let n=[],o={};return Object.keys(i).forEach(r=>{if(e&&e.has(r)||!r)return;let s=i[r];r=nX(t?tX(t,r):r),r.startsWith("\\\\")?r="\\\\"+r.substr(2).replace(/\\/g,"/"):r=r.replace(/\\/g,"/"),typeof s=="boolean"&&s?(r.startsWith("\\\\")&&(r+="**"),n.push(oX(r))):s&&s.when&&(o[r]=s)}),{globArgs:n,siblingClauses:o}}function tX(i,t){return cn(t)?t:Be(i,t)}function nX(i){return i=vr(i,"\\"),vr(i,"/")}function oX(i){return fv(i).toLowerCase()==="c:/"?i.replace(/^c:[/\\]/i,"/"):i}var RN=new Set;process.on("exit",()=>{RN.forEach(i=>i())});var DN=class{constructor(t,e=Uz){this.spawnRipgrep=e;this.normalizedFilePatternLowercase=null;this.maxFilesize=null;this.isCanceled=!1;this.fileWalkSW=null;this.cmdSW=null;this.cmdResultCount=0;this.killCmds=new Set;this.config=t,this.filePattern=t.filePattern||"";let n=t.ignoreGlobCase?{ignoreCase:!0}:void 0;this.includePattern=t.includePattern&&Po(t.includePattern,n),this.maxResults=t.maxResults||null,this.exists=!!t.exists,this.walkedPaths=Object.create(null),this.resultCount=0,this.isLimitHit=!1,this.directoriesWalked=0,this.filesWalked=0,this.errors=[],this.filePattern&&(this.normalizedFilePatternLowercase=t.shouldGlobMatchFilePattern?null:sI(this.filePattern).normalizedLowercase),this.globalExcludePattern=t.excludePattern&&Po(t.excludePattern,n),this.folderExcludePatterns=new Map,t.folderQueries.forEach(o=>{let r={};o.excludePattern?.forEach(a=>{Object.assign(r,a.pattern||{},this.config.excludePattern||{})}),o.excludePattern?.length||Object.assign(r,this.config.excludePattern||{});let s=o.folder.fsPath;t.folderQueries.map(a=>a.folder.fsPath).filter(a=>a!==s).forEach(a=>{Or(a,s,t.ignoreGlobCase)&&(r[_i(s,a)]=!0)}),this.folderExcludePatterns.set(s,new AN(r,s,t.ignoreGlobCase))})}cancel(){this.isCanceled=!0,this.killCmds.forEach(t=>t())}walk(t,e,n,o,r,s){if(this.fileWalkSW=Xt.create(!1),this.isCanceled)return s(null,this.isLimitHit);e.forEach(a=>{let l=ot(a.fsPath);this.globalExcludePattern&&this.globalExcludePattern(a.fsPath,l)||this.matchFile(o,{relativePath:a.fsPath,searchPath:void 0})}),this.cmdSW=Xt.create(!1),this.parallel(t,(a,l)=>{this.call(this.cmdTraversal,this,a,n,o,r,d=>{if(d){let c=To(d);console.error(c),this.errors.push(c),l(d,void 0)}else l(null,void 0)})},(a,l)=>{this.fileWalkSW.stop();let d=a?nt(a)[0]:null;s(d,this.isLimitHit)})}parallel(t,e,n){let o=new Array(t.length),r=new Array(t.length),s=!1,a=0;if(t.length===0)return n(null,[]);t.forEach((l,d)=>{e(l,(c,u)=>{if(c?(s=!0,o[d]=null,r[d]=c):(o[d]=u,r[d]=null),++a===t.length)return n(s?r:null,o)})})}call(t,e,...n){try{t.apply(e,n)}catch(o){n[n.length-1](o)}}async cmdTraversal(t,e,n,o,r){let s=t.folder.fsPath,a=St,l="",d=this.initDirectoryTree(),c;try{c=await this.spawnRipgrep(this.config,t,this.config.includePattern,this.folderExcludePatterns.get(t.folder.fsPath).expression,e)}catch(x){r(x instanceof Error?x:new Error(String(x)));return}let u=c.cmd,m=()=>{u.pid!==void 0&&u.kill()};this.killCmds.add(m),RN.add(m);let g=x=>{this.killCmds.delete(m),RN.delete(m),g=()=>{},r(x)};if(this.isCanceled){u.once("error",()=>{}),u.once("close",()=>g()),m();return}let h=!Object.keys(c.siblingClauses).length,f=c.rgArgs.args.map(x=>x.match(/^-/)?x:`'${x}'`).join(" "),I=`${c.rgDiskPath} ${f}
 - cwd: ${c.cwd}`;c.rgArgs.siblingClauses&&(I+=`
 - Sibling clauses: ${JSON.stringify(c.rgArgs.siblingClauses)}`),o({message:I}),this.cmdResultCount=0,this.collectStdout(u,"utf8",o,(x,E,w)=>{if(x){g(x);return}if(this.isLimitHit){g();return}let L=(l+(a?Fc(E||""):E)).split(`
`);if(w){let U=L.length;L[U-1]=L[U-1].trim(),L[U-1]||L.pop()}else l=L.pop()||"";if(L.length&&L[0].indexOf(`
`)!==-1){g(new Error("Splitting up files failed"));return}if(this.cmdResultCount+=L.length,h){for(let U of L)if(this.matchFile(n,{base:s,relativePath:U,searchPath:this.getSearchPath(t,U)}),this.isLimitHit){m();break}(w||this.isLimitHit)&&g();return}this.addDirectoryEntries(t,d,s,L,n),w&&(this.matchDirectoryTree(d,s,n),g())})}spawnFindCmd(t){let e=this.folderExcludePatterns.get(t.folder.fsPath),n=e.getBasenameTerms(),o=e.getPathTerms(),r=["-L","."];if(n.length||o.length){r.push("-not","(","(");for(let s of n)r.push("-name",s),r.push("-o");for(let s of o)r.push("-path",s),r.push("-o");r.pop(),r.push(")","-prune",")")}return r.push("-type","f"),Wz.spawn("find",r,{cwd:t.folder.fsPath})}readStdout(t,e,n){let o="";this.collectStdout(t,e,()=>{},(r,s,a)=>{if(r){n(r);return}o+=s,a&&n(null,o)})}collectStdout(t,e,n,o){let r=(l,d,c)=>{(l||c)&&(r=()=>{},this.cmdSW?.stop()),o(l,d,c)},s=!1;t.stdout?(this.forwardData(t.stdout,e,r),t.stdout.once("data",()=>s=!0)):n({message:"stdout is null"});let a;t.stderr?a=this.collectData(t.stderr):n({message:"stderr is null"}),t.on("error",l=>{r(l)}),t.on("close",l=>{let d;!s&&(d=this.decodeData(a,e))&&rX(d)?r(new Error(`command failed with error code ${l}: ${this.decodeData(a,e)}`)):(this.exists&&l===0&&(this.isLimitHit=!0),r(null,"",!0))})}forwardData(t,e,n){let o=new Hz(e);return t.on("data",r=>{n(null,o.write(r))}),o}collectData(t){let e=[];return t.on("data",n=>{e.push(n)}),e}decodeData(t,e){let n=new Hz(e);return t.map(o=>n.write(o)).join("")}initDirectoryTree(){let t={rootEntries:[],pathToEntries:Object.create(null)};return t.pathToEntries["."]=t.rootEntries,t}addDirectoryEntries(t,{pathToEntries:e},n,o,r){let s=this.filePattern&&o.find(l=>hs(l,this.filePattern,this.config.ignoreGlobCase));s&&this.matchFile(r,{base:n,relativePath:s,searchPath:this.getSearchPath(t,s)});let a=l=>{let d=ot(l),c=gn(l),u=e[c];u||(u=e[c]=[],a(c)),u.push({base:n,relativePath:l,basename:d,searchPath:this.getSearchPath(t,l)})};o.forEach(a)}matchDirectoryTree({rootEntries:t,pathToEntries:e},n,o){let r=this,s=this.folderExcludePatterns.get(n),a=this.filePattern,l=this.config.ignoreGlobCase;function d(c){r.directoriesWalked++;let u=Pb(()=>c.map(m=>m.basename));for(let m=0,g=c.length;m<g;m++){let h=c[m],{relativePath:f,basename:I}=h;if(s.test(f,I,hs(a,I,l)?void 0:u))continue;let x=e[f];if(x)d(x);else{if(r.filesWalked++,hs(f,a,l))continue;r.matchFile(o,h)}if(r.isLimitHit)break}}d(t)}getStats(){return{cmdTime:this.cmdSW.elapsed(),fileWalkTime:this.fileWalkSW.elapsed(),directoriesWalked:this.directoriesWalked,filesWalked:this.filesWalked,cmdResultCount:this.cmdResultCount}}doWalk(t,e,n,o,r){let s=t.folder,a=Pb(()=>n);this.parallel(n,(l,d)=>{if(this.isCanceled||this.isLimitHit)return d(null);let c=e?[e,l].join(Dt):l;if(this.folderExcludePatterns.get(t.folder.fsPath).test(c,l,hs(this.config.filePattern,l,this.config.ignoreGlobCase)?void 0:a))return d(null);let u=[s.fsPath,c].join(Dt);nh.lstat(u,(m,g)=>{if(m||this.isCanceled||this.isLimitHit)return d(null);this.statLinkIfNeeded(u,g,(h,f)=>h||this.isCanceled||this.isLimitHit?d(null):f.isDirectory()?(this.directoriesWalked++,this.realPathIfNeeded(u,g,(I,x)=>I||this.isCanceled||this.isLimitHit||(x=x||"",this.walkedPaths[x])?d(null):(this.walkedPaths[x]=!0,at.readdir(u).then(E=>{if(this.isCanceled||this.isLimitHit)return d(null);this.doWalk(t,c,E,o,w=>d(w||null))},E=>{d(null)})))):(this.filesWalked++,hs(c,this.filePattern,this.config.ignoreGlobCase)||this.maxFilesize&&jn(f.size)&&f.size>this.maxFilesize||this.matchFile(o,{base:s.fsPath,relativePath:c,searchPath:this.getSearchPath(t,c)}),d(null,void 0)))})},l=>{let d=l&&nt(l);return r(d&&d.length>0?d[0]:void 0)})}matchFile(t,e){this.isFileMatch(e)&&(!this.includePattern||this.includePattern(e.relativePath,ot(e.relativePath)))&&(this.resultCount++,(this.exists||this.maxResults&&this.resultCount>this.maxResults)&&(this.isLimitHit=!0),this.isLimitHit||t(e))}isFileMatch(t){if(this.filePattern){if(this.filePattern==="*")return!0;if(this.normalizedFilePatternLowercase)return kb(t,this.normalizedFilePatternLowercase);if(this.filePattern)return kb(t,this.filePattern,!1,this.config.ignoreGlobCase)}return!0}statLinkIfNeeded(t,e,n){return e.isSymbolicLink()?nh.stat(t,n):n(null,e)}realPathIfNeeded(t,e,n){return e.isSymbolicLink()?nh.realpath(t,(o,r)=>o?n(o):n(null,r)):n(null,t)}getSearchPath(t,e){return t.folderName?Be(t.folderName,e):e}},aI=class{constructor(t,e){this.folderQueries=t.folderQueries,this.extraFiles=t.extraFileResources||[],this.numThreads=e,this.walker=new DN(t)}search(t,e,n){this.walker.walk(this.folderQueries,this.extraFiles,this.numThreads,t,e,(o,r)=>{n(o,{limitHit:r,stats:this.walker.getStats(),messages:[]})})}cancel(){this.walker.cancel()}},AN=class{constructor(t,e,n){this.expression=t;this.root=e;this.ignoreCase=n;this.init(t)}init(t){let e,n;Object.keys(t).filter(r=>t[r]).forEach(r=>{cn(r)?(e=e||S1(),e[r]=t[r]):(n=n||S1(),n[r]=t[r])});let o={trimForExclusions:!0,ignoreCase:this.ignoreCase};this.absoluteParsedExpr=e&&Po(e,o),this.relativeParsedExpr=n&&Po(n,o)}test(t,e,n){return this.relativeParsedExpr&&this.relativeParsedExpr(t,e,n)||this.absoluteParsedExpr&&this.absoluteParsedExpr(Be(this.root,t),e,n)}getBasenameTerms(){let t=[];return this.absoluteParsedExpr&&t.push(...T1(this.absoluteParsedExpr)),this.relativeParsedExpr&&t.push(...T1(this.relativeParsedExpr)),t}getPathTerms(){let t=[];return this.absoluteParsedExpr&&t.push(...E1(this.absoluteParsedExpr)),this.relativeParsedExpr&&t.push(...E1(this.relativeParsedExpr)),t}};function rX(i){let t=i.trim().split(`
`),e=t[0].trim();if(e.startsWith("Error parsing regex"))return e;if(e.startsWith("regex parse error"))return v2(t[t.length-1].trim());if(e.startsWith("error parsing glob")||e.startsWith("unsupported encoding"))return e.charAt(0).toUpperCase()+e.substr(1);if(e==="Literal '\\n' not allowed.")return"Literal '\\n' currently not supported";if(e.startsWith("Literal "))return e}import*as $z from"child_process";import{EventEmitter as iX}from"events";import{StringDecoder as sX}from"string_decoder";import{RegExpParser as aX,RegExpVisitor as lX}from"vscode-regexpp";var oh=class{constructor(t,e){this.outputChannel=t;this._numThreads=e}provideTextSearchResults(t,e,n,o){return Promise.all(e.folderOptions.map(r=>{let s={folderOptions:r,numThreads:this._numThreads,maxResults:e.maxResults,previewOptions:e.previewOptions,maxFileSize:e.maxFileSize,surroundingContext:e.surroundingContext};return this.provideTextSearchResultsWithRgOptions(t,s,n,o)})).then((r=>({limitHit:r.some(a=>!!a&&a.limitHit)})))}async provideTextSearchResultsWithRgOptions(t,e,n,o){if(this.outputChannel.appendLine(`provideTextSearchResults ${t.pattern}, ${JSON.stringify({...e,folder:e.folderOptions.folder.toString()})}`),!t.pattern)return{limitHit:!1};let r=await wk();return new Promise((s,a)=>{o.onCancellationRequested(()=>I());let l={...e,numThreads:this._numThreads},d=uX(t,l),c=e.folderOptions.folder.fsPath,u=d.map(L=>L.match(/^-/)?L:`'${L}'`).join(" ");this.outputChannel.appendLine(`${r} ${u}
 - cwd: ${c}`);let m=$z.spawn(r,d,{cwd:c});m.on("error",L=>{console.error(L),this.outputChannel.appendLine("Error: "+(L&&L.message)),a(FL(new na(L&&L.message,5)))});let g=!1,h=new MN(e.maxResults??Jd,e.folderOptions.folder,sN(e.previewOptions));h.on("result",L=>{g=!0,E="",n.report(L)});let f=!1,I=()=>{f=!0,m?.kill(),h?.cancel()},x=!1;h.on("hitLimit",()=>{x=!0,I()});let E="";m.stdout.on("data",L=>{h.handleData(L),g||(E+=L)});let w=!1;m.stdout.once("data",()=>w=!0);let R="";m.stderr.on("data",L=>{let U=L.toString();this.outputChannel.appendLine(U),R.length+U.length<1e6&&(R+=U)}),m.on("close",()=>{if(this.outputChannel.appendLine(w?"Got data from stdout":"No data from stdout"),this.outputChannel.appendLine(g?"Got result from parser":"No result from parser"),E&&this.outputChannel.appendLine(`Got data without result: ${E}`),this.outputChannel.appendLine(""),f)s({limitHit:x});else{h.flush(),m=null;let L;R&&!w&&(L=dX(R))?a(FL(new na(L.message,L.code))):s({limitHit:x})}})})}};function dX(i){let t=i.split(`
`),e=t[0].trim();if(t.some(o=>o.startsWith("regex parse error")))return new na(cX(t),2);let n=e.match(/grep config error: unknown encoding: (.*)/);if(n)return new na(`Unknown encoding: ${n[1]}`,1);if(e.startsWith("error parsing glob"))return new na(e.charAt(0).toUpperCase()+e.substr(1),3);if(e.startsWith("the literal"))return new na(e.charAt(0).toUpperCase()+e.substr(1),4);if(e.startsWith("PCRE2: error compiling pattern"))return new na(e,2)}function cX(i){let t=["Regex parse error"],e=i.filter(n=>n.startsWith("PCRE2:"));if(e.length>=1){let n=e[0].replace("PCRE2:","");if(n.indexOf(":")!==-1&&n.split(":").length>=2){let o=n.split(":")[1];t.push(":"+o)}}return t.join("")}var MN=class extends iX{constructor(e,n,o){super();this.maxResults=e;this.root=n;this.previewOptions=o;this.remainder="";this.isDone=!1;this.hitLimit=!1;this.numResults=0;this.stringDecoder=new sX}cancel(){this.isDone=!0}flush(){this.handleDecodedData(this.stringDecoder.end())}on(e,n){return super.on(e,n),this}handleData(e){if(this.isDone)return;let n=typeof e=="string"?e:this.stringDecoder.write(e);this.handleDecodedData(n)}handleDecodedData(e){let n=e.indexOf(`
`),o=this.remainder+e;if(n>=0)n+=this.remainder.length;else{this.remainder=o;return}let r=0;for(;n>=0;)this.handleLine(o.substring(r,n).trim()),r=n+1,n=o.indexOf(`
`,r);this.remainder=o.substring(r)}handleLine(e){if(this.isDone||!e)return;let n;try{n=JSON.parse(e)}catch{throw new Error(`malformed line from rg: ${e}`)}if(n.type==="match"){let o=lI(n.data.path),r=y.joinPath(this.root,o),s=this.createTextSearchMatch(n.data,r);this.onResult(s),this.hitLimit&&(this.cancel(),this.emit("hitLimit"))}else if(n.type==="context"){let o=lI(n.data.path),r=y.joinPath(this.root,o);this.createTextSearchContexts(n.data,r).forEach(a=>this.onResult(a))}}createTextSearchMatch(e,n){let o=e.line_number-1,r=lI(e.lines),s=Buffer.from(r),a=0,l=0,d=o;e.submatches.length===0&&e.submatches.push(r.length?{start:0,end:1,match:{text:r[0]}}:{start:0,end:0,match:{text:""}});let c=nt(e.submatches.map((g,h)=>{if(this.hitLimit)return null;this.numResults++,this.numResults>=this.maxResults&&(this.hitLimit=!0);let f=lI(g.match),I=s.slice(a,g.start).toString(),x=Vz(I),E=x.numLines>0?x.lastLineLength:x.lastLineLength+l,w=Vz(f),R=x.numLines+d,L=w.numLines+R,U=w.numLines>0?w.lastLineLength:w.lastLineLength+E;return a=g.end,l=U,d=L,new zg(R,E,L,U)})),u=Ec(c,Oz),m=new qg(r,u,this.previewOptions);return new Yo(n,m.rangeLocations.map(g=>({sourceRange:_N(g.source),previewRange:_N(g.preview)})),m.previewText)}createTextSearchContexts(e,n){let o=lI(e.lines),r=e.line_number;return o.replace(/\r?\n$/,"").split(`
`).map((s,a)=>new ta(n,s,r+a))}onResult(e){this.emit("result",e)}};function lI(i){return i.bytes?Buffer.from(i.bytes,"base64").toString():i.text}function Vz(i){let t=/\n/g,e=0,n=-1,o;for(;o=t.exec(i);)e++,n=o.index;let r=n>=0?i.length-n-1:i.length;return{numLines:e,lastLineLength:r}}function uX(i,t){let e=["--hidden","--no-require-git"];e.push(i.isCaseSensitive?"--case-sensitive":"--ignore-case"),t.folderOptions.ignoreGlobCase&&(e.push("--glob-case-insensitive"),e.push("--ignore-file-case-insensitive"));let{doubleStarIncludes:n,otherIncludes:o}=Dp(t.folderOptions.includes,s=>s.startsWith("**")?"doubleStarIncludes":"otherIncludes");if(o&&o.length){let s=new Set;o.forEach(a=>{s.add(a)}),e.push("-g","!*"),s.forEach(a=>{pX(a).map(th).forEach(l=>{e.push("-g",l)})})}n&&n.length&&n.forEach(s=>{e.push("-g",s)}),t.folderOptions.excludes.map(s=>typeof s=="string"?s:s.pattern).map(th).forEach(s=>e.push("-g",`!${s}`)),t.maxFileSize&&e.push("--max-filesize",t.maxFileSize+""),t.folderOptions.useIgnoreFiles.local?t.folderOptions.useIgnoreFiles.parent||e.push("--no-ignore-parent"):e.push("--no-ignore"),t.folderOptions.followSymlinks&&e.push("--follow"),t.folderOptions.encoding&&t.folderOptions.encoding!=="utf8"&&e.push("--encoding",t.folderOptions.encoding),t.numThreads&&e.push("--threads",`${t.numThreads}`),i.pattern==="--"&&(i.isRegExp=!0,i.pattern="\\-\\-"),i.isMultiline&&!i.isRegExp&&(i.pattern=nr(i.pattern),i.isRegExp=!0),e.push("--crlf"),i.isRegExp&&(i.pattern=mX(i.pattern),e.push("--engine","auto"));let r;if(i.isWordMatch){let a=bx(i.pattern,!!i.isRegExp,{wholeWord:i.isWordMatch}).source.replace(/\\\//g,"/");e.push("--regexp",a)}else if(i.isRegExp){let s=gX(i.pattern);s=fX(s),e.push("--regexp",s)}else r=i.pattern,e.push("--fixed-strings");return e.push("--no-config"),t.folderOptions.useIgnoreFiles.global||e.push("--no-ignore-global"),e.push("--json"),i.isMultiline&&e.push("--multiline"),t.surroundingContext&&(e.push("--before-context",t.surroundingContext+""),e.push("--after-context",t.surroundingContext+"")),e.push("--"),r&&e.push(r),e.push("."),e}function pX(i){return zz(i).flatMap(e=>{let n=Ba(e,"/");return n.map((o,r)=>n.slice(0,r+1).join("/"))})}function mX(i){let t=/((?:[^\\]|^)(?:\\\\)*)\\u([a-z0-9]{4})/gi;for(;i.match(t);)i=i.replace(t,"$1\\x{$2}");let e=/((?:[^\\]|^)(?:\\\\)*)\\u\{([a-z0-9]{4})\}/gi;for(;i.match(e);)i=i.replace(e,"$1\\x{$2}");return i}var Bz=i=>i.type==="Assertion"&&i.kind==="lookbehind";function gX(i){let t;try{t=new aX().parsePattern(i)}catch{return i}let e="",n=0,o=(a,l,d)=>{e+=i.slice(n,a)+d,n=l},r=[];return new lX({onCharacterEnter(a){if(a.raw!=="\\n")return;let l=r[0];if(!l)o(a.start,a.end,"\\r?\\n");else if(!r.some(Bz))if(l.type==="CharacterClass")if(l.negate){let d=i.slice(l.start+2,a.start)+i.slice(a.end,l.end-1);l.parent?.type==="Quantifier"?o(l.start,l.end,d?`[^${d}]`:"."):o(l.start,l.end,"(?!\\r?\\n"+(d?`|[${d}]`:"")+")")}else{let d=i.slice(l.start+1,a.start)+i.slice(a.end,l.end-1);o(l.start,l.end,d===""?"\\r?\\n":`(?:[${d}]|\\r?\\n)`)}else l.type==="Quantifier"&&o(a.start,a.end,"(?:\\r?\\n)")},onQuantifierEnter(a){r.unshift(a)},onQuantifierLeave(){r.shift()},onCharacterClassRangeEnter(a){r.unshift(a)},onCharacterClassRangeLeave(){r.shift()},onCharacterClassEnter(a){r.unshift(a)},onCharacterClassLeave(){r.shift()},onAssertionEnter(a){Bz(a)&&r.push(a)},onAssertionLeave(a){r[0]===a&&r.shift()}}).visit(t),e+=i.slice(n),e}function fX(i){return i.replace(/\n/g,"\\r?\\n")}function hX(i){let t=!1,e=!1,n="",o="";for(let r=0;r<i.length;r++){let s=i[r];switch(s){case"\\":e?(t?o+="\\"+s:n+="\\"+s,e=!1):e=!0;break;case"{":if(e)t?o+=s:n+=s,e=!1;else{if(t)return{strInBraces:n+"{"+o+"{"+i.substring(r+1)};t=!0}break;case"}":if(e)t?o+=s:n+=s,e=!1;else{if(t)return{fixedStart:n,strInBraces:o,fixedEnd:i.substring(r+1)};n+=s}break;default:t?o+=(e?"\\":"")+s:n+=(e?"\\":"")+s,e=!1;break}}return{strInBraces:n+(t?"{"+o:"")}}function zz(i){let{fixedStart:t,strInBraces:e,fixedEnd:n}=hX(i);if(t===void 0||n===void 0)return[e];let o=Ba(e,",");o.length||(o=[""]);let r=zz(n);return o.flatMap(s=>{let a=t+s;return r.map(l=>a+l)})}var rh=class extends up{constructor(t,e,n=Ai,o="searchProcess"){super({query:t,provider:e},{readdir:r=>n.Promises.readdir(r.fsPath),toCanonicalName:r=>i5(r)},o)}};var kk=class{constructor(t,e){this.query=t;this.numThreads=e}search(t,e,n){if((!this.query.folderQueries||!this.query.folderQueries.length)&&(!this.query.extraFileResources||!this.query.extraFileResources.length))return Promise.resolve({type:"success",limitHit:!1,stats:{type:"searchProcess"},messages:[]});let o={appendLine(s){n({message:s})}},r=new rh(this.query,new oh(o,this.numThreads),Ai);return new Promise((s,a)=>r.search(l=>{e(l.map(vX))},t).then(l=>s({limitHit:l.limitHit??!1,type:"success",stats:l.stats,messages:[]}),a))}};function vX(i){return{path:i.resource&&i.resource.fsPath,results:i.results,numMatches:(i.results||[]).reduce((t,e)=>wb(e)?t+e.rangeLocations.length:t+1,0)}}var Pk=class i{constructor(t="searchProcess",e){this.processType=t;this.getNumThreads=e;this.caches=Object.create(null)}static{this.BATCH_SIZE=512}fileSearch(t){let e,n=qz(t),o=new T({onDidAddFirstListener:()=>{e=br(async r=>{let s=await this.getNumThreads?.();return this.doFileSearchWithEngine(aI,n,a=>o.fire(a),r,i.BATCH_SIZE,s)}),e.then(r=>o.fire(r),r=>o.fire({type:"error",error:{message:r.message,stack:r.stack}}))},onDidRemoveLastListener:()=>{e.cancel()}});return o.event}textSearch(t){let e,n=qz(t),o=new T({onDidAddFirstListener:()=>{e=br(r=>this.ripgrepTextSearch(n,s=>o.fire(s),r)),e.then(r=>o.fire(r),r=>o.fire({type:"error",error:{message:r.message,stack:r.stack}}))},onDidRemoveLastListener:()=>{e.cancel()}});return o.event}async ripgrepTextSearch(t,e,n){t.maxFileSize=this.getPlatformFileLimits().maxFileSize;let o=await this.getNumThreads?.();return new kk(t,o).search(n,e,e)}getPlatformFileLimits(){return{maxFileSize:16*Gc.GB}}doFileSearch(t,e,n,o){return this.doFileSearchWithEngine(aI,t,n,o,i.BATCH_SIZE,e)}doFileSearchWithEngine(t,e,n,o,r=i.BATCH_SIZE,s){let a=0,l=c=>{Array.isArray(c)?(a+=c.length,n(c.map(u=>this.rawMatchToSearchItem(u)))):c.relativePath?(a++,n(this.rawMatchToSearchItem(c))):n(c)};if(e.sortByScore){let c=this.trySortedSearchFromCache(e,l,o);if(!c){let u=e.maxResults?Object.assign({},e,{maxResults:null}):e,m=new t(u,s);c=this.doSortedSearch(m,e,n,l,o)}return new Promise((u,m)=>{c.then(([g,h])=>{let f=h.map(I=>this.rawMatchToSearchItem(I));this.sendProgress(f,n,r),u(g)},m)})}let d=new t(e,s);return this.doSearch(d,l,r,o).then(c=>({limitHit:c.limitHit,type:"success",stats:{detailStats:c.stats,type:this.processType,fromCache:!1,resultCount:a,sortingTime:void 0},messages:[]}))}rawMatchToSearchItem(t){return{path:t.base?Be(t.base,t.relativePath):t.relativePath}}doSortedSearch(t,e,n,o,r){let s=new T,a=br(d=>{let c=[],u=m=>{Array.isArray(m)?c=m:(o(m),s.fire(m))};return this.doSearch(t,u,-1,d).then(m=>[m,c])}),l;if(e.cacheKey){l=this.getOrCreateCache(e.cacheKey);let d={promise:a,event:s.event,resolved:!1};l.resultsToSearchCache[e.filePattern||""]=d,a.then(()=>{d.resolved=!0},c=>{delete l.resultsToSearchCache[e.filePattern||""]}),a=this.preventCancellation(a)}return a.then(([d,c])=>{let u=l?l.scorerCache:Object.create(null),m=(typeof e.maxResults!="number"||e.maxResults>0)&&Xt.create(!1);return this.sortResults(e,c,u,r).then(g=>{let h=m?m.elapsed():-1;return[{type:"success",stats:{detailStats:d.stats,sortingTime:h,fromCache:!1,type:this.processType,resultCount:g.length},messages:d.messages,limitHit:d.limitHit||typeof e.maxResults=="number"&&c.length>e.maxResults},g]})})}getOrCreateCache(t){let e=this.caches[t];return e||(this.caches[t]=new LN)}trySortedSearchFromCache(t,e,n){let o=t.cacheKey&&this.caches[t.cacheKey];if(!o)return;let r=this.getResultsFromCache(o,t.filePattern||"",e,n);if(r)return r.then(([s,a,l])=>{let d=Xt.create(!1);return this.sortResults(t,a,o.scorerCache,n).then(c=>{let u=d.elapsed(),m={fromCache:!0,detailStats:l,type:this.processType,resultCount:a.length,sortingTime:u};return[{type:"success",limitHit:s.limitHit||typeof t.maxResults=="number"&&a.length>t.maxResults,stats:m,messages:[]},c]})})}sortResults(t,e,n,o){let r=sI(t.filePattern||""),s=(l,d)=>Lz(l,d,r,!0,yX,n),a=typeof t.maxResults=="number"?t.maxResults:Jd;return yH(e,s,a,1e4,o)}sendProgress(t,e,n){if(n&&n>0)for(let o=0;o<t.length;o+=n)e(t.slice(o,o+n));else e(t)}getResultsFromCache(t,e,n,o){let r=Xt.create(!1),s=e.indexOf(Dt)>=0,a;for(let u in t.resultsToSearchCache)if(e.startsWith(u)){if(s&&u.indexOf(Dt)<0&&u!=="")continue;let m=t.resultsToSearchCache[u];a={promise:this.preventCancellation(m.promise),event:m.event,resolved:m.resolved};break}if(!a)return null;let l=r.elapsed(),d=Xt.create(!1),c=a.event(n);return o&&o.onCancellationRequested(()=>{c.dispose()}),a.promise.then(([u,m])=>{if(o&&o.isCancellationRequested)throw Ia();let g=[],h=sI(e).normalizedLowercase;for(let f of m)kb(f,h)&&g.push(f);return[u,g,{cacheWasResolved:a.resolved,cacheLookupTime:l,cacheFilterTime:d.elapsed(),cacheEntryCount:m.length}]})}doSearch(t,e,n,o){return new Promise((r,s)=>{let a=[];o?.onCancellationRequested(()=>t.cancel()),t.search(l=>{l&&(n?(a.push(l),n>0&&a.length>=n&&(e(a),a=[])):e(l))},l=>{e(l)},(l,d)=>{a.length&&e(a),l?(e({message:"Search finished. Error: "+l.message}),s(l)):(e({message:"Search finished. Stats: "+JSON.stringify(d.stats)}),r(d))})})}clearCache(t){return delete this.caches[t],Promise.resolve(void 0)}preventCancellation(t){return new class{get[Symbol.toStringTag](){return this.toString()}cancel(){}then(e,n){return t.then(e,n)}catch(e){return this.then(void 0,e)}finally(e){return t.finally(e)}}}},LN=class{constructor(){this.resultsToSearchCache=Object.create(null);this.scorerCache=Object.create(null)}},yX=new class{getItemLabel(i){return ot(i.relativePath)}getItemDescription(i){return gn(i.relativePath)}getItemPath(i){return i.relativePath}};function qz(i){return{...i,folderQueries:i.folderQueries&&i.folderQueries.map(bX),extraFileResources:i.extraFileResources&&i.extraFileResources.map(t=>y.revive(t))}}function bX(i){return Tt(i)}var dI=class{constructor(t,e){this.outputChannel=t;this.getNumThreads=e;this.inProgress=new Set;process.once("exit",()=>this.dispose())}async provideTextSearchResults(t,e,n,o){let r=await this.getNumThreads(),s=new oh(this.outputChannel,r);return Promise.all(e.folderOptions.map(a=>{let l={folderOptions:a,numThreads:r,maxResults:e.maxResults,previewOptions:e.previewOptions,maxFileSize:e.maxFileSize,surroundingContext:e.surroundingContext};if(a.folder.scheme===B.vscodeUserData){let d={...l,folder:a.folder.with({scheme:B.file})},c=new Cs(u=>n.report({...u,uri:u.uri.with({scheme:a.folder.scheme})}));return this.withToken(o,u=>s.provideTextSearchResultsWithRgOptions(t,d,c,u))}else return this.withToken(o,d=>s.provideTextSearchResultsWithRgOptions(t,l,n,d))})).then((a=>({limitHit:a.some(d=>!!d&&d.limitHit)})))}async withToken(t,e){let n=IX(t);this.inProgress.add(n);let o=await e(n.token);return this.inProgress.delete(n),o}dispose(){this.inProgress.forEach(t=>t.cancel())}};function IX(i){let t=new Ee;return i.onCancellationRequested(()=>t.cancel()),t}var ih=class extends mc{constructor(e,n,o,r,s){super(e,o,s);this.configurationService=r;this._pfs=Ai;this._internalFileSearchHandle=-1;this._internalFileSearchProvider=null;this._registeredEHSearchProvider=!1;this._disposables=new $;this.isDisposed=!1;this.getNumThreads=this.getNumThreads.bind(this),this.getNumThreadsCached=this.getNumThreadsCached.bind(this),this.handleConfigurationChanged=this.handleConfigurationChanged.bind(this);let a=new hp("RipgrepSearchUD",this._logService);this._disposables.add(this.registerTextSearchProvider(B.vscodeUserData,new dI(a,this.getNumThreadsCached))),n.remote.isRemote&&n.remote.authority&&this._registerEHSearchProviders(),r.getConfigProvider().then(l=>{this.isDisposed||this._disposables.add(l.onDidChangeConfiguration(this.handleConfigurationChanged))})}handleConfigurationChanged(e){e.affectsConfiguration("search")&&(this._numThreadsPromise=void 0)}async getNumThreads(){return(await this.configurationService.getConfigProvider()).getConfiguration("search").get("ripgrep.maxThreads")}async getNumThreadsCached(){return this._numThreadsPromise||(this._numThreadsPromise=this.getNumThreads()),this._numThreadsPromise}dispose(){this.isDisposed=!0,this._disposables.dispose()}$enableExtensionHostSearch(){this._registerEHSearchProviders()}_registerEHSearchProviders(){if(this._registeredEHSearchProvider)return;this._registeredEHSearchProvider=!0;let e=new hp("RipgrepSearchEH",this._logService);this._disposables.add(this.registerTextSearchProvider(B.file,new dI(e,this.getNumThreadsCached))),this._disposables.add(this.registerInternalFileSearchProvider(B.file,new Pk("fileSearchProvider",this.getNumThreadsCached)))}registerInternalFileSearchProvider(e,n){let o=this._handlePool++;return this._internalFileSearchProvider=n,this._internalFileSearchHandle=o,this._proxy.$registerFileSearchProvider(o,this._transformScheme(e)),q(()=>{this._internalFileSearchProvider=null,this._proxy.$unregisterProvider(o)})}$provideFileSearchResults(e,n,o,r){let s=jb(o);if(e===this._internalFileSearchHandle){let a=Date.now();return this.doInternalFileSearch(e,n,s,r).then(l=>{let d=Date.now()-a;return this._logService.debug(`Ext host file search time: ${d}ms`),l})}return super.$provideFileSearchResults(e,n,o,r)}async doInternalFileSearchWithCustomCallback(e,n,o){let r=a=>{if(X$(a)&&(a=[a]),Array.isArray(a)){o(a.map(l=>y.file(l.path)));return}a.message&&this._logService.debug("ExtHostSearch",a.message)};if(!this._internalFileSearchProvider)throw new Error("No internal file search handler");let s=await this.getNumThreadsCached();return this._internalFileSearchProvider.doFileSearch(e,s,r,n)}async doInternalFileSearch(e,n,o,r){return this.doInternalFileSearchWithCustomCallback(o,r,s=>{this._proxy.$handleFileMatch(e,n,s)})}$clearCache(e){return this._internalFileSearchProvider?.clearCache(e),super.$clearCache(e)}createTextSearchManager(e,n){return new rh(e,n,void 0,"textSearchProvider")}};ih=_([S(0,le),S(1,Ye),S(2,xs),S(3,_n),S(4,te)],ih);function ON(i,t,e,n,o,r){if(Array.isArray(i)){let s=0;for(let a of i){let l=ON(a,t,e,n,o,r);if(l===10)return l;l>s&&(s=l)}return s}else{if(typeof i=="string")return n?i==="*"?5:i===e?10:0:0;if(i){let{language:s,pattern:a,scheme:l,hasAccessToAllModels:d,notebookType:c}=i;if(!n&&!d)return 0;c&&o&&(t=o);let u=0;if(l)if(l===t.scheme)u=10;else if(l==="*")u=5;else return 0;if(s)if(s===e)u=10;else if(s==="*")u=Math.max(u,5);else return 0;if(c)if(c===r)u=10;else if(c==="*"&&r!==void 0)u=Math.max(u,5);else return 0;if(a){let m;if(typeof a=="string"?m=a:m={...a,base:so(a.base)},m===t.fsPath||_r(m,t.fsPath))u=10;else return 0}return u}else return 0}}function NN(i){return typeof i=="string"?!1:Array.isArray(i)?i.some(NN):!!i.notebookType}var UN=(o=>(o[o.None=0]="None",o[o.Indent=1]="Indent",o[o.IndentOutdent=2]="IndentOutdent",o[o.Outdent=3]="Outdent",o))(UN||{});var sdt=A("editSessionIdentityService"),FN=(n=>(n[n.Complete=100]="Complete",n[n.Partial=50]="Partial",n[n.None=0]="None",n))(FN||{});var _k=class{constructor(t){this._relatedInformationProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiRelatedInformation)}async $provideAiRelatedInformation(t,e,n){if(this._relatedInformationProviders.size===0)throw new Error("No related information providers registered");let o=this._relatedInformationProviders.get(t);if(!o)throw new Error("related information provider not found");return await o.provideRelatedInformation(e,n)??[]}getRelatedInformation(t,e,n){return this._proxy.$getAiRelatedInformation(e,n)}registerRelatedInformationProvider(t,e,n){let o=this._nextHandle;return this._nextHandle++,this._relatedInformationProviders.set(o,n),this._proxy.$registerAiRelatedInformationProvider(o,e),new Se(()=>{this._proxy.$unregisterAiRelatedInformationProvider(o),this._relatedInformationProviders.delete(o)})}};var Rk=class{constructor(t){this._settingsSearchProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiSettingsSearch)}async $startSearch(t,e,n,o){if(this._settingsSearchProviders.size===0)throw new Error("No related information providers registered");let r=this._settingsSearchProviders.get(t);if(!r)throw new Error("Settings search provider not found");let s=new Cs(a=>{this._proxy.$handleSearchResult(t,OL.fromSettingsSearchResult(a))});return r.provideSettingsSearchResults(e,n,s,o)}registerSettingsSearchProvider(t,e){let n=this._nextHandle;return this._nextHandle++,this._settingsSearchProviders.set(n,e),this._proxy.$registerAiSettingsSearchProvider(n),new Se(()=>{this._proxy.$unregisterAiSettingsSearchProvider(n),this._settingsSearchProviders.delete(n)})}};function Kz(i){for(let t=0,e=i.length;t<e;t+=4){let n=i[t+0],o=i[t+1],r=i[t+2],s=i[t+3];i[t+0]=s,i[t+1]=r,i[t+2]=o,i[t+3]=n}}function SX(i){let t=new Uint8Array(i.buffer,i.byteOffset,i.length*4);return lx()||Kz(t),H.wrap(t)}function CX(i){let t=i.buffer;if(lx()||Kz(t),t.byteOffset%4===0)return new Uint32Array(t.buffer,t.byteOffset,t.length/4);{let e=new Uint8Array(t.byteLength);return e.set(t),new Uint32Array(e.buffer,e.byteOffset,e.length/4)}}function Dk(i){let t=new Uint32Array(TX(i)),e=0;if(t[e++]=i.id,i.type==="full")t[e++]=1,t[e++]=i.data.length,t.set(i.data,e),e+=i.data.length;else{t[e++]=2,t[e++]=i.deltas.length;for(let n of i.deltas)t[e++]=n.start,t[e++]=n.deleteCount,n.data?(t[e++]=n.data.length,t.set(n.data,e),e+=n.data.length):t[e++]=0}return SX(t)}function TX(i){let t=0;if(t+=2,i.type==="full")t+=1+i.data.length;else{t+=1,t+=3*i.deltas.length;for(let e of i.deltas)e.data&&(t+=e.data.length)}return t}function HN(i){let t=CX(i),e=0,n=t[e++];if(t[e++]===1){let a=t[e++],l=t.subarray(e,e+a);return e+=a,{id:n,type:"full",data:l}}let r=t[e++],s=[];for(let a=0;a<r;a++){let l=t[e++],d=t[e++],c=t[e++],u;c>0&&(u=t.subarray(e,e+c),e+=c),s[a]={start:l,deleteCount:d,data:u}}return{id:n,type:"delta",deltas:s}}var EX=[new Me("vscode.executeDocumentHighlights","_executeDocumentHighlights","Execute document highlight provider.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of DocumentHighlight-instances.",ns(zu.to))),new Me("vscode.executeDocumentSymbolProvider","_executeDocumentSymbolProvider","Execute document symbol provider.",[oe.Uri],new Ae("A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.",(i,t)=>{if(iv(i))return;class e extends Br{constructor(){super(...arguments);this.containerName=""}static to(r){let s=new e(r.name,zr.to(r.kind),r.containerName||"",new rn(t[0],K.to(r.range)));return s.detail=r.detail,s.range=s.location.range,s.selectionRange=K.to(r.selectionRange),s.children=r.children?r.children.map(e.to):[],s}}return i.map(e.to)})),new Me("vscode.executeFormatDocumentProvider","_executeFormatDocumentProvider","Execute document format provider.",[oe.Uri,new oe("options","Formatting options",i=>!0,i=>i)],new Ae("A promise that resolves to an array of TextEdits.",ns(Mn.to))),new Me("vscode.executeFormatRangeProvider","_executeFormatRangeProvider","Execute range format provider.",[oe.Uri,oe.Range,new oe("options","Formatting options",i=>!0,i=>i)],new Ae("A promise that resolves to an array of TextEdits.",ns(Mn.to))),new Me("vscode.executeFormatOnTypeProvider","_executeFormatOnTypeProvider","Execute format on type provider.",[oe.Uri,oe.Position,new oe("ch","Trigger character",i=>typeof i=="string",i=>i),new oe("options","Formatting options",i=>!0,i=>i)],new Ae("A promise that resolves to an array of TextEdits.",ns(Mn.to))),new Me("vscode.executeDefinitionProvider","_executeDefinitionProvider","Execute all definition providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.experimental.executeDefinitionProvider_recursive","_executeDefinitionProvider_recursive","Execute all definition providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.executeTypeDefinitionProvider","_executeTypeDefinitionProvider","Execute all type definition providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.experimental.executeTypeDefinitionProvider_recursive","_executeTypeDefinitionProvider_recursive","Execute all type definition providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.executeDeclarationProvider","_executeDeclarationProvider","Execute all declaration providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.experimental.executeDeclarationProvider_recursive","_executeDeclarationProvider_recursive","Execute all declaration providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.executeImplementationProvider","_executeImplementationProvider","Execute all implementation providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.experimental.executeImplementationProvider_recursive","_executeImplementationProvider_recursive","Execute all implementation providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location or LocationLink instances.",yc)),new Me("vscode.executeReferenceProvider","_executeReferenceProvider","Execute all reference providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location-instances.",ns(bo.to))),new Me("vscode.experimental.executeReferenceProvider","_executeReferenceProvider_recursive","Execute all reference providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Location-instances.",ns(bo.to))),new Me("vscode.executeHoverProvider","_executeHoverProvider","Execute all hover providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Hover-instances.",ns(Og.to))),new Me("vscode.experimental.executeHoverProvider_recursive","_executeHoverProvider_recursive","Execute all hover providers.",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of Hover-instances.",ns(Og.to))),new Me("vscode.executeSelectionRangeProvider","_executeSelectionRangeProvider","Execute selection range provider.",[oe.Uri,new oe("position","A position in a text document",i=>Array.isArray(i)&&i.every(t=>De.isPosition(t)),i=>i.map(ht.from))],new Ae("A promise that resolves to an array of ranges.",i=>i.map(t=>{let e;for(let n of t.reverse())e=new Fs(K.to(n),e);return e}))),new Me("vscode.executeWorkspaceSymbolProvider","_executeWorkspaceSymbolProvider","Execute all workspace symbol providers.",[oe.String.with("query","Search string")],new Ae("A promise that resolves to an array of SymbolInformation-instances.",i=>i.map(Gd.to))),new Me("vscode.prepareCallHierarchy","_executePrepareCallHierarchy","Prepare call hierarchy at a position inside a document",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of CallHierarchyItem-instances",i=>i.map(gl.to))),new Me("vscode.provideIncomingCalls","_executeProvideIncomingCalls","Compute incoming calls for an item",[oe.CallHierarchyItem],new Ae("A promise that resolves to an array of CallHierarchyIncomingCall-instances",i=>i.map(dL.to))),new Me("vscode.provideOutgoingCalls","_executeProvideOutgoingCalls","Compute outgoing calls for an item",[oe.CallHierarchyItem],new Ae("A promise that resolves to an array of CallHierarchyOutgoingCall-instances",i=>i.map(cL.to))),new Me("vscode.prepareRename","_executePrepareRename","Execute the prepareRename of rename provider.",[oe.Uri,oe.Position],new Ae("A promise that resolves to a range and placeholder text.",i=>{if(i)return{range:K.to(i.range),placeholder:i.text}})),new Me("vscode.executeDocumentRenameProvider","_executeDocumentRenameProvider","Execute rename provider.",[oe.Uri,oe.Position,oe.String.with("newName","The new symbol name")],new Ae("A promise that resolves to a WorkspaceEdit.",i=>{if(i){if(i.rejectReason)throw new Error(i.rejectReason);return Io.to(i)}})),new Me("vscode.executeLinkProvider","_executeLinkProvider","Execute document link provider.",[oe.Uri,oe.Number.with("linkResolveCount","Number of links that should be resolved, only when links are unresolved.").optional()],new Ae("A promise that resolves to an array of DocumentLink-instances.",i=>i.map(fl.to))),new Me("vscode.provideDocumentSemanticTokensLegend","_provideDocumentSemanticTokensLegend","Provide semantic tokens legend for a document",[oe.Uri],new Ae("A promise that resolves to SemanticTokensLegend.",i=>{if(i)return new Du(i.tokenTypes,i.tokenModifiers)})),new Me("vscode.provideDocumentSemanticTokens","_provideDocumentSemanticTokens","Provide semantic tokens for a document",[oe.Uri],new Ae("A promise that resolves to SemanticTokens.",i=>{if(!i)return;let t=HN(i);if(t.type==="full")return new Qi(t.data,void 0)})),new Me("vscode.provideDocumentRangeSemanticTokensLegend","_provideDocumentRangeSemanticTokensLegend","Provide semantic tokens legend for a document range",[oe.Uri,oe.Range.optional()],new Ae("A promise that resolves to SemanticTokensLegend.",i=>{if(i)return new Du(i.tokenTypes,i.tokenModifiers)})),new Me("vscode.provideDocumentRangeSemanticTokens","_provideDocumentRangeSemanticTokens","Provide semantic tokens for a document range",[oe.Uri,oe.Range],new Ae("A promise that resolves to SemanticTokens.",i=>{if(!i)return;let t=HN(i);if(t.type==="full")return new Qi(t.data,void 0)})),new Me("vscode.executeCompletionItemProvider","_executeCompletionItemProvider","Execute completion item provider.",[oe.Uri,oe.Position,oe.String.with("triggerCharacter","Trigger completion when the user types the character, like `,` or `(`").optional(),oe.Number.with("itemResolveCount","Number of completions to resolve (too large numbers slow down completions)").optional()],new Ae("A promise that resolves to a CompletionList-instance.",(i,t,e)=>{if(!i)return new Bi([]);let n=i.suggestions.map(o=>fL.to(o,e));return new Bi(n,i.incomplete)})),new Me("vscode.executeSignatureHelpProvider","_executeSignatureHelpProvider","Execute signature help provider.",[oe.Uri,oe.Position,oe.String.with("triggerCharacter","Trigger signature help when the user types the character, like `,` or `(`").optional()],new Ae("A promise that resolves to SignatureHelp.",i=>{if(i)return Ng.to(i)})),new Me("vscode.executeCodeLensProvider","_executeCodeLensProvider","Execute code lens provider.",[oe.Uri,oe.Number.with("itemResolveCount","Number of lenses that should be resolved and returned. Will only return resolved lenses, will impact performance)").optional()],new Ae("A promise that resolves to an array of CodeLens-instances.",(i,t,e)=>ns(n=>new Id(K.to(n.range),n.command&&e.fromInternal(n.command)))(i))),new Me("vscode.executeCodeActionProvider","_executeCodeActionProvider","Execute code action provider.",[oe.Uri,new oe("rangeOrSelection","Range in a text document. Some refactoring provider requires Selection object.",i=>ve.isRange(i),i=>oo.isSelection(i)?Do.from(i):K.from(i)),oe.String.with("kind","Code action kind to return code actions for").optional(),oe.Number.with("itemResolveCount","Number of code actions to resolve (too large numbers slow down code actions)").optional()],new Ae("A promise that resolves to an array of Command-instances.",(i,t,e)=>ns(n=>{if(n._isSynthetic){if(!n.command)throw new Error("Synthetic code actions must have a command");return e.fromInternal(n.command)}else{let o=new Us(n.title,n.kind?new Rt(n.kind):void 0);return n.edit&&(o.edit=Io.to(n.edit)),n.command&&(o.command=e.fromInternal(n.command)),o.isPreferred=n.isPreferred,o}})(i))),new Me("vscode.executeDocumentColorProvider","_executeDocumentColorProvider","Execute document color provider.",[oe.Uri],new Ae("A promise that resolves to an array of ColorInformation objects.",i=>i?i.map(t=>new Ed(K.to(t.range),Qu.to(t.color))):[])),new Me("vscode.executeColorPresentationProvider","_executeColorPresentationProvider","Execute color presentation provider.",[new oe("color","The color to show and insert",i=>i instanceof $i,Qu.from),new oe("context","Context object with uri and range",i=>!0,i=>({uri:i.uri,range:K.from(i.range)}))],new Ae("A promise that resolves to an array of ColorPresentation objects.",i=>i?i.map(gb.to):[])),new Me("vscode.executeInlayHintProvider","_executeInlayHintProvider","Execute inlay hints provider",[oe.Uri,oe.Range],new Ae("A promise that resolves to an array of Inlay objects",(i,t,e)=>i.map(hL.to.bind(void 0,e)))),new Me("vscode.executeFoldingRangeProvider","_executeFoldingRangeProvider","Execute folding range provider",[oe.Uri],new Ae("A promise that resolves to an array of FoldingRange objects",(i,t)=>{if(i)return i.map(hb.to)})),new Me("vscode.resolveNotebookContentProviders","_resolveNotebookContentProvider","Resolve Notebook Content Providers",[],new Ae("A promise that resolves to an array of NotebookContentProvider static info objects.",ns(i=>({viewType:i.viewType,displayName:i.displayName,options:{transientOutputs:i.options.transientOutputs,transientCellMetadata:i.options.transientCellMetadata,transientDocumentMetadata:i.options.transientDocumentMetadata},filenamePattern:i.filenamePattern.map(t=>yb.to(t))})))),new Me("vscode.executeInlineValueProvider","_executeInlineValueProvider","Execute inline value provider",[oe.Uri,oe.Range,new oe("context","An InlineValueContext",i=>i&&typeof i.frameId=="number"&&i.stoppedLocation instanceof ve,i=>mb.from(i))],new Ae("A promise that resolves to an array of InlineValue objects",i=>i.map(pb.to))),new Me("vscode.open","_workbench.open","Opens the provided resource in the editor. Can be a text or binary file, or an http(s) URL. If you need more control over the options for opening a text file, use vscode.window.showTextDocument instead.",[new oe("uriOrString","Uri-instance or string (only http/https)",i=>y.isUri(i)||typeof i=="string"&&JR(i,B.http,B.https),i=>i),new oe("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",i=>i===void 0||typeof i=="number"||typeof i=="object",i=>i&&(typeof i=="number"?[zt.from(i),void 0]:[zt.from(i.viewColumn),vb.from(i)])).optional(),oe.String.with("label","").optional()],Ae.Void),new Me("vscode.openWith","_workbench.openWith","Opens the provided resource with a specific editor.",[oe.Uri.with("resource","Resource to open"),oe.String.with("viewId","Custom editor view id. This should be the viewType string for custom editors or the notebookType string for notebooks. Use 'default' to use VS Code's default text editor"),new oe("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",i=>i===void 0||typeof i=="number"||typeof i=="object",i=>i&&(typeof i=="number"?[zt.from(i),void 0]:[zt.from(i.viewColumn),vb.from(i)])).optional()],Ae.Void),new Me("vscode.diff","_workbench.diff","Opens the provided resources in the diff editor to compare their contents.",[oe.Uri.with("left","Left-hand side resource of the diff editor"),oe.Uri.with("right","Right-hand side resource of the diff editor"),oe.String.with("title","Human readable title for the diff editor").optional(),new oe("columnOrOptions","Either the column in which to open or editor options, see vscode.TextDocumentShowOptions",i=>i===void 0||typeof i=="object",i=>i&&[zt.from(i.viewColumn),vb.from(i)]).optional()],Ae.Void),new Me("vscode.changes","_workbench.changes","Opens a list of resources in the changes editor to compare their contents.",[oe.String.with("title","Human readable title for the changes editor"),new oe("resourceList","List of resources to compare",i=>{for(let t of i){if(t.length!==3)return!1;let[e,n,o]=t;if(!y.isUri(e)||!y.isUri(n)&&n!==void 0&&n!==null||!y.isUri(o)&&o!==void 0&&o!==null)return!1}return!0},i=>i)],Ae.Void),new Me("vscode.prepareTypeHierarchy","_executePrepareTypeHierarchy","Prepare type hierarchy at a position inside a document",[oe.Uri,oe.Position],new Ae("A promise that resolves to an array of TypeHierarchyItem-instances",i=>i.map(hl.to))),new Me("vscode.provideSupertypes","_executeProvideSupertypes","Compute supertypes for an item",[oe.TypeHierarchyItem],new Ae("A promise that resolves to an array of TypeHierarchyItem-instances",i=>i.map(hl.to))),new Me("vscode.provideSubtypes","_executeProvideSubtypes","Compute subtypes for an item",[oe.TypeHierarchyItem],new Ae("A promise that resolves to an array of TypeHierarchyItem-instances",i=>i.map(hl.to))),new Me("vscode.revealTestInExplorer","_revealTestInExplorer","Reveals a test instance in the explorer",[oe.TestItem],Ae.Void),new Me("vscode.startContinuousTestRun","testing.startContinuousRunFromExtension","Starts running the given tests with continuous run mode.",[oe.TestProfile,oe.Arr(oe.TestItem)],Ae.Void),new Me("vscode.stopContinuousTestRun","testing.stopContinuousRunFromExtension","Stops running the given tests with continuous run mode.",[oe.Arr(oe.TestItem)],Ae.Void),new Me("vscode.experimental.editSession.continue","_workbench.editSessions.actions.continueEditSession","Continue the current edit session in a different workspace",[oe.Uri.with("workspaceUri","The target workspace to continue the current edit session in")],Ae.Void),new Me("setContext","_setContext","Set a custom context key value that can be used in when clauses.",[oe.String.with("name","The context key name"),new oe("value","The context key value",()=>!0,i=>i)],Ae.Void),new Me("vscode.editorChat.start","inlineChat.start","Invoke a new editor chat session",[new oe("Run arguments","",i=>!0,i=>{if(i)return{initialRange:i.initialRange?K.from(i.initialRange):void 0,initialSelection:oo.isSelection(i.initialSelection)?Do.from(i.initialSelection):void 0,message:i.message,attachments:i.attachments,autoSend:i.autoSend,position:i.position?ht.from(i.position):void 0,resolveOnResponse:i.resolveOnResponse}})],Ae.Void),new Me("vscode.extensionPromptFileProvider","_listExtensionPromptFiles","Get all extension-contributed prompt files (custom agents, instructions, and prompt files).",[],new Ae("A promise that resolves to an array of objects containing uri, type, and extensionId.",i=>i?i.map(t=>({uri:y.revive(t.uri),type:t.type,extensionId:t.extensionId})):[]))],Ak=class{static register(t){EX.forEach(t.registerApiCommand,t),this._registerValidateWhenClausesCommand(t)}static _registerValidateWhenClausesCommand(t){t.registerCommand(!1,"_validateWhenClauses",EW)}};function ns(i){return t=>{if(Array.isArray(t))return t.map(i)}}function yc(i){if(!Array.isArray(i))return;let t=[];for(let e of i)MV(e)?t.push(Lg.to(e)):t.push(bo.to(e));return t}var sh=class{constructor(t,e){this._proxy=t.getProxy(F.MainThreadBulkEdits),this._versionInformationProvider={getTextDocumentVersion:n=>e.getDocument(n)?.version,getNotebookDocumentVersion:()=>{}}}applyWorkspaceEdit(t,e,n){let o=new Zt(Io.from(t,this._versionInformationProvider));return this._proxy.$tryApplyWorkspaceEdit(o,void 0,n?.isRefactoring??!1)}};sh=_([S(0,le)],sh);var jz;(t=>{function i(e,n){return e.callstack<n.callstack?-1:e.callstack>n.callstack?1:0}t.compare=i})(jz||={});function VN(i){if(!i||typeof i!="object")return{callstack:void 0,msg:Jp(i)};let t=Array.isArray(i.stack)?i.stack.join(`
`):i.stack,e=i.message?i.message:Jp(i);return{callstack:t,msg:e}}var WN=class i{constructor(t,e=i.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new $;this._telemetryService=t,this._flushDelay=e;let n=Ml.addListener(o=>this._onErrorEvent(o));this._disposables.add(q(n)),this.installErrorListeners()}static{this.ERROR_FLUSH_TIMEOUT=5*1e3}dispose(){clearTimeout(this._flushHandle),this._flushBuffer(),this._disposables.dispose()}installErrorListeners(){}_onErrorEvent(t){if(!t||t.code||(t.detail&&t.detail.stack&&(t=t.detail),Ln.isErrorNoTelemetry(t)||t instanceof Ss||ya.is(t)||typeof t?.message=="string"&&t.message.includes("Unable to read file")))return;let{callstack:e,msg:n}=VN(t);if(!e)return;let o={msg:n,callstack:e};Fp.is(t)&&(o.kind=t.kind,o.listenerCount=t.listenerCount),this._enqueue(o)}_enqueue(t){let e=fH(this._buffer,t,jz.compare);e<0?(t.count=1,this._buffer.splice(~e,0,t)):(this._buffer[e].count||(this._buffer[e].count=0),this._buffer[e].count+=1),this._flushHandle===void 0&&(this._flushHandle=setTimeout(()=>{this._flushBuffer(),this._flushHandle=void 0},this._flushDelay))}_flushBuffer(){for(let t of this._buffer)this._telemetryService.publicLogError2("UnhandledError",t);this._buffer.length=0}};function Gz(i){return!!i&&y.isUri(i.sessionResource)&&i.$mid===19}var ah=class{constructor(t,e,n,o,r,s,a){this._extension=t;this._request=e;this._proxy=n;this._commandsConverter=o;this._sessionDisposables=r;this._pendingCarouselResolvers=s;this._token=a;this._stopWatch=Xt.create(!1);this._isClosed=!1}close(){this._isClosed=!0}get timings(){return{firstProgress:this._firstProgress,totalElapsed:this._stopWatch.elapsed()}}get apiObject(){if(!this._apiObject){let n=function(l){if(t._isClosed){let d=new Error("Response stream has been closed");throw Error.captureStackTrace(d,l),d}},s=function(l,d){if(o.push(d!==void 0?[l,d]:l)===1&&queueMicrotask(()=>{let u=r;r=[],t._proxy.$handleProgressChunk(t._request.requestId,o).finally(()=>{u.forEach(m=>m())}),o.length=0}),d!==void 0)return new Promise(u=>{r.push(u)})},t=this;this._stopWatch.reset();let e=0,o=[],r=[],a=(l,d)=>{if(typeof this._firstProgress>"u"&&(l.kind==="markdownContent"||l.kind==="markdownVuln"||l.kind==="beginToolInvocation")&&(this._firstProgress=this._stopWatch.elapsed()),d){let c=e++,u=s(l,c),m={report:g=>{u.then(()=>{en.isMarkdownString(g.value)?s(Cb.from(g),c):s(ju.from(g),c)})}};Promise.all([u,d(m)]).then(([g,h])=>{s(EL.from(h),c)})}else s(l)};this._apiObject=Object.freeze({clearToPreviousToolInvocation(l){return n(this.markdown),s({kind:"clearToPreviousToolInvocation",reason:l}),this},markdown(l){n(this.markdown);let d=new tl(l),c=lb.from(d);return a(c),this},markdownWithVulnerabilities(l,d){n(this.markdown),d&&M(t._extension,"chatParticipantAdditions");let c=new qs(l,d),u=YE.from(c);return a(u),this},codeblockUri(l,d){n(this.codeblockUri),M(t._extension,"chatParticipantAdditions");let c=new al(l,d),u=JE.from(c);return a(u),this},filetree(l,d){n(this.filetree);let c=new ol(l,d),u=db.from(c);return a(u),this},anchor(l,d){let c=new Ks(l,d);return this.push(c)},button(l){n(this.anchor);let d=new sl(l),c=cb.from(d,t._commandsConverter,t._sessionDisposables);return a(c),this},progress(l,d){n(this.progress);let c=new Vd(l,d),u=d?rw.from(c):xb.from(c);return a(u,d),this},thinkingProgress(l){n(this.thinkingProgress),M(t._extension,"chatParticipantAdditions");let d=new Ji(l.text??"",l.id,l.metadata),c=Sb.from(d);return a(c),this},hookProgress(l,d,c){n(this.hookProgress),M(t._extension,"chatParticipantAdditions");let u=new rl(l,d,c),m=ew.from(u);return a(m),this},voiceProgress(l,d){n(this.voiceProgress),M(t._extension,"chatParticipantPrivate");let c=new Bd(l,d);return a(tw.from(c)),this},warning(l){n(this.progress),M(t._extension,"chatParticipantAdditions");let d=new Gs(l),c=Cb.from(d);return a(c),this},info(l){n(this.progress),M(t._extension,"chatParticipantAdditions");let d=new il(l),c=ow.from(d);return a(c),this},reference(l,d){return this.reference2(l,d)},reference2(l,d,c){if(n(this.reference),typeof l=="object"&&"variableName"in l&&M(t._extension,"chatParticipantAdditions"),typeof l=="object"&&"variableName"in l&&!l.value){let u=t._request.variables.variables.find(m=>m.name===l.variableName);if(u){let m;if(u.references?.length)m=u.references.map(g=>({kind:"reference",reference:{variableName:l.variableName,value:g.reference}}));else{let g=new fi(l,d,c);m=[ju.from(g)]}return m.forEach(g=>a(g)),this}}else{let u=new fi(l,d,c),m=ju.from(u);a(m)}return this},codeCitation(l,d,c){n(this.codeCitation),M(t._extension,"chatParticipantAdditions");let u=new ll(l,d,c),m=dw.from(u);a(m)},textEdit(l,d){n(this.textEdit),M(t._extension,"chatParticipantAdditions");let c=new Js(l,d);c.isDone=d===!0?!0:void 0;let u=iw.from(c);return a(u),this},notebookEdit(l,d){n(this.notebookEdit),M(t._extension,"chatParticipantAdditions");let c=new cl(l,d),u=aw.from(c);return a(u),this},workspaceEdit(l){n(this.workspaceEdit),M(t._extension,"chatParticipantAdditions");let d=new qd(l),c=lw.from(d);return a(c),this},async externalEdit(l,d){n(this.externalEdit);let c=Array.isArray(l)?l:[l],u=e++,m=_e();await s({kind:"externalEdits",start:!0,resources:c,undoStopId:m},u);try{return await d(),m}finally{await s({kind:"externalEdits",start:!1,resources:c,undoStopId:m},u)}},confirmation(l,d,c,u){n(this.confirmation),M(t._extension,"chatParticipantAdditions");let m=new nl(l,d,c,u),g=XE.from(m);return a(g),this},async questionCarousel(l,d=!0){n(this.questionCarousel),M(t._extension,"chatParticipantAdditions");let c=_e(),u=new Qs(l,d),m=ZE.from(u);m.resolveId=c;let g=new jt;return t._pendingCarouselResolvers.has(t._request.requestId)||t._pendingCarouselResolvers.set(t._request.requestId,new Map),t._pendingCarouselResolvers.get(t._request.requestId).set(c,g),a(m),Jl(g.p,t._token)},beginToolInvocation(l,d,c){n(this.beginToolInvocation),M(t._extension,"chatParticipantAdditions");let u={kind:"beginToolInvocation",toolCallId:l,toolName:d,streamData:c?{partialInput:c.partialInput}:void 0,subagentInvocationId:c?.subagentInvocationId};return a(u),this},updateToolInvocation(l,d){n(this.updateToolInvocation),M(t._extension,"chatParticipantAdditions");let c={kind:"updateToolInvocation",toolCallId:l,streamData:{partialInput:d.partialInput}};return a(c),this},push(l){if(n(this.push),(l instanceof Js||l instanceof cl||l instanceof qs||l instanceof Gs||l instanceof nl||l instanceof Qs||l instanceof ll||l instanceof dl||l instanceof $d||l instanceof Lu||l instanceof Ji||l instanceof zd||l instanceof js||l instanceof Vd)&&M(t._extension,"chatParticipantAdditions"),l instanceof fi)this.reference2(l.value,l.iconPath,l.options);else if(l instanceof Vd){let d=l.task?rw.from(l):xb.from(l);a(d,l.task)}else if(l instanceof Ji){let d=Sb.from(l);a(d)}else if(l instanceof js){let d=nw.from(l);a(d)}else if(l instanceof Ks){let d=Ag.from(l);if(l.resolve&&(M(t._extension,"chatParticipantAdditions"),d.resolveId=_e()),a(d),l.resolve){let c=new Ee;l.resolve(c.token).then(()=>{let u=Ag.from(l);t._proxy.$handleAnchorResolve(t._request.requestId,d.resolveId,u)}).then(()=>c.dispose(),()=>c.dispose()),t._sessionDisposables.add(q(()=>c.dispose(!0)))}}else{if(l instanceof Lu)return this.externalEdit(l.uris,l.callback).then(c=>l.didGetApplied(c)),this;{let d=Hg.from(l,t._commandsConverter,t._sessionDisposables);a(d)}}return this},usage(l){n(this.usage),M(t._extension,"chatParticipantAdditions");let d={kind:"usage",promptTokens:l.promptTokens,completionTokens:l.completionTokens,outputBuffer:l.outputBuffer,copilotCredits:l.copilotCredits,promptTokenDetails:l.promptTokenDetails};return a(d),this}})}return this._apiObject}},Mk=class i extends N{constructor(e,n,o,r,s,a,l,d,c){super();this._logService=n;this._commands=o;this._documents=r;this._editorsAndDocuments=s;this._languageModels=a;this._diagnostics=l;this._tools=d;this._chatSessions=c;this._agents=new Map;this._participantDetectionProviders=new Map;this._promptFileProviders=new Map;this._customizationProviders=new Map;this._sessionDisposables=this._register(new ex);this._completionDisposables=this._register(new bn);this._inFlightRequests=new Set;this._pendingCarouselResolvers=new Map;this._onDidChangeChatRequestTools=this._register(new T);this.onDidChangeChatRequestTools=this._onDidChangeChatRequestTools.event;this._onDidDisposeChatSession=this._register(new T);this.onDidDisposeChatSession=this._onDidDisposeChatSession.event;this._onDidChangeCustomAgents=this._register(new T);this.onDidChangeCustomAgents=this._onDidChangeCustomAgents.event;this._onDidChangeInstructions=this._register(new T);this.onDidChangeInstructions=this._onDidChangeInstructions.event;this._onDidChangeSkills=this._register(new T);this.onDidChangeSkills=this._onDidChangeSkills.event;this._onDidChangeSlashCommands=this._register(new T);this.onDidChangeSlashCommands=this._onDidChangeSlashCommands.event;this._onDidChangeHooks=this._register(new T);this.onDidChangeHooks=this._onDidChangeHooks.event;this._onDidChangePlugins=this._register(new T);this.onDidChangePlugins=this._onDidChangePlugins.event;this._customAgents=new bc(()=>this._proxy.$provideCustomAgents(pe.None).then(e=>e.map(n=>this.toCustomAgent(n))));this._instructions=new bc(()=>this._proxy.$provideInstructions(pe.None).then(e=>e.map(n=>this.toInstruction(n))));this._skills=new bc(()=>this._proxy.$provideSkills(pe.None).then(e=>e.map(n=>this.toSkill(n))));this._slashCommands=new bc(()=>this._proxy.$provideSlashCommands(pe.None).then(e=>e.map(n=>this.toSlashCommand(n))));this._hooks=new bc(()=>this._proxy.$provideHooks(pe.None).then(e=>e.map(n=>this.toHook(n))));this._plugins=new bc(()=>this._proxy.$providePlugins(pe.None).then(e=>e.map(n=>this.toPlugin(n))));this._onDidChangeActiveChatPanelSessionResource=this._register(new T);this.onDidChangeActiveChatPanelSessionResource=this._onDidChangeActiveChatPanelSessionResource.event;this._proxy=e.getProxy(F.MainThreadChatAgents2),o.registerArgumentProcessor({processArgument:u=>Gz(u)?null:u})}static{this._idPool=0}static{this._participantDetectionProviderIdPool=0}static{this._contributionsProviderIdPool=0}static{this._customizationProviderIdPool=0}get activeChatPanelSessionResource(){return this._activeChatPanelSessionResource}toCustomAgent(e){return Object.freeze({uri:y.revive(e.uri),name:e.name,description:e.description,source:e.source,extensionId:e.extensionId,pluginUri:e.pluginUri?y.revive(e.pluginUri):void 0,sessionTypes:e.sessionTypes,argumentHint:e.argumentHint,tools:e.tools,model:e.model,userInvocable:e.userInvocable,disableModelInvocation:e.disableModelInvocation,enabled:e.enabled})}toInstruction(e){return Object.freeze({uri:y.revive(e.uri),name:e.name,description:e.description,source:e.source,extensionId:e.extensionId,pluginUri:e.pluginUri?y.revive(e.pluginUri):void 0,sessionTypes:e.sessionTypes,pattern:e.pattern})}toSkill(e){return Object.freeze({uri:y.revive(e.uri),name:e.name,description:e.description,source:e.source,extensionId:e.extensionId,pluginUri:e.pluginUri?y.revive(e.pluginUri):void 0,sessionTypes:e.sessionTypes,userInvocable:e.userInvocable,disableModelInvocation:e.disableModelInvocation})}toSlashCommand(e){return Object.freeze({uri:y.revive(e.uri),name:e.name,description:e.description,source:e.source,extensionId:e.extensionId,pluginUri:e.pluginUri?y.revive(e.pluginUri):void 0,sessionTypes:e.sessionTypes,argumentHint:e.argumentHint,userInvocable:e.userInvocable})}toHook(e){return Object.freeze({uri:y.revive(e.uri),sessionTypes:e.sessionTypes,source:e.source,extensionId:e.extensionId,pluginUri:e.pluginUri?y.revive(e.pluginUri):void 0})}toPlugin(e){return Object.freeze({uri:y.revive(e.uri)})}provideCustomAgents(e){return this._customAgents.get(e)}provideInstructions(e){return this._instructions.get(e)}provideSkills(e){return this._skills.get(e)}provideSlashCommands(e){return this._slashCommands.get(e)}provideHooks(e){return this._hooks.get(e)}providePlugins(e){return this._plugins.get(e)}$onDidChangeCustomAgents(){this._customAgents.clear(),this._onDidChangeCustomAgents.fire()}$onDidChangeInstructions(){this._instructions.clear(),this._onDidChangeInstructions.fire()}$onDidChangeSkills(){this._skills.clear(),this._onDidChangeSkills.fire()}$onDidChangeSlashCommands(){this._slashCommands.clear(),this._onDidChangeSlashCommands.fire()}$onDidChangeHooks(){this._hooks.clear(),this._onDidChangeHooks.fire()}$onDidChangePlugins(){this._plugins.clear(),this._onDidChangePlugins.fire()}async transferActiveChat(e){await this._proxy.$transferActiveChatSession(e)}createChatAgent(e,n,o){let r=i._idPool++,s=new Lk(e,n,this._proxy,r,o);return this._agents.set(r,s),this._proxy.$registerAgent(r,e.identifier,n,{},void 0),s.apiAgent}createDynamicChatAgent(e,n,o,r){let s=i._idPool++,a=new Lk(e,n,this._proxy,s,r);return this._agents.set(s,a),this._proxy.$registerAgent(s,e.identifier,n,{isSticky:!0},o),a.apiAgent}registerChatParticipantDetectionProvider(e,n){let o=i._participantDetectionProviderIdPool++;return this._participantDetectionProviders.set(o,new BN(e,n)),this._proxy.$registerChatParticipantDetectionProvider(o),q(()=>{this._participantDetectionProviders.delete(o),this._proxy.$unregisterChatParticipantDetectionProvider(o)})}registerPromptFileProvider(e,n,o){let r=i._contributionsProviderIdPool++;this._promptFileProviders.set(r,{extension:e,provider:o}),this._proxy.$registerPromptFileProvider(r,n,e.identifier);let s=new $,a;switch(n){case"agent":a=o.onDidChangeCustomAgents;break;case"instructions":a=o.onDidChangeInstructions;break;case"prompt":a=o.onDidChangePromptFiles;break;case"skill":a=o.onDidChangeSkills;break;case"hook":a=o.onDidChangeHooks;break}return a&&s.add(a(()=>{this._proxy.$onDidChangePromptFiles(r)})),s.add(q(()=>{this._promptFileProviders.delete(r),this._proxy.$unregisterPromptFileProvider(r)})),s}async $providePromptFiles(e,n,o,r){let s=this._promptFileProviders.get(e);if(!s)return;let a=s.provider,l;switch(n){case"agent":l=await a.provideCustomAgents(o,r)??void 0;break;case"instructions":l=await a.provideInstructions(o,r)??void 0;break;case"prompt":l=await a.providePromptFiles(o,r)??void 0;break;case"skill":l=await a.provideSkills(o,r)??void 0;break;case"hook":l=await a.provideHooks(o,r)??void 0;break}return l}registerChatSessionCustomizationProvider(e,n,o,r){let s=i._customizationProviderIdPool++;this._customizationProviders.set(s,{extension:e,provider:r});let a={label:o.label,iconId:o.iconId,supportedTypes:o.supportedTypes?.map(d=>Tb.from(d))};this._proxy.$registerChatSessionCustomizationProvider(s,n,a,e.identifier);let l=new $;return r.onDidChange&&l.add(r.onDidChange(()=>{this._proxy.$onDidChangeCustomizations(s)})),l.add(q(()=>{this._customizationProviders.delete(s),this._proxy.$unregisterChatSessionCustomizationProvider(s)})),l}async $provideChatSessionCustomizations(e,n,o){let r=this._customizationProviders.get(e);if(r&&n)try{let s=await r.provider.provideChatSessionCustomizations(y.revive(n),o);return s?s.map(a=>({uri:a.uri,type:Tb.from(a.type),name:a.name,description:a.description,source:a.source,groupKey:a.groupKey,badge:a.badge,badgeTooltip:a.badgeTooltip,extensionId:a.extensionId,pluginUri:a.pluginUri,pluginLabel:a.pluginLabel,userInvocable:a.userInvocable})):void 0}catch{return}}async $provideSourceFolders(e,n,o,r){let s=this._customizationProviders.get(e);if(s?.provider.provideSourceFolders)try{let a=await s.provider.provideSourceFolders(y.revive(n),Tb.to(o),r);return a?a.map(l=>({uri:l.uri,label:l.label,source:l.source})):void 0}catch{return}}async $detectChatParticipant(e,n,o,r,s){let a=this._participantDetectionProviders.get(e);if(!a)return;let{request:l,location:d,history:c}=await this._createRequest(n,o,a.extension),u=await this.getModelForRequest(l,a.extension),m=await this.getToolsForRequest(a.extension,l.userSelectedTools,u.id,s),g=Wg.to(l,d,u,l.modelConfiguration,this.getDiagnosticsWhenEnabled(a.extension),m,a.extension,this._logService);return a.provider.provideParticipantDetection(g,{history:c,yieldRequested:!1},{participants:r.participants,location:Vg.to(r.location)},s)}async _createRequest(e,n,o){let r=Tt(e),s=await this.prepareHistoryTurns(o,r.agentId,n),a;if(r.locationData?.type==="editor"){let l=this._documents.getDocument(r.locationData.document),d=this._editorsAndDocuments.getEditor(r.locationData.id);a=new Eg(d.value,l,Do.to(r.locationData.selection),K.to(r.locationData.wholeRange))}else if(r.locationData?.type==="notebook"){let l=this._documents.getDocument(r.locationData.sessionInputUri);a=new wg(l)}else r.locationData?.type,"terminal";return{request:r,location:a,history:s}}async getModelForRequest(e,n){let o;if(e.userSelectedModelId&&(o=await this._languageModels.getLanguageModelByIdentifier(n,e.userSelectedModelId)),!o&&(o=await this._languageModels.getDefaultLanguageModel(n),!o))throw new Error("Language model unavailable");return o}async $setRequestTools(e,n){let o=[...this._inFlightRequests].find(s=>s.requestId===e);if(!o)return;o.extRequest.tools.clear();let r=await this.getToolsForRequest(o.extension,n,o.extRequest.model.id,pe.None);for(let[s,a]of r)o.extRequest.tools.set(s,a);this._onDidChangeChatRequestTools.fire(o.extRequest)}$setYieldRequested(e,n){let o=[...this._inFlightRequests].find(r=>r.requestId===e);o&&(o.yieldRequested=n)}async $invokeAgent(e,n,o,r){let s=this._agents.get(e);if(!s)throw new Error(`[CHAT](${e}) CANNOT invoke agent because the agent is not registered`);let a,l;try{let{request:d,location:c,history:u}=await this._createRequest(n,o,s.extension),m=this._sessionDisposables.get(d.sessionResource);m||(m=new $,this._sessionDisposables.set(d.sessionResource,m)),a=new ah(s.extension,d,this._proxy,this._commands.converter,m,this._pendingCarouselResolvers,r);let g=await this.getModelForRequest(d,s.extension),h=await this.getToolsForRequest(s.extension,d.userSelectedTools,g.id,r),f=Wg.to(d,c,g,d.modelConfiguration,this.getDiagnosticsWhenEnabled(s.extension),h,s.extension,this._logService);l={requestId:n.requestId,extRequest:f,extension:s.extension,hooks:d.hooks,yieldRequested:!1},this._inFlightRequests.add(l);let I;if(o.chatSessionContext){let w=y.revive(o.chatSessionContext.chatSessionResource),R=await this._chatSessions.getInputStateForSession(w,o.chatSessionContext.initialSessionOptions,r);I={chatSessionItem:{resource:w,label:o.chatSessionContext.isUntitled?"Untitled Session":"Session"},isUntitled:o.chatSessionContext.isUntitled,initialSessionOptions:o.chatSessionContext.initialSessionOptions,inputState:R}}let x={history:u,chatSessionContext:I,get yieldRequested(){return l?.yieldRequested??!1}},E=s.invoke(f,x,a.apiObject,r);return await wX(1e3,Promise.resolve(E).then(w=>{if(w?.metadata)try{JSON.stringify(w.metadata)}catch(L){let U=`result.metadata MUST be JSON.stringify-able. Got error: ${L.message}`;return this._logService.error(`[${s.extension.identifier.value}] [@${s.id}] ${U}`,s.extension),{errorDetails:{message:U},timings:a?.timings,nextQuestion:w.nextQuestion}}let R;return w?.errorDetails&&(R={...w.errorDetails,responseIsIncomplete:!0}),(R?.responseIsRedacted||R?.isQuotaExceeded||R?.isRateLimited||R?.isExpectedError||R?.confirmationButtons||R?.code)&&M(s.extension,"chatParticipantPrivate"),{errorDetails:R,timings:a?.timings,metadata:w?.metadata,nextQuestion:w?.nextQuestion,details:w?.details}}),r)}catch(d){this._logService.error(d,s.extension),d instanceof Ar&&d.cause&&(d=d.cause);let c=d instanceof Error&&d.name==="ChatQuotaExceeded",u=d instanceof Error&&d.name==="ChatRateLimited",m=d instanceof Error&&d.name==="ChatExpectedError",{callstack:g}=VN(d),h=d instanceof Error?d.name:void 0;return{errorDetails:{message:To(d),responseIsIncomplete:!0,isQuotaExceeded:c,isRateLimited:u,isExpectedError:m},errorCallstack:g,errorName:h}}finally{l&&this._inFlightRequests.delete(l);let d=this._pendingCarouselResolvers.get(n.requestId);if(d){for(let c of d.values())c.complete(void 0);this._pendingCarouselResolvers.delete(n.requestId)}a?.close()}}getDiagnosticsWhenEnabled(e){return Le(e,"chatReferenceDiagnostic")?this._diagnostics.getDiagnostics():[]}async getToolsForRequest(e,n,o,r){if(!n)return new Map;let s=new Map;for(let a of this._tools.getTools(e))typeof n[a.name]=="boolean"&&s.set(a,n[a.name]);return s}async prepareHistoryTurns(e,n,o){let r=[];for(let s of o.history){let a=Bg.to(s.result),l=n===s.request.agentId||Qz(s.request.agentId)&&Qz(n)?a:{...a,metadata:void 0},d=[],c=[];for(let f of s.request.variables.variables)f.kind==="tool"?c.push(Gu.to(f)):f.kind==="toolset"?c.push(...f.value.map(Gu.to)):d.push(...cw.toReferences(f,this.getDiagnosticsWhenEnabled(e),this._logService));let u=Le(e,"chatParticipantPrivate")?s.request.editedFileEvents:void 0,m=Le(e,"chatParticipantPrivate")&&s.request.modeInstructions?Xu.to(s.request.modeInstructions):void 0,g=new Ys(s.request.message,s.request.command,d,s.request.agentId,c,u,s.request.requestId,void 0,m);r.push(g);let h=nt(s.response.map(f=>Hg.toContent(f,this._commands.converter)));r.push(new yg(h,l,s.request.agentId,s.request.command))}return r}$releaseSession(e){let n=y.revive(e);this._sessionDisposables.deleteAndDispose(n);let o=Hr.parseLocalSessionId(n);o&&this._onDidDisposeChatSession.fire(o)}$acceptActiveChatSession(e){let n=e?y.revive(e):void 0;this._activeChatPanelSessionResource?.toString()!==n?.toString()&&(this._activeChatPanelSessionResource=n,this._onDidChangeActiveChatPanelSessionResource.fire(n))}async $provideFollowups(e,n,o,r,s){let a=this._agents.get(n);if(!a)return Promise.resolve([]);let l=Tt(e),d=await this.prepareHistoryTurns(a.extension,a.id,r),c=Bg.to(o);return(await a.provideFollowups(c,{history:d,yieldRequested:!1},s)).filter(u=>{let m=!u.participant||Mt.some(this._agents.values(),g=>g.id===u.participant&&xe.equals(g.extension.identifier,a.extension.identifier));return m||this._logService.warn(`[@${a.id}] ChatFollowup refers to an unknown participant: ${u.participant}`),m}).map(u=>GE.from(u,l))}$acceptFeedback(e,n,o){let r=this._agents.get(e);if(!r)return;let s=Bg.to(n),a;switch(o.direction){case 0:a=0;break;case 1:a=1;break}let l={result:s,kind:a};r.acceptFeedback(Object.freeze(l))}$handleQuestionCarouselAnswer(e,n,o){let r=this._pendingCarouselResolvers.get(e);if(!r)return;let s=r.get(n);s&&(s.complete(o),r.delete(n)),r.size===0&&this._pendingCarouselResolvers.delete(e)}$acceptAction(e,n,o){let r=this._agents.get(e);if(!r||o.action.kind==="vote")return;let s=PL.to(n,o,this._commands.converter);s&&r.acceptAction(Object.freeze(s))}async $invokeCompletionProvider(e,n,o){let r=this._agents.get(e);if(!r)return[];let s=this._completionDisposables.get(e);return s?s.clear():(s=new $,this._completionDisposables.set(e,s)),(await r.invokeCompletionProvider(n,o)).map(l=>kL.from(l,this._commands.converter,s))}async $provideChatTitle(e,n,o){let r=this._agents.get(e);if(!r)return;let s=await this.prepareHistoryTurns(r.extension,r.id,{history:n}),a=n[0]?.request.sessionResource?y.revive(n[0].request.sessionResource):void 0;return await r.provideTitle({history:s,sessionResource:a,yieldRequested:!1},o)}async $provideChatSummary(e,n,o){let r=this._agents.get(e);if(!r)return;let s=await this.prepareHistoryTurns(r.extension,r.id,{history:n}),a=n[0]?.request.sessionResource?y.revive(n[0].request.sessionResource):void 0;return await r.provideSummary({history:s,sessionResource:a,yieldRequested:!1},o)}},BN=class{constructor(t,e){this.extension=t;this.provider=e}},Lk=class{constructor(t,e,n,o,r){this.extension=t;this.id=e;this._proxy=n;this._handle=o;this._requestHandler=r;this._onDidReceiveFeedback=new T;this._onDidPerformAction=new T;this._pauseStateEmitter=new T}acceptFeedback(t){this._onDidReceiveFeedback.fire(t)}acceptAction(t){this._onDidPerformAction.fire(t)}setChatRequestPauseState(t){this._pauseStateEmitter.fire(t)}async invokeCompletionProvider(t,e){return this._agentVariableProvider?await this._agentVariableProvider.provider.provideCompletionItems(t,e)??[]:[]}async provideFollowups(t,e,n){if(!this._followupProvider)return[];let o=await this._followupProvider.provideFollowups(t,e,n);return o?o.filter(r=>!(r&&"commandId"in r)).filter(r=>!(r&&"message"in r)):[]}async provideTitle(t,e){if(this._titleProvider)return await this._titleProvider.provideChatTitle(t,e)??void 0}async provideSummary(t,e){if(this._summarizer)return await this._summarizer.provideChatSummary(t,e)??void 0}get apiAgent(){let t=!1,e=!1,n=()=>{t||e||(e=!0,queueMicrotask(()=>{this._proxy.$updateAgent(this._handle,{icon:this._iconPath?this._iconPath instanceof y?this._iconPath:"light"in this._iconPath?this._iconPath.light:void 0:void 0,iconDark:this._iconPath&&"dark"in this._iconPath?this._iconPath.dark:void 0,themeIcon:this._iconPath instanceof fn?this._iconPath:void 0,hasFollowups:this._followupProvider!==void 0,helpTextPrefix:!this._helpTextPrefix||typeof this._helpTextPrefix=="string"?this._helpTextPrefix:fe.from(this._helpTextPrefix),helpTextPostfix:!this._helpTextPostfix||typeof this._helpTextPostfix=="string"?this._helpTextPostfix:fe.from(this._helpTextPostfix),supportIssueReporting:this._supportIssueReporting,additionalWelcomeMessage:!this._additionalWelcomeMessage||typeof this._additionalWelcomeMessage=="string"?this._additionalWelcomeMessage:fe.from(this._additionalWelcomeMessage)}),e=!1}))},o=this;return{get id(){return o.id},get iconPath(){return o._iconPath},set iconPath(r){o._iconPath=r,n()},get requestHandler(){return o._requestHandler},set requestHandler(r){Lp(typeof r=="function","Invalid request handler"),o._requestHandler=r},get followupProvider(){return o._followupProvider},set followupProvider(r){o._followupProvider=r,n()},get helpTextPrefix(){return M(o.extension,"defaultChatParticipant"),o._helpTextPrefix},set helpTextPrefix(r){M(o.extension,"defaultChatParticipant"),o._helpTextPrefix=r,n()},get helpTextPostfix(){return M(o.extension,"defaultChatParticipant"),o._helpTextPostfix},set helpTextPostfix(r){M(o.extension,"defaultChatParticipant"),o._helpTextPostfix=r,n()},get supportIssueReporting(){return M(o.extension,"chatParticipantPrivate"),o._supportIssueReporting},set supportIssueReporting(r){M(o.extension,"chatParticipantPrivate"),o._supportIssueReporting=r,n()},get onDidReceiveFeedback(){return o._onDidReceiveFeedback.event},set participantVariableProvider(r){if(M(o.extension,"chatParticipantAdditions"),o._agentVariableProvider=r,r){if(!r.triggerCharacters.length)throw new Error("triggerCharacters are required");o._proxy.$registerAgentCompletionsProvider(o._handle,o.id,r.triggerCharacters)}else o._proxy.$unregisterAgentCompletionsProvider(o._handle,o.id)},get participantVariableProvider(){return M(o.extension,"chatParticipantAdditions"),o._agentVariableProvider},set additionalWelcomeMessage(r){M(o.extension,"defaultChatParticipant"),o._additionalWelcomeMessage=r,n()},get additionalWelcomeMessage(){return M(o.extension,"defaultChatParticipant"),o._additionalWelcomeMessage},set titleProvider(r){M(o.extension,"defaultChatParticipant"),o._titleProvider=r,n()},get titleProvider(){return M(o.extension,"defaultChatParticipant"),o._titleProvider},set summarizer(r){M(o.extension,"defaultChatParticipant"),o._summarizer=r},get summarizer(){return M(o.extension,"defaultChatParticipant"),o._summarizer},get onDidChangePauseState(){return M(o.extension,"chatParticipantAdditions"),o._pauseStateEmitter.event},onDidPerformAction:Le(this.extension,"chatParticipantAdditions")?this._onDidPerformAction.event:void 0,dispose(){t=!0,o._followupProvider=void 0,o._onDidReceiveFeedback.dispose(),o._onDidPerformAction.dispose(),o._pauseStateEmitter.dispose(),o._proxy.$unregisterAgent(o._handle)}}}invoke(t,e,n,o){return this._requestHandler(t,e,n,o)}};function wX(i,t,e){return new Promise((n,o)=>{let r=e.onCancellationRequested(async()=>{r.dispose(),await Vt(i),n(void 0)});t.then(n,o).finally(()=>r.dispose())})}var bc=class{constructor(t){this.computeFn=t}get(t){if(!this.cachedPromise){let e=this.computeFn().catch(n=>{throw this.cachedPromise===e&&(this.cachedPromise=void 0),n});this.cachedPromise=e}return ri(this.cachedPromise,t)}clear(){this.cachedPromise=void 0}};function Qz(i){return i.startsWith("github.copilot")}var Nk=class{constructor(t,e){this.webviews=e;this._renderers=new Map;this._proxy=t.getProxy(F.MainThreadChatOutputRenderer)}registerChatOutputRenderer(t,e,n){if(this._renderers.has(e))throw new Error(`Chat output renderer already registered for: ${e}`);return this._renderers.set(e,{extension:t,renderer:n}),this._proxy.$registerChatOutputRenderer(e,t.identifier,t.extensionLocation),new Se(()=>{this._renderers.delete(e),this._proxy.$unregisterChatOutputRenderer(e)})}async $renderChatOutput(t,e,n,o,r,s){let a=this._renderers.get(t);if(!a)throw new Error(`No chat output renderer registered for: ${t}`);let l=this.webviews.createNewWebview(o,{},a.extension),d=Object.freeze({webview:l,onDidDispose:l._onDidDispose});return a.renderer.renderChatOutput(Object.freeze({mime:e,value:n.buffer}),d,Object.freeze(r),s)}};var Sl=class{constructor(t,e){this.#n=new T;this.onDidChange=this.#n.event;this.#o=new T;this.onDidDispose=this.#o.event;this.#e=t,this.#t=e}#e;#t;#n;#o;#s;get sessionResource(){return this.#s}set sessionResource(t){this.#s=t}#r;get untitledSessionResource(){return this.#r}set untitledSessionResource(t){this.#r=t}get groups(){return this.#e}set groups(t){this.#e=t,this.#t?.()}_fireDidChange(){this.#n.fire()}_setGroups(t){this.#e=t}_dispose(){this.#o.fire(),this.#o.dispose(),this.#n.dispose()}},$N=class{#e;#t;#n;#o;#s;#r;#l;#a;#d;#c;#i;constructor(t,e,n){this.resource=t,this.#e=e,this.#i=n}get label(){return this.#e}set label(t){this.#e!==t&&(this.#e=t,this.#i())}get iconPath(){return this.#t}set iconPath(t){this.#t!==t&&(this.#t=t,this.#i())}get description(){return this.#n}set description(t){this.#n!==t&&(this.#n=t,this.#i())}get badge(){return this.#o}set badge(t){this.#o!==t&&(this.#o=t,this.#i())}get status(){return this.#s}set status(t){this.#s!==t&&(this.#s=t,this.#i())}get archived(){return this.#r}set archived(t){this.#r!==t&&(this.#r=t,this.#i())}get tooltip(){return this.#l}set tooltip(t){this.#l!==t&&(this.#l=t,this.#i())}get timing(){return this.#a}set timing(t){this.#a!==t&&(this.#a=t,this.#i())}get changes(){return this.#d}set changes(t){this.#d!==t&&(this.#d=t,this.#i())}get metadata(){return this.#c}set metadata(t){if(t!==void 0)try{JSON.stringify(t)}catch{throw new Error("metadata must be JSON-serializable")}Et(this.#c,t)||(this.#c=t,this.#i())}};function PX(i,t){let e={addedOrUpdated:new Ve,removed:new Lr};for(let[n,o]of t)i.get(n)!==o&&e.addedOrUpdated.set(n,o);for(let n of i.keys())t.has(n)||e.removed.add(n);return e}function _X(i){return{addedOrUpdated:i.addedOrUpdated?Array.from(i.addedOrUpdated.values(),vl.from):[],removed:i.removed?Array.from(i.removed.keys()):[]}}var Uk=class{#e=new Ve;#t;#n;constructor(t,e){this.#t=e,this.#n=t}get size(){return this.#e.size}replace(t){if(!t.length&&!this.#e.size)return;let e=new Ve(t.map(o=>[o.resource,o])),n=PX(this.#e,e);!n.addedOrUpdated?.size&&!n.removed?.size||(this.#e=e,this.#t.$updateChatSessionItems(this.#n,_X(n)))}forEach(t,e){for(let[n,o]of this.#e)t.call(e,o,this)}add(t){let e=this.#e.get(t.resource);e&&e===t||(this.#e.set(t.resource,t),this.#t.$addOrUpdateChatSessionItem(this.#n,vl.from(t)))}delete(t){this.#e.delete(t)&&this.#t.$updateChatSessionItems(this.#n,{addedOrUpdated:[],removed:[t]})}get(t){return this.#e.get(t)}[Symbol.iterator](){return this.#e.entries()}},zN=class{constructor(t,e,n,o,r,s){this.session=t;this.extension=e;this.proxy=o;this.commandsConverter=r;this.sessionDisposables=s;this._pendingCarouselResolvers=new Map;this._stream=new ah(e,n,o,r,s,this._pendingCarouselResolvers,pe.None)}get activeResponseStream(){return this._stream}getActiveRequestStream(t){return new ah(this.extension,t,this.proxy,this.commandsConverter,this.sessionDisposables,this._pendingCarouselResolvers,pe.None)}},lh=class extends N{constructor(e,n,o,r){super();this.commands=e;this._languageModels=n;this._extHostRpc=o;this._logService=r;this._itemControllerHandlePool=0;this._chatSessionItemControllers=new Map;this._contentProviderHandlePool=0;this._chatSessionContentProviders=new Map;this._extHostChatSessions=new Ve;this._proxyCommands=new Map;this._proxy=this._extHostRpc.getProxy(F.MainThreadChatSessions),e.registerArgumentProcessor({processArgument:s=>{if(s&&s.$mid===25){let a=s.session.resource;for(let{controller:l}of this._chatSessionItemControllers.values()){let d=l.items.get(a);if(d)return d}return this._logService.warn(`No chat session found with uri: ${a}`),s}return s}})}registerChatSessionItemProvider(e,n,o){let r=this._itemControllerHandlePool++,s=new $,a=s.add(new T),l=new Uk(r,this._proxy),d={id:n,items:l,createChatSessionItem:(u,m)=>{throw new Error("Not implemented for providers")},createChatSessionInputState:u=>new Sl([]),onDidChangeChatSessionItemState:a.event,newChatSessionItemHandler:void 0,resolveChatSessionItem:o.resolveChatSessionItem?async(u,m)=>{let g=await o.resolveChatSessionItem(u,m);g&&l.add(g)}:void 0,dispose:()=>{s.dispose()},refreshHandler:async u=>{let m=await o.provideChatSessionItems(u)??[];l.replace(m)}};return this._chatSessionItemControllers.set(r,{chatSessionType:n,controller:d,extension:e,disposable:s,onDidChangeChatSessionItemStateEmitter:a,inputStates:new Set}),this._proxy.$registerChatSessionItemController(r,n,!!o.resolveChatSessionItem),o.onDidChangeChatSessionItems&&s.add(o.onDidChangeChatSessionItems(()=>{this._logService.trace(`ExtHostChatSessions. Provider items changed for ${n}`),d.refreshHandler(pe.None)})),o.onDidCommitChatSessionItem&&s.add(o.onDidCommitChatSessionItem(u=>{let{original:m,modified:g}=u;this._proxy.$onDidCommitChatSessionItem(r,m.resource,g.resource)})),Object.assign({dispose:()=>{this._chatSessionItemControllers.delete(r),s.dispose(),this._proxy.$unregisterChatSessionItemController(r)}},{onDidChangeChatSessionItemState:a.event})}createChatSessionItemController(e,n,o){let r=this._itemControllerHandlePool++,s=new $,a=!1,l,d,c,u,m=s.add(new T),g=new Set,h=new Uk(r,this._proxy),f=this._proxy,I=Object.freeze({id:n,refreshHandler:async x=>{if(a)throw new Error("ChatSessionItemController has been disposed");this._logService.trace(`ExtHostChatSessions. Controller(${n}).refresh()`),await o(x)},items:h,onDidChangeChatSessionItemState:m.event,createChatSessionItem:(x,E)=>{if(a)throw new Error("ChatSessionItemController has been disposed");let w=new $N(x,E,()=>{h.get(x)===w&&this._proxy.$addOrUpdateChatSessionItem(r,vl.from(w))});return w},get newChatSessionItemHandler(){return l},set newChatSessionItemHandler(x){l=x},get forkHandler(){return d},set forkHandler(x){d=x},get resolveChatSessionItem(){return c},set resolveChatSessionItem(x){let E=!!c;c=x;let w=!!x;E!==w&&!a&&f.$updateChatSessionItemControllerCapabilities(r,w)},get getChatSessionInputState(){return u},set getChatSessionInputState(x){u=x},createChatSessionInputState:x=>{if(a)throw new Error("ChatSessionItemController has been disposed");let E=new Sl(x,()=>{let w=this._chatSessionItemControllers.get(r);w&&(w.optionGroups=E.groups);let L=this._wrapOptionGroupCommands(r,E.groups).map(z=>({id:z.id,name:z.name,description:z.description,items:z.items,selected:z.selected,when:z.when,icon:z.icon,commands:z.commands,kind:z.kind})),U=E.sessionResource??E.untitledSessionResource;U&&this._proxy.$updateChatSessionInputState(r,U,L)});return g.add(E),E},dispose:()=>{a=!0;for(let x of g)x._dispose();g.clear(),s.dispose()}});return this._chatSessionItemControllers.set(r,{controller:I,extension:e,disposable:s,chatSessionType:n,onDidChangeChatSessionItemStateEmitter:m,inputStates:g}),this._proxy.$registerChatSessionItemController(r,n,!!c),s.add(q(()=>{this._chatSessionItemControllers.delete(r),this._proxy.$unregisterChatSessionItemController(r)})),I}registerChatSessionContentProvider(e,n,o,r,s){let a=this._contentProviderHandlePool++,l=new $;return this._chatSessionContentProviders.set(a,{chatSessionScheme:n,provider:r,extension:e,capabilities:s,disposable:l}),this._proxy.$registerChatSessionContentProvider(a,n),r.onDidChangeChatSessionOptions&&l.add(r.onDidChangeChatSessionOptions(d=>{let c=Object.create(null);for(let u of d.updates)c[u.optionId]=u.value;this._proxy.$onDidChangeChatSessionOptions(a,d.resource,c)})),r.onDidChangeChatSessionProviderOptions&&l.add(r.onDidChangeChatSessionProviderOptions(()=>{this._proxy.$onDidChangeChatSessionProviderOptions(a)})),new Se(()=>{this._chatSessionContentProviders.delete(a),l.dispose(),this._proxy.$unregisterChatSessionContentProvider(a)})}async $provideChatSessionContent(e,n,o,r){let s=this._chatSessionContentProviders.get(e);if(!s)throw new Error(`No provider for handle ${e}`);let a=y.revive(n),l=this.getChatSessionItemController(ou(a)),d;if(l?.controller.getChatSessionInputState){let I=await l.controller.getChatSessionInputState(ru(a)?void 0:a,{previousInputState:this._createInputStateFromOptions(l.optionGroups??[],o.initialSessionOptions)},r);I&&(d=I)}d??=this._createInputStateFromOptions(l?.optionGroups??[],o.initialSessionOptions),d instanceof Sl&&(l&&this._disposeInputStatesForResource(l.inputStates,a),ru(a)?d.untitledSessionResource=a:d.sessionResource=a);let c=await s.provider.provideChatSessionContent(a,r,{inputState:d});if(r.isCancellationRequested)throw new Oe;let u=new $,m=a.toString(),g=new zN(c,s.extension,{sessionResource:a,requestId:"ongoing",agentId:m,message:"",variables:{variables:[]},location:"panel"},{$handleProgressChunk:(I,x)=>this._proxy.$handleProgressChunk(e,a,I,x),$handleAnchorResolve:(I,x,E)=>{this._proxy.$handleAnchorResolve(e,a,I,x,E)}},this.commands.converter,u),h=u.add(new Ee);this._extHostChatSessions.set(a,{sessionObj:g,disposeCts:h}),c.activeResponseCallback&&Promise.resolve(c.activeResponseCallback(g.activeResponseStream.apiObject,h.token)).finally(()=>{this._proxy.$handleProgressComplete(e,a,"ongoing")});let{capabilities:f}=s;return{resource:y.revive(a),title:c.title,hasActiveResponseCallback:!!c.activeResponseCallback,hasRequestHandler:!!c.requestHandler,hasForkHandler:!!l?.controller.forkHandler||!!c.forkHandler,supportsInterruption:!!f?.supportsInterruptions,options:c.options,history:c.history.map(I=>I instanceof Ys?this.convertRequestTurn(I):this.convertResponseTurn(I,u))}}async $provideHandleOptionsChange(e,n,o,r){let s=y.revive(n),a=this._chatSessionContentProviders.get(e);if(!a){this._logService.warn(`No provider for handle ${e}`);return}if(a.provider.provideHandleOptionsChange){try{let c=Object.entries(o).map(([u,m])=>({optionId:u,value:m===void 0?void 0:typeof m=="string"?m:m.id}));a.provider.provideHandleOptionsChange(s,c,r)}catch(c){this._logService.error(`Error calling provideHandleOptionsChange for handle ${e}, sessionResource ${s}:`,c)}return}let l=ou(s),d=this.getChatSessionItemController(l);if(!d||!d.controller.getChatSessionInputState){this._logService.warn(`No valid controller found for session type ${l}`);return}for(let c of d?.inputStates??[]){let u=c.groups.map(m=>{let g=o[m.id];if(!g)return m;let h=typeof g=="string"?g:g.id,f=m.items.find(I=>I.id===h);return f?{...m,selected:f}:m});c._setGroups(u),c._fireDidChange()}}async $provideChatSessionProviderOptions(e,n){let o=this._chatSessionContentProviders.get(e);if(!o){this._logService.warn(`No provider for handle ${e} when requesting chat session options`);return}let r=o.provider;if(r.provideChatSessionProviderOptions)try{let s=await r.provideChatSessionProviderOptions(n);if(!s)return;let{optionGroups:a,newSessionOptions:l}=s;if(a){let d=this.getChatSessionItemController(o.chatSessionScheme);d&&(d.optionGroups=a)}return{optionGroups:a,newSessionOptions:l}}catch(s){this._logService.error(`Error calling provideChatSessionProviderOptions for handle ${e}:`,s);return}}async $interruptChatSessionActiveResponse(e,n,o){this._extHostChatSessions.get(y.revive(n))?.disposeCts.cancel()}async $disposeChatSessionContent(e,n){let o=y.revive(n),r=this._extHostChatSessions.get(o);if(!r){this._logService.warn(`No chat session found for resource: ${n}`);return}let s=this.getChatSessionItemController(o.scheme);s&&this._disposeInputStatesForResource(s.inputStates,o),r.disposeCts.cancel(),r.sessionObj.sessionDisposables.dispose(),this._extHostChatSessions.delete(o)}async $invokeChatSessionRequestHandler(e,n,o,r,s){let a=this._extHostChatSessions.get(y.revive(n));if(!a||!a.sessionObj.session.requestHandler)return{};let l=Wg.to(o,void 0,await this.getModelForRequest(o,a.sessionObj.extension),o.modelConfiguration,[],new Map,a.sessionObj.extension,this._logService),d=a.sessionObj.getActiveRequestStream(o);return await a.sessionObj.session.requestHandler(l,{history:r,yieldRequested:!1},d.apiObject,s),{}}async $forkChatSession(e,n,o,r){let s=y.revive(n),a=this._extHostChatSessions.get(s);if(!a)throw new Error(`No chat session found for resource ${s.toString()}`);let l=this.convertRequestDtoToRequestTurn(o),d=this.getChatSessionItemController(ou(s));if(d?.controller.forkHandler){let u=await d.controller.forkHandler(s,l,r);return vl.from(u)}if(!a.sessionObj.session.forkHandler)throw new Error(`No fork handler for session ${s.toString()}`);let c=await a.sessionObj.session.forkHandler(s,l,r);return vl.from(c)}convertRequestDtoToRequestTurn(e){if(e)return new Ys(e.prompt,e.command,[],e.participant,[],void 0,e.id,e.modelId,Xu.to(e.modeInstructions))}getChatSessionItemController(e){for(let n of this._chatSessionItemControllers.values())if(n.chatSessionType===e)return n}_disposeInputStatesForResource(e,n){for(let o of e){let r=o.sessionResource??o.untitledSessionResource;r&&Sn(n,r)&&(o._dispose(),e.delete(o))}}_createInputStateFromOptions(e,n){if(!n?.length)return new Sl(e);let o=e.map(r=>{let s=n.find(l=>l.optionId===r.id);if(!s)return r;let a=r.items.find(l=>l.id===s.value);return a?{...r,selected:a}:r});return new Sl(o)}async getInputStateForSession(e,n,o){let r=e?ou(e):void 0,s=r?this.getChatSessionItemController(r):void 0,a=e&&!ru(e)?e:void 0;if(s?.controller.getChatSessionInputState){let d=await s.controller.getChatSessionInputState(a,{previousInputState:this._createInputStateFromOptions(s.optionGroups??[],n)},o);if(d)return d instanceof Sl&&(e&&s&&this._disposeInputStatesForResource(s.inputStates,e),e&&ru(e)?d.untitledSessionResource=e:e&&(d.sessionResource=a)),d}let l=this._createInputStateFromOptions(s?.optionGroups??[],n);return l.sessionResource=a,l}_wrapOptionGroupCommands(e,n){return this._chatSessionItemControllers.get(e)?.controller.getChatSessionInputState?n.map(r=>r.commands?.length?{...r,commands:r.commands.map(s=>{let a=`_chatSession.proxyCommand.${_e()}`;return this._proxyCommands.set(a,{originalCommandId:s.command,controllerHandle:e}),this.commands.registerCommand(!0,a,async(...l)=>{let d=l[0]instanceof y?l[0]:void 0,c=await this.getInputStateForSession(d,void 0,pe.None);return this.commands.executeCommand(s.command,{inputState:c,sessionResource:d},...s.arguments??[])}),{...s,command:a}})}:r):n}async getModelForRequest(e,n){let o;if(e.userSelectedModelId&&(o=await this._languageModels.getLanguageModelByIdentifier(n,e.userSelectedModelId)),!o&&(o=await this._languageModels.getDefaultLanguageModel(n),!o))throw new Error("Language model unavailable");return o}convertRequestTurn(e){let n=e.references.map(o=>this.convertReferenceToVariable(o));return{type:"request",id:e.id,prompt:e.prompt,participant:e.participant,command:e.command,variableData:n.length>0?{variables:n}:void 0,modelId:e.modelId,modeInstructions:Xu.from(e.modeInstructions2)}}convertReferenceToVariable(e){let n=e.value&&typeof e.value=="object"&&"uri"in e.value&&"range"in e.value?bi.from(e.value):e.value,o=e.range?{start:e.range[0],endExclusive:e.range[1]}:void 0;if(n&&n instanceof Kd&&Array.isArray(n.diagnostics)&&n.diagnostics.length&&n.diagnostics[0][1].length){let a=ml.from(n.diagnostics[0][1][0]),l={filterRange:{startLineNumber:a.startLineNumber,startColumn:a.startColumn,endLineNumber:a.endLineNumber,endColumn:a.endColumn},filterSeverity:a.severity,filterUri:n.diagnostics[0][0],problemMessage:n.diagnostics[0][1][0].message};return ly.toEntry(l)}if(rn.isLocation(e.value)&&e.name.startsWith("sym:")){let a=bi.from(e.value);return{id:e.id,name:e.name,fullName:e.name.substring(4),value:{uri:e.value.uri,range:a.range},symbolKind:6,icon:vM.toIcon(6),kind:"symbol",range:o}}if(y.isUri(n)&&e.name.startsWith("prompt:")){if(e.id.startsWith("vscode.instructions.file.root"))return ld(n,"vscode.instructions.file.root");if(e.id.startsWith("vscode.instructions.file.reference"))return ld(n,"vscode.instructions.file.reference");if(e.id.startsWith("vscode.prompt.file"))return ld(n,"vscode.prompt.file")}let r=y.isUri(n)||n&&typeof n=="object"&&"uri"in n,s=r&&y.isUri(n)&&n.path.endsWith("/");return{id:e.id,name:e.name,value:n,modelDescription:e.modelDescription,range:o,kind:s?"directory":r?"file":"generic"}}convertResponseTurn(e,n){return{type:"response",parts:nt(e.response.map(r=>Hg.from(r,this.commands.converter,n))),participant:e.participant,details:e.result?.details}}async $refreshChatSessionItems(e,n){let o=this._chatSessionItemControllers.get(e);if(!o){this._logService.warn(`No controller found for handle ${e}`);return}await o.controller.refreshHandler(n)}async $newChatSessionItem(e,n,o){let r=this._chatSessionItemControllers.get(e);if(!r){this._logService.warn(`No controller found for handle ${e}`);return}let s=r.controller.newChatSessionItemHandler;if(!s)return;let a=this._createInputStateFromOptions(r.optionGroups??[],n.initialSessionOptions),l;r.controller.getChatSessionInputState?l=await r.controller.getChatSessionInputState(void 0,{previousInputState:a},o):l=a;let d=await s({request:{prompt:n.prompt,command:n.command},inputState:l},o);if(d)return r.controller.items.add(d),vl.from(d)}$onDidChangeChatSessionItemState(e,n,o){let r=this._chatSessionItemControllers.get(e);if(!r){this._logService.warn(`No controller found for handle ${e}`);return}let s=y.revive(n),a=r.controller.items.get(s);if(!a){this._logService.warn(`No item found for session resource ${s.toString()}`);return}a.archived=o,r.onDidChangeChatSessionItemStateEmitter.fire(a)}async $resolveChatSessionItem(e,n,o){let r=y.revive(n),s=this._chatSessionItemControllers.get(e);if(!s?.controller.resolveChatSessionItem)return;let a=s.controller.items.get(r);if(!a){this._logService.warn(`No item found for session resource ${r.toString()}`);return}await s.controller.resolveChatSessionItem(a,o);let l=s.controller.items.get(r);if(l)return vl.from(l)}async $provideChatSessionInputState(e,n,o){let r=this._chatSessionItemControllers.get(e);if(!r){this._logService.warn(`No controller found for handle ${e}`);return}let s=r.controller.getChatSessionInputState;if(!s)return;let a=n?y.revive(n):void 0,l=await s(!a||ru(a)?void 0:a,{previousInputState:void 0},o);return l?(l instanceof Sl&&a&&(this._disposeInputStatesForResource(r.inputStates,a),ru(a)?l.untitledSessionResource=a:l.sessionResource=a),r.optionGroups=l.groups,this._wrapOptionGroupCommands(e,l.groups).map(c=>({id:c.id,name:c.name,description:c.description,items:c.items,selected:c.selected,when:c.when,icon:c.icon,commands:c.commands,kind:c.kind}))):void 0}};lh=_([S(2,le),S(3,te)],lh);var Fk=class{constructor(t){this._items=new Map;this._proxy=t.getProxy(F.MainThreadChatStatus)}createChatStatusItem(t,e){let n=RX(t.identifier,e);if(this._items.has(n))throw new Error(`Chat status item '${e}' already exists`);let o={id:n,title:"",description:"",detail:"",tooltip:void 0},r=!1,s=!1,a=()=>{if(r)throw new Error("Chat status item is disposed");s&&this._proxy.$setEntry(e,o)},l=Object.freeze({id:e,get title(){return o.title},set title(d){o.title=d,a()},get description(){return o.description},set description(d){o.description=d,a()},get detail(){return o.detail},set detail(d){o.detail=d,a()},get tooltip(){return o.tooltip},set tooltip(d){o.tooltip=d,a()},show:()=>{s=!0,a()},hide:()=>{s=!1,this._proxy.$disposeEntry(e)},dispose:()=>{r=!0,this._proxy.$disposeEntry(e),this._items.delete(n)}});return this._items.set(n,l),l}};function RX(i,t){return`${xe.toKey(i)}.${t}`}var Hk=class extends N{constructor(t){super(),this._proxy=t.getProxy(F.MainThreadChatQuota)}updateQuotas(t){this._proxy.$updateQuotas(t)}};var Wk=class{constructor(t){this._items=new Map;this._proxy=t.getProxy(F.MainThreadChatInputNotification)}createInputNotification(t,e){let n=DX(t.identifier,e);if(this._items.has(n))throw new Error(`Chat input notification '${e}' already exists`);let o={id:n,severity:0,message:"",description:void 0,actions:[],dismissible:!0,autoDismissOnMessage:!1,sessionTypes:void 0},r=!1,s=!1,a=()=>{if(r)throw new Error("Chat input notification is disposed");s&&this._proxy.$setNotification({...o})},l=Object.freeze({id:e,get severity(){return o.severity},set severity(d){o.severity=d,a()},get message(){return o.message},set message(d){o.message=d,a()},get description(){return o.description},set description(d){o.description=d,a()},get actions(){return o.actions},set actions(d){o.actions=d.map(c=>({label:c.label,commandId:c.commandId,commandArgs:c.commandArgs})),a()},get dismissible(){return o.dismissible},set dismissible(d){o.dismissible=d,a()},get autoDismissOnMessage(){return o.autoDismissOnMessage},set autoDismissOnMessage(d){o.autoDismissOnMessage=d,a()},get sessionTypes(){return o.sessionTypes},set sessionTypes(d){o.sessionTypes=d,a()},show:()=>{s=!0,a()},hide:()=>{r||(s=!1,this._proxy.$disposeNotification(n))},dispose:()=>{r||(r=!0,s=!1,this._proxy.$disposeNotification(n),this._items.delete(n))}});return this._items.set(n,l),l}};function DX(i,t){return`${xe.toKey(i)}.${t}`}var Vk=class{constructor(t){let e=t.getProxy(F.MainThreadClipboard);this.value=Object.freeze({readText(){return e.$readText()},writeText(n){return e.$writeText(n)}})}};var Jz="vscode-cdn.net",AX=`vscode-resource.${Jz}`,cI=`'self' https://*.${Jz}`;function Ic(i,t){return i.scheme===B.http||i.scheme===B.https?i:(t&&t.authority&&t.isRemote&&i.scheme===B.file&&(i=y.from({scheme:B.vscodeRemote,authority:t.authority,path:i.path})),y.from({scheme:B.https,authority:`${i.scheme}+${MX(i.authority)}.${AX}`,path:i.path,fragment:i.fragment,query:i.query}))}function MX(i){return i.replace(/./g,t=>{let e=t.charCodeAt(0);return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?t:"-"+e.toString(16).padStart(4,"0")})}var Bk=class{constructor(t,e,n){this._proxy=t;this._editors=e;this._remoteInfo=n;this._handlePool=0;this._disposables=new $;this._insets=new Map;this._disposables.add(e.onDidChangeVisibleTextEditors(()=>{let o=e.getVisibleTextEditors();for(let r of this._insets.values())o.indexOf(r.editor)<0&&r.inset.dispose()}))}dispose(){this._insets.forEach(t=>t.inset.dispose()),this._disposables.dispose()}createWebviewEditorInset(t,e,n,o,r){let s;for(let g of this._editors.getVisibleTextEditors(!0))if(g.value===t){s=g;break}if(!s)throw new Error("not a visible editor");let a=this,l=this._handlePool++,d=new T,c=new T,u=new class{constructor(){this._html="";this._options=Object.create(null)}asWebviewUri(g){return Ic(g,a._remoteInfo)}get cspSource(){return cI}set options(g){this._options=g,a._proxy.$setOptions(l,g)}get options(){return this._options}set html(g){this._html=g,a._proxy.$setHtml(l,g)}get html(){return this._html}get onDidReceiveMessage(){return d.event}postMessage(g){return a._proxy.$postMessage(l,g)}},m=new class{constructor(){this.editor=t;this.line=e;this.height=n;this.webview=u;this.onDidDispose=c.event}dispose(){a._insets.delete(l)&&(a._proxy.$disposeEditorInset(l),c.fire(),c.dispose(),d.dispose())}};return this._proxy.$createEditorInset(l,s.id,s.value.document.uri,e+1,n,o||{},r.identifier,r.extensionLocation),this._insets.set(l,{editor:t,inset:m,onDidReceiveMessage:d}),m}$onDidDispose(t){let e=this._insets.get(t);e&&e.inset.dispose()}$onDidReceiveMessage(t,e){this._insets.get(t)?.onDidReceiveMessage.fire(e)}};var $k=class i{constructor(t){this.providers=new Map;this._proxy=t.getProxy(F.MainThreadCodeMapper)}static{this._providerHandlePool=0}async $mapCode(t,e,n){let o=this.providers.get(t);if(!o)throw new Error(`Received request to map code for unknown provider handle ${t}`);let r={textEdit:(l,d)=>{d=On(d),this._proxy.$handleProgress(e.requestId,{uri:l,edits:d.map(Mn.from)})},notebookEdit:(l,d)=>{d=On(d),this._proxy.$handleProgress(e.requestId,{uri:l,edits:d.map(sw.from)})}},s={location:e.location,chatRequestId:e.chatRequestId,chatRequestModel:e.chatRequestModel,chatSessionId:e.chatSessionResource?Hr.parseLocalSessionId(y.revive(e.chatSessionResource)):void 0,codeBlocks:e.codeBlocks.map(l=>({code:l.code,resource:y.revive(l.resource),markdownBeforeBlock:l.markdownBeforeBlock}))};return await o.provideMappedEdits(s,r,n)??null}registerMappedEditsProvider(t,e){let n=i._providerHandlePool++;return this._proxy.$registerCodeMapperProvider(n,t.displayName??t.name),this.providers.set(n,e),{dispose:()=>this._proxy.$unregisterCodeMapperProvider(n)}}};function Yz(i,t,e){let n=i.getProxy(F.MainThreadComments);class o{constructor(){this._commentControllers=new Map;this._commentControllersByExtension=new vo;t.registerArgumentProcessor({processArgument:f=>{if(f&&f.$mid===6){let I=this._commentControllers.get(f.handle);return I?I.value:f}else if(f&&f.$mid===7){let I=f,x=this._commentControllers.get(I.commentControlHandle);if(!x)return I;let E=x.getCommentThread(I.commentThreadHandle);return E?E.value:I}else if(f&&(f.$mid===9||f.$mid===8)){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let x=I.getCommentThread(f.thread.commentThreadHandle);return x?f.$mid===8?x.value:{thread:x.value,text:f.text}:f}else if(f&&f.$mid===10){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let x=I.getCommentThread(f.thread.commentThreadHandle);if(!x)return f;let E=f.commentUniqueId,w=x.getCommentByUniqueId(E);return w||f}else if(f&&f.$mid===11){let I=this._commentControllers.get(f.thread.commentControlHandle);if(!I)return f;let x=I.getCommentThread(f.thread.commentThreadHandle);if(!x)return f;let E=f.text,w=f.commentUniqueId,R=x.getCommentByUniqueId(w);return R?(typeof R.body=="string"?R.body=E:R.body=new en(E),R):f}return f}})}static{this.handlePool=0}createCommentController(f,I,x){let E=o.handlePool++,w=new s(f,E,I,x);this._commentControllers.set(w.handle,w);let R=this._commentControllersByExtension.get(f.identifier)||[];return R.push(w),this._commentControllersByExtension.set(f.identifier,R),w.value}async $createCommentThreadTemplate(f,I,x,E){let w=this._commentControllers.get(f);w&&w.$createCommentThreadTemplate(I,x,E)}async $setActiveComment(f,I){let x=this._commentControllers.get(f);x&&x.$setActiveComment(I??void 0)}async $updateCommentThreadTemplate(f,I,x){let E=this._commentControllers.get(f);E&&E.$updateCommentThreadTemplate(I,x)}$deleteCommentThread(f,I){this._commentControllers.get(f)?.$deleteCommentThread(I)}async $updateCommentThread(f,I,x){this._commentControllers.get(f)?.$updateCommentThread(I,x)}async $provideCommentingRanges(f,I,x){let E=this._commentControllers.get(f);if(!E||!E.commentingRangeProvider)return Promise.resolve(void 0);let w=await e.ensureDocumentData(y.revive(I));return Cn(async()=>{let R=await E.commentingRangeProvider?.provideCommentingRanges(w.document,x),L;return Array.isArray(R)?L={ranges:R,fileComments:!1}:R?L={ranges:R.ranges||[],fileComments:R.enableFileComments||!1}:L=R??void 0,L}).then(R=>{let L;return R&&(L={ranges:R.ranges.map(U=>K.from(U)),fileComments:R.fileComments}),L})}$toggleReaction(f,I,x,E,w){let R=this._commentControllers.get(f);return!R||!R.reactionHandler?Promise.resolve(void 0):Cn(()=>{let L=R.getCommentThread(I);if(L){let U=L.getCommentByUniqueId(E.uniqueIdInThread);if(R!==void 0&&U&&R.reactionHandler)return R.reactionHandler(U,d(w))}return Promise.resolve(void 0)})}}let g=class g{constructor(f,I,x,E,w,R,L,U,z){this._commentControllerHandle=I;this._id=x;this._uri=E;this._range=w;this._comments=R;this.extensionDescription=L;this._isTemplate=U;this.handle=g._handlePool++;this.commentHandle=0;this.modifications=Object.create(null);this._onDidUpdateCommentThread=new T;this.onDidUpdateCommentThread=this._onDidUpdateCommentThread.event;this._canReply=!0;this._commentsMap=new Map;this._acceptInputDisposables=new tn;this._acceptInputDisposables.value=new $,this._id===void 0&&(this._id=`${f}.${this.handle}`),n.$createCommentThread(I,this.handle,this._id,this._uri,K.from(this._range),this._comments.map(j=>a(this,j,this._commentsMap,this.extensionDescription)),L.identifier,this._isTemplate,z),this._localDisposables=[],this._isDiposed=!1,this._localDisposables.push(this.onDidUpdateCommentThread(()=>{this.eventuallyUpdateCommentThread()})),this._localDisposables.push({dispose:()=>{n.$deleteCommentThread(I,this.handle)}});let Y=this;this.value={get uri(){return Y.uri},get range(){return Y.range},set range(j){Y.range=j},get comments(){return Y.comments},set comments(j){Y.comments=j},get collapsibleState(){return Y.collapsibleState},set collapsibleState(j){Y.collapsibleState=j},get canReply(){return Y.canReply},set canReply(j){Y.canReply=j},get contextValue(){return Y.contextValue},set contextValue(j){Y.contextValue=j},get label(){return Y.label},set label(j){Y.label=j},get state(){return Y.state},set state(j){Y.state=j},reveal:(j,Q)=>Y.reveal(j,Q),hide:()=>Y.hide(),dispose:()=>{Y.dispose()}}}static{this._handlePool=0}set threadId(f){this._id=f}get threadId(){return this._id}get id(){return this._id}get resource(){return this._uri}get uri(){return this._uri}set range(f){(f===void 0!=(this._range===void 0)||!f||!this._range||!f.isEqual(this._range))&&(this._range=f,this.modifications.range=f,this._onDidUpdateCommentThread.fire())}get range(){return this._range}set canReply(f){this._canReply!==f&&(this._canReply=f,this.modifications.canReply=f,this._onDidUpdateCommentThread.fire())}get canReply(){return this._canReply}get label(){return this._label}set label(f){this._label=f,this.modifications.label=f,this._onDidUpdateCommentThread.fire()}get contextValue(){return this._contextValue}set contextValue(f){this._contextValue=f,this.modifications.contextValue=f,this._onDidUpdateCommentThread.fire()}get comments(){return this._comments}set comments(f){this._comments=f,this.modifications.comments=f,this._onDidUpdateCommentThread.fire()}get collapsibleState(){return this._collapseState}set collapsibleState(f){this._collapseState!==f&&(this._collapseState=f,this.modifications.collapsibleState=f,this._onDidUpdateCommentThread.fire())}get state(){return this._state}set state(f){this._state=f,typeof f=="object"?(M(this.extensionDescription,"commentThreadApplicability"),this.modifications.state=f.resolved,this.modifications.applicability=f.applicability):this.modifications.state=f,this._onDidUpdateCommentThread.fire()}get isDisposed(){return this._isDiposed}updateIsTemplate(){this._isTemplate&&(this._isTemplate=!1,this.modifications.isTemplate=!1)}eventuallyUpdateCommentThread(){if(this._isDiposed)return;this.updateIsTemplate(),this._acceptInputDisposables.value||(this._acceptInputDisposables.value=new $);let f=x=>Object.prototype.hasOwnProperty.call(this.modifications,x),I={};f("range")&&(I.range=K.from(this._range)),f("label")&&(I.label=this.label),f("contextValue")&&(I.contextValue=this.contextValue??null),f("comments")&&(I.comments=this._comments.map(x=>a(this,x,this._commentsMap,this.extensionDescription))),f("collapsibleState")&&(I.collapseState=c(this._collapseState)),f("canReply")&&(I.canReply=this.canReply),f("state")&&(I.state=u(this._state)),f("applicability")&&(I.applicability=m(this._state)),f("isTemplate")&&(I.isTemplate=this._isTemplate),this.modifications={},n.$updateCommentThread(this._commentControllerHandle,this.handle,this._id,this._uri,I)}getCommentByUniqueId(f){for(let I of this._commentsMap){let x=I[0],E=I[1];if(f===E)return x}}async reveal(f,I){M(this.extensionDescription,"commentReveal");let x;f&&f.body!==void 0?x=f:I=I??f;let E=x?this._commentsMap.get(x):void 0;E??=this._commentsMap.get(this._comments[0]);let w=!0,R=!1;return I?.focus===1?(R=!0,w=!1):I?.focus===2&&(w=!1),n.$revealCommentThread(this._commentControllerHandle,this.handle,E,{preserveFocus:w,focusReply:R})}async hide(){return n.$hideCommentThread(this._commentControllerHandle,this.handle)}dispose(){this._isDiposed=!0,this._acceptInputDisposables.dispose(),this._onDidUpdateCommentThread.dispose(),this._localDisposables.forEach(f=>f.dispose())}};_([Hc(100)],g.prototype,"eventuallyUpdateCommentThread",1);let r=g;class s{constructor(f,I,x,E){this._extension=f;this._handle=I;this._id=x;this._label=E;this._threads=new Map;n.$registerCommentController(this.handle,x,E,this._extension.identifier.value);let w=this;this.value=Object.freeze({id:w.id,label:w.label,get options(){return w.options},set options(R){w.options=R},get commentingRangeProvider(){return w.commentingRangeProvider},set commentingRangeProvider(R){w.commentingRangeProvider=R},get reactionHandler(){return w.reactionHandler},set reactionHandler(R){w.reactionHandler=R},get activeCommentThread(){return w.activeCommentThread},createCommentThread(R,L,U){return w.createCommentThread(R,L,U).value},dispose:()=>{w.dispose()}}),this._localDisposables=[],this._localDisposables.push({dispose:()=>{n.$unregisterCommentController(this.handle)}})}get id(){return this._id}get label(){return this._label}get handle(){return this._handle}get commentingRangeProvider(){return this._commentingRangeProvider}set commentingRangeProvider(f){this._commentingRangeProvider=f,f?.resourceHints&&M(this._extension,"commentingRangeHint"),n.$updateCommentingRanges(this.handle,f?.resourceHints)}get reactionHandler(){return this._reactionHandler}set reactionHandler(f){this._reactionHandler=f,n.$updateCommentControllerFeatures(this.handle,{reactionHandler:!!f})}get options(){return this._options}set options(f){this._options=f,n.$updateCommentControllerFeatures(this.handle,{options:this._options})}get activeComment(){return M(this._extension,"activeComment"),this._activeComment}get activeCommentThread(){return M(this._extension,"activeComment"),this._activeThread?.value}createCommentThread(f,I,x){let E=new r(this.id,this.handle,void 0,f,I,x,this._extension,!1);return this._threads.set(E.handle,E),E}$setActiveComment(f){if(!f){this._activeComment=void 0,this._activeThread=void 0;return}let I=this._threads.get(f.commentThreadHandle);I&&(this._activeComment=f.uniqueIdInThread?I.getCommentByUniqueId(f.uniqueIdInThread):void 0,this._activeThread=I)}$createCommentThreadTemplate(f,I,x){let E=new r(this.id,this.handle,void 0,y.revive(f),K.to(I),[],this._extension,!0,x);return E.collapsibleState=1,this._threads.set(E.handle,E),E}$updateCommentThreadTemplate(f,I){let x=this._threads.get(f);x&&(x.range=K.to(I))}$updateCommentThread(f,I){let x=this._threads.get(f);if(!x)return;(w=>Object.prototype.hasOwnProperty.call(I,w))("collapseState")&&(x.collapsibleState=c(I.collapseState))}$deleteCommentThread(f){this._threads.get(f)?.dispose(),this._threads.delete(f)}getCommentThread(f){return this._threads.get(f)}dispose(){this._threads.forEach(f=>{f.dispose()}),this._localDisposables.forEach(f=>f.dispose())}}function a(h,f,I,x){let E=I.get(f);return E||(E=++h.commentHandle,I.set(f,E)),f.state!==void 0&&M(x,"commentsDraftState"),f.reactions?.some(w=>w.reactors!==void 0)&&M(x,"commentReactor"),{mode:f.mode,contextValue:f.contextValue,uniqueIdInThread:E,body:typeof f.body=="string"?f.body:fe.from(f.body),userName:f.author.name,userIconPath:f.author.iconPath,label:f.label,commentReactions:f.reactions?f.reactions.map(w=>l(w)):void 0,state:f.state,timestamp:f.timestamp?.toJSON()}}function l(h){return{label:h.label,iconPath:h.iconPath?ub(h.iconPath):void 0,count:h.count,hasReacted:h.authorHasReacted,reactors:h.reactors&&h.reactors.length>0&&typeof h.reactors[0]!="string"?h.reactors.map(f=>f.name):h.reactors}}function d(h){return{label:h.label||"",count:h.count||0,iconPath:h.iconPath?y.revive(h.iconPath):"",authorHasReacted:h.hasReacted||!1,reactors:h.reactors?.map(f=>({name:f}))}}function c(h){if(h!==void 0)switch(h){case 1:return 1;case 0:return 0}return 0}function u(h){let f;if(typeof h=="object"?f=h.resolved:f=h,f!==void 0)switch(f){case 0:return 0;case 1:return 1}return 0}function m(h){let f;if(typeof h=="object"&&(f=h.applicability),f!==void 0)switch(f){case 0:return 0;case 1:return 1}return 0}return new o}var zk={},Pt={exports:zk};(function(i,t){if(typeof zk=="object"&&typeof Pt=="object")Pt.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e=t();for(var n in e)(typeof zk=="object"?zk:i)[n]=e[n]}})(typeof self<"u"?self:void 0,(function(){return(function(i){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return i[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=i,e.c=t,e.d=function(n,o,r){e.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:r})},e.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,o){if(1&o&&(n=e(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var s in n)e.d(r,s,function(a){return n[a]}.bind(null,s));return r},e.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(o,"a",o),o},e.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},e.p="",e(e.s=0)})([function(i,t,e){(function(n){var o;t=i.exports=Je,o=typeof n=="object"&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?function(){var O=Array.prototype.slice.call(arguments,0);O.unshift("SEMVER"),console.log.apply(console,O)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var r=256,s=Number.MAX_SAFE_INTEGER||9007199254740991,a=t.re=[],l=t.src=[],d=0,c=d++;l[c]="0|[1-9]\\d*";var u=d++;l[u]="[0-9]+";var m=d++;l[m]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var g=d++;l[g]="("+l[c]+")\\.("+l[c]+")\\.("+l[c]+")";var h=d++;l[h]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var f=d++;l[f]="(?:"+l[c]+"|"+l[m]+")";var I=d++;l[I]="(?:"+l[u]+"|"+l[m]+")";var x=d++;l[x]="(?:-("+l[f]+"(?:\\."+l[f]+")*))";var E=d++;l[E]="(?:-?("+l[I]+"(?:\\."+l[I]+")*))";var w=d++;l[w]="[0-9A-Za-z-]+";var R=d++;l[R]="(?:\\+("+l[w]+"(?:\\."+l[w]+")*))";var L=d++,U="v?"+l[g]+l[x]+"?"+l[R]+"?";l[L]="^"+U+"$";var z="[v=\\s]*"+l[h]+l[E]+"?"+l[R]+"?",Y=d++;l[Y]="^"+z+"$";var j=d++;l[j]="((?:<|>)?=?)";var Q=d++;l[Q]=l[u]+"|x|X|\\*";var Z=d++;l[Z]=l[c]+"|x|X|\\*";var me=d++;l[me]="[v=\\s]*("+l[Z]+")(?:\\.("+l[Z]+")(?:\\.("+l[Z]+")(?:"+l[x]+")?"+l[R]+"?)?)?";var vt=d++;l[vt]="[v=\\s]*("+l[Q]+")(?:\\.("+l[Q]+")(?:\\.("+l[Q]+")(?:"+l[E]+")?"+l[R]+"?)?)?";var ut=d++;l[ut]="^"+l[j]+"\\s*"+l[me]+"$";var ie=d++;l[ie]="^"+l[j]+"\\s*"+l[vt]+"$";var ee=d++;l[ee]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var ne=d++;l[ne]="(?:~>?)";var se=d++;l[se]="(\\s*)"+l[ne]+"\\s+",a[se]=new RegExp(l[se],"g");var X=d++;l[X]="^"+l[ne]+l[me]+"$";var ae=d++;l[ae]="^"+l[ne]+l[vt]+"$";var be=d++;l[be]="(?:\\^)";var yt=d++;l[yt]="(\\s*)"+l[be]+"\\s+",a[yt]=new RegExp(l[yt],"g");var Qe=d++;l[Qe]="^"+l[be]+l[me]+"$";var He=d++;l[He]="^"+l[be]+l[vt]+"$";var qt=d++;l[qt]="^"+l[j]+"\\s*("+z+")$|^$";var Gt=d++;l[Gt]="^"+l[j]+"\\s*("+U+")$|^$";var It=d++;l[It]="(\\s*)"+l[j]+"\\s*("+z+"|"+l[me]+")",a[It]=new RegExp(l[It],"g");var Lo=d++;l[Lo]="^\\s*("+l[me]+")\\s+-\\s+("+l[me]+")\\s*$";var ga=d++;l[ga]="^\\s*("+l[vt]+")\\s+-\\s+("+l[vt]+")\\s*$";var ss=d++;l[ss]="(<|>)?=?\\s*\\*";for(var Ti=0;Ti<35;Ti++)o(Ti,l[Ti]),a[Ti]||(a[Ti]=new RegExp(l[Ti]));function Ei(O,G){if(O instanceof Je)return O;if(typeof O!="string"||O.length>r||!(G?a[Y]:a[L]).test(O))return null;try{return new Je(O,G)}catch{return null}}function Je(O,G){if(O instanceof Je){if(O.loose===G)return O;O=O.version}else if(typeof O!="string")throw new TypeError("Invalid Version: "+O);if(O.length>r)throw new TypeError("version is longer than "+r+" characters");if(!(this instanceof Je))return new Je(O,G);o("SemVer",O,G),this.loose=G;var J=O.trim().match(G?a[Y]:a[L]);if(!J)throw new TypeError("Invalid Version: "+O);if(this.raw=O,this.major=+J[1],this.minor=+J[2],this.patch=+J[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");J[4]?this.prerelease=J[4].split(".").map((function(we){if(/^[0-9]+$/.test(we)){var Ke=+we;if(Ke>=0&&Ke<s)return Ke}return we})):this.prerelease=[],this.build=J[5]?J[5].split("."):[],this.format()}t.parse=Ei,t.valid=function(O,G){var J=Ei(O,G);return J?J.version:null},t.clean=function(O,G){var J=Ei(O.trim().replace(/^[=v]+/,""),G);return J?J.version:null},t.SemVer=Je,Je.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Je.prototype.toString=function(){return this.version},Je.prototype.compare=function(O){return o("SemVer.compare",this.version,this.loose,O),O instanceof Je||(O=new Je(O,this.loose)),this.compareMain(O)||this.comparePre(O)},Je.prototype.compareMain=function(O){return O instanceof Je||(O=new Je(O,this.loose)),fa(this.major,O.major)||fa(this.minor,O.minor)||fa(this.patch,O.patch)},Je.prototype.comparePre=function(O){if(O instanceof Je||(O=new Je(O,this.loose)),this.prerelease.length&&!O.prerelease.length)return-1;if(!this.prerelease.length&&O.prerelease.length)return 1;if(!this.prerelease.length&&!O.prerelease.length)return 0;var G=0;do{var J=this.prerelease[G],we=O.prerelease[G];if(o("prerelease compare",G,J,we),J===void 0&&we===void 0)return 0;if(we===void 0)return 1;if(J===void 0)return-1;if(J!==we)return fa(J,we)}while(++G)},Je.prototype.inc=function(O,G){switch(O){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",G);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",G);break;case"prepatch":this.prerelease.length=0,this.inc("patch",G),this.inc("pre",G);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",G),this.inc("pre",G);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var J=this.prerelease.length;--J>=0;)typeof this.prerelease[J]=="number"&&(this.prerelease[J]++,J=-2);J===-1&&this.prerelease.push(0)}G&&(this.prerelease[0]===G?isNaN(this.prerelease[1])&&(this.prerelease=[G,0]):this.prerelease=[G,0]);break;default:throw new Error("invalid increment argument: "+O)}return this.format(),this.raw=this.version,this},t.inc=function(O,G,J,we){typeof J=="string"&&(we=J,J=void 0);try{return new Je(O,J).inc(G,we).version}catch{return null}},t.diff=function(O,G){if(_p(O,G))return null;var J=Ei(O),we=Ei(G);if(J.prerelease.length||we.prerelease.length){for(var Ke in J)if((Ke==="major"||Ke==="minor"||Ke==="patch")&&J[Ke]!==we[Ke])return"pre"+Ke;return"prerelease"}for(var Ke in J)if((Ke==="major"||Ke==="minor"||Ke==="patch")&&J[Ke]!==we[Ke])return Ke},t.compareIdentifiers=fa;var We=/^[0-9]+$/;function fa(O,G){var J=We.test(O),we=We.test(G);return J&&we&&(O=+O,G=+G),J&&!we?-1:we&&!J?1:O<G?-1:O>G?1:0}function Oo(O,G,J){return new Je(O,J).compare(new Je(G,J))}function Jr(O,G,J){return Oo(O,G,J)>0}function tt(O,G,J){return Oo(O,G,J)<0}function _p(O,G,J){return Oo(O,G,J)===0}function Yh(O,G,J){return Oo(O,G,J)!==0}function Yr(O,G,J){return Oo(O,G,J)>=0}function as(O,G,J){return Oo(O,G,J)<=0}function Pl(O,G,J,we){var Ke;switch(G){case"===":typeof O=="object"&&(O=O.version),typeof J=="object"&&(J=J.version),Ke=O===J;break;case"!==":typeof O=="object"&&(O=O.version),typeof J=="object"&&(J=J.version),Ke=O!==J;break;case"":case"=":case"==":Ke=_p(O,J,we);break;case"!=":Ke=Yh(O,J,we);break;case">":Ke=Jr(O,J,we);break;case">=":Ke=Yr(O,J,we);break;case"<":Ke=tt(O,J,we);break;case"<=":Ke=as(O,J,we);break;default:throw new TypeError("Invalid operator: "+G)}return Ke}function No(O,G){if(O instanceof No){if(O.loose===G)return O;O=O.value}if(!(this instanceof No))return new No(O,G);o("comparator",O,G),this.loose=G,this.parse(O),this.semver===_l?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}t.rcompareIdentifiers=function(O,G){return fa(G,O)},t.major=function(O,G){return new Je(O,G).major},t.minor=function(O,G){return new Je(O,G).minor},t.patch=function(O,G){return new Je(O,G).patch},t.compare=Oo,t.compareLoose=function(O,G){return Oo(O,G,!0)},t.rcompare=function(O,G,J){return Oo(G,O,J)},t.sort=function(O,G){return O.sort((function(J,we){return t.compare(J,we,G)}))},t.rsort=function(O,G){return O.sort((function(J,we){return t.rcompare(J,we,G)}))},t.gt=Jr,t.lt=tt,t.eq=_p,t.neq=Yh,t.gte=Yr,t.lte=as,t.cmp=Pl,t.Comparator=No;var _l={};function hn(O,G){if(O instanceof hn)return O.loose===G?O:new hn(O.raw,G);if(O instanceof No)return new hn(O.value,G);if(!(this instanceof hn))return new hn(O,G);if(this.loose=G,this.raw=O,this.set=O.split(/\s*\|\|\s*/).map((function(J){return this.parseRange(J.trim())}),this).filter((function(J){return J.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+O);this.format()}function po(O){return!O||O.toLowerCase()==="x"||O==="*"}function KI(O,G,J,we,Ke,zn,Lt,qn,an,it,Zo,vn,Kn){return((G=po(J)?"":po(we)?">="+J+".0.0":po(Ke)?">="+J+"."+we+".0":">="+G)+" "+(qn=po(an)?"":po(it)?"<"+(+an+1)+".0.0":po(Zo)?"<"+an+"."+(+it+1)+".0":vn?"<="+an+"."+it+"."+Zo+"-"+vn:"<="+qn)).trim()}function Xh(O,G){for(var J=0;J<O.length;J++)if(!O[J].test(G))return!1;if(G.prerelease.length){for(J=0;J<O.length;J++)if(o(O[J].semver),O[J].semver!==_l&&O[J].semver.prerelease.length>0){var we=O[J].semver;if(we.major===G.major&&we.minor===G.minor&&we.patch===G.patch)return!0}return!1}return!0}function Cc(O,G,J){try{G=new hn(G,J)}catch{return!1}return G.test(O)}function ha(O,G,J,we){var Ke,zn,Lt,qn,an;switch(O=new Je(O,we),G=new hn(G,we),J){case">":Ke=Jr,zn=as,Lt=tt,qn=">",an=">=";break;case"<":Ke=tt,zn=Yr,Lt=Jr,qn="<",an="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Cc(O,G,we))return!1;for(var it=0;it<G.set.length;++it){var Zo=G.set[it],vn=null,Kn=null;if(Zo.forEach((function(So){So.semver===_l&&(So=new No(">=0.0.0")),vn=vn||So,Kn=Kn||So,Ke(So.semver,vn.semver,we)?vn=So:Lt(So.semver,Kn.semver,we)&&(Kn=So)})),vn.operator===qn||vn.operator===an||(!Kn.operator||Kn.operator===qn)&&zn(O,Kn.semver)||Kn.operator===an&&Lt(O,Kn.semver))return!1}return!0}No.prototype.parse=function(O){var G=this.loose?a[qt]:a[Gt],J=O.match(G);if(!J)throw new TypeError("Invalid comparator: "+O);this.operator=J[1],this.operator==="="&&(this.operator=""),J[2]?this.semver=new Je(J[2],this.loose):this.semver=_l},No.prototype.toString=function(){return this.value},No.prototype.test=function(O){return o("Comparator.test",O,this.loose),this.semver===_l||(typeof O=="string"&&(O=new Je(O,this.loose)),Pl(O,this.operator,this.semver,this.loose))},No.prototype.intersects=function(O,G){if(!(O instanceof No))throw new TypeError("a Comparator is required");var J;if(this.operator==="")return J=new hn(O.value,G),Cc(this.value,J,G);if(O.operator==="")return J=new hn(this.value,G),Cc(O.semver,J,G);var we=!(this.operator!==">="&&this.operator!==">"||O.operator!==">="&&O.operator!==">"),Ke=!(this.operator!=="<="&&this.operator!=="<"||O.operator!=="<="&&O.operator!=="<"),zn=this.semver.version===O.semver.version,Lt=!(this.operator!==">="&&this.operator!=="<="||O.operator!==">="&&O.operator!=="<="),qn=Pl(this.semver,"<",O.semver,G)&&(this.operator===">="||this.operator===">")&&(O.operator==="<="||O.operator==="<"),an=Pl(this.semver,">",O.semver,G)&&(this.operator==="<="||this.operator==="<")&&(O.operator===">="||O.operator===">");return we||Ke||zn&&Lt||qn||an},t.Range=hn,hn.prototype.format=function(){return this.range=this.set.map((function(O){return O.join(" ").trim()})).join("||").trim(),this.range},hn.prototype.toString=function(){return this.range},hn.prototype.parseRange=function(O){var G=this.loose;O=O.trim(),o("range",O,G);var J=G?a[ga]:a[Lo];O=O.replace(J,KI),o("hyphen replace",O),O=O.replace(a[It],"$1$2$3"),o("comparator trim",O,a[It]),O=(O=(O=O.replace(a[se],"$1~")).replace(a[yt],"$1^")).split(/\s+/).join(" ");var we=G?a[qt]:a[Gt],Ke=O.split(" ").map((function(zn){return(function(Lt,qn){return o("comp",Lt),Lt=(function(an,it){return an.trim().split(/\s+/).map((function(Zo){return(function(vn,Kn){o("caret",vn,Kn);var So=Kn?a[He]:a[Qe];return vn.replace(So,(function(ur,je,bt,Ft,Ht){var Yn;return o("caret",vn,ur,je,bt,Ft,Ht),po(je)?Yn="":po(bt)?Yn=">="+je+".0.0 <"+(+je+1)+".0.0":po(Ft)?Yn=je==="0"?">="+je+"."+bt+".0 <"+je+"."+(+bt+1)+".0":">="+je+"."+bt+".0 <"+(+je+1)+".0.0":Ht?(o("replaceCaret pr",Ht),Ht.charAt(0)!=="-"&&(Ht="-"+Ht),Yn=je==="0"?bt==="0"?">="+je+"."+bt+"."+Ft+Ht+" <"+je+"."+bt+"."+(+Ft+1):">="+je+"."+bt+"."+Ft+Ht+" <"+je+"."+(+bt+1)+".0":">="+je+"."+bt+"."+Ft+Ht+" <"+(+je+1)+".0.0"):(o("no pr"),Yn=je==="0"?bt==="0"?">="+je+"."+bt+"."+Ft+" <"+je+"."+bt+"."+(+Ft+1):">="+je+"."+bt+"."+Ft+" <"+je+"."+(+bt+1)+".0":">="+je+"."+bt+"."+Ft+" <"+(+je+1)+".0.0"),o("caret return",Yn),Yn}))})(Zo,it)})).join(" ")})(Lt,qn),o("caret",Lt),Lt=(function(an,it){return an.trim().split(/\s+/).map((function(Zo){return(function(vn,Kn){var So=Kn?a[ae]:a[X];return vn.replace(So,(function(ur,je,bt,Ft,Ht){var Yn;return o("tilde",vn,ur,je,bt,Ft,Ht),po(je)?Yn="":po(bt)?Yn=">="+je+".0.0 <"+(+je+1)+".0.0":po(Ft)?Yn=">="+je+"."+bt+".0 <"+je+"."+(+bt+1)+".0":Ht?(o("replaceTilde pr",Ht),Ht.charAt(0)!=="-"&&(Ht="-"+Ht),Yn=">="+je+"."+bt+"."+Ft+Ht+" <"+je+"."+(+bt+1)+".0"):Yn=">="+je+"."+bt+"."+Ft+" <"+je+"."+(+bt+1)+".0",o("tilde return",Yn),Yn}))})(Zo,it)})).join(" ")})(Lt,qn),o("tildes",Lt),Lt=(function(an,it){return o("replaceXRanges",an,it),an.split(/\s+/).map((function(Zo){return(function(vn,Kn){vn=vn.trim();var So=Kn?a[ie]:a[ut];return vn.replace(So,(function(ur,je,bt,Ft,Ht,Yn){o("xRange",vn,ur,je,bt,Ft,Ht,Yn);var Zh=po(bt),Rl=Zh||po(Ft),Dl=Rl||po(Ht);return je==="="&&Dl&&(je=""),Zh?ur=je===">"||je==="<"?"<0.0.0":"*":je&&Dl?(Rl&&(Ft=0),Dl&&(Ht=0),je===">"?(je=">=",Rl?(bt=+bt+1,Ft=0,Ht=0):Dl&&(Ft=+Ft+1,Ht=0)):je==="<="&&(je="<",Rl?bt=+bt+1:Ft=+Ft+1),ur=je+bt+"."+Ft+"."+Ht):Rl?ur=">="+bt+".0.0 <"+(+bt+1)+".0.0":Dl&&(ur=">="+bt+"."+Ft+".0 <"+bt+"."+(+Ft+1)+".0"),o("xRange return",ur),ur}))})(Zo,it)})).join(" ")})(Lt,qn),o("xrange",Lt),Lt=(function(an,it){return o("replaceStars",an,it),an.trim().replace(a[ss],"")})(Lt,qn),o("stars",Lt),Lt})(zn,G)})).join(" ").split(/\s+/);return this.loose&&(Ke=Ke.filter((function(zn){return!!zn.match(we)}))),Ke=Ke.map((function(zn){return new No(zn,G)}))},hn.prototype.intersects=function(O,G){if(!(O instanceof hn))throw new TypeError("a Range is required");return this.set.some((function(J){return J.every((function(we){return O.set.some((function(Ke){return Ke.every((function(zn){return we.intersects(zn,G)}))}))}))}))},t.toComparators=function(O,G){return new hn(O,G).set.map((function(J){return J.map((function(we){return we.value})).join(" ").trim().split(" ")}))},hn.prototype.test=function(O){if(!O)return!1;typeof O=="string"&&(O=new Je(O,this.loose));for(var G=0;G<this.set.length;G++)if(Xh(this.set[G],O))return!0;return!1},t.satisfies=Cc,t.maxSatisfying=function(O,G,J){var we=null,Ke=null;try{var zn=new hn(G,J)}catch{return null}return O.forEach((function(Lt){zn.test(Lt)&&(we&&Ke.compare(Lt)!==-1||(Ke=new Je(we=Lt,J)))})),we},t.minSatisfying=function(O,G,J){var we=null,Ke=null;try{var zn=new hn(G,J)}catch{return null}return O.forEach((function(Lt){zn.test(Lt)&&(we&&Ke.compare(Lt)!==1||(Ke=new Je(we=Lt,J)))})),we},t.validRange=function(O,G){try{return new hn(O,G).range||"*"}catch{return null}},t.ltr=function(O,G,J){return ha(O,G,"<",J)},t.gtr=function(O,G,J){return ha(O,G,">",J)},t.outside=ha,t.prerelease=function(O,G){var J=Ei(O,G);return J&&J.prerelease.length?J.prerelease:null},t.intersects=function(O,G,J){return O=new hn(O,J),G=new hn(G,J),O.intersects(G)},t.coerce=function(O){if(O instanceof Je)return O;if(typeof O!="string")return null;var G=O.match(a[ee]);return G==null?null:Ei((G[1]||"0")+"."+(G[2]||"0")+"."+(G[3]||"0"))}}).call(this,e(1))},function(i,t){var e,n,o=i.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(I){if(e===setTimeout)return setTimeout(I,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(I,0);try{return e(I,0)}catch{try{return e.call(null,I,0)}catch{return e.call(this,I,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:r}catch{e=r}try{n=typeof clearTimeout=="function"?clearTimeout:s}catch{n=s}})();var l,d=[],c=!1,u=-1;function m(){c&&l&&(c=!1,l.length?d=l.concat(d):u=-1,d.length&&g())}function g(){if(!c){var I=a(m);c=!0;for(var x=d.length;x;){for(l=d,d=[];++u<x;)l&&l[u].run();u=-1,x=d.length}l=null,c=!1,(function(E){if(n===clearTimeout)return clearTimeout(E);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(E);try{n(E)}catch{try{return n.call(null,E)}catch{return n.call(this,E)}}})(I)}}function h(I,x){this.fun=I,this.array=x}function f(){}o.nextTick=function(I){var x=new Array(arguments.length-1);if(arguments.length>1)for(var E=1;E<arguments.length;E++)x[E-1]=arguments[E];d.push(new h(I,x)),d.length!==1||c||a(g)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(I){return[]},o.binding=function(I){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(I){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));var Ppt=Pt.exports.SEMVER_SPEC_VERSION,_pt=Pt.exports.parse,LX=Pt.exports.valid,Rpt=Pt.exports.coerce,Dpt=Pt.exports.clean,Apt=Pt.exports.inc,Mpt=Pt.exports.major,Lpt=Pt.exports.minor,Opt=Pt.exports.patch,Npt=Pt.exports.prerelease,Upt=Pt.exports.gt,Fpt=Pt.exports.gte,Hpt=Pt.exports.lt,Wpt=Pt.exports.lte,Vpt=Pt.exports.eq,Bpt=Pt.exports.neq,$pt=Pt.exports.cmp,zpt=Pt.exports.compare,qpt=Pt.exports.rcompare,Kpt=Pt.exports.compareIdentifiers,jpt=Pt.exports.rcompareIdentifiers,Gpt=Pt.exports.compareBuild,Qpt=Pt.exports.sort,Jpt=Pt.exports.rsort,Ypt=Pt.exports.diff,Xpt=Pt.exports.validRange,Zpt=Pt.exports.satisfies,emt=Pt.exports.maxSatisfying,tmt=Pt.exports.minSatisfying,nmt=Pt.exports.minVersion,omt=Pt.exports.gtr,rmt=Pt.exports.ltr,imt=Pt.exports.outside,smt=Pt.exports.intersects,amt=Pt.exports.SemVer,lmt=Pt.exports.Comparator,dmt=Pt.exports.Range;var Xz=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,NX=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function UX(i){return i=i.trim(),i==="*"||Xz.test(i)}function qN(i){if(!UX(i))return null;if(i=i.trim(),i==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let t=i.match(Xz);return t?{hasCaret:t[1]==="^",hasGreaterEquals:t[1]===">=",majorBase:t[2]==="x"?0:parseInt(t[2],10),majorMustEqual:t[2]!=="x",minorBase:t[4]==="x"?0:parseInt(t[4],10),minorMustEqual:t[4]!=="x",patchBase:t[6]==="x"?0:parseInt(t[6],10),patchMustEqual:t[6]!=="x",preRelease:t[8]||null}:null}function KN(i){if(!i)return null;let t=i.majorBase,e=i.majorMustEqual,n=i.minorBase,o=i.minorMustEqual,r=i.patchBase,s=i.patchMustEqual;i.hasCaret&&(t===0||(o=!1),s=!1);let a=0;if(i.preRelease){let l=NX.exec(i.preRelease);if(l){let[,d,c,u,m,g]=l;a=Date.UTC(Number(d),Number(c)-1,Number(u),Number(m)||0,Number(g)||0)}}return{majorBase:t,majorMustEqual:e,minorBase:n,minorMustEqual:o,patchBase:r,patchMustEqual:s,isMinimum:i.hasGreaterEquals,notBefore:a}}var jN=class{constructor(){this.buffers=[]}add(t){let e=this.buffers.indexOf(t);return e<0&&(e=this.buffers.length,this.buffers.push(t)),e}};function Zz(i,t){if(t.serializeBuffersForPostMessage){let e=new jN,o=JSON.stringify(i,(s,a)=>{if(a instanceof ArrayBuffer)return{$$vscode_array_buffer_reference$$:!0,index:e.add(a)};if(ArrayBuffer.isView(a)){let l=FX(a);if(l)return{$$vscode_array_buffer_reference$$:!0,index:e.add(a.buffer),view:{type:l,byteLength:a.byteLength,byteOffset:a.byteOffset}}}return a}),r=e.buffers.map(s=>{let a=new Uint8Array(s);return H.wrap(a)});return{message:o,buffers:r}}else return{message:JSON.stringify(i),buffers:[]}}function FX(i){switch(i.constructor.name){case"Int8Array":return 1;case"Uint8Array":return 2;case"Uint8ClampedArray":return 3;case"Int16Array":return 4;case"Uint16Array":return 5;case"Int32Array":return 6;case"Uint32Array":return 7;case"Float32Array":return 8;case"Float64Array":return 9;case"BigInt64Array":return 10;case"BigUint64Array":return 11}}function e9(i,t){let e=t.map(r=>{let s=new ArrayBuffer(r.byteLength);return new Uint8Array(s).set(r.buffer),s}),n=t.length?(r,s)=>{if(s&&typeof s=="object"&&s.$$vscode_array_buffer_reference$$){let a=s,{index:l}=a,d=e[l];if(a.view)switch(a.view.type){case 1:return new Int8Array(d,a.view.byteOffset,a.view.byteLength/Int8Array.BYTES_PER_ELEMENT);case 2:return new Uint8Array(d,a.view.byteOffset,a.view.byteLength/Uint8Array.BYTES_PER_ELEMENT);case 3:return new Uint8ClampedArray(d,a.view.byteOffset,a.view.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT);case 4:return new Int16Array(d,a.view.byteOffset,a.view.byteLength/Int16Array.BYTES_PER_ELEMENT);case 5:return new Uint16Array(d,a.view.byteOffset,a.view.byteLength/Uint16Array.BYTES_PER_ELEMENT);case 6:return new Int32Array(d,a.view.byteOffset,a.view.byteLength/Int32Array.BYTES_PER_ELEMENT);case 7:return new Uint32Array(d,a.view.byteOffset,a.view.byteLength/Uint32Array.BYTES_PER_ELEMENT);case 8:return new Float32Array(d,a.view.byteOffset,a.view.byteLength/Float32Array.BYTES_PER_ELEMENT);case 9:return new Float64Array(d,a.view.byteOffset,a.view.byteLength/Float64Array.BYTES_PER_ELEMENT);case 10:return new BigInt64Array(d,a.view.byteOffset,a.view.byteLength/BigInt64Array.BYTES_PER_ELEMENT);case 11:return new BigUint64Array(d,a.view.byteOffset,a.view.byteLength/BigUint64Array.BYTES_PER_ELEMENT);default:throw new Error("Unknown array buffer view type")}return d}return s}:void 0;return{message:JSON.parse(i,n),arrayBuffers:e}}var GN=class{constructor(t,e,n,o,r,s,a){this.#l="";this.#d=!1;this.#c=!1;this._onMessageEmitter=new T;this.onDidReceiveMessage=this._onMessageEmitter.event;this.#p=new T;this._onDidDispose=this.#p.event;this.#e=t,this.#t=e,this.#a=n,this.#o=o,this.#s=r,this.#r=s,this.#i=Cl(s),this.#u=HX(s),this.#n=a}#e;#t;#n;#o;#s;#r;#l;#a;#d;#c;#i;#u;#p;dispose(){this.#d=!0,this.#p.fire(),this.#p.dispose(),this._onMessageEmitter.dispose()}asWebviewUri(t){return this.#c=!0,Ic(t,this.#o)}get cspSource(){let t=this.#r.extensionLocation;if(t.scheme===B.https||t.scheme===B.http){let e=t.toString();return e.endsWith("/")||(e+="/"),e+" "+cI}return cI}get html(){return this.assertNotDisposed(),this.#l}set html(t){this.assertNotDisposed(),this.#l!==t&&(this.#l=t,this.#u&&!this.#c&&/(["'])vscode-resource:([^\s'"]+?)(["'])/i.test(t)&&(this.#c=!0,this.#n.report("Webview vscode-resource: uris",this.#r,"Please migrate to use the 'webview.asWebviewUri' api instead: https://aka.ms/vscode-webview-use-aswebviewuri")),this.#t.$setHtml(this.#e,this.rewriteOldResourceUrlsIfNeeded(t)))}get options(){return this.assertNotDisposed(),this.#a}set options(t){this.assertNotDisposed(),Et(this.#a,t)||this.#t.$setOptions(this.#e,QN(this.#r,this.#s,t)),this.#a=t}async postMessage(t){if(this.#d)return!1;let e=Zz(t,{serializeBuffersForPostMessage:this.#i});return this.#t.$postMessage(this.#e,e.message,...e.buffers)}assertNotDisposed(){if(this.#d)throw new Error("Webview is disposed")}rewriteOldResourceUrlsIfNeeded(t){if(!this.#u)return t;let e=this.#r.extensionLocation?.scheme===B.vscodeRemote,n=this.#r.extensionLocation.scheme===B.vscodeRemote?this.#r.extensionLocation.authority:void 0;return t.replace(/(["'])(?:vscode-resource):(\/\/([^\s\/'"]+?)(?=\/))?([^\s'"]+?)(["'])/gi,(o,r,s,a,l,d)=>{let c=y.from({scheme:a||"file",path:decodeURIComponent(l)}),u=Ic(c,{isRemote:e,authority:n}).toString();return`${r}${u}${d}`}).replace(/(["'])(?:vscode-webview-resource):(\/\/[^\s\/'"]+\/([^\s\/'"]+?)(?=\/))?([^\s'"]+?)(["'])/gi,(o,r,s,a,l,d)=>{let c=y.from({scheme:a||"file",path:decodeURIComponent(l)}),u=Ic(c,{isRemote:e,authority:n}).toString();return`${r}${u}${d}`})}};function Cl(i){try{let t=KN(qN(i.engines.vscode));return!!t&&t.majorBase>=1&&t.minorBase>=57}catch{return!1}}function HX(i){try{let t=KN(qN(i.engines.vscode));return t?t.majorBase<1||t.majorBase===1&&t.minorBase<60:!1}catch{return!1}}var qk=class extends N{constructor(e,n,o,r,s){super();this.remoteInfo=n;this.workspace=o;this._logService=r;this._deprecationService=s;this._webviews=new Map;this._webviewProxy=e.getProxy(F.MainThreadWebviews)}dispose(){super.dispose();for(let e of this._webviews.values())e.dispose();this._webviews.clear()}$onMessage(e,n,o){let r=this.getWebview(e);if(r){let{message:s}=e9(n,o.value);r._onMessageEmitter.fire(s)}}$onMissingCsp(e,n){this._logService.warn(`${n} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`)}createNewWebview(e,n,o){let r=new GN(e,this._webviewProxy,WX(n),this.remoteInfo,this.workspace,o,this._deprecationService);this._webviews.set(e,r);let s=r._onDidDispose(()=>{s.dispose(),this.deleteWebview(e)});return r}ensureDefaultContentOptions(e,n,o){n.localResourceRoots||this._webviewProxy.$setOptions(e,{...n,localResourceRoots:t9(o,this.workspace)})}deleteWebview(e){this._webviews.delete(e)}getWebview(e){return this._webviews.get(e)}};function vp(i){return{id:i.identifier,location:i.extensionLocation}}function QN(i,t,e){return{enableCommandUris:e.enableCommandUris,enableScripts:e.enableScripts,enableForms:e.enableForms,portMapping:e.portMapping,localResourceRoots:e.localResourceRoots||t9(i,t)}}function WX(i){return{enableCommandUris:i.enableCommandUris,enableScripts:i.enableScripts,enableForms:i.enableForms,portMapping:i.portMapping,localResourceRoots:i.localResourceRoots?.map(t=>y.from(t))}}function t9(i,t){return[...(t?.getWorkspaceFolders()||[]).map(e=>e.uri),i.extensionLocation]}var Xo=class i{constructor(t){this.id=t;this._data=new Map;this._idPool=1}static{this.enableDebugLogging=!1}add(t){let e=this._idPool++;return this._data.set(e,t),this.logDebugInfo(),e}get(t,e){return this._data.has(t)?this._data.get(t)[e]:void 0}delete(t){this._data.delete(t),this.logDebugInfo()}logDebugInfo(){i.enableDebugLogging&&console.log(`${this.id} cache size - ${this._data.size}`)}};var JN=class{constructor(t,e){this.document=t;this._storagePath=e;this._backupCounter=1;this._edits=new Xo("custom documents")}addEdit(t){return this._edits.add([t])}async undo(t,e){await this.getEdit(t).undo(),e||this.disposeBackup()}async redo(t,e){await this.getEdit(t).redo(),e||this.disposeBackup()}disposeEdits(t){for(let e of t)this._edits.delete(e)}getNewBackupUri(){if(!this._storagePath)throw new Error("Backup requires a valid storage path");let t=$X(this.document.uri)+this._backupCounter++;return gt(this._storagePath,t)}updateBackup(t){this._backup?.delete(),this._backup=t}disposeBackup(){this._backup?.delete(),this._backup=void 0}getEdit(t){let e=this._edits.get(t,0);if(!e)throw new Error("No edit found");return e}},YN=class{constructor(){this._documents=new Map}get(t,e){return this._documents.get(this.key(t,e))}add(t,e,n){let o=this.key(t,e.uri);if(this._documents.has(o))throw new Error(`Document already exists for viewType:${t} resource:${e.uri}`);let r=new JN(e,n);return this._documents.set(o,r),r}delete(t,e){let n=this.key(t,e);this._documents.delete(n)}key(t,e){return`${t}@@@${e}`}};var XN=class{constructor(){this._providers=new Map}addTextProvider(t,e,n){return this.add(t,{type:0,extension:e,provider:n})}addCustomProvider(t,e,n){return this.add(t,{type:1,extension:e,provider:n})}get(t){return this._providers.get(t)}add(t,e){if(this._providers.has(t))throw new Error(`Provider for viewType:${t} already registered`);return this._providers.set(t,e),new Se(()=>this._providers.delete(t))}},jk=class{constructor(t,e,n,o,r){this._extHostDocuments=e;this._extensionStoragePaths=n;this._extHostWebview=o;this._extHostWebviewPanels=r;this._editorProviders=new XN;this._documents=new YN;this._proxy=t.getProxy(F.MainThreadCustomEditors)}registerCustomEditorProvider(t,e,n,o){let r=new $;if(VX(n))r.add(this._editorProviders.addTextProvider(e,t,n)),this._proxy.$registerTextEditorProvider(vp(t),e,o.webviewOptions||{},{supportsMove:!!n.moveCustomTextEditor,supportsInlineDiff:Le(t,"customEditorDiffs")&&n9(n),supportsSideBySideDiff:Le(t,"customEditorDiffs")&&o9(n)},Cl(t));else{r.add(this._editorProviders.addCustomProvider(e,t,n));let s=Le(t,"customEditorDiffs");Kk(n)&&r.add(n.onDidChangeCustomDocument(a=>{let l=this.getCustomDocumentEntry(e,a.document.uri);if(BX(a)){let d=l.addEdit(a);this._proxy.$onDidEdit(a.document.uri,e,d,a.label)}else this._proxy.$onContentChange(a.document.uri,e)})),this._proxy.$registerCustomEditorProvider(vp(t),e,o.webviewOptions||{},{supportsInlineDiff:s&&r9(n),supportsSideBySideDiff:s&&i9(n)},!!o.supportsMultipleEditorsPerDocument,Cl(t))}return Se.from(r,new Se(()=>{this._proxy.$unregisterEditorProvider(e)}))}async $createCustomDocument(t,e,n,o,r){let s=this._editorProviders.get(e);if(!s)throw new Error(`No provider found for '${e}'`);if(s.type!==1)throw new Error(`Invalid provide type for '${e}'`);let a=y.revive(t),l=await s.provider.openCustomDocument(a,{backupId:n,untitledDocumentData:o?.buffer},r),d;return Kk(s.provider)&&this._extensionStoragePaths&&(d=this._extensionStoragePaths.workspaceValue(s.extension)??this._extensionStoragePaths.globalValue(s.extension)),this._documents.add(e,l,d),{editable:Kk(s.provider)}}async $disposeCustomDocument(t,e){let n=this._editorProviders.get(e);if(!n)throw new Error(`No provider found for '${e}'`);if(n.type!==1)throw new Error(`Invalid provider type for '${e}'`);let o=y.revive(t),{document:r}=this.getCustomDocumentEntry(e,o);this._documents.delete(e,o),r.dispose()}async $resolveCustomEditor(t,e,n,o,r,s){let a=this._editorProviders.get(n);if(!a)throw new Error(`No provider found for '${n}'`);let l=zt.to(r),d=this._extHostWebview.createNewWebview(e,o.contentOptions,a.extension);this._extHostWebview.ensureDefaultContentOptions(e,o.contentOptions,a.extension);let c=this._extHostWebviewPanels.createNewWebviewPanel(e,n,o.title,l,o.options,d,o.active),u=y.revive(t);switch(a.type){case 1:{let{document:m}=this.getCustomDocumentEntry(n,u);return a.provider.resolveCustomEditor(m,c,s)}case 0:{let m=this._extHostDocuments.getDocument(u);return a.provider.resolveCustomTextEditor(m,c,s)}default:throw new Error("Unknown webview provider type")}}async $resolveCustomEditorInlineDiff(t,e,n,o,r,s,a){let{entry:l,panel:d}=this.createCustomEditorDiffPanel(n,o,r,s),c=y.revive(t),u=y.revive(e);if(l.type===0){if(!n9(l.provider))throw new Error(`Provider for '${o}' does not support inline custom text editor diffs`);let h=this._extHostDocuments.getDocument(c),f=this._extHostDocuments.getDocument(u);return l.provider.resolveCustomTextEditorInlineDiff({original:h,modified:f},d,a)}if(!r9(l.provider))throw new Error(`Provider for '${o}' does not support inline custom editor diffs`);let{document:m}=this.getCustomDocumentEntry(o,c),{document:g}=this.getCustomDocumentEntry(o,u);return l.provider.resolveCustomEditorInlineDiff({original:m,modified:g},d,a)}async $resolveCustomEditorSideBySideDiff(t,e,n,o,r,s,a){let{entry:l,panel:d}=this.createCustomEditorDiffPanel(n.original,o,r.original,s),{panel:c}=this.createCustomEditorDiffPanel(n.modified,o,r.modified,s),u=y.revive(t),m=y.revive(e);if(l.type===0){if(!o9(l.provider))throw new Error(`Provider for '${o}' does not support side by side custom text editor diffs`);let f=this._extHostDocuments.getDocument(u),I=this._extHostDocuments.getDocument(m);return l.provider.resolveCustomTextEditorSideBySideDiff({original:f,modified:I},{original:d,modified:c},a)}if(!i9(l.provider))throw new Error(`Provider for '${o}' does not support side by side custom editor diffs`);let{document:g}=this.getCustomDocumentEntry(o,u),{document:h}=this.getCustomDocumentEntry(o,m);return l.provider.resolveCustomEditorSideBySideDiff({original:g,modified:h},{original:d,modified:c},a)}createCustomEditorDiffPanel(t,e,n,o){let r=this._editorProviders.get(e);if(!r)throw new Error(`No provider found for '${e}'`);let s=zt.to(o),a=this._extHostWebview.createNewWebview(t,n.contentOptions,r.extension);this._extHostWebview.ensureDefaultContentOptions(t,n.contentOptions,r.extension);let l=this._extHostWebviewPanels.createNewWebviewPanel(t,e,n.title,s,n.options,a,n.active);return{entry:r,panel:l}}$disposeEdits(t,e,n){this.getCustomDocumentEntry(e,t).disposeEdits(n)}async $onMoveCustomEditor(t,e,n){let o=this._editorProviders.get(n);if(!o)throw new Error(`No provider found for '${n}'`);if(!o.provider.moveCustomTextEditor)throw new Error(`Provider does not implement move '${n}'`);let r=this._extHostWebviewPanels.getWebviewPanel(t);if(!r)throw new Error("No webview found");let s=y.revive(e),a=this._extHostDocuments.getDocument(s);await o.provider.moveCustomTextEditor(a,r,pe.None)}async $undo(t,e,n,o){return this.getCustomDocumentEntry(e,t).undo(n,o)}async $redo(t,e,n,o){return this.getCustomDocumentEntry(e,t).redo(n,o)}async $revert(t,e,n){let o=this.getCustomDocumentEntry(e,t);await this.getCustomEditorProvider(e).revertCustomDocument(o.document,n),o.disposeBackup()}async $onSave(t,e,n){let o=this.getCustomDocumentEntry(e,t);await this.getCustomEditorProvider(e).saveCustomDocument(o.document,n),o.disposeBackup()}async $onSaveAs(t,e,n,o){let r=this.getCustomDocumentEntry(e,t);return this.getCustomEditorProvider(e).saveCustomDocumentAs(r.document,y.revive(n),o)}async $backup(t,e,n){let o=this.getCustomDocumentEntry(e,t),s=await this.getCustomEditorProvider(e).backupCustomDocument(o.document,{destination:o.getNewBackupUri()},n);return o.updateBackup(s),s.id}getCustomDocumentEntry(t,e){let n=this._documents.get(t,y.revive(e));if(!n)throw new Error("No custom document found");return n}getCustomEditorProvider(t){let n=this._editorProviders.get(t)?.provider;if(!n||!Kk(n))throw new Error("Custom document is not editable");return n}};function Kk(i){return!!i.onDidChangeCustomDocument}function VX(i){return typeof i.resolveCustomTextEditor=="function"}function n9(i){return typeof i.resolveCustomTextEditorInlineDiff=="function"}function o9(i){return typeof i.resolveCustomTextEditorSideBySideDiff=="function"}function r9(i){return typeof i.resolveCustomEditorInlineDiff=="function"}function i9(i){return typeof i.resolveCustomEditorSideBySideDiff=="function"}function BX(i){return typeof i.undo=="function"&&typeof i.redo=="function"}function $X(i){let t=i.scheme===B.file||i.scheme===B.untitled?i.fsPath:i.toString();return to(t)+""}var Gk=class i{constructor(t,e,n,o,r,s,a,l){this._name=t;this._owner=e;this._maxDiagnosticsTotal=n;this._maxDiagnosticsPerFile=o;this._modelVersionIdProvider=r;this._isDisposed=!1;this._maxDiagnosticsTotal=Math.max(o,n),this.#n=new Ve(d=>s.getComparisonKey(d)),this.#e=a,this.#t=l}#e;#t;#n;dispose(){this._isDisposed||(this.#t.fire([...this.#n.keys()]),this.#e?.$clear(this._owner),this.#n.clear(),this._isDisposed=!0)}get name(){return this._checkDisposed(),this._name}set(t,e){if(!t){this.clear();return}this._checkDisposed();let n=[];if(y.isUri(t)){if(!e){this.delete(t);return}this.#n.set(t,nt(e)),n=[t]}else if(Array.isArray(t)){n=[];let s;t=[...t].sort(i._compareIndexedTuplesByUri);for(let a of t){let[l,d]=a;if((!s||l.toString()!==s.toString())&&(s&&this.#n.get(s).length===0&&this.#n.delete(s),s=l,n.push(l),this.#n.set(l,[])),d)this.#n.get(l)?.push(...nt(d));else{let c=this.#n.get(l);c&&(c.length=0)}}}if(this.#t.fire(n),!this.#e)return;let o=[],r=0;for(let s of n){let a=[],l=this.#n.get(s);if(l)if(l.length>this._maxDiagnosticsPerFile){a=[];let d=[0,1,2,3];e:for(let c=0;c<4;c++)for(let u of l)if(u.severity===d[c]&&a.push({...ml.from(u),modelVersionId:this._modelVersionIdProvider(s)})===this._maxDiagnosticsPerFile)break e;a.push({severity:2,message:p(5877,null,l.length-this._maxDiagnosticsPerFile),startLineNumber:a[a.length-1].startLineNumber,startColumn:a[a.length-1].startColumn,endLineNumber:a[a.length-1].endLineNumber,endColumn:a[a.length-1].endColumn})}else a=l.map(d=>({...ml.from(d),modelVersionId:this._modelVersionIdProvider(s)}));if(o.push([s,a]),r+=a.length,r>this._maxDiagnosticsTotal)break}this.#e.$changeMany(this._owner,o)}delete(t){this._checkDisposed(),this.#t.fire([t]),this.#n.delete(t),this.#e?.$changeMany(this._owner,[[t,void 0]])}clear(){this._checkDisposed(),this.#t.fire([...this.#n.keys()]),this.#n.clear(),this.#e?.$clear(this._owner)}forEach(t,e){this._checkDisposed();for(let[n,o]of this)t.call(e,n,o,this)}*[Symbol.iterator](){this._checkDisposed();for(let t of this.#n.keys())yield[t,this.get(t)]}get(t){this._checkDisposed();let e=this.#n.get(t);return Array.isArray(e)?Object.freeze(e.slice(0)):[]}has(t){return this._checkDisposed(),Array.isArray(this.#n.get(t))}_checkDisposed(){if(this._isDisposed)throw new Error("illegal state - object is disposed")}static _compareIndexedTuplesByUri(t,e){return t[0].toString()<e[0].toString()?-1:t[0].toString()>e[0].toString()?1:0}},Si=class{constructor(t,e,n,o){this._logService=e;this._fileSystemInfoService=n;this._extHostDocumentsAndEditors=o;this._collections=new Map;this._onDidChangeDiagnostics=new ux({merge:t=>t.flat(),delay:50});this.onDidChangeDiagnostics=ye.map(this._onDidChangeDiagnostics.event,Si._mapper);this._proxy=t.getProxy(F.MainThreadDiagnostics)}static{this._idPool=0}static{this._maxDiagnosticsPerFile=1e3}static{this._maxDiagnosticsTotal=1.1*this._maxDiagnosticsPerFile}static _mapper(t){let e=new Ve;for(let n of t)e.set(n,n);return{uris:Object.freeze(Array.from(e.values()))}}createDiagnosticCollection(t,e){let{_collections:n,_proxy:o,_onDidChangeDiagnostics:r,_logService:s,_fileSystemInfoService:a,_extHostDocumentsAndEditors:l}=this,d=new class{$changeMany(m,g){o.$changeMany(m,g),s.trace("[DiagnosticCollection] change many (extension, owner, uris)",t.value,m,g.length===0?"CLEARING":g)}$clear(m){o.$clear(m),s.trace("[DiagnosticCollection] remove all (extension, owner)",t.value,m)}dispose(){o.dispose()}},c;if(!e)e="_generated_diagnostic_collection_name_#"+Si._idPool++,c=e;else if(!n.has(e))c=e;else{this._logService.warn(`DiagnosticCollection with name '${e}' does already exist.`);do c=e+Si._idPool++;while(n.has(c))}return new class extends Gk{constructor(){super(e,c,Si._maxDiagnosticsTotal,Si._maxDiagnosticsPerFile,m=>l.getDocument(m)?.version,a.extUri,d,r),n.set(c,this)}dispose(){super.dispose(),n.delete(c)}}}getDiagnostics(t){if(t)return this._getDiagnostics(t);{let e=new Map,n=[];for(let o of this._collections.values())o.forEach((r,s)=>{let a=e.get(r.toString());typeof a>"u"&&(a=n.length,e.set(r.toString(),a),n.push([r,[]])),n[a][1]=n[a][1].concat(s)});return n}}_getDiagnostics(t){let e=[];for(let n of this._collections.values())n.has(t)&&(e=e.concat(n.get(t)));return e}$acceptMarkersChange(t){if(!this._mirrorCollection){let e="_generated_mirror",n=new Gk(e,e,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,o=>{},this._fileSystemInfoService.extUri,void 0,this._onDidChangeDiagnostics);this._collections.set(e,n),this._mirrorCollection=n}for(let[e,n]of t)n.length===0?this._mirrorCollection.delete(y.revive(e)):this._mirrorCollection.set(y.revive(e),n.map(ml.to))}};Si=_([S(1,te),S(2,ai)],Si);var Qk=class{constructor(t){this._proxy=t.getProxy(F.MainThreadDialogs)}showOpenDialog(t){return this._proxy.$showOpenDialog(t).then(e=>e?e.map(n=>y.revive(n)):void 0)}showSaveDialog(t){return this._proxy.$showSaveDialog(t).then(e=>e?y.revive(e):void 0)}};var Jk=class i{constructor(t,e,n){this._documentsAndEditors=e;this._logService=n;this._documentContentProviders=new Map;this._proxy=t.getProxy(F.MainThreadDocumentContentProviders)}static{this._handlePool=0}registerTextDocumentContentProvider(t,e){if(Object.keys(B).indexOf(t)>=0)throw new Error(`scheme '${t}' already registered`);let n=i._handlePool++;this._documentContentProviders.set(n,e),this._proxy.$registerTextContentProvider(n,t);let o;if(typeof e.onDidChange=="function"){let r;o=e.onDidChange(async s=>{if(s.scheme!==t){this._logService.warn(`Provider for scheme '${t}' is firing event for schema '${s.scheme}' which will be IGNORED`);return}if(!this._documentsAndEditors.getDocument(s))return;r&&await r;let a=this.$provideTextDocumentContent(n,s).then(async l=>{if(!l&&typeof l!="string")return;let d=this._documentsAndEditors.getDocument(s);if(!d)return;let c=xx(l);if(!d.equalLines(c))return this._proxy.$onVirtualDocumentChange(s,l)}).catch(Ge).finally(()=>{r===a&&(r=void 0)});r=a})}return new Se(()=>{this._documentContentProviders.delete(n)&&this._proxy.$unregisterTextContentProvider(n),o&&(o.dispose(),o=void 0)})}$provideTextDocumentContent(t,e){let n=this._documentContentProviders.get(t);return n?Promise.resolve(n.provideTextDocumentContent(y.revive(e),pe.None)):Promise.reject(new Error(`unsupported uri-scheme: ${e.scheme}`))}};var Yk=class{constructor(t,e,n,o={timeout:1500,errors:3}){this._logService=t;this._documents=e;this._mainThreadBulkEdits=n;this._thresholds=o;this._callbacks=new mo;this._badListeners=new WeakMap}dispose(){this._callbacks.clear()}getOnWillSaveTextDocumentEvent(t){return(e,n,o)=>{let s={dispose:this._callbacks.push([e,n,t])};return Array.isArray(o)&&o.push(s),s}}async $participateInSave(t,e){let n=y.revive(t),o=!1,r=setTimeout(()=>o=!0,this._thresholds.timeout),s=[];try{for(let a of[...this._callbacks]){if(o)break;let l=this._documents.getDocument(n),d=await this._deliverEventAsyncAndBlameBadListeners(a,{document:l,reason:fb.to(e)});s.push(d)}}finally{clearTimeout(r)}return s}_deliverEventAsyncAndBlameBadListeners([t,e,n],o){let r=this._badListeners.get(t);return typeof r=="number"&&r>this._thresholds.errors?Promise.resolve(!1):this._deliverEventAsync(n,t,e,o).then(()=>!0,s=>{if(this._logService.error(`onWillSaveTextDocument-listener from extension '${n.identifier.value}' threw ERROR`),this._logService.error(s),!(s instanceof Error)||s.message!=="concurrent_edits"){let a=this._badListeners.get(t);this._badListeners.set(t,a?a+1:1),typeof a=="number"&&a>this._thresholds.errors&&this._logService.info(`onWillSaveTextDocument-listener from extension '${n.identifier.value}' will now be IGNORED because of timeouts and/or errors`)}return!1})}_deliverEventAsync(t,e,n,o){let r=[],s=Date.now(),{document:a,reason:l}=o,{version:d}=a,c=Object.freeze({document:a,reason:l,waitUntil(u){if(Object.isFrozen(r))throw Ap("waitUntil can not be called async");r.push(Promise.resolve(u))}});try{e.apply(n,[c])}catch(u){return Promise.reject(u)}return Object.freeze(r),new Promise((u,m)=>{let g=setTimeout(()=>m(new Error("timeout")),this._thresholds.timeout);return Promise.all(r).then(h=>{this._logService.debug(`onWillSaveTextDocument-listener from extension '${t.identifier.value}' finished after ${Date.now()-s}ms`),clearTimeout(g),u(h)}).catch(h=>{clearTimeout(g),m(h)})}).then(u=>{let m={edits:[]};for(let g of u)if(Array.isArray(g)&&g.every(h=>h instanceof Qn))for(let{newText:h,newEol:f,range:I}of g)m.edits.push({resource:a.uri,versionId:void 0,textEdit:{range:I&&K.from(I),text:h,eol:f&&qu.from(f)}});if(m.edits.length!==0)return d===a.version?this._mainThreadBulkEdits.$tryApplyWorkspaceEdit(new Zt(m)):Promise.reject(new Error("concurrent_edits"))})}};var Xk=class{constructor(t,e){this._toDispose=new $;this._onDidAddDocument=this._toDispose.add(new T);this._onDidRemoveDocument=this._toDispose.add(new T);this._onDidChangeDocument=this._toDispose.add(new T);this._onDidChangeDocumentWithReason=this._toDispose.add(new T);this._onDidSaveDocument=this._toDispose.add(new T);this.onDidAddDocument=this._onDidAddDocument.event;this.onDidRemoveDocument=this._onDidRemoveDocument.event;this.onDidChangeDocument=this._onDidChangeDocument.event;this.onDidChangeDocumentWithReason=this._onDidChangeDocumentWithReason.event;this.onDidSaveDocument=this._onDidSaveDocument.event;this._documentLoader=new Map;this._proxy=t.getProxy(F.MainThreadDocuments),this._documentsAndEditors=e,this._documentsAndEditors.onDidRemoveDocuments(n=>{for(let o of n)this._onDidRemoveDocument.fire(o.document)},void 0,this._toDispose),this._documentsAndEditors.onDidAddDocuments(n=>{for(let o of n)this._onDidAddDocument.fire(o.document)},void 0,this._toDispose)}dispose(){this._toDispose.dispose()}getAllDocumentData(){return[...this._documentsAndEditors.allDocuments()]}getDocumentData(t){if(!t)return;let e=this._documentsAndEditors.getDocument(t);if(e)return e}getDocument(t){let e=this.getDocumentData(t);if(!e?.document)throw new Error(`Unable to retrieve document from URI '${t}'`);return e.document}ensureDocumentData(t,e){let n=this._documentsAndEditors.getDocument(t);if(n&&(!e?.encoding||n.document.encoding===e.encoding))return Promise.resolve(n);let o=this._documentLoader.get(t.toString());return o?e?.encoding&&(o=o.then(r=>r.document.encoding!==e.encoding?this.ensureDocumentData(t,e):r)):(o=this._proxy.$tryOpenDocument(t,e).then(r=>{this._documentLoader.delete(t.toString());let s=y.revive(r);return ki(this._documentsAndEditors.getDocument(s))},r=>(this._documentLoader.delete(t.toString()),Promise.reject(r))),this._documentLoader.set(t.toString(),o)),o}createDocumentData(t){return this._proxy.$tryCreateDocument(t).then(e=>y.revive(e))}$acceptModelLanguageChanged(t,e){let n=y.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");this._onDidRemoveDocument.fire(o.document),o._acceptLanguageId(e),this._onDidAddDocument.fire(o.document)}$acceptModelSaved(t){let e=y.revive(t),n=this._documentsAndEditors.getDocument(e);if(!n)throw new Error("unknown document");this.$acceptDirtyStateChanged(t,!1),this._onDidSaveDocument.fire(n.document)}$acceptDirtyStateChanged(t,e){let n=y.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");o._acceptIsDirty(e),this._onDidChangeDocument.fire({document:o.document,contentChanges:[],reason:void 0}),this._onDidChangeDocumentWithReason.fire({document:o.document,contentChanges:[],reason:void 0,detailedReason:void 0})}$acceptEncodingChanged(t,e){let n=y.revive(t),o=this._documentsAndEditors.getDocument(n);if(!o)throw new Error("unknown document");o._acceptEncoding(e),this._onDidChangeDocument.fire({document:o.document,contentChanges:[],reason:void 0}),this._onDidChangeDocumentWithReason.fire({document:o.document,contentChanges:[],reason:void 0,detailedReason:void 0})}$acceptModelChanged(t,e,n){let o=y.revive(t),r=this._documentsAndEditors.getDocument(o);if(!r)throw new Error("unknown document");r._acceptIsDirty(n),r.onEvents(e);let s;e.isUndoing?s=1:e.isRedoing&&(s=2),this._onDidChangeDocument.fire(Ov({document:r.document,contentChanges:e.changes.map(a=>({range:K.to(a.range),rangeOffset:a.rangeOffset,rangeLength:a.rangeLength,text:a.text})),reason:s})),this._onDidChangeDocumentWithReason.fire(Ov({document:r.document,contentChanges:e.changes.map(a=>({range:K.to(a.range),rangeOffset:a.rangeOffset,rangeLength:a.rangeLength,text:a.text})),reason:s,detailedReason:e.detailedReason?{source:e.detailedReason.source,metadata:e.detailedReason}:void 0}))}setWordDefinitionFor(t,e){$5(t,e)}};var Zk=class{constructor(t){this._provider=new Map;this._registeredModels=new Set;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._allKnownModels=new Set;this._handlePool=0;this._proxy=t.getProxy(F.MainThreadEmbeddings)}registerEmbeddingsProvider(t,e,n){if(this._registeredModels.has(e))throw new Error(`An embeddings provider for model '${e}' is already registered`);let o=this._handlePool++;return this._proxy.$registerEmbeddingProvider(o,e),this._provider.set(o,{id:e,provider:n}),this._registeredModels.add(e),q(()=>{this._registeredModels.delete(e),this._proxy.$unregisterEmbeddingProvider(o),this._provider.delete(o)})}async computeEmbeddings(t,e,n){n??=pe.None;let o=!1;typeof e=="string"&&(e=[e],o=!0);let r=await this._proxy.$computeEmbeddings(t,e,n);if(r.length!==e.length)throw new Error;if(o){if(r.length!==1)throw new Error;return r[0]}return r}async $provideEmbeddings(t,e,n){let o=this._provider.get(t);if(!o)return[];let r=await o.provider.provideEmbeddings(e,n);return r||[]}get embeddingsModels(){return Array.from(this._allKnownModels)}$acceptEmbeddingModels(t){this._allKnownModels=new Set(t),this._onDidChange.fire()}};var eP=class{constructor(t){this._AiEmbeddingVectorProviders=new Map;this._nextHandle=0;this._proxy=t.getProxy(F.MainThreadAiEmbeddingVector)}async $provideAiEmbeddingVector(t,e,n){if(this._AiEmbeddingVectorProviders.size===0)throw new Error("No embedding vector providers registered");let o=this._AiEmbeddingVectorProviders.get(t);if(!o)throw new Error("Embedding vector provider not found");let r=await o.provideEmbeddingVector(e,n);if(!r)throw new Error("Embedding vector provider returned undefined");return r}registerEmbeddingVectorProvider(t,e,n){let o=this._nextHandle;return this._nextHandle++,this._AiEmbeddingVectorProviders.set(o,n),this._proxy.$registerAiEmbeddingVectorProvider(e,o),new Se(()=>{this._proxy.$unregisterAiEmbeddingVectorProvider(o),this._AiEmbeddingVectorProviders.delete(o)})}};var eU=class{constructor(t,e,n){let o=new Uint8Array(t*e);for(let r=0,s=t*e;r<s;r++)o[r]=n;this._data=o,this.rows=t,this.cols=e}get(t,e){return this._data[t*this.cols+e]}set(t,e,n){this._data[t*this.cols+e]=n}},pI=class{constructor(t){let e=0,n=0;for(let r=0,s=t.length;r<s;r++){let[a,l,d]=t[r];l>e&&(e=l),a>n&&(n=a),d>n&&(n=d)}e++,n++;let o=new eU(n,e,0);for(let r=0,s=t.length;r<s;r++){let[a,l,d]=t[r];o.set(a,l,d)}this._states=o,this._maxCharCode=e}nextState(t,e){return e<0||e>=this._maxCharCode?0:this._states.get(t,e)}},ZN=null;function zX(){return ZN===null&&(ZN=new pI([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),ZN}var uI=null;function qX(){if(uI===null){uI=new xf(0);let i=` 	<>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026|`;for(let e=0;e<i.length;e++)uI.set(i.charCodeAt(e),1);let t=".,;:";for(let e=0;e<t.length;e++)uI.set(t.charCodeAt(e),2)}return uI}var tP=class i{static _createLink(t,e,n,o,r){let s=r-1;do{let a=e.charCodeAt(s);if(t.get(a)!==2)break;s--}while(s>o);if(o>0){let a=e.charCodeAt(o-1),l=e.charCodeAt(s);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&s--}return{range:{startLineNumber:n,startColumn:o+1,endLineNumber:n,endColumn:s+2},url:e.substring(o,s+1)}}static computeLinks(t,e=zX()){let n=qX(),o=[];for(let r=1,s=t.getLineCount();r<=s;r++){let a=t.getLineContent(r),l=a.length,d=0,c=0,u=0,m=1,g=!1,h=!1,f=!1,I=!1;for(;d<l;){let x=!1,E=a.charCodeAt(d);if(m===13){let w;switch(E){case 40:g=!0,w=0;break;case 41:w=g?0:1;break;case 91:f=!0,h=!0,w=0;break;case 93:f=!1,w=h?0:1;break;case 123:I=!0,w=0;break;case 125:w=I?0:1;break;case 39:case 34:case 96:u===E?w=1:u===39||u===34||u===96?w=0:w=1;break;case 42:w=u===42?1:0;break;case 32:w=f?0:1;break;default:w=n.get(E)}w===1&&(o.push(i._createLink(n,a,r,c,d)),x=!0)}else if(m===12){let w;E===91?(h=!0,w=0):w=n.get(E),w===1?x=!0:m=13}else m=e.nextState(m,E),m===0&&(x=!0);x&&(m=1,g=!1,h=!1,I=!1,c=d+1,u=E),d++}m===13&&o.push(i._createLink(n,a,r,c,l))}return o}};var tU=class{constructor(){this._schemes=[]}add(t){this._stateMachine=void 0,this._schemes.push(t)}delete(t){let e=this._schemes.indexOf(t);e>=0&&(this._schemes.splice(e,1),this._stateMachine=void 0)}_initStateMachine(){if(!this._stateMachine){let t=this._schemes.sort(),e=[],n,o,r=14,s=14;for(let a of t){let l=n?p2(n,a):0;for(l===0?o=1:o=s;l<a.length;l++)l+1===a.length?(r=s,s=9):s+=1,e.push([o,a.toUpperCase().charCodeAt(l),s]),e.push([o,a.toLowerCase().charCodeAt(l),s]),o=s;n=a,s=r}e.push([9,58,10]),e.push([10,47,12]),this._stateMachine=new pI(e)}}provideDocumentLinks(t){this._initStateMachine();let e=[],n=tP.computeLinks({getLineContent(o){return t.lineAt(o-1).text},getLineCount(){return t.lineCount}},this._stateMachine);for(let o of n){let r=fl.to(o);r.target&&e.push(r)}return e}},nP=class i{constructor(t,e){this._extHostLanguageFeatures=e;this._linkProvider=new tU;this._fsProvider=new Map;this._registeredSchemes=new Set;this._watches=new Map;this._handlePool=0;this._proxy=t.getProxy(F.MainThreadFileSystem)}dispose(){this._linkProviderRegistration?.dispose()}registerFileSystemProvider(t,e,n,o={}){if(i._validateFileSystemProvider(n),this._registeredSchemes.has(e))throw new Error(`a provider for the scheme '${e}' is already registered`);this._linkProviderRegistration||(this._linkProviderRegistration=this._extHostLanguageFeatures.registerDocumentLinkProvider(t,"*",this._linkProvider));let r=this._handlePool++;this._linkProvider.add(e),this._registeredSchemes.add(e),this._fsProvider.set(r,n);let s=2;o.isCaseSensitive&&(s+=1024),o.isReadonly&&(s+=2048),typeof n.copy=="function"&&(s+=8),typeof n.open=="function"&&typeof n.close=="function"&&typeof n.read=="function"&&typeof n.write=="function"&&(M(t,"fsChunks"),s+=4);let a;o.isReadonly&&qo(o.isReadonly)&&o.isReadonly.value!==""&&(a={value:o.isReadonly.value,isTrusted:o.isReadonly.isTrusted,supportThemeIcons:o.isReadonly.supportThemeIcons,supportHtml:o.isReadonly.supportHtml,baseUri:o.isReadonly.baseUri,uris:o.isReadonly.uris}),this._proxy.$registerFileSystemProvider(r,e,s,a).catch(d=>{console.error(`FAILED to register filesystem provider of ${t.identifier.value}-extension for the scheme ${e}`),console.error(d)});let l=n.onDidChangeFile(d=>{let c=[];for(let u of d){let{uri:m,type:g}=u;if(m.scheme!==e)continue;let h;switch(g){case 1:h=0;break;case 2:h=1;break;case 3:h=2;break;default:throw new Error("Unknown FileChangeType")}c.push({resource:m,type:h})}this._proxy.$onFileSystemChange(r,c)});return q(()=>{l.dispose(),this._linkProvider.delete(e),this._registeredSchemes.delete(e),this._fsProvider.delete(r),this._proxy.$unregisterProvider(r)})}static _validateFileSystemProvider(t){if(!t)throw new Error("MISSING provider");if(typeof t.watch!="function")throw new Error("Provider does NOT implement watch");if(typeof t.stat!="function")throw new Error("Provider does NOT implement stat");if(typeof t.readDirectory!="function")throw new Error("Provider does NOT implement readDirectory");if(typeof t.createDirectory!="function")throw new Error("Provider does NOT implement createDirectory");if(typeof t.readFile!="function")throw new Error("Provider does NOT implement readFile");if(typeof t.writeFile!="function")throw new Error("Provider does NOT implement writeFile");if(typeof t.delete!="function")throw new Error("Provider does NOT implement delete");if(typeof t.rename!="function")throw new Error("Provider does NOT implement rename")}static _asIStat(t){let{type:e,ctime:n,mtime:o,size:r,permissions:s}=t;return{type:e,ctime:n,mtime:o,size:r,permissions:s}}$stat(t,e){return Promise.resolve(this._getFsProvider(t).stat(y.revive(e))).then(n=>i._asIStat(n))}$readdir(t,e){return Promise.resolve(this._getFsProvider(t).readDirectory(y.revive(e)))}$readFile(t,e){return Promise.resolve(this._getFsProvider(t).readFile(y.revive(e))).then(n=>H.wrap(n))}$writeFile(t,e,n,o){return Promise.resolve(this._getFsProvider(t).writeFile(y.revive(e),n.buffer,o))}$delete(t,e,n){return Promise.resolve(this._getFsProvider(t).delete(y.revive(e),n))}$rename(t,e,n,o){return Promise.resolve(this._getFsProvider(t).rename(y.revive(e),y.revive(n),o))}$copy(t,e,n,o){let r=this._getFsProvider(t);if(!r.copy)throw new Error('FileSystemProvider does not implement "copy"');return Promise.resolve(r.copy(y.revive(e),y.revive(n),o))}$mkdir(t,e){return Promise.resolve(this._getFsProvider(t).createDirectory(y.revive(e)))}$watch(t,e,n,o){let r=this._getFsProvider(t).watch(y.revive(n),o);this._watches.set(e,r)}$unwatch(t,e){let n=this._watches.get(e);n&&(n.dispose(),this._watches.delete(e))}$open(t,e,n){let o=this._getFsProvider(t);if(!o.open)throw new Error('FileSystemProvider does not implement "open"');return Promise.resolve(o.open(y.revive(e),n))}$close(t,e){let n=this._getFsProvider(t);if(!n.close)throw new Error('FileSystemProvider does not implement "close"');return Promise.resolve(n.close(e))}$read(t,e,n,o){let r=this._getFsProvider(t);if(!r.read)throw new Error('FileSystemProvider does not implement "read"');let s=H.alloc(o);return Promise.resolve(r.read(e,n,s.buffer,0,o)).then(a=>s.slice(0,a))}$write(t,e,n,o){let r=this._getFsProvider(t);if(!r.write)throw new Error('FileSystemProvider does not implement "write"');return Promise.resolve(r.write(e,n,o.buffer,0,o.byteLength))}_getFsProvider(t){let e=this._fsProvider.get(t);if(!e){let n=new Error;throw n.name="ENOPRO",n.message="no provider",n}return e}};function sP(i){return typeof i.correlationId=="number"}function s9(i){return i.recursive===!0}var oP=class i extends N{constructor(e,n,o,r){super();this.onFileChanges=e;this.onLogMessage=n;this.verboseLogging=o;this.options=r;this.watcherDisposables=this._register(new tn);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new $;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(n=>this.onFileChanges(n))),e.add(this.watcher.onDidLogMessage(n=>this.onLogMessage(n))),e.add(this.watcher.onDidError(n=>this.onError(n.error,n.request)))}onError(e,n){this.canRestart(e,n)?this.restartCounter<i.MAX_RESTARTS&&this.requests?(this.error(`restarting watcher after unexpected error: ${e}`),this.restart(this.requests)):this.error(`gave up attempting to restart watcher after unexpected error: ${e}`):this.error(e)}canRestart(e,n){return!(!this.options.restartOnError||n||e.indexOf("No space left on device")!==-1||e.indexOf("EMFILE")!==-1)}restart(e){this.restartCounter++,this.init(),this.watch(e)}async watch(e){this.requests=e,await this.watcher?.watch(e)}async setVerboseLogging(e){this.verboseLogging=e,await this.watcher?.setVerboseLogging(e)}error(e){this.onLogMessage({type:"error",message:`[File Watcher (${this.options.type})] ${e}`})}trace(e){this.onLogMessage({type:"trace",message:`[File Watcher (${this.options.type})] ${e}`})}dispose(){return this.watcher=void 0,super.dispose()}},rP=class extends oP{constructor(t,e,n){super(t,e,n,{type:"node.js",restartOnError:!1})}},iP=class extends oP{constructor(t,e,n){super(t,e,n,{type:"universal",restartOnError:!0})}};function rU(i){return i.map(t=>({type:t.type,resource:y.revive(t.resource),cId:t.cId}))}function a9(i){let t=new oU;for(let e of i)t.processEvent(e);return t.coalesce()}function iU(i,t){return typeof t=="string"&&!t.startsWith(Va)&&!cn(t)?{base:i,pattern:t}:t}function sU(i,t,e){let n=[];for(let o of t)n.push(Po(iU(i,o),{ignoreCase:e}));return n}var oU=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(t){return Xe?t.resource.fsPath:t.resource.fsPath.toLowerCase()}processEvent(t){let e=this.mapPathToChange.get(this.toKey(t)),n=!1;if(e){let o=e.type,r=t.type;e.resource.fsPath!==t.resource.fsPath&&(t.type===2||t.type===1)?n=!0:o===1&&r===2?(this.mapPathToChange.delete(this.toKey(t)),this.coalesced.delete(e)):o===2&&r===1?e.type=0:o===1&&r===0||(e.type=r)}else n=!0;n&&(this.coalesced.add(t),this.mapPathToChange.set(this.toKey(t),t))}coalesce(){let t=[],e=[];return Array.from(this.coalesced).filter(n=>n.type!==2?(t.push(n),!1):!0).sort((n,o)=>n.resource.fsPath.length-o.resource.fsPath.length).filter(n=>e.some(o=>JW(n.resource.fsPath,o,!Xe))?!1:(e.push(n.resource.fsPath),!0)).concat(t)}};function l9(i,t){if(typeof t=="number")switch(i.type){case 1:return(t&4)===0;case 2:return(t&8)===0;case 0:return(t&2)===0}return!1}function d9(i){if(typeof i=="number"){let t=[];return i&4&&t.push("Added"),i&8&&t.push("Deleted"),i&2&&t.push("Updated"),t.length===0?"<all>":`[${t.join(", ")}]`}return"<none>"}var aU=class{constructor(t,e,n,o,r,s,a,l){this.session=Math.random();this._onDidCreate=new T;this._onDidChange=new T;this._onDidDelete=new T;this._config=0,l.ignoreCreateEvents&&(this._config+=1),l.ignoreChangeEvents&&(this._config+=2),l.ignoreDeleteEvents&&(this._config+=4);let d=typeof a=="string"?!((n.getCapabilities(B.file)??0)&1024):n.extUri.ignorePathCasing(y.revive(a.baseUri)),c=a;d&&(c=typeof a=="string"?a.toLowerCase():{base:a.base.toLowerCase(),pattern:a.pattern.toLowerCase()});let u=Po(c,{ignoreCase:!1}),m=typeof a=="string",g=!1,h=s(f=>{if(!(typeof f.session=="number"&&f.session!==this.session)&&!(g&&typeof f.session>"u")){if(!l.ignoreCreateEvents)for(let{uri:I,lowerCaseFsPath:x}of f.created)u(d?x:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidCreate.fire(I);if(!l.ignoreChangeEvents)for(let{uri:I,lowerCaseFsPath:x}of f.changed)u(d?x:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidChange.fire(I);if(!l.ignoreDeleteEvents)for(let{uri:I,lowerCaseFsPath:x}of f.deleted)u(d?x:I.fsPath)&&(!m||o.getWorkspaceFolder(I))&&this._onDidDelete.fire(I)}});this._disposable=Se.from(this.ensureWatching(t,o,e,r,a,l,!1),this._onDidCreate,this._onDidChange,this._onDidDelete,h)}get ignoreCreateEvents(){return!!(this._config&1)}get ignoreChangeEvents(){return!!(this._config&2)}get ignoreDeleteEvents(){return!!(this._config&4)}ensureWatching(t,e,n,o,r,s,a){let l=Se.from();if(typeof r=="string"||s.ignoreChangeEvents&&s.ignoreCreateEvents&&s.ignoreDeleteEvents)return l;let d=t.getProxy(F.MainThreadFileSystemEventService),c=!1;(r.pattern.includes(Va)||r.pattern.includes(LC))&&(c=!0);let u=[],m,g;if(a)(s.ignoreChangeEvents||s.ignoreCreateEvents||s.ignoreDeleteEvents)&&(g=14,s.ignoreChangeEvents&&(g&=-3),s.ignoreCreateEvents&&(g&=-5),s.ignoreDeleteEvents&&(g&=-9));else if(c&&u.length===0){let h=e.getWorkspaceFolder(y.revive(r.baseUri)),f=n.getConfiguration("files",h).get("watcherExclude");if(f)for(let I in f)I&&f[I]===!0&&u.push(I)}else if(!c){let h=e.getWorkspaceFolder(y.revive(r.baseUri));if(h){let f=n.getConfiguration("files",h).get("watcherExclude");if(f){for(let I in f)if(I&&f[I]===!0){let x=`${vr(I,"/")}/${Va}`;m||(m=[]),m.push(iU(h.uri.fsPath,x))}}if(!m||m.length===0)return l}}return d.$watch(o.identifier.value,this.session,r.baseUri,{recursive:c,excludes:u,includes:m,filter:g},!!a),Se.from({dispose:()=>d.$unwatch(this.session)})}dispose(){this._disposable.dispose()}get onDidCreate(){return this._onDidCreate.event}get onDidChange(){return this._onDidChange.event}get onDidDelete(){return this._onDidDelete.event}},lU=class i{constructor(t){this._events=t;this._created=new mt(()=>this._events.created.map(i._revive));this._changed=new mt(()=>this._events.changed.map(i._revive));this._deleted=new mt(()=>this._events.deleted.map(i._revive));this.session=this._events.session}get created(){return this._created.value}get changed(){return this._changed.value}get deleted(){return this._deleted.value}static _revive(t){let e=y.revive(t);return{uri:e,lowerCaseFsPath:e.fsPath.toLowerCase()}}},aP=class{constructor(t,e,n){this._mainContext=t;this._logService=e;this._extHostDocumentsAndEditors=n;this._onFileSystemEvent=new T;this._onDidRenameFile=new T;this._onDidCreateFile=new T;this._onDidDeleteFile=new T;this._onWillRenameFile=new ms;this._onWillCreateFile=new ms;this._onWillDeleteFile=new ms;this.onDidRenameFile=this._onDidRenameFile.event;this.onDidCreateFile=this._onDidCreateFile.event;this.onDidDeleteFile=this._onDidDeleteFile.event}createFileSystemWatcher(t,e,n,o,r,s){return new aU(this._mainContext,e,n,t,o,this._onFileSystemEvent.event,Jo.from(r),s)}$onFileEvent(t){this._onFileSystemEvent.fire(new lU(t))}$onDidRunFileOperation(t,e){switch(t){case 2:this._onDidRenameFile.fire(Object.freeze({files:e.map(n=>({oldUri:y.revive(n.source),newUri:y.revive(n.target)}))}));break;case 1:this._onDidDeleteFile.fire(Object.freeze({files:e.map(n=>y.revive(n.target))}));break;case 0:case 3:this._onDidCreateFile.fire(Object.freeze({files:e.map(n=>y.revive(n.target))}));break;default:}}getOnWillRenameFileEvent(t){return this._createWillExecuteEvent(t,this._onWillRenameFile)}getOnWillCreateFileEvent(t){return this._createWillExecuteEvent(t,this._onWillCreateFile)}getOnWillDeleteFileEvent(t){return this._createWillExecuteEvent(t,this._onWillDeleteFile)}_createWillExecuteEvent(t,e){return(n,o,r)=>{let s=function(l){n.call(o,l)};return s.extension=t,e.event(s,void 0,r)}}async $onWillRunFileOperation(t,e,n,o){switch(t){case 2:return await this._fireWillEvent(this._onWillRenameFile,{files:e.map(r=>({oldUri:y.revive(r.source),newUri:y.revive(r.target)}))},n,o);case 1:return await this._fireWillEvent(this._onWillDeleteFile,{files:e.map(r=>y.revive(r.target))},n,o);case 0:case 3:return await this._fireWillEvent(this._onWillCreateFile,{files:e.map(r=>y.revive(r.target))},n,o)}}async _fireWillEvent(t,e,n,o){let r=new Set,s=[];if(await t.fireAsync(e,o,async(l,d)=>{let c=Date.now(),u=await Promise.resolve(l);u instanceof Dr&&(s.push([d.extension,u]),r.add(d.extension.displayName??d.extension.identifier.value)),Date.now()-c>n&&this._logService.warn("SLOW file-participant",d.extension.identifier)}),o.isCancellationRequested||s.length===0)return;let a={edits:[]};for(let[,l]of s){let{edits:d}=Io.from(l,{getTextDocumentVersion:c=>this._extHostDocumentsAndEditors.getDocument(c)?.version,getNotebookDocumentVersion:()=>{}});a.edits=a.edits.concat(d)}return{edit:a,extensionNames:Array.from(r)}}};var lP=class{constructor(t,e,n,o,r){this._extHostNotebooks=e;this._textDocumentsAndEditors=n;this._commands=o;let s=new Me("interactive.open","_interactive.open","Open interactive window and return notebook editor and input URI",[new oe("showOptions","Show Options",a=>!0,a=>a),new oe("resource","Interactive resource Uri",a=>!0,a=>a),new oe("controllerId","Notebook controller Id",a=>!0,a=>a),new oe("title","Interactive editor title",a=>!0,a=>a)],new Ae("Notebook and input URI",a=>{if(r.debug("[ExtHostInteractive] open iw with notebook editor id",a.notebookEditorId),a.notebookEditorId!==void 0){let l=this._extHostNotebooks.getEditorById(a.notebookEditorId);return r.debug("[ExtHostInteractive] notebook editor found",l.id),{notebookUri:y.revive(a.notebookUri),inputUri:y.revive(a.inputUri),notebookEditor:l.apiEditor}}return r.debug("[ExtHostInteractive] notebook editor not found, uris for the interactive document",a.notebookUri,a.inputUri),{notebookUri:y.revive(a.notebookUri),inputUri:y.revive(a.inputUri)}}));this._commands.registerApiCommand(s)}$willAddInteractiveDocument(t,e,n,o){this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({addedDocuments:[{EOL:e,lines:[""],languageId:n,uri:t,isDirty:!1,versionId:1,encoding:"utf8"}]})}$willRemoveInteractiveDocument(t,e){this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({removedDocuments:[t]})}};var dP=class{constructor(t){this._handlePool=0;this._proxy=t.getProxy(F.MainThreadLabelService)}$registerResourceLabelFormatter(t){let e=this._handlePool++;return this._proxy.$registerResourceLabelFormatter(e,t),q(()=>{this._proxy.$unregisterResourceLabelFormatter(e)})}};var cP=class i extends ze{constructor(t,e,n,o){super(t,e,n,o),this.selectionStartLineNumber=t,this.selectionStartColumn=e,this.positionLineNumber=n,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(t){return i.selectionsEqual(this,t)}static selectionsEqual(t,e){return t.selectionStartLineNumber===e.selectionStartLineNumber&&t.selectionStartColumn===e.selectionStartColumn&&t.positionLineNumber===e.positionLineNumber&&t.positionColumn===e.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(t,e){return this.getDirection()===0?new i(this.startLineNumber,this.startColumn,t,e):new i(t,e,this.startLineNumber,this.startColumn)}getPosition(){return new Un(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new Un(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(t,e){return this.getDirection()===0?new i(t,e,this.endLineNumber,this.endColumn):new i(this.endLineNumber,this.endColumn,t,e)}static fromPositions(t,e=t){return new i(t.lineNumber,t.column,e.lineNumber,e.column)}static fromRange(t,e){return e===0?new i(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):new i(t.endLineNumber,t.endColumn,t.startLineNumber,t.startColumn)}static liftSelection(t){return new i(t.selectionStartLineNumber,t.selectionStartColumn,t.positionLineNumber,t.positionColumn)}static selectionsArrEqual(t,e){if(t&&!e||!t&&e)return!1;if(!t&&!e)return!0;if(t.length!==e.length)return!1;for(let n=0,o=t.length;n<o;n++)if(!this.selectionsEqual(t[n],e[n]))return!1;return!0}static isISelection(t){return!!t&&typeof t.selectionStartLineNumber=="number"&&typeof t.selectionStartColumn=="number"&&typeof t.positionLineNumber=="number"&&typeof t.positionColumn=="number"}static createWithDirection(t,e,n,o,r){return r===0?new i(t,e,n,o):new i(n,o,t,e)}};var uP=class i{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentSymbols(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentSymbols(n,e);if(!iv(o))return o[0]instanceof $r?o.map(lL.from):i._asDocumentSymbolTree(o)}static _asDocumentSymbolTree(t){t=t.slice(0).sort((o,r)=>{let s=o.location.range.start.compareTo(r.location.range.start);return s===0&&(s=r.location.range.end.compareTo(o.location.range.end)),s});let e=[],n=[];for(let o of t){let r={name:o.name||"!!MISSING: name!!",kind:zr.from(o.kind),tags:o.tags?.map(ul.from)||[],detail:"",containerName:o.containerName,range:K.from(o.location.range),selectionRange:K.from(o.location.range),children:[]};for(;;){if(n.length===0){n.push(r),e.push(r);break}let s=n[n.length-1];if(ze.containsRange(s.range,r.range)&&!ze.equalsRange(s.range,r.range)){s.children?.push(r),n.push(r);break}n.pop()}}return e}},dh=class{constructor(t,e,n,o,r,s){this._documents=t;this._commands=e;this._provider=n;this._extension=o;this._extTelemetry=r;this._logService=s;this._cache=new Xo("CodeLens");this._disposables=new Map}async provideCodeLenses(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideCodeLenses(n,e);if(!o||e.isCancellationRequested)return;let r=this._cache.add(o),s=new $;this._disposables.set(r,s);let a={cacheId:r,lenses:[]};for(let l=0;l<o.length;l++){if(!ve.isRange(o[l].range)){console.warn("INVALID code lens, range is not defined",this._extension.identifier.value);continue}a.lenses.push({cacheId:[r,l],range:K.from(o[l].range),command:this._commands.toInternal(o[l].command,s)})}return a}async resolveCodeLens(t,e){let n=t.cacheId&&this._cache.get(...t.cacheId);if(!n)return;let o;if(typeof this._provider.resolveCodeLens!="function"||n.isResolved?o=n:o=await this._provider.resolveCodeLens(n,e),o||(o=n),e.isCancellationRequested)return;let r=t.cacheId&&this._disposables.get(t.cacheId[0]);if(r){if(!o.command){let s=new Error("INVALID code lens resolved, lacks command: "+this._extension.identifier.value);this._extTelemetry.onExtensionError(this._extension.identifier,s),this._logService.error(s);return}return t.command=this._commands.toInternal(o.command,r),t}}releaseCodeLenses(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}};function PP(i){return Array.isArray(i)?i.map(Lg.from):i?[Lg.from(i)]:[]}var pP=class{constructor(t,e){this._documents=t;this._provider=e}async provideDefinition(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideDefinition(o,r,n);return PP(s)}},mP=class{constructor(t,e){this._documents=t;this._provider=e}async provideDeclaration(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideDeclaration(o,r,n);return PP(s)}},gP=class{constructor(t,e){this._documents=t;this._provider=e}async provideImplementation(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideImplementation(o,r,n);return PP(s)}},fP=class{constructor(t,e){this._documents=t;this._provider=e}async provideTypeDefinition(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideTypeDefinition(o,r,n);return PP(s)}},mI=class i{constructor(t,e){this._documents=t;this._provider=e;this._hoverCounter=0;this._hoverMap=new Map}static{this.HOVER_MAP_MAX_SIZE=10}async provideHover(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e),a;if(n&&n.verbosityRequest){let u=n.verbosityRequest.previousHover.id,m=this._hoverMap.get(u);if(!m)throw new Error(`Hover with id ${u} not found`);let g={verbosityDelta:n.verbosityRequest.verbosityDelta,previousHover:m};a=await this._provider.provideHover(r,s,o,g)}else a=await this._provider.provideHover(r,s,o);if(!a||iv(a.contents))return;a.range||(a.range=r.getWordRangeAtPosition(s)),a.range||(a.range=new ve(s,s));let l=Og.from(a),d=this._hoverCounter;if(this._hoverMap.size===i.HOVER_MAP_MAX_SIZE){let u=Math.min(...this._hoverMap.keys());this._hoverMap.delete(u)}return this._hoverMap.set(d,a),this._hoverCounter+=1,{...l,id:d}}releaseHover(t){this._hoverMap.delete(t)}},hP=class{constructor(t,e){this._documents=t;this._provider=e}async provideEvaluatableExpression(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideEvaluatableExpression(o,r,n);if(s)return uL.from(s)}},vP=class{constructor(t,e){this._documents=t;this._provider=e}async provideInlineValues(t,e,n,o){let r=this._documents.getDocument(t),s=await this._provider.provideInlineValues(r,K.to(e),mb.to(n),o);if(Array.isArray(s))return s.map(a=>pb.from(a))}},yP=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentHighlights(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideDocumentHighlights(o,r,n);if(Array.isArray(s))return s.map(zu.from)}},bP=class{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}async provideMultiDocumentHighlights(t,e,n,o){let r=this._documents.getDocument(t),s=n.map(d=>{try{return this._documents.getDocument(d)}catch(c){this._logService.error("Error: Unable to retrieve document from URI: "+d+". Error message: "+c);return}}).filter(d=>d!==void 0),a=ht.to(e),l=await this._provider.provideMultiDocumentHighlights(r,a,s,o);if(Array.isArray(l))return l.map(pL.from)}},IP=class{constructor(t,e){this._documents=t;this._provider=e}async provideLinkedEditingRanges(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.provideLinkedEditingRanges(o,r,n);if(s&&Array.isArray(s.ranges))return{ranges:nt(s.ranges.map(K.from)),wordPattern:s.wordPattern}}},xP=class{constructor(t,e){this._documents=t;this._provider=e}async provideReferences(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e),a=await this._provider.provideReferences(r,s,n,o);if(Array.isArray(a))return a.map(bo.from)}},ch=class i{constructor(t,e,n,o,r,s,a){this._documents=t;this._commands=e;this._diagnostics=n;this._provider=o;this._logService=r;this._extension=s;this._apiDeprecation=a;this._cache=new Xo("CodeAction");this._disposables=new Map}static{this._maxCodeActionsPerFile=1e3}async provideCodeActions(t,e,n,o){let r=this._documents.getDocument(t),s=cP.isISelection(e)?Do.to(e):K.to(e),a=[];for(let g of this._diagnostics.getDiagnostics(t))if(s.intersection(g.range)&&a.push(g)>i._maxCodeActionsPerFile)break;let l={diagnostics:a,only:n.only?new Rt(n.only):void 0,triggerKind:TL.to(n.trigger)},d=await this._provider.provideCodeActions(r,s,l,o);if(!Ul(d)||o.isCancellationRequested)return;let c=this._cache.add(d),u=new $;this._disposables.set(c,u);let m=[];for(let g=0;g<d.length;g++){let h=d[g];if(h)if(i._isCommand(h)&&!(h instanceof Us))this._apiDeprecation.report("CodeActionProvider.provideCodeActions - return commands",this._extension,"Return 'CodeAction' instances instead."),m.push({_isSynthetic:!0,title:h.title,command:this._commands.toInternal(h,u)});else{let f=h;l.only&&(f.kind?l.only.contains(f.kind)||this._logService.warn(`${this._extension.identifier.value} - Code actions of kind '${l.only.value}' requested but returned code action is of kind '${f.kind.value}'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.`):this._logService.warn(`${this._extension.identifier.value} - Code actions of kind '${l.only.value}' requested but returned code action does not have a 'kind'. Code action will be dropped. Please set 'CodeAction.kind'.`));let I=f.ranges??[];m.push({cacheId:[c,g],title:f.title,command:f.command&&this._commands.toInternal(f.command,u),diagnostics:f.diagnostics&&f.diagnostics.map(ml.from),edit:f.edit&&Io.from(f.edit,void 0),kind:f.kind&&f.kind.value,isPreferred:f.isPreferred,isAI:Le(this._extension,"codeActionAI")?f.isAI:!1,ranges:Le(this._extension,"codeActionRanges")?nt(I.map(K.from)):void 0,disabled:f.disabled?.reason})}}return{cacheId:c,actions:m}}async resolveCodeAction(t,e){let[n,o]=t,r=this._cache.get(n,o);if(!r||i._isCommand(r))return{};if(!this._provider.resolveCodeAction)return{};let s=await this._provider.resolveCodeAction(r,e)??r,a;s.edit&&(a=Io.from(s.edit,void 0));let l;if(s.command){let d=this._disposables.get(n);d&&(l=this._commands.toInternal(s.command,d))}return{edit:a,command:l}}releaseCodeActions(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}static _isCommand(t){return typeof t.command=="string"&&typeof t.title=="string"}},yp=class{constructor(t,e,n,o,r){this._proxy=t;this._documents=e;this._provider=n;this._handle=o;this._extension=r;this._editsCache=new Xo("DocumentPasteEdit.edits")}async prepareDocumentPaste(t,e,n,o){if(!this._provider.prepareDocumentPaste)return;this._cachedPrepare=void 0;let r=this._documents.getDocument(t),s=e.map(u=>K.to(u)),a=Yu.toDataTransfer(n,()=>{throw new JI});if(await this._provider.prepareDocumentPaste(r,s,a,o),o.isCancellationRequested)return;let l=Array.from(a).filter(([,u])=>!(u instanceof Ld)),d=new Map,c=await Promise.all(Array.from(l,async([u,m])=>{let g=_e();return d.set(g,m),[u,await $u.from(u,m,g)]}));return this._cachedPrepare=d,{items:c}}async providePasteEdits(t,e,n,o,r,s){if(!this._provider.provideDocumentPasteEdits)return[];let a=this._documents.getDocument(e),l=n.map(g=>K.to(g)),d=o.items.map(([g,h])=>{let f=this._cachedPrepare?.get(h.id);return f?[g,f]:[g,$u.to(g,h,async I=>(await this._proxy.$resolvePasteFileData(this._handle,t,I)).buffer)]}),c=new mi(d),u=await this._provider.provideDocumentPasteEdits(a,l,c,{only:r.only?new gi(r.only):void 0,triggerKind:r.triggerKind},s);if(!u||s.isCancellationRequested)return[];let m=this._editsCache.add(u);return u.map((g,h)=>({_cacheId:[m,h],title:g.title??p(5881,null,this._extension.displayName||this._extension.name),kind:g.kind,yieldTo:g.yieldTo?.map(f=>f.value),insertText:typeof g.insertText=="string"?g.insertText:{snippet:g.insertText.value},additionalEdit:g.additionalEdit?Io.from(g.additionalEdit,void 0):void 0}))}async resolvePasteEdit(t,e){let[n,o]=t,r=this._editsCache.get(n,o);if(!r||!this._provider.resolveDocumentPasteEdit)return{};let s=await this._provider.resolveDocumentPasteEdit(r,e)??r;return{insertText:s.insertText,additionalEdit:s.additionalEdit?Io.from(s.additionalEdit,void 0):void 0}}releasePasteEdits(t){this._editsCache.delete(t)}},SP=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentFormattingEdits(t,e,n){let o=this._documents.getDocument(t),r=await this._provider.provideDocumentFormattingEdits(o,e,n);if(Array.isArray(r))return r.map(Mn.from)}},gI=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentRangeFormattingEdits(t,e,n,o){let r=this._documents.getDocument(t),s=K.to(e),a=await this._provider.provideDocumentRangeFormattingEdits(r,s,n,o);if(Array.isArray(a))return a.map(Mn.from)}async provideDocumentRangesFormattingEdits(t,e,n,o){Lp(typeof this._provider.provideDocumentRangesFormattingEdits=="function","INVALID invocation of `provideDocumentRangesFormattingEdits`");let r=this._documents.getDocument(t),s=e.map(K.to),a=await this._provider.provideDocumentRangesFormattingEdits(r,s,n,o);if(Array.isArray(a))return a.map(Mn.from)}},CP=class{constructor(t,e){this._documents=t;this._provider=e;this.autoFormatTriggerCharacters=[]}async provideOnTypeFormattingEdits(t,e,n,o,r){let s=this._documents.getDocument(t),a=ht.to(e),l=await this._provider.provideOnTypeFormattingEdits(s,a,n,o,r);if(Array.isArray(l))return l.map(Mn.from)}},uh=class{constructor(t,e){this._provider=t;this._logService=e;this._cache=new Xo("WorkspaceSymbols")}async provideWorkspaceSymbols(t,e){let n=await this._provider.provideWorkspaceSymbols(t,e);if(!Ul(n))return{symbols:[]};let o=this._cache.add(n),r={cacheId:o,symbols:[]};for(let s=0;s<n.length;s++){let a=n[s];if(!a||!a.name){this._logService.warn("INVALID SymbolInformation",a);continue}r.symbols.push({...Gd.from(a),cacheId:[o,s]})}return r}async resolveWorkspaceSymbol(t,e){if(typeof this._provider.resolveWorkspaceSymbol!="function"||!t.cacheId)return t;let n=this._cache.get(...t.cacheId);if(n){let o=await this._provider.resolveWorkspaceSymbol(n,e);return o&&or(t,Gd.from(o),!0)}}releaseWorkspaceSymbols(t){this._cache.delete(t)}},ph=class i{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}static supportsResolving(t){return typeof t.prepareRename=="function"}async provideRenameEdits(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e);try{let a=await this._provider.provideRenameEdits(r,s,n,o);return a?Io.from(a):void 0}catch(a){let l=i._asMessage(a);return l?{rejectReason:l,edits:void 0}:Promise.reject(a)}}async resolveRenameLocation(t,e,n){if(typeof this._provider.prepareRename!="function")return Promise.resolve(void 0);let o=this._documents.getDocument(t),r=ht.to(e);try{let s=await this._provider.prepareRename(o,r,n),a,l;if(ve.isRange(s)?(a=s,l=o.getText(s)):st(s)&&(a=s.range,l=s.placeholder),!a||!l)return;if(a.start.line>r.line||a.end.line<r.line){this._logService.warn("INVALID rename location: position line must be within range start/end lines");return}return{range:K.from(a),text:l}}catch(s){let a=i._asMessage(s);return a?{rejectReason:a,range:void 0,text:void 0}:Promise.reject(s)}}static _asMessage(t){return typeof t=="string"?t:t instanceof Error&&typeof t.message=="string"?t.message:void 0}},fI=class i{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}static{this.languageTriggerKindToVSCodeTriggerKind={0:0,1:1}}async supportsAutomaticNewSymbolNamesTriggerKind(){return this._provider.supportsAutomaticTriggerKind}async provideNewSymbolNames(t,e,n,o){let r=this._documents.getDocument(t),s=K.to(e);try{let a=i.languageTriggerKindToVSCodeTriggerKind[n],l=await this._provider.provideNewSymbolNames(r,s,a,o);return l?l.map(d=>typeof d=="string"?{newSymbolName:d}:{newSymbolName:d.newSymbolName,tags:d.tags}):void 0}catch(a){this._logService.error(i._asMessage(a)??JSON.stringify(a,null,"	"));return}}static _asMessage(t){return typeof t=="string"?t:t instanceof Error&&typeof t.message=="string"?t.message:void 0}},hI=class{constructor(t,e){this.resultId=t;this.tokens=e}},vI=class i{constructor(t,e){this._documents=t;this._provider=e;this._nextResultId=1;this._previousResults=new Map}async provideDocumentSemanticTokens(t,e,n){let o=this._documents.getDocument(t),r=e!==0?this._previousResults.get(e):null,s=typeof r?.resultId=="string"&&typeof this._provider.provideDocumentSemanticTokensEdits=="function"?await this._provider.provideDocumentSemanticTokensEdits(o,r.resultId,n):await this._provider.provideDocumentSemanticTokens(o,n);return r&&this._previousResults.delete(e),s?(s=i._fixProvidedSemanticTokens(s),this._send(i._convertToEdits(r,s),s)):null}async releaseDocumentSemanticColoring(t){this._previousResults.delete(t)}static _fixProvidedSemanticTokens(t){return i._isSemanticTokens(t)?i._isCorrectSemanticTokens(t)?t:new Qi(new Uint32Array(t.data),t.resultId):i._isSemanticTokensEdits(t)?i._isCorrectSemanticTokensEdits(t)?t:new Od(t.edits.map(e=>new rg(e.start,e.deleteCount,e.data?new Uint32Array(e.data):e.data)),t.resultId):t}static _isSemanticTokens(t){return t&&!!t.data}static _isCorrectSemanticTokens(t){return t.data instanceof Uint32Array}static _isSemanticTokensEdits(t){return t&&Array.isArray(t.edits)}static _isCorrectSemanticTokensEdits(t){for(let e of t.edits)if(!(e.data instanceof Uint32Array))return!1;return!0}static _convertToEdits(t,e){if(!i._isSemanticTokens(e)||!t||!t.tokens)return e;let n=t.tokens,o=n.length,r=e.data,s=r.length,a=0,l=Math.min(o,s);for(;a<l&&n[a]===r[a];)a++;if(a===o&&a===s)return new Od([],e.resultId);let d=0,c=l-a;for(;d<c&&n[o-d-1]===r[s-d-1];)d++;return new Od([{start:a,deleteCount:o-a-d,data:r.subarray(a,s-d)}],e.resultId)}_send(t,e){if(i._isSemanticTokens(t)){let n=this._nextResultId++;return this._previousResults.set(n,new hI(t.resultId,t.data)),Dk({id:n,type:"full",data:t.data})}if(i._isSemanticTokensEdits(t)){let n=this._nextResultId++;return i._isSemanticTokens(e)?this._previousResults.set(n,new hI(e.resultId,e.data)):this._previousResults.set(n,new hI(t.resultId)),Dk({id:n,type:"delta",deltas:(t.edits||[]).map(o=>({start:o.start,deleteCount:o.deleteCount,data:o.data}))})}return null}},TP=class{constructor(t,e){this._documents=t;this._provider=e}async provideDocumentRangeSemanticTokens(t,e,n){let o=this._documents.getDocument(t),r=await this._provider.provideDocumentRangeSemanticTokens(o,K.to(e),n);return r?this._send(r):null}_send(t){return Dk({id:0,type:"full",data:t.data})}},bp=class i{constructor(t,e,n,o,r){this._documents=t;this._commands=e;this._provider=n;this._apiDeprecation=o;this._extension=r;this._cache=new Xo("CompletionItem");this._disposables=new Map}static supportsResolving(t){return typeof t.resolveCompletionItem=="function"}async provideCompletionItems(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e),a=r.getWordRangeAtPosition(s)||new ve(s,s),l=a.with({end:s}),d=new Xt,c=await this._provider.provideCompletionItems(r,s,o,mL.to(n));if(!c||o.isCancellationRequested)return;let u=Array.isArray(c)?new Bi(c):c,m=i.supportsResolving(this._provider)?this._cache.add(u.items):this._cache.add([]),g=new $;this._disposables.set(m,g);let h=[],f={x:m,b:h,a:{replace:K.from(a),insert:K.from(l)},c:u.isIncomplete||void 0,d:d.elapsed()};for(let I=0;I<u.items.length;I++){let x=u.items[I],E=this._convertCompletionItem(x,[m,I],l,a);h.push(E)}return f}async resolveCompletionItem(t,e){if(typeof this._provider.resolveCompletionItem!="function")return;let n=this._cache.get(...t);if(!n)return;let o=this._convertCompletionItem(n,t),r=await this._provider.resolveCompletionItem(n,e);if(!r)return;let s=this._convertCompletionItem(r,t);return(o.h!==s.h||o.i!==s.i)&&this._apiDeprecation.report("CompletionItem.insertText",this._extension,"extension MAY NOT change 'insertText' of a CompletionItem during resolve"),(o.n!==s.n||o.o!==s.o||!Et(o.p,s.p))&&this._apiDeprecation.report("CompletionItem.command",this._extension,"extension MAY NOT change 'command' of a CompletionItem during resolve"),{...o,d:s.d,c:s.c,l:s.l,h:s.h,i:s.i,n:s.n,o:s.o,p:s.p}}releaseCompletionItems(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}_convertCompletionItem(t,e,n,o){let r=this._disposables.get(e[0]);if(!r)throw Error("DisposableStore is missing...");let s=this._commands.toInternal(t.command,r),a={x:e,a:t.label,b:t.kind!==void 0?zE.from(t.kind):void 0,m:t.tags&&t.tags.map($E.from),c:t.detail,d:typeof t.documentation>"u"?void 0:fe.fromStrict(t.documentation),e:t.sortText!==t.label?t.sortText:void 0,f:t.filterText!==t.label?t.filterText:void 0,g:t.preselect||void 0,i:t.keepWhitespace?1:0,k:t.commitCharacters?.join(""),l:t.additionalTextEdits&&t.additionalTextEdits.map(Mn.from),n:s?.$ident,o:s?.id,p:s?.$ident?void 0:s?.arguments};t.textEdit?(this._apiDeprecation.report("CompletionItem.textEdit",this._extension,"Use 'CompletionItem.insertText' and 'CompletionItem.range' instead."),a.h=t.textEdit.newText):typeof t.insertText=="string"?a.h=t.insertText:t.insertText instanceof ro&&(a.h=t.insertText.value,a.i|=4);let l;return t.textEdit?l=t.textEdit.range:t.range&&(l=t.range),ve.isRange(l)?a.j=K.from(l):l&&(!n?.isEqual(l.inserting)||!o?.isEqual(l.replacing))&&(a.j={insert:K.from(l.inserting),replace:K.from(l.replacing)}),a}},os=class{constructor(t,e,n,o){this._extension=t;this._documents=e;this._provider=n;this._commands=o;this._references=new dU;this.languageTriggerKindToVSCodeTriggerKind={0:1,1:0};this._isAdditionsProposedApiEnabled=Le(this._extension,"inlineCompletionsAdditions")}get supportsHandleEvents(){return Le(this._extension,"inlineCompletionsAdditions")&&(typeof this._provider.handleDidShowCompletionItem=="function"||typeof this._provider.handleDidPartiallyAcceptCompletionItem=="function"||typeof this._provider.handleDidRejectCompletionItem=="function"||typeof this._provider.handleEndOfLifetime=="function")}get supportsSetModelId(){return Le(this._extension,"inlineCompletionsAdditions")&&typeof this._provider.setCurrentModelId=="function"}get supportsSetProviderOption(){return Le(this._extension,"inlineCompletionsAdditions")&&typeof this._provider.setProviderOptionValue=="function"}get modelInfo(){if(this._isAdditionsProposedApiEnabled)return this._provider.modelInfo?{models:this._provider.modelInfo.models,currentModelId:this._provider.modelInfo.currentModelId}:void 0}setCurrentModelId(t){this._isAdditionsProposedApiEnabled&&this._provider.setCurrentModelId?.(t)}get providerOptions(){if(this._isAdditionsProposedApiEnabled)return this._provider.providerOptions?.map(t=>({id:t.id,label:t.label,values:t.values.map(e=>({id:e.id,label:e.label})),currentValueId:t.currentValueId}))}setProviderOption(t,e){this._isAdditionsProposedApiEnabled&&this._provider.setProviderOptionValue?.(t,e)}async provideInlineCompletions(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e),a=await this._provider.provideInlineCompletionItems(r,s,{selectedCompletionInfo:n.selectedSuggestionInfo?{range:K.to(n.selectedSuggestionInfo.range),text:n.selectedSuggestionInfo.text}:void 0,triggerKind:this.languageTriggerKindToVSCodeTriggerKind[n.triggerKind],requestUuid:n.requestUuid,requestIssuedDateTime:n.requestIssuedDateTime,earliestShownDateTime:n.earliestShownDateTime,changeHint:n.changeHint},o);if(!a)return;let{resultItems:l,list:d}=Array.isArray(a)?{resultItems:a,list:void 0}:{resultItems:a.items,list:a},c=this._isAdditionsProposedApiEnabled?Array.isArray(a)?[]:a.commands||[]:[],u=this._isAdditionsProposedApiEnabled&&!Array.isArray(a)?a.enableForwardStability:void 0,m,g=this._references.createReferenceId({dispose(){m?.dispose()},items:l,list:d});return{pid:g,languageId:r.languageId,items:l.map((f,I)=>{let x;f.command&&(m||(m=new $),x=this._commands.toInternal(f.command,m));let E;f.action&&(m||(m=new $),E=this._commands.toInternal(f.action,m));let w=f.insertText;return{insertText:w===void 0?void 0:typeof w=="string"?w:{snippet:w.value},range:f.range?K.from(f.range):void 0,showRange:this._isAdditionsProposedApiEnabled&&f.showRange?K.from(f.showRange):void 0,command:x,gutterMenuLinkAction:E,pid:g,idx:I,completeBracketPairs:this._isAdditionsProposedApiEnabled?f.completeBracketPairs:!1,isInlineEdit:this._isAdditionsProposedApiEnabled?f.isInlineEdit:!1,showInlineEditMenu:this._isAdditionsProposedApiEnabled?f.showInlineEditMenu:!1,hint:f.displayLocation&&this._isAdditionsProposedApiEnabled?{range:K.from(f.displayLocation.range),content:f.displayLocation.label,style:f.displayLocation.kind?AL.from(f.displayLocation.kind):1}:void 0,warning:f.warning&&this._isAdditionsProposedApiEnabled?{message:fe.from(f.warning.message),icon:f.warning.icon?Xi.fromThemeIcon(f.warning.icon):void 0}:void 0,correlationId:this._isAdditionsProposedApiEnabled?f.correlationId:void 0,suggestionId:void 0,uri:this._isAdditionsProposedApiEnabled&&f.uri?f.uri:void 0,supportsRename:this._isAdditionsProposedApiEnabled?f.supportsRename:!1,jumpToPosition:this._isAdditionsProposedApiEnabled&&f.jumpToPosition?ht.from(f.jumpToPosition):void 0}}),commands:c.map(f=>(m||(m=new $),gL.from(f,this._commands,m))),suppressSuggestions:!1,enableForwardStability:u}}disposeCompletions(t,e){let n=this._references.get(t);if(this._provider.handleListEndOfLifetime&&this._isAdditionsProposedApiEnabled&&n?.list){let r=function(s){switch(s.kind){case"lostRace":return{kind:3};case"tokenCancellation":return{kind:2};case"other":return{kind:0};case"empty":return{kind:1};case"notTaken":return{kind:4};default:return{kind:0}}};this._provider.handleListEndOfLifetime(n.list,r(e))}this._references.disposeReferenceId(t)?.dispose()}handleDidShowCompletionItem(t,e,n){let o=this._references.get(t)?.items[e];o&&this._provider.handleDidShowCompletionItem&&this._isAdditionsProposedApiEnabled&&this._provider.handleDidShowCompletionItem(o,n)}handlePartialAccept(t,e,n,o){let r=this._references.get(t)?.items[e];r&&this._provider.handleDidPartiallyAcceptCompletionItem&&this._isAdditionsProposedApiEnabled&&(this._provider.handleDidPartiallyAcceptCompletionItem(r,n),this._provider.handleDidPartiallyAcceptCompletionItem(r,RL.to(o)))}handleEndOfLifetime(t,e,n){let o=this._references.get(t)?.items[e];if(o&&this._provider.handleEndOfLifetime&&this._isAdditionsProposedApiEnabled){let r=DL.to(n,s=>this._references.get(s.pid)?.items[s.idx]);this._provider.handleEndOfLifetime(o,r)}}handleRejection(t,e){let n=this._references.get(t)?.items[e];n&&this._provider.handleDidRejectCompletionItem&&this._isAdditionsProposedApiEnabled&&this._provider.handleDidRejectCompletionItem(n)}},dU=class{constructor(){this._references=new Map;this._idPool=1}createReferenceId(t){let e=this._idPool++;return this._references.set(e,t),e}disposeReferenceId(t){let e=this._references.get(t);return this._references.delete(t),e}get(t){return this._references.get(t)}},yI=class{constructor(t,e){this._documents=t;this._provider=e;this._cache=new Xo("SignatureHelp")}async provideSignatureHelp(t,e,n,o){let r=this._documents.getDocument(t),s=ht.to(e),a=this.reviveContext(n),l=await this._provider.provideSignatureHelp(r,s,o,a);if(l){let d=this._cache.add([l]);return{...Ng.from(l),id:d}}}reviveContext(t){let e;if(t.activeSignatureHelp){let n=Ng.to(t.activeSignatureHelp),o=this._cache.get(t.activeSignatureHelp.id,0);o?(e=o,e.activeSignature=n.activeSignature,e.activeParameter=n.activeParameter):e=n}return{...t,activeSignatureHelp:e}}releaseSignatureHelp(t){this._cache.delete(t)}},mh=class{constructor(t,e,n,o,r){this._documents=t;this._commands=e;this._provider=n;this._logService=o;this._extension=r;this._cache=new Xo("InlayHints");this._disposables=new Map}async provideInlayHints(t,e,n){let o=this._documents.getDocument(t),r=K.to(e),s=await this._provider.provideInlayHints(o,r,n);if(!Array.isArray(s)||s.length===0){this._logService.trace(`[InlayHints] NO inlay hints from '${this._extension.identifier.value}' for range ${JSON.stringify(e)}`);return}if(n.isCancellationRequested)return;let a=this._cache.add(s);this._disposables.set(a,new $);let l={hints:[],cacheId:a};for(let d=0;d<s.length;d++)this._isValidInlayHint(s[d],r)&&l.hints.push(this._convertInlayHint(s[d],[a,d]));return this._logService.trace(`[InlayHints] ${l.hints.length} inlay hints from '${this._extension.identifier.value}' for range ${JSON.stringify(e)}`),l}async resolveInlayHint(t,e){if(typeof this._provider.resolveInlayHint!="function")return;let n=this._cache.get(...t);if(!n)return;let o=await this._provider.resolveInlayHint(n,e);if(o&&this._isValidInlayHint(o))return this._convertInlayHint(o,t)}releaseHints(t){this._disposables.get(t)?.dispose(),this._disposables.delete(t),this._cache.delete(t)}_isValidInlayHint(t,e){return t.label.length===0||Array.isArray(t.label)&&t.label.every(n=>n.value.length===0)?(console.log("INVALID inlay hint, empty label",t),!1):!(e&&!e.contains(t.position))}_convertInlayHint(t,e){let n=this._disposables.get(e[0]);if(!n)throw Error("DisposableStore is missing...");let o={label:"",cacheId:e,tooltip:fe.fromStrict(t.tooltip),position:ht.from(t.position),textEdits:t.textEdits&&t.textEdits.map(Mn.from),kind:t.kind&&qE.from(t.kind),paddingLeft:t.paddingLeft,paddingRight:t.paddingRight};if(typeof t.label=="string")o.label=t.label;else{let r=[];o.label=r;for(let s of t.label){if(!s.value){console.warn("INVALID inlay hint, empty label part",this._extension.identifier.value);continue}let a={label:s.value,tooltip:fe.fromStrict(s.tooltip)};rn.isLocation(s.location)&&(a.location=bo.from(s.location)),s.command&&(a.command=this._commands.toInternal(s.command,n)),r.push(a)}}return o}},gh=class i{constructor(t,e){this._documents=t;this._provider=e;this._cache=new Xo("DocumentLink")}async provideLinks(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentLinks(n,e);if(!(!Array.isArray(o)||o.length===0)&&!e.isCancellationRequested){if(typeof this._provider.resolveDocumentLink!="function")return{links:o.filter(i._validateLink).map(fl.from)};{let r=this._cache.add(o),s={links:[],cacheId:r};for(let a=0;a<o.length;a++){if(!i._validateLink(o[a]))continue;let l=fl.from(o[a]);l.cacheId=[r,a],s.links.push(l)}return s}}}static _validateLink(t){return t.target&&t.target.path.length>5e4?(console.warn("DROPPING link because it is too long"),!1):!0}async resolveLink(t,e){if(typeof this._provider.resolveDocumentLink!="function")return;let n=this._cache.get(...t);if(!n)return;let o=await this._provider.resolveDocumentLink(n,e);if(!(!o||!i._validateLink(o)))return fl.from(o)}releaseLinks(t){this._cache.delete(t)}},bI=class{constructor(t,e){this._documents=t;this._provider=e}async provideColors(t,e){let n=this._documents.getDocument(t),o=await this._provider.provideDocumentColors(n,e);return Array.isArray(o)?o.map(s=>({color:Qu.from(s.color),range:K.from(s.range)})):[]}async provideColorPresentations(t,e,n){let o=this._documents.getDocument(t),r=K.to(e.range),s=Qu.to(e.color),a=await this._provider.provideColorPresentations(s,{document:o,range:r},n);if(Array.isArray(a))return a.map(gb.from)}},EP=class{constructor(t,e){this._documents=t;this._provider=e}async provideFoldingRanges(t,e,n){let o=this._documents.getDocument(t),r=await this._provider.provideFoldingRanges(o,e,n);if(Array.isArray(r))return r.map(hb.from)}},wP=class{constructor(t,e,n){this._documents=t;this._provider=e;this._logService=n}async provideSelectionRanges(t,e,n){let o=this._documents.getDocument(t),r=e.map(ht.to),s=await this._provider.provideSelectionRanges(o,r,n);if(!Ul(s))return[];if(s.length!==r.length)return this._logService.warn("BAD selection ranges, provider must return ranges for each position"),[];let a=[];for(let l=0;l<r.length;l++){let d=[];a.push(d);let c=r[l],u=s[l];for(;;){if(!u.range.contains(c))throw new Error("INVALID selection range, must contain the previous range");if(d.push(vL.from(u)),!u.parent)break;c=u.range,u=u.parent}}return a}},Ip=class{constructor(t,e){this._documents=t;this._provider=e;this._idPool=new uc("");this._cache=new Map}async prepareSession(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.prepareCallHierarchy(o,r,n);if(!s)return;let a=this._idPool.nextId();return this._cache.set(a,new Map),Array.isArray(s)?s.map(l=>this._cacheAndConvertItem(a,l)):[this._cacheAndConvertItem(a,s)]}async provideCallsTo(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing call hierarchy item");let r=await this._provider.provideCallHierarchyIncomingCalls(o,n);if(r)return r.map(s=>({from:this._cacheAndConvertItem(t,s.from),fromRanges:s.fromRanges.map(a=>K.from(a))}))}async provideCallsFrom(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing call hierarchy item");let r=await this._provider.provideCallHierarchyOutgoingCalls(o,n);if(r)return r.map(s=>({to:this._cacheAndConvertItem(t,s.to),fromRanges:s.fromRanges.map(a=>K.from(a))}))}releaseSession(t){this._cache.delete(t)}_cacheAndConvertItem(t,e){let n=this._cache.get(t),o=gl.from(e,t,n.size.toString(36));return n.set(o._itemId,e),o}_itemFromCache(t,e){return this._cache.get(t)?.get(e)}},xp=class{constructor(t,e){this._documents=t;this._provider=e;this._idPool=new uc("");this._cache=new Map}async prepareSession(t,e,n){let o=this._documents.getDocument(t),r=ht.to(e),s=await this._provider.prepareTypeHierarchy(o,r,n);if(!s)return;let a=this._idPool.nextId();return this._cache.set(a,new Map),Array.isArray(s)?s.map(l=>this._cacheAndConvertItem(a,l)):[this._cacheAndConvertItem(a,s)]}async provideSupertypes(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing type hierarchy item");let r=await this._provider.provideTypeHierarchySupertypes(o,n);if(r)return r.map(s=>this._cacheAndConvertItem(t,s))}async provideSubtypes(t,e,n){let o=this._itemFromCache(t,e);if(!o)throw new Error("missing type hierarchy item");let r=await this._provider.provideTypeHierarchySubtypes(o,n);if(r)return r.map(s=>this._cacheAndConvertItem(t,s))}releaseSession(t){this._cache.delete(t)}_cacheAndConvertItem(t,e){let n=this._cache.get(t),o=hl.from(e,t,n.size.toString(36));return n.set(o._itemId,e),o}_itemFromCache(t,e){return this._cache.get(t)?.get(e)}},fh=class{constructor(t,e,n,o,r){this._proxy=t;this._documents=e;this._provider=n;this._handle=o;this._extension=r;this._cache=new Xo("DocumentDropEdit")}async provideDocumentOnDropEdits(t,e,n,o,r){let s=this._documents.getDocument(e),a=ht.to(n),l=Yu.toDataTransfer(o,async m=>(await this._proxy.$resolveDocumentOnDropFileData(this._handle,t,m)).buffer),d=await this._provider.provideDocumentDropEdits(s,a,l,r);if(!d)return;let c=On(d),u=this._cache.add(c);return c.map((m,g)=>({_cacheId:[u,g],title:m.title??p(5880,null,this._extension.displayName||this._extension.name),kind:m.kind?.value,yieldTo:m.yieldTo?.map(h=>h.value),insertText:typeof m.insertText=="string"?m.insertText:{snippet:m.insertText.value},additionalEdit:m.additionalEdit?Io.from(m.additionalEdit,void 0):void 0}))}async resolveDropEdit(t,e){let[n,o]=t,r=this._cache.get(n,o);if(!r||!this._provider.resolveDocumentDropEdit)return{};let s=await this._provider.resolveDocumentDropEdit(r,e)??r;return{additionalEdit:s.additionalEdit?Io.from(s.additionalEdit,void 0):void 0}}releaseDropEdits(t){this._cache.delete(t)}},Sp=class{constructor(t,e){this.adapter=t;this.extension=e}},kP=class i extends N{constructor(e,n,o,r,s,a,l,d){super();this._uriTransformer=n;this._documents=o;this._commands=r;this._diagnostics=s;this._logService=a;this._apiDeprecation=l;this._extensionTelemetry=d;this._adapter=new Map;this._onDidChangeInlineCompletionsUnificationState=this._register(new T);this.onDidChangeInlineCompletionsUnificationState=this._onDidChangeInlineCompletionsUnificationState.event;this._proxy=e.getProxy(F.MainThreadLanguageFeatures),this._inlineCompletionsUnificationState={codeUnification:!1,modelUnification:!1,extensionUnification:!1,expAssignments:[]}}static{this._handlePool=0}get inlineCompletionsUnificationState(){return this._inlineCompletionsUnificationState}_transformDocumentSelector(e,n){return Zs.from(e,this._uriTransformer,n)}_createDisposable(e){return new Se(()=>{this._adapter.delete(e),this._proxy.$unregister(e)})}_nextHandle(){return i._handlePool++}async _withAdapter(e,n,o,r,s,a=!1){let l=this._adapter.get(e);if(!l||!(l.adapter instanceof n))return r;let d=Date.now();a||this._logService.trace(`[${l.extension.identifier.value}] INVOKE provider '${o.toString().replace(/[\r\n]/g,"")}'`);let c=o(l.adapter,l.extension);return Promise.resolve(c).catch(u=>{Yt(u)||(this._logService.error(`[${l.extension.identifier.value}] provider FAILED`),this._logService.error(u),this._extensionTelemetry.onExtensionError(l.extension.identifier,u))}).finally(()=>{a||this._logService.trace(`[${l.extension.identifier.value}] provider DONE after ${Date.now()-d}ms`)}),pe.isCancellationToken(s)?ri(c,s):c}_addNewAdapter(e,n){let o=this._nextHandle();return this._adapter.set(o,new Sp(e,n)),o}static _extLabel(e){return e.displayName||e.name}static _extId(e){return e.identifier.value}registerDocumentSymbolProvider(e,n,o,r){let s=this._addNewAdapter(new uP(this._documents,o),e),a=r&&r.label||i._extLabel(e);return this._proxy.$registerDocumentSymbolProvider(s,this._transformDocumentSelector(n,e),a),this._createDisposable(s)}$provideDocumentSymbols(e,n,o){return this._withAdapter(e,uP,r=>r.provideDocumentSymbols(y.revive(n),o),void 0,o)}registerCodeLensProvider(e,n,o){let r=this._nextHandle(),s=typeof o.onDidChangeCodeLenses=="function"?this._nextHandle():void 0;this._adapter.set(r,new Sp(new dh(this._documents,this._commands.converter,o,e,this._extensionTelemetry,this._logService),e)),this._proxy.$registerCodeLensSupport(r,this._transformDocumentSelector(n,e),s);let a=this._createDisposable(r);if(s!==void 0){let l=o.onDidChangeCodeLenses(d=>this._proxy.$emitCodeLensEvent(s));a=Se.from(a,l)}return a}$provideCodeLenses(e,n,o){return this._withAdapter(e,dh,r=>r.provideCodeLenses(y.revive(n),o),void 0,o,n.scheme==="output")}$resolveCodeLens(e,n,o){return this._withAdapter(e,dh,r=>r.resolveCodeLens(n,o),void 0,void 0,!0)}$releaseCodeLenses(e,n){this._withAdapter(e,dh,o=>Promise.resolve(o.releaseCodeLenses(n)),void 0,void 0,!0)}registerDefinitionProvider(e,n,o){let r=this._addNewAdapter(new pP(this._documents,o),e);return this._proxy.$registerDefinitionSupport(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideDefinition(e,n,o,r){return this._withAdapter(e,pP,s=>s.provideDefinition(y.revive(n),o,r),[],r)}registerDeclarationProvider(e,n,o){let r=this._addNewAdapter(new mP(this._documents,o),e);return this._proxy.$registerDeclarationSupport(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideDeclaration(e,n,o,r){return this._withAdapter(e,mP,s=>s.provideDeclaration(y.revive(n),o,r),[],r)}registerImplementationProvider(e,n,o){let r=this._addNewAdapter(new gP(this._documents,o),e);return this._proxy.$registerImplementationSupport(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideImplementation(e,n,o,r){return this._withAdapter(e,gP,s=>s.provideImplementation(y.revive(n),o,r),[],r)}registerTypeDefinitionProvider(e,n,o){let r=this._addNewAdapter(new fP(this._documents,o),e);return this._proxy.$registerTypeDefinitionSupport(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideTypeDefinition(e,n,o,r){return this._withAdapter(e,fP,s=>s.provideTypeDefinition(y.revive(n),o,r),[],r)}registerHoverProvider(e,n,o,r){let s=this._addNewAdapter(new mI(this._documents,o),e);return this._proxy.$registerHoverProvider(s,this._transformDocumentSelector(n,e)),this._createDisposable(s)}$provideHover(e,n,o,r,s){return this._withAdapter(e,mI,a=>a.provideHover(y.revive(n),o,r,s),void 0,s)}$releaseHover(e,n){this._withAdapter(e,mI,o=>Promise.resolve(o.releaseHover(n)),void 0,void 0)}registerEvaluatableExpressionProvider(e,n,o,r){let s=this._addNewAdapter(new hP(this._documents,o),e);return this._proxy.$registerEvaluatableExpressionProvider(s,this._transformDocumentSelector(n,e)),this._createDisposable(s)}$provideEvaluatableExpression(e,n,o,r){return this._withAdapter(e,hP,s=>s.provideEvaluatableExpression(y.revive(n),o,r),void 0,r)}registerInlineValuesProvider(e,n,o,r){let s=typeof o.onDidChangeInlineValues=="function"?this._nextHandle():void 0,a=this._addNewAdapter(new vP(this._documents,o),e);this._proxy.$registerInlineValuesProvider(a,this._transformDocumentSelector(n,e),s);let l=this._createDisposable(a);if(s!==void 0){let d=o.onDidChangeInlineValues(c=>this._proxy.$emitInlineValuesEvent(s));l=Se.from(l,d)}return l}$provideInlineValues(e,n,o,r,s){return this._withAdapter(e,vP,a=>a.provideInlineValues(y.revive(n),o,r,s),void 0,s)}registerDocumentHighlightProvider(e,n,o){let r=this._addNewAdapter(new yP(this._documents,o),e);return this._proxy.$registerDocumentHighlightProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}registerMultiDocumentHighlightProvider(e,n,o){let r=this._addNewAdapter(new bP(this._documents,o,this._logService),e);return this._proxy.$registerMultiDocumentHighlightProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideDocumentHighlights(e,n,o,r){return this._withAdapter(e,yP,s=>s.provideDocumentHighlights(y.revive(n),o,r),void 0,r)}$provideMultiDocumentHighlights(e,n,o,r,s){return this._withAdapter(e,bP,a=>a.provideMultiDocumentHighlights(y.revive(n),o,r.map(l=>y.revive(l)),s),void 0,s)}registerLinkedEditingRangeProvider(e,n,o){let r=this._addNewAdapter(new IP(this._documents,o),e);return this._proxy.$registerLinkedEditingRangeProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideLinkedEditingRanges(e,n,o,r){return this._withAdapter(e,IP,async s=>{let a=await s.provideLinkedEditingRanges(y.revive(n),o,r);if(a)return{ranges:a.ranges,wordPattern:a.wordPattern?i._serializeRegExp(a.wordPattern):void 0}},void 0,r)}registerReferenceProvider(e,n,o){let r=this._addNewAdapter(new xP(this._documents,o),e);return this._proxy.$registerReferenceSupport(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideReferences(e,n,o,r,s){return this._withAdapter(e,xP,a=>a.provideReferences(y.revive(n),o,r,s),void 0,s)}registerCodeActionProvider(e,n,o,r){let s=new $,a=this._addNewAdapter(new ch(this._documents,this._commands.converter,this._diagnostics,o,this._logService,e,this._apiDeprecation),e);return this._proxy.$registerCodeActionSupport(a,this._transformDocumentSelector(n,e),{providedKinds:r?.providedCodeActionKinds?.map(l=>l.value),documentation:r?.documentation?.map(l=>({kind:l.kind.value,command:this._commands.converter.toInternal(l.command,s)}))},i._extLabel(e),i._extId(e),!!o.resolveCodeAction),s.add(this._createDisposable(a)),s}$provideCodeActions(e,n,o,r,s){return this._withAdapter(e,ch,a=>a.provideCodeActions(y.revive(n),o,r,s),void 0,s)}$resolveCodeAction(e,n,o){return this._withAdapter(e,ch,r=>r.resolveCodeAction(n,o),{},void 0)}$releaseCodeActions(e,n){this._withAdapter(e,ch,o=>Promise.resolve(o.releaseCodeActions(n)),void 0,void 0)}registerDocumentFormattingEditProvider(e,n,o){let r=this._addNewAdapter(new SP(this._documents,o),e);return this._proxy.$registerDocumentFormattingSupport(r,this._transformDocumentSelector(n,e),e.identifier,e.displayName||e.name),this._createDisposable(r)}$provideDocumentFormattingEdits(e,n,o,r){return this._withAdapter(e,SP,s=>s.provideDocumentFormattingEdits(y.revive(n),o,r),void 0,r)}registerDocumentRangeFormattingEditProvider(e,n,o){let r=typeof o.provideDocumentRangesFormattingEdits=="function",s=this._addNewAdapter(new gI(this._documents,o),e);return this._proxy.$registerRangeFormattingSupport(s,this._transformDocumentSelector(n,e),e.identifier,e.displayName||e.name,r),this._createDisposable(s)}$provideDocumentRangeFormattingEdits(e,n,o,r,s){return this._withAdapter(e,gI,a=>a.provideDocumentRangeFormattingEdits(y.revive(n),o,r,s),void 0,s)}$provideDocumentRangesFormattingEdits(e,n,o,r,s){return this._withAdapter(e,gI,a=>a.provideDocumentRangesFormattingEdits(y.revive(n),o,r,s),void 0,s)}registerOnTypeFormattingEditProvider(e,n,o,r){let s=this._addNewAdapter(new CP(this._documents,o),e);return this._proxy.$registerOnTypeFormattingSupport(s,this._transformDocumentSelector(n,e),r,e.identifier),this._createDisposable(s)}$provideOnTypeFormattingEdits(e,n,o,r,s,a){return this._withAdapter(e,CP,l=>l.provideOnTypeFormattingEdits(y.revive(n),o,r,s,a),void 0,a)}registerWorkspaceSymbolProvider(e,n){let o=this._addNewAdapter(new uh(n,this._logService),e);return this._proxy.$registerNavigateTypeSupport(o,typeof n.resolveWorkspaceSymbol=="function"),this._createDisposable(o)}$provideWorkspaceSymbols(e,n,o){return this._withAdapter(e,uh,r=>r.provideWorkspaceSymbols(n,o),{symbols:[]},o)}$resolveWorkspaceSymbol(e,n,o){return this._withAdapter(e,uh,r=>r.resolveWorkspaceSymbol(n,o),void 0,void 0)}$releaseWorkspaceSymbols(e,n){this._withAdapter(e,uh,o=>o.releaseWorkspaceSymbols(n),void 0,void 0)}registerRenameProvider(e,n,o){let r=this._addNewAdapter(new ph(this._documents,o,this._logService),e);return this._proxy.$registerRenameSupport(r,this._transformDocumentSelector(n,e),ph.supportsResolving(o)),this._createDisposable(r)}$provideRenameEdits(e,n,o,r,s){return this._withAdapter(e,ph,a=>a.provideRenameEdits(y.revive(n),o,r,s),void 0,s)}$resolveRenameLocation(e,n,o,r){return this._withAdapter(e,ph,s=>s.resolveRenameLocation(y.revive(n),o,r),void 0,r)}registerNewSymbolNamesProvider(e,n,o){let r=this._addNewAdapter(new fI(this._documents,o,this._logService),e);return this._proxy.$registerNewSymbolNamesProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$supportsAutomaticNewSymbolNamesTriggerKind(e){return this._withAdapter(e,fI,n=>n.supportsAutomaticNewSymbolNamesTriggerKind(),!1,void 0)}$provideNewSymbolNames(e,n,o,r,s){return this._withAdapter(e,fI,a=>a.provideNewSymbolNames(y.revive(n),o,r,s),void 0,s)}registerDocumentSemanticTokensProvider(e,n,o,r){let s=this._addNewAdapter(new vI(this._documents,o),e),a=typeof o.onDidChangeSemanticTokens=="function"?this._nextHandle():void 0;this._proxy.$registerDocumentSemanticTokensProvider(s,this._transformDocumentSelector(n,e),r,a);let l=this._createDisposable(s);if(a){let d=o.onDidChangeSemanticTokens(c=>this._proxy.$emitDocumentSemanticTokensEvent(a));l=Se.from(l,d)}return l}$provideDocumentSemanticTokens(e,n,o,r){return this._withAdapter(e,vI,s=>s.provideDocumentSemanticTokens(y.revive(n),o,r),null,r)}$releaseDocumentSemanticTokens(e,n){this._withAdapter(e,vI,o=>o.releaseDocumentSemanticColoring(n),void 0,void 0)}registerDocumentRangeSemanticTokensProvider(e,n,o,r){let s=this._addNewAdapter(new TP(this._documents,o),e),a=typeof o.onDidChangeSemanticTokens=="function"?this._nextHandle():void 0;this._proxy.$registerDocumentRangeSemanticTokensProvider(s,this._transformDocumentSelector(n,e),r,a);let l=this._createDisposable(s);if(a){let d=o.onDidChangeSemanticTokens(c=>this._proxy.$emitDocumentRangeSemanticTokensEvent(a));l=Se.from(l,d)}return l}$provideDocumentRangeSemanticTokens(e,n,o,r){return this._withAdapter(e,TP,s=>s.provideDocumentRangeSemanticTokens(y.revive(n),o,r),null,r)}registerCompletionItemProvider(e,n,o,r){let s=this._addNewAdapter(new bp(this._documents,this._commands.converter,o,this._apiDeprecation,e),e);return this._proxy.$registerCompletionsProvider(s,this._transformDocumentSelector(n,e),r,bp.supportsResolving(o),e.identifier),this._createDisposable(s)}$provideCompletionItems(e,n,o,r,s){return this._withAdapter(e,bp,a=>a.provideCompletionItems(y.revive(n),o,r,s),void 0,s)}$resolveCompletionItem(e,n,o){return this._withAdapter(e,bp,r=>r.resolveCompletionItem(n,o),void 0,o)}$releaseCompletionItems(e,n){this._withAdapter(e,bp,o=>o.releaseCompletionItems(n),void 0,void 0)}registerInlineCompletionsProvider(e,n,o,r){let s=new os(e,this._documents,o,this._commands.converter),a=this._addNewAdapter(s,e),l=this._createDisposable(a),d=Le(e,"inlineCompletionsAdditions")&&typeof o.onDidChange=="function";if(d){let m=o.onDidChange(g=>this._proxy.$emitInlineCompletionsChange(a,g?{data:g.data}:void 0));l=Se.from(l,m)}let c=Le(e,"inlineCompletionsAdditions")&&typeof o.onDidChangeModelInfo=="function";if(c){let m=o.onDidChangeModelInfo(g=>this._proxy.$emitInlineCompletionModelInfoChange(a,s.modelInfo));l=Se.from(l,m)}let u=Le(e,"inlineCompletionsAdditions")&&typeof o.onDidChangeProviderOptions=="function";if(u){let m=o.onDidChangeProviderOptions(g=>this._proxy.$emitInlineCompletionProviderOptionsChange(a,s.providerOptions));l=Se.from(l,m)}return this._proxy.$registerInlineCompletionsSupport(a,this._transformDocumentSelector(n,e),s.supportsHandleEvents,xe.toKey(e.identifier.value),e.version,r?.groupId?xe.toKey(r.groupId):void 0,r?.yieldTo?.map(m=>xe.toKey(m))||[],r?.displayName,r?.debounceDelayMs,r?.excludes?.map(m=>xe.toKey(m))||[],d,s.supportsSetModelId,s.modelInfo,c,s.supportsSetProviderOption,s.providerOptions,u),l}$provideInlineCompletions(e,n,o,r,s){return this._withAdapter(e,os,a=>a.provideInlineCompletions(y.revive(n),o,r,s),void 0,void 0)}$handleInlineCompletionDidShow(e,n,o,r){this._withAdapter(e,os,async s=>{s.handleDidShowCompletionItem(n,o,r)},void 0,void 0)}$handleInlineCompletionPartialAccept(e,n,o,r,s){this._withAdapter(e,os,async a=>{a.handlePartialAccept(n,o,r,s)},void 0,void 0)}$handleInlineCompletionEndOfLifetime(e,n,o,r){this._withAdapter(e,os,async s=>{s.handleEndOfLifetime(n,o,r)},void 0,void 0)}$handleInlineCompletionRejection(e,n,o){this._withAdapter(e,os,async r=>{r.handleRejection(n,o)},void 0,void 0)}$freeInlineCompletionsList(e,n,o){this._withAdapter(e,os,async r=>{r.disposeCompletions(n,o)},void 0,void 0)}$acceptInlineCompletionsUnificationState(e){this._inlineCompletionsUnificationState=e,this._onDidChangeInlineCompletionsUnificationState.fire()}$handleInlineCompletionSetCurrentModelId(e,n){this._withAdapter(e,os,async o=>{o.setCurrentModelId(n)},void 0,void 0)}$handleInlineCompletionSetProviderOption(e,n,o){this._withAdapter(e,os,async r=>{r.setProviderOption(n,o)},void 0,void 0)}registerSignatureHelpProvider(e,n,o,r){let s=Array.isArray(r)?{triggerCharacters:r,retriggerCharacters:[]}:r,a=this._addNewAdapter(new yI(this._documents,o),e);return this._proxy.$registerSignatureHelpProvider(a,this._transformDocumentSelector(n,e),s),this._createDisposable(a)}$provideSignatureHelp(e,n,o,r,s){return this._withAdapter(e,yI,a=>a.provideSignatureHelp(y.revive(n),o,r,s),void 0,s)}$releaseSignatureHelp(e,n){this._withAdapter(e,yI,o=>o.releaseSignatureHelp(n),void 0,void 0)}registerInlayHintsProvider(e,n,o){let r=typeof o.onDidChangeInlayHints=="function"?this._nextHandle():void 0,s=this._addNewAdapter(new mh(this._documents,this._commands.converter,o,this._logService,e),e);this._proxy.$registerInlayHintsProvider(s,this._transformDocumentSelector(n,e),typeof o.resolveInlayHint=="function",r,i._extLabel(e));let a=this._createDisposable(s);if(r!==void 0){let l=o.onDidChangeInlayHints(d=>this._proxy.$emitInlayHintsEvent(r));a=Se.from(a,l)}return a}$provideInlayHints(e,n,o,r){return this._withAdapter(e,mh,s=>s.provideInlayHints(y.revive(n),o,r),void 0,r)}$resolveInlayHint(e,n,o){return this._withAdapter(e,mh,r=>r.resolveInlayHint(n,o),void 0,o)}$releaseInlayHints(e,n){this._withAdapter(e,mh,o=>o.releaseHints(n),void 0,void 0)}registerDocumentLinkProvider(e,n,o){let r=this._addNewAdapter(new gh(this._documents,o),e);return this._proxy.$registerDocumentLinkProvider(r,this._transformDocumentSelector(n,e),typeof o.resolveDocumentLink=="function"),this._createDisposable(r)}$provideDocumentLinks(e,n,o){return this._withAdapter(e,gh,r=>r.provideLinks(y.revive(n),o),void 0,o,n.scheme==="output")}$resolveDocumentLink(e,n,o){return this._withAdapter(e,gh,r=>r.resolveLink(n,o),void 0,void 0,!0)}$releaseDocumentLinks(e,n){this._withAdapter(e,gh,o=>o.releaseLinks(n),void 0,void 0,!0)}registerColorProvider(e,n,o){let r=this._addNewAdapter(new bI(this._documents,o),e);return this._proxy.$registerDocumentColorProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideDocumentColors(e,n,o){return this._withAdapter(e,bI,r=>r.provideColors(y.revive(n),o),[],o)}$provideColorPresentations(e,n,o,r){return this._withAdapter(e,bI,s=>s.provideColorPresentations(y.revive(n),o,r),void 0,r)}registerFoldingRangeProvider(e,n,o){let r=this._nextHandle(),s=typeof o.onDidChangeFoldingRanges=="function"?this._nextHandle():void 0;this._adapter.set(r,new Sp(new EP(this._documents,o),e)),this._proxy.$registerFoldingRangeProvider(r,this._transformDocumentSelector(n,e),e.identifier,s);let a=this._createDisposable(r);if(s!==void 0){let l=o.onDidChangeFoldingRanges(()=>this._proxy.$emitFoldingRangeEvent(s));a=Se.from(a,l)}return a}$provideFoldingRanges(e,n,o,r){return this._withAdapter(e,EP,s=>s.provideFoldingRanges(y.revive(n),o,r),void 0,r)}registerSelectionRangeProvider(e,n,o){let r=this._addNewAdapter(new wP(this._documents,o,this._logService),e);return this._proxy.$registerSelectionRangeProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$provideSelectionRanges(e,n,o,r){return this._withAdapter(e,wP,s=>s.provideSelectionRanges(y.revive(n),o,r),[],r)}registerCallHierarchyProvider(e,n,o){let r=this._addNewAdapter(new Ip(this._documents,o),e);return this._proxy.$registerCallHierarchyProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$prepareCallHierarchy(e,n,o,r){return this._withAdapter(e,Ip,s=>Promise.resolve(s.prepareSession(y.revive(n),o,r)),void 0,r)}$provideCallHierarchyIncomingCalls(e,n,o,r){return this._withAdapter(e,Ip,s=>s.provideCallsTo(n,o,r),void 0,r)}$provideCallHierarchyOutgoingCalls(e,n,o,r){return this._withAdapter(e,Ip,s=>s.provideCallsFrom(n,o,r),void 0,r)}$releaseCallHierarchy(e,n){this._withAdapter(e,Ip,o=>Promise.resolve(o.releaseSession(n)),void 0,void 0)}registerTypeHierarchyProvider(e,n,o){let r=this._addNewAdapter(new xp(this._documents,o),e);return this._proxy.$registerTypeHierarchyProvider(r,this._transformDocumentSelector(n,e)),this._createDisposable(r)}$prepareTypeHierarchy(e,n,o,r){return this._withAdapter(e,xp,s=>Promise.resolve(s.prepareSession(y.revive(n),o,r)),void 0,r)}$provideTypeHierarchySupertypes(e,n,o,r){return this._withAdapter(e,xp,s=>s.provideSupertypes(n,o,r),void 0,r)}$provideTypeHierarchySubtypes(e,n,o,r){return this._withAdapter(e,xp,s=>s.provideSubtypes(n,o,r),void 0,r)}$releaseTypeHierarchy(e,n){this._withAdapter(e,xp,o=>Promise.resolve(o.releaseSession(n)),void 0,void 0)}registerDocumentOnDropEditProvider(e,n,o,r){let s=this._nextHandle();return this._adapter.set(s,new Sp(new fh(this._proxy,this._documents,o,s,e),e)),this._proxy.$registerDocumentOnDropEditProvider(s,this._transformDocumentSelector(n,e),r?{supportsResolve:!!o.resolveDocumentDropEdit,dropMimeTypes:r.dropMimeTypes,providedDropKinds:r.providedDropEditKinds?.map(a=>a.value)}:void 0),this._createDisposable(s)}$provideDocumentOnDropEdits(e,n,o,r,s,a){return this._withAdapter(e,fh,l=>Promise.resolve(l.provideDocumentOnDropEdits(n,y.revive(o),r,s,a)),void 0,void 0)}$resolveDropEdit(e,n,o){return this._withAdapter(e,fh,r=>r.resolveDropEdit(n,o),{},void 0)}$releaseDocumentOnDropEdits(e,n){this._withAdapter(e,fh,o=>Promise.resolve(o.releaseDropEdits(n)),void 0,void 0)}registerDocumentPasteEditProvider(e,n,o,r){let s=this._nextHandle();return this._adapter.set(s,new Sp(new yp(this._proxy,this._documents,o,s,e),e)),this._proxy.$registerPasteEditProvider(s,this._transformDocumentSelector(n,e),{supportsCopy:!!o.prepareDocumentPaste,supportsPaste:!!o.provideDocumentPasteEdits,supportsResolve:!!o.resolveDocumentPasteEdit,providedPasteEditKinds:r.providedPasteEditKinds?.map(a=>a.value),copyMimeTypes:r.copyMimeTypes,pasteMimeTypes:r.pasteMimeTypes}),this._createDisposable(s)}$prepareDocumentPaste(e,n,o,r,s){return this._withAdapter(e,yp,a=>a.prepareDocumentPaste(y.revive(n),o,r,s),void 0,s)}$providePasteEdits(e,n,o,r,s,a,l){return this._withAdapter(e,yp,d=>d.providePasteEdits(n,y.revive(o),r,s,a,l),void 0,l)}$resolvePasteEdit(e,n,o){return this._withAdapter(e,yp,r=>r.resolvePasteEdit(n,o),{},void 0)}$releasePasteEdits(e,n){this._withAdapter(e,yp,o=>Promise.resolve(o.releasePasteEdits(n)),void 0,void 0)}static _serializeRegExp(e){return{pattern:e.source,flags:e.flags}}static _serializeIndentationRule(e){return{decreaseIndentPattern:i._serializeRegExp(e.decreaseIndentPattern),increaseIndentPattern:i._serializeRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?i._serializeRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?i._serializeRegExp(e.unIndentedLinePattern):void 0}}static _serializeOnEnterRule(e){return{beforeText:i._serializeRegExp(e.beforeText),afterText:e.afterText?i._serializeRegExp(e.afterText):void 0,previousLineText:e.previousLineText?i._serializeRegExp(e.previousLineText):void 0,action:e.action}}static _serializeOnEnterRules(e){return e.map(i._serializeOnEnterRule)}static _serializeAutoClosingPair(e){return{open:e.open,close:e.close,notIn:e.notIn?e.notIn.map(n=>Bu.toString(n)):void 0}}static _serializeAutoClosingPairs(e){return e.map(i._serializeAutoClosingPair)}setLanguageConfiguration(e,n,o){let{wordPattern:r}=o;if(r&&Ix(r))throw new Error(`Invalid language configuration: wordPattern '${r}' is not allowed to match the empty string.`);r?this._documents.setWordDefinitionFor(n,r):this._documents.setWordDefinitionFor(n,void 0),o.__electricCharacterSupport&&this._apiDeprecation.report("LanguageConfiguration.__electricCharacterSupport",e,"Do not use."),o.__characterPairSupport&&this._apiDeprecation.report("LanguageConfiguration.__characterPairSupport",e,"Do not use.");let s=this._nextHandle(),a={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?i._serializeRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?i._serializeIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?i._serializeOnEnterRules(o.onEnterRules):void 0,__electricCharacterSupport:o.__electricCharacterSupport,__characterPairSupport:o.__characterPairSupport,autoClosingPairs:o.autoClosingPairs?i._serializeAutoClosingPairs(o.autoClosingPairs):void 0};return this._proxy.$setLanguageConfiguration(s,n,a),this._createDisposable(s)}$setWordDefinitions(e){for(let n of e)this._documents.setWordDefinitionFor(n.languageId,new RegExp(n.regexSource,n.regexFlags))}};async function c9(i,t){let e=i+":"+JSON.stringify(t),n=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",n),r=Array.from(new Uint8Array(o)).map(s=>s.toString(16).padStart(2,"0")).join("");return i+":combination:"+r}var ivt=A("ILanguageModelToolsConfirmationService");var u9=A("notebookService");var p9=A("codeMapperService");var cU="vscode_editFile",_P="vscode_editFile_internal",m9={id:_P,displayName:"",modelDescription:"",source:pn.Internal},hh=class{constructor(t,e,n){this.chatService=t;this.codeMapperService=e;this.notebookService=n}async invoke(t,e,n,o){if(!t.context)throw new Error("toolInvocationToken is required for this tool");let r=t.parameters,s=y.revive(r.uri),a=Dy.parse(s)?.notebook||s,l=this.chatService.getSession(t.context.sessionResource),d=l.getRequests().at(-1);l.acceptResponseProgress(d,{kind:"markdownContent",content:new _t("\n````\n")}),l.acceptResponseProgress(d,{kind:"codeblockUri",uri:a,isEdit:!0}),l.acceptResponseProgress(d,{kind:"markdownContent",content:new _t("\n````\n")}),this.notebookService.hasSupportedNotebooks(a)&&this.notebookService.getNotebookTextModel(a)?l.acceptResponseProgress(d,{kind:"notebookEdit",edits:[],uri:a}):l.acceptResponseProgress(d,{kind:"textEdit",edits:[],uri:a});let c=l.editingSession;if(!c)throw new Error("This tool must be called from within an editing session");let u=await this.codeMapperService.mapCode({codeBlocks:[{code:r.code,resource:a,markdownBeforeBlock:r.explanation}],location:"tool",chatRequestId:t.chatRequestId,chatRequestModel:t.modelId,chatSessionResource:t.context.sessionResource},{textEdit:(g,h)=>{l.acceptResponseProgress(d,{kind:"textEdit",uri:g,edits:h})},notebookEdit(g,h){l.acceptResponseProgress(d,{kind:"notebookEdit",uri:g,edits:h})}},o);if(this.notebookService.hasSupportedNotebooks(a)&&this.notebookService.getNotebookTextModel(a)?l.acceptResponseProgress(d,{kind:"notebookEdit",uri:a,edits:[],done:!0}):l.acceptResponseProgress(d,{kind:"textEdit",uri:a,edits:[],done:!0}),u?.errorMessage)throw new Error(u.errorMessage);let m;return await new Promise(g=>{let h=!1;m=Eo(f=>{let x=c.entries.read(f)?.find(E=>Sn(E.modifiedURI,a));x&&(x.isCurrentlyBeingModifiedBy.read(f)?h=!0:h&&g(!0))})}).finally(()=>{m.dispose()}),{content:[{kind:"text",value:"The file was edited successfully"}]}}async prepareToolInvocation(t,e){return{presentation:"hidden"}}};hh=_([S(0,wr),S(1,p9),S(2,u9)],hh);var RP="The user is not available to respond and will review your work later. Work autonomously and make good decisions.",g9="vscode_askQuestions",DP={header:50,question:200},jX={header:75};function GX(i,t){if(i!==void 0)return i.length>t?i.slice(0,t-3)+"...":i}function QX(){let t={type:"object",properties:{questions:{type:"array",description:"List of questions to ask the user. Order is preserved.",items:{type:"object",properties:{header:{type:"string",description:`Short identifier for the question. Must be unique so answers can be mapped back to the question. Maximum ${DP.header} characters.`,maxLength:DP.header},question:{type:"string",description:`The question text to display to the user. Keep it concise, ideally one sentence. Maximum ${DP.question} characters.`,maxLength:DP.question},multiSelect:{type:"boolean",description:"Allow selecting multiple options when options are provided."},allowFreeformInput:{type:"boolean",description:"Allow freeform text answers in addition to option selection. Defaults to true; set to false to restrict to predefined options only."},message:{type:"string",description:"Optional markdown message to display below the question text, providing additional context or details."},options:{type:"array",description:"Optional list of selectable answers. If omitted, the question is free text.",items:{type:"object",properties:{label:{type:"string",description:"Display label and value for the option."},description:{type:"string",description:"Optional secondary text shown with the option."},recommended:{type:"boolean",description:"Mark this option as the recommended default."}},required:["label"]}}},required:["header","question"]},minItems:1}},required:["questions"]};return{id:g9,toolReferenceName:"askQuestions",legacyToolReferenceFullNames:[g9,"vscode/askQuestions"],canBeReferencedInPrompt:!1,icon:ct.fromId(de.question.id),displayName:p(13513,null),userDescription:p(13514,null),modelDescription:"Use this tool to ask the user a small number of clarifying questions before proceeding. Provide the questions array with concise headers and prompts. Use options for fixed choices, set multiSelect when multiple selections are allowed. Users can always provide a freeform text answer alongside options unless you set allowFreeformInput to false.",source:pn.Internal,inputSchema:t}}var uU=QX(),vh=class extends N{constructor(e,n,o,r){super();this.chatService=e;this.telemetryService=n;this.logService=o;this.configService=r}async invoke(e,n,o,r){let s=Xt.create(!0),a=e.parameters,{questions:l}=a;if(this.logService.trace(`[AskQuestionsTool] Invoking with ${l?.length??0} question(s)`),!l||l.length===0)throw new Error(p(13511,null));let d=e.context?.sessionResource,c=e.chatRequestId,{request:u,sessionResource:m}=this.getRequest(d,c);if(!m||!u)return this.logService.warn("[AskQuestionsTool] Missing chat context; marking all questions as skipped."),this.createSkippedResult(l);let g=e.chatStreamToolCallId??e.callId;if(u.modeInfo?.permissionLevel==="autopilot"||this.configService.getValue("chat.autoReply")){let j=u.modeInfo?.permissionLevel==="autopilot"?"Autopilot mode":"Auto-reply enabled";this.logService.info(`[AskQuestionsTool] ${j}: auto-responding to questions`);let{carousel:Q,idToHeaderMap:Z}=this.toQuestionCarousel(l,g);return Q.terminalId=this.extractTerminalId(u),Q.data=this.buildAutopilotCarouselAnswers(l,Q,Z),Q.isUsed=!0,this.chatService.appendProgress(u,Q),this.createAutopilotResult(l)}let{carousel:h,idToHeaderMap:f}=this.toQuestionCarousel(l,g);h.terminalId=this.extractTerminalId(u),this.logService.trace(`[AskQuestionsTool] request=${u.id} terminalExecutionId=${u.terminalExecutionId??"undefined"} carousel.terminalId=${h.terminalId??"undefined"}`),this.chatService.appendProgress(u,h);let I=this.chatService.onDidReceiveQuestionCarouselAnswer(j=>{j.resolveId!==h.resolveId||h.isUsed||h.dismiss(j.answers)}),x;try{x=await Jl(h.completion.p,r)}catch(j){throw j instanceof Oe&&h.dismiss(void 0),j}finally{I.dispose()}if(!x)throw h.dismiss(void 0),new Oe;if(r.isCancellationRequested)throw new Oe;if(h.dismissedByTerminalInput&&h.terminalId)return this.logService.info(`[AskQuestionsTool] Carousel dismissed because user typed directly in terminal ${h.terminalId}`),{content:[{kind:"text",value:`The user is replying to the terminal prompts directly. Do not ask more questions or send input to the terminal. You will be automatically notified when the command in terminal ${h.terminalId} completes.`}]};o.report({message:p(13512,null)});let E=this.convertCarouselAnswers(l,x?.answers,f),{answeredCount:w,skippedCount:R,freeTextCount:L,recommendedAvailableCount:U,recommendedSelectedCount:z}=this.collectMetrics(l,E);this.sendTelemetry(e.chatRequestId,l.length,w,R,L,U,z,s.elapsed());let Y=JSON.stringify(E);return this.logService.trace(`[AskQuestionsTool] Returning tool result with metrics: questions=${l.length}, answered=${w}, skipped=${R}, freeText=${L}, recommendedAvailable=${U}, recommendedSelected=${z}`),{content:[{kind:"text",value:Y}]}}async prepareToolInvocation(e,n){let o=e.parameters,{questions:r}=o;if(!r||r.length===0)throw new Error(p(13511,null));for(let c of r)if(c.options&&c.options.length===1&&!c.allowFreeformInput)throw new Error(p(13506,null,c.header));let s=r.length,a=r.map(c=>c.header).join(", "),l=s===1?p(13509,null,a):p(13507,null,s,a),d=s===1?p(13510,null,a):p(13508,null,s,a);return{invocationMessage:new _t(l),pastTenseMessage:new _t(d)}}getRequest(e,n){if(!e)return{request:void 0,sessionResource:void 0};let o=this.chatService.getSession(e),r;return o&&(n&&(r=o.getRequests().find(s=>s.id===n)),r||(r=o.getRequests().at(-1))),r?{request:r,sessionResource:e}:{request:void 0,sessionResource:e}}extractTerminalId(e){if(e.terminalExecutionId)return e.terminalExecutionId;let n=e.message.text.match(/\[Terminal (?<termId>\S+) notification:/);if(n?.groups?.termId)return n.groups.termId;let o=e.response;if(o){let r=o.response.value;for(let s=r.length-1;s>=0;s--){let a=r[s];if(a.kind==="toolInvocation"&&a.toolId==="run_in_terminal"){let l=a.state.get();if(l.type===Fe.StateKind.Completed&&l.contentForModel){for(let d of l.contentForModel)if(d.kind==="text"){let c=d.value.match(/(?:running in terminal ID|may still be running in terminal ID) ([0-9a-fA-F-]+)/);if(c)return c[1]}}}}}}toQuestionCarousel(e,n){let o=new Map,r=n??_e(),s=e.map((a,l)=>this.toChatQuestion(a,o,r,l));return{carousel:new km(s,!0,r),idToHeaderMap:o}}toChatQuestion(e,n,o,r){let s;!e.options||e.options.length===0?s="text":e.multiSelect?s="multiSelect":s="singleSelect";let a;if(e.options){let c=e.options.filter(u=>u.recommended);c.length>0&&(a=e.multiSelect?c.map(u=>u.label):c[0].label)}let l=`${o}:${r}`;n.set(l,e.header);let d=GX(e.header,jX.header)??e.header;return{id:l,type:s,title:d,message:e.question,detailedMessage:e.message,options:e.options?.map(c=>({id:c.label,label:c.description?`${c.label} - ${c.description}`:c.label,value:c.label})),defaultValue:a,allowFreeformInput:e.allowFreeformInput??!0}}convertCarouselAnswers(e,n,o){let r={answers:{}};n&&(this.logService.trace(`[AskQuestionsTool] Carousel answer keys: ${Object.keys(n).join(", ")}`),this.logService.trace(`[AskQuestionsTool] Question headers: ${e.map(a=>a.header).join(", ")}`));let s=new Map;for(let[a,l]of o)s.set(l,a);for(let a of e){if(!n){r.answers[a.header]={selected:[],freeText:null,skipped:!0};continue}let l=s.get(a.header),d=l?n[l]:void 0;if(this.logService.trace(`[AskQuestionsTool] Processing question "${a.header}" (internal ID: ${l}), raw answer: ${JSON.stringify(d)}, type: ${typeof d}`),d===void 0)r.answers[a.header]={selected:[],freeText:null,skipped:!0};else if(typeof d=="string")a.options?.some(c=>c.label===d)?r.answers[a.header]={selected:[d],freeText:null,skipped:!1}:r.answers[a.header]={selected:[],freeText:d,skipped:!1};else if(Array.isArray(d))r.answers[a.header]={selected:d.map(c=>String(c)),freeText:null,skipped:!1};else if(typeof d=="object"&&Gn(d,{selectedValues:!0})){let{selectedValues:c,freeformValue:u}=d;r.answers[a.header]={selected:c,freeText:u??null,skipped:!1}}else if(typeof d=="object"&&(Gn(d,{selectedValue:!0})||Gn(d,{freeformValue:!0}))){let{selectedValue:c,freeformValue:u}=d;u?r.answers[a.header]={selected:[],freeText:u,skipped:!1}:c!==void 0?a.options?.some(m=>m.label===c)?r.answers[a.header]={selected:[c],freeText:null,skipped:!1}:r.answers[a.header]={selected:[],freeText:c,skipped:!1}:r.answers[a.header]={selected:[],freeText:null,skipped:!0}}else this.logService.warn(`[AskQuestionsTool] Unknown answer format for "${a.header}": ${JSON.stringify(d)}`),r.answers[a.header]={selected:[],freeText:null,skipped:!0}}return r}collectMetrics(e,n){let o=Object.values(n.answers),r=o.filter(c=>!c.skipped).length,s=o.filter(c=>c.skipped).length,a=o.filter(c=>c.freeText!==null).length,l=e.filter(c=>c.options?.some(u=>u.recommended)).length,d=e.filter(c=>{let u=n.answers[c.header],m=c.options?.find(g=>g.recommended);return u&&!u.skipped&&m&&u.selected.includes(m.label)}).length;return{answeredCount:r,skippedCount:s,freeTextCount:a,recommendedAvailableCount:l,recommendedSelectedCount:d}}createSkippedResult(e){let n={};for(let o of e)n[o.header]={selected:[],freeText:null,skipped:!0};return{content:[{kind:"text",value:JSON.stringify({answers:n})}]}}createAutopilotResult(e){let n={};for(let o of e)n[o.header]={selected:[],freeText:RP,skipped:!1};return{content:[{kind:"text",value:JSON.stringify({answers:n})}]}}buildAutopilotCarouselAnswers(e,n,o){let r={},s=new Map;for(let[a,l]of o)s.set(l,a);for(let a of e){let l=s.get(a.header);if(!l)continue;let d=n.questions.find(c=>c.id===l);d&&(d.type==="multiSelect"?r[l]={selectedValues:[],freeformValue:RP}:d.type==="singleSelect"?r[l]={freeformValue:RP}:r[l]=RP)}return r}sendTelemetry(e,n,o,r,s,a,l,d){this.telemetryService.publicLog2("askQuestionsToolInvoked",{requestId:e,questionCount:n,answeredCount:o,skippedCount:r,freeTextCount:s,recommendedAvailableCount:a,recommendedSelectedCount:l,duration:d})}};vh=_([S(0,wr),S(1,ui),S(2,te),S(3,$t)],vh);var JX="vscode_get_confirmation",YX="vscode_get_confirmation_with_options",XX="vscode_get_modified_files_confirmation",f9={id:JX,displayName:"Confirmation Tool",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and confirmation type (basic or terminal).",source:pn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},confirmationType:{type:"string",enum:["basic","terminal"],description:"Type of confirmation to show - basic for simple confirmation, terminal for terminal command confirmation"},terminalCommand:{type:"string",description:'Terminal command to show (only used when confirmationType is "terminal")'}},required:["title","message","confirmationType"],additionalProperties:!1}},h9={id:YX,displayName:"Confirmation Tool with Options",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and buttons.",source:pn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},buttons:{type:"array",items:{type:"string"},description:"Custom button labels to display."}},required:["title","message","buttons"],additionalProperties:!1}},v9={id:XX,displayName:"Modified Files Confirmation Tool",modelDescription:"A tool that shows a modified-files confirmation UI with a split primary button and a hardcoded cancel action.",source:pn.Internal,inputSchema:{type:"object",properties:{title:{type:"string",description:"Title for the confirmation dialog"},message:{type:"string",description:"Message to show in the confirmation dialog"},options:{type:"array",items:{type:"string"},minItems:1,description:"Selectable option labels. The first option is used for the primary split button and the remaining options are placed in the dropdown menu."},modifiedFiles:{type:"array",items:{type:"object",properties:{uri:{type:"string",description:"URI of the modified file."},originalUri:{type:"string",description:"Optional original URI used when opening a diff."},insertions:{type:"number",description:"Optional number of lines added."},deletions:{type:"number",description:"Optional number of lines removed."},title:{type:"string",description:"Optional title shown in the file tooltip."},description:{type:"string",description:"Optional secondary label shown for the file entry."}},required:["uri"],additionalProperties:!1},description:"Modified files to show in the confirmation UI."}},required:["title","message","options","modifiedFiles"],additionalProperties:!1}},AP=class{async prepareToolInvocation(t,e){let n=t.parameters;if(!n.title||!n.message)throw new Error("Missing required parameters for ConfirmationTool");let o=n.confirmationType??"basic",r;return o==="terminal"?r={kind:"terminal",commandLine:{original:n.terminalCommand??""},language:"bash"}:r=void 0,{confirmationMessages:{title:n.title,message:new _t(n.message),allowAutoConfirm:!(n.buttons||[]).length,customOptions:n.buttons?.map((s,a)=>({id:s,label:s,kind:a===0?"approve":"deny"}))},toolSpecificData:r,presentation:"hiddenAfterComplete"}}async invoke(t,e,n,o){return t.selectedCustomButton?{content:[{kind:"text",value:t.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}},MP=class{async prepareToolInvocation(t,e){let n=t.parameters;if(!n.title||!n.message)throw new Error("Missing required parameters for ModifiedFilesConfirmationTool");if(!n.options?.length)throw new Error("ModifiedFilesConfirmationTool requires at least one option");let o={kind:"modifiedFilesConfirmation",options:n.options,modifiedFiles:n.modifiedFiles.map(r=>({uri:y.parse(r.uri).toJSON(),originalUri:r.originalUri?y.parse(r.originalUri).toJSON():void 0,insertions:r.insertions,deletions:r.deletions,title:r.title,description:r.description}))};return{confirmationMessages:{title:n.title,message:new _t(n.message),allowAutoConfirm:!1},toolSpecificData:o,presentation:"hiddenAfterComplete"}}async invoke(t,e,n,o){return t.selectedCustomButton?{content:[{kind:"text",value:t.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}};var bh=class i{constructor(t,e){this.storageService=e;this.id=i.COMMON_PREFIX+t}static{this.applicationMementos=new Map}static{this.applicationSharedMementos=new Map}static{this.profileMementos=new Map}static{this.workspaceMementos=new Map}static{this.COMMON_PREFIX="memento/"}getMemento(t,e){switch(t){case 1:{let n=i.workspaceMementos.get(this.id);return n||(n=new yh(this.id,t,e,this.storageService),i.workspaceMementos.set(this.id,n)),n.getMemento()}case 0:{let n=i.profileMementos.get(this.id);return n||(n=new yh(this.id,t,e,this.storageService),i.profileMementos.set(this.id,n)),n.getMemento()}case-1:{let n=i.applicationMementos.get(this.id);return n||(n=new yh(this.id,t,e,this.storageService),i.applicationMementos.set(this.id,n)),n.getMemento()}case-2:{let n=i.applicationSharedMementos.get(this.id);return n||(n=new yh(this.id,t,e,this.storageService),i.applicationSharedMementos.set(this.id,n)),n.getMemento()}}}onDidChangeValue(t,e){return this.storageService.onDidChangeValue(t,this.id,e)}saveMemento(){i.workspaceMementos.get(this.id)?.save(),i.profileMementos.get(this.id)?.save(),i.applicationMementos.get(this.id)?.save(),i.applicationSharedMementos.get(this.id)?.save()}reloadMemento(t){let e;switch(t){case-2:e=i.applicationSharedMementos.get(this.id);break;case-1:e=i.applicationMementos.get(this.id);break;case 0:e=i.profileMementos.get(this.id);break;case 1:e=i.workspaceMementos.get(this.id);break}e?.reload()}static clear(t){switch(t){case 1:i.workspaceMementos.clear();break;case 0:i.profileMementos.clear();break;case-1:i.applicationMementos.clear();break;case-2:i.applicationSharedMementos.clear();break}}},yh=class{constructor(t,e,n,o){this.id=t;this.scope=e;this.target=n;this.storageService=o;this.mementoObj=this.doLoad()}doLoad(){try{return this.storageService.getObject(this.id,this.scope,{})}catch(t){Ge(`[memento]: failed to parse contents: ${t} (id: ${this.id}, scope: ${this.scope}, contents: ${this.storageService.get(this.id,this.scope)})`)}return{}}getMemento(){return this.mementoObj}reload(){for(let t of Object.getOwnPropertyNames(this.mementoObj))delete this.mementoObj[t];Object.assign(this.mementoObj,this.doLoad())}save(){Wl(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var y9=A("chatTodoListService"),II=class{constructor(t){this.memento=new bh("chat-todo-list",t)}getSessionData(t){return this.memento.getMemento(1,1)[this.toKey(t)]||[]}setSessionData(t,e){let n=this.memento.getMemento(1,1);n[this.toKey(t)]=e,this.memento.saveMemento()}getTodoList(t){return this.getSessionData(t)}setTodoList(t,e){this.setSessionData(t,e)}migrateTodoList(t,e){let n=this.getSessionData(t);if(n.length>0){this.setSessionData(e,n);let o=this.memento.getMemento(1,1);delete o[this.toKey(t)],this.memento.saveMemento()}}toKey(t){return sd(t)}};II=_([S(0,yo)],II);var LP=class extends N{constructor(e){super();this._onDidUpdateTodos=this._register(new T);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new II(e)}getTodos(e){return this.todoListStorage.getTodoList(e)}setTodos(e,n){this.todoListStorage.setTodoList(e,n),this._onDidUpdateTodos.fire(e)}migrateTodos(e,n){this.todoListStorage.migrateTodoList(e,n),this._onDidUpdateTodos.fire(n)}};LP=_([S(0,yo)],LP);var pU="manage_todo_list";function mU(){let i={type:"object",properties:{todoList:{type:"array",description:"Complete array of all todo items. Must include ALL items - both existing and new.",items:{type:"object",properties:{id:{type:"number",description:"Unique identifier for the todo. Use sequential numbers starting from 1."},title:{type:"string",description:"Concise action-oriented todo label (3-7 words). Displayed in UI."},status:{type:"string",enum:["not-started","in-progress","completed"],description:"not-started: Not begun | in-progress: Currently working (max 1) | completed: Fully finished with no blockers"}},required:["id","title","status"]}}},required:["todoList"]};return{id:pU,toolReferenceName:"todo",legacyToolReferenceFullNames:["todos"],canBeReferencedInPrompt:!0,icon:ct.fromId(de.checklist.id),displayName:p(13550,null),userDescription:p(13551,null),modelDescription:`Manage a structured todo list to track progress and plan tasks throughout your coding session. Use this tool VERY frequently to ensure task visibility and proper planning.

When to use this tool:
- Complex multi-step work requiring planning and tracking
- When user provides multiple tasks or requests (numbered/comma-separated)
- After receiving new instructions that require multiple steps
- BEFORE starting work on any todo (mark as in-progress)
- IMMEDIATELY after completing each todo (mark completed individually)
- When breaking down larger tasks into smaller actionable steps
- To give users visibility into your progress and planning

When NOT to use:
- Single, trivial tasks that can be completed in one step
- Purely conversational/informational requests
- When just reading files or performing simple searches

CRITICAL workflow:
1. Plan tasks by writing todo list with specific, actionable items
2. Mark ONE todo as in-progress before starting work
3. Complete the work for that specific todo
4. Mark that todo as completed IMMEDIATELY
5. Move to next todo and repeat

Todo states:
- not-started: Todo not yet begun
- in-progress: Currently working (limit ONE at a time)
- completed: Finished successfully

IMPORTANT: Mark todos completed as soon as they are done. Do not batch completions.`,source:pn.Internal,inputSchema:i}}var ibt=mU(),Ih=class extends N{constructor(e,n,o){super();this.chatTodoListService=e;this.logService=n;this.telemetryService=o}async invoke(e,n,o,r){let s=e.parameters,a=e.context?.sessionResource;if(!a&&s.operation==="read"&&s.chatSessionResource)try{a=y.parse(s.chatSessionResource)}catch(l){this.logService.error("ManageTodoListTool: Invalid chatSessionResource URI",l)}if(!a)return{content:[{kind:"text",value:"Error: No session resource available"}]};this.logService.debug(`ManageTodoListTool: Invoking with options ${JSON.stringify(s)}`);try{return s.operation==="read"?this.handleReadOperation(a):this.handleWriteOperation(s,a)}catch(l){return{content:[{kind:"text",value:`Error: ${l instanceof Error?l.message:"Unknown error"}`}]}}}async prepareToolInvocation(e,n){let o=e.parameters,r=e.chatSessionResource;if(!r)return;let s=this.chatTodoListService.getTodos(r),a;o.operation==="read"?a=p(13545,null):o.todoList&&(a=this.generatePastTenseMessage(s,o.todoList));let l=o.todoList??s,d=l.map(m=>({id:m.id.toString(),title:m.title,status:m.status})),c=a?.replace(/^(Starting|Completed): /i,"")??p(13549,null);return{invocationMessage:new _t(c),presentation:l.length?void 0:"hidden",pastTenseMessage:new _t(a??p(13548,null)),toolSpecificData:{kind:"todoList",todoList:d}}}generatePastTenseMessage(e,n){if(e.length===0&&n.length>0)return n.length===1?p(13544,null):p(13543,null,n.length);let o=new Map(e.map(l=>[l.id,l])),r=n.filter(l=>{let d=o.get(l.id);return d&&d.status!=="in-progress"&&l.status==="in-progress"});if(r.length>0){let l=r[0],d=n.length,c=n.findIndex(u=>u.id===l.id)+1;return p(13546,null,l.title,c,d)}let s=n.filter(l=>{let d=o.get(l.id);return d&&d.status!=="completed"&&l.status==="completed"});if(s.length>0){let l=s[0],d=n.length,c=n.findIndex(u=>u.id===l.id)+1;return p(13542,null,l.title,c,d)}let a=n.filter(l=>!o.has(l.id));return a.length>0?a.length===1?p(13541,null):p(13540,null,a.length):p(13547,null)}handleRead(e,n){return e.length===0?"No todo list found.":`# Todo List

${this.formatTodoListAsMarkdownTaskList(e)}`}handleReadOperation(e){let n=this.chatTodoListService.getTodos(e),o=this.handleRead(n,e),r=this.calculateStatusCounts(n);return this.telemetryService.publicLog2("todoListToolInvoked",{operation:"read",notStartedCount:r.notStartedCount,inProgressCount:r.inProgressCount,completedCount:r.completedCount}),{content:[{kind:"text",value:o}]}}handleWriteOperation(e,n){if(!e.todoList)return{content:[{kind:"text",value:"Error: todoList is required for write operation"}]};let o=e.todoList.map(d=>({id:d.id,title:d.title,status:d.status})),r=this.chatTodoListService.getTodos(n),s=this.calculateTodoChanges(r,o);this.chatTodoListService.setTodos(n,o);let a=this.calculateStatusCounts(o),l=[];return o.length<3?l.push("Warning: Small todo list (<3 items). This task might not need a todo list."):o.length>10&&l.push("Warning: Large todo list (>10 items). Consider keeping the list focused and actionable."),s>3&&l.push("Warning: Did you mean to update so many todos at the same time? Consider working on them one by one."),this.telemetryService.publicLog2("todoListToolInvoked",{operation:"write",notStartedCount:a.notStartedCount,inProgressCount:a.inProgressCount,completedCount:a.completedCount}),{content:[{kind:"text",value:`Successfully wrote todo list${l.length?`

`+l.join(`
`):""}`}],toolMetadata:{warnings:l}}}calculateStatusCounts(e){let n=e.filter(s=>s.status==="not-started").length,o=e.filter(s=>s.status==="in-progress").length,r=e.filter(s=>s.status==="completed").length;return{notStartedCount:n,inProgressCount:o,completedCount:r}}formatTodoListAsMarkdownTaskList(e){return e.length===0?"":e.map(n=>{let o;switch(n.status){case"completed":o="[x]";break;case"in-progress":o="[-]";break;default:o="[ ]";break}return[`- ${o} ${n.title}`].join(`
`)}).join(`
`)}calculateTodoChanges(e,n){let o=0,r=Math.min(e.length,n.length);for(let d=0;d<r;d++){let c=e[d],u=n[d];(c.title!==u.title||c.status!==u.status)&&o++}let s=Math.max(0,n.length-e.length),a=Math.max(0,e.length-n.length);return s+a+o}};Ih=_([S(0,y9),S(1,te),S(2,ui)],Ih);var ZX="vscode_reviewPlan";function eZ(){let t={type:"object",properties:{title:{type:"string",description:'Title displayed in the widget header. Defaults to "Plan summary" if omitted.'},plan:{type:"string",description:"Optional URI of an editable plan file. An Edit button in the widget header opens it in the editor."},content:{type:"string",description:"Markdown content rendered in the body of the widget. May be the plan summary or full plan text."},actions:{type:"array",description:"List of approval actions offered in the primary dropdown button. Order is preserved.",items:{type:"object",properties:{label:{type:"string",description:"Short action label shown in the dropdown button."},description:{type:"string",description:"Optional detail shown below the label in the dropdown list."},default:{type:"boolean",description:"Whether this action should be selected by default."},permissionLevel:{type:"string",enum:["autopilot"],description:'When set to "autopilot", a confirmation dialog is shown before proceeding.'}},required:["label"]},minItems:1},canProvideFeedback:{type:"boolean",description:"When true, an additional feedback textarea is shown below the plan content."}},required:["content","actions","canProvideFeedback"]};return{id:ZX,toolReferenceName:"reviewPlan",canBeReferencedInPrompt:!1,icon:ct.fromId(de.checklist.id),displayName:p(13556,null),userDescription:p(13557,null),modelDescription:"Use this tool to present a plan to the user for review. Provide the plan content as markdown, a list of approval actions (with optional default), and whether the user can provide freeform feedback. Optionally provide a URI to the backing plan file so the user can edit it. The tool returns the chosen action, whether the plan was rejected, and any feedback.",source:pn.Internal,inputSchema:t}}var b9=eZ(),xh=class extends N{constructor(e,n){super();this.chatService=e;this.logService=n}async invoke(e,n,o,r){let s=e.parameters,{title:a,plan:l,content:d,actions:c,canProvideFeedback:u}=s;if(!c||c.length===0)throw new Error(p(13555,null));let{request:m}=this.getRequest(e.context?.sessionResource,e.chatRequestId);if(!m)return this.logService.warn("[ReviewPlanTool] Missing chat context; returning rejected result."),this.toResult({rejected:!0});let g;if(l)try{g=y.parse(l)}catch{try{g=y.file(l)}catch{g=void 0}}let h=new wm(a??p(13552,null),d,c,u,g?.toJSON(),_e());this.chatService.appendProgress(m,h);let f=await Jl(h.completion.p,r);if(r.isCancellationRequested)throw h.dismiss(),new Oe;return this.toResult(f??{rejected:!0})}async prepareToolInvocation(e,n){let o=e.parameters;if(!o.actions||o.actions.length===0)throw new Error(p(13555,null));return{invocationMessage:new _t(p(13553,null)),pastTenseMessage:new _t(p(13554,null))}}toResult(e){return{content:[{kind:"text",value:JSON.stringify(e)}]}}getRequest(e,n){if(!e)return{request:void 0};let o=this.chatService.getSession(e);if(!o)return{request:void 0};let r;return n&&(r=o.getRequests().find(s=>s.id===n)),r||(r=o.getRequests().at(-1)),{request:r}}};xh=_([S(0,wr),S(1,te)],xh);var Hbt=0,Wbt=0;function I9(i){return i.isBYOK===!0||i.byokModelIdentifier!==void 0}var x9=A("labelService");function gU(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}function fU(){return{debugDetails:[],durationInMillis:0}}function Sh(i,t){return i===void 0||t===void 0||i.includes(t)}var OP=A("IPromptsService");var tZ;(e=>{function i(n){return n.storage==="extension"?{storage:"extension",extensionId:n.extension.identifier}:n.storage==="plugin"?{storage:"plugin",pluginUri:n.pluginUri}:{storage:n.storage}}e.fromPromptPath=i;function t(n,o){return n===o?!0:!n||!o||n.storage!==o.storage?!1:n.storage==="extension"&&o.storage==="extension"?xe.equals(n.extensionId,o.extensionId):n.storage==="plugin"&&o.storage==="plugin"?Sn(n.pluginUri,o.pluginUri):!0}e.isEquals=t})(tZ||={});var oZ=".prompt.md",rZ=".instructions.md",iZ=".chatmode.md",sZ=".agent.md",aZ="SKILL.md";function lZ(i){return Ac(i,aZ)===0}var dZ="copilot-instructions.md";var cZ=".github/prompts",uZ=".github/instructions";var C9=".github/agents",NP=".claude/agents",T9="~/.copilot/agents",hU=".claude/rules";var pZ=[{path:".agents/skills",source:"agents-workspace",storage:"local"},{path:".github/skills",source:"github-workspace",storage:"local"},{path:".claude/skills",source:"claude-workspace",storage:"local"},{path:"~/.agents/skills",source:"agents-personal",storage:"user"},{path:"~/.copilot/skills",source:"copilot-personal",storage:"user"},{path:"~/.claude/skills",source:"claude-personal",storage:"user"}],mZ=[{path:uZ,source:"github-workspace",storage:"local"},{path:hU,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+hU,source:"claude-personal",storage:"user"}],gZ=[{path:cZ,source:"github-workspace",storage:"local"}],fZ=[{path:C9,source:"github-workspace",storage:"local"},{path:NP,source:"claude-workspace",storage:"local"},{path:T9,source:"copilot-personal",storage:"user"},{path:"~/"+NP,source:"claude-personal",storage:"user"}],hZ=[{path:".github/hooks",source:"github-workspace",storage:"local"},{path:".claude/settings.local.json",source:"claude-workspace-local",storage:"local"},{path:".claude/settings.json",source:"claude-workspace",storage:"local"},{path:"~/.copilot/hooks",source:"copilot-personal",storage:"user"},{path:"~/.claude/settings.json",source:"claude-personal",storage:"user"}];function vZ(i){let t=Ho(i).path;return t.endsWith("/"+C9)||t.endsWith("/"+NP)||yZ(i)}function E9(i){return Ho(i).path.endsWith("/"+NP)}function yZ(i){return Ho(i).path.endsWith(T9.substring(1))}function vU(i){return i.path.includes("/"+hU+"/")}function bZ(i){let t=Ze(i);if(t.endsWith(oZ))return"prompt";if(t.endsWith(rZ)||t===dZ)return"instructions";if(t.endsWith(iZ)||t.endsWith(sZ))return"agent";if(lZ(t))return"skill";if(t.endsWith(".md")&&t!=="README.md"&&vZ(i))return"agent";if(t.endsWith(".md")&&t!=="README.md"&&vU(i))return"instructions";if(t.toLowerCase().endsWith(".json"))return"hook"}function yU(i){return bZ(i)!==void 0}function w9(i){switch(i){case"instructions":return mZ;case"prompt":return gZ;case"agent":return fZ;case"skill":return pZ;case"hook":return hZ;default:throw new Error("Unknown prompt type")}}var rs;(L=>{L.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",L.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",L.MODE_LOCATION_KEY="chat.modeFilesLocations",L.AGENTS_LOCATION_KEY="chat.agentFilesLocations",L.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",L.HOOKS_LOCATION_KEY="chat.hookFilesLocations",L.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",L.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",L.USE_AGENT_MD="chat.useAgentsMdFile",L.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",L.USE_CLAUDE_MD="chat.useClaudeMdFile",L.USE_AGENT_SKILLS="chat.useAgentSkills",L.USE_CHAT_HOOKS="chat.useHooks",L.USE_CLAUDE_HOOKS="chat.useClaudeHooks",L.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",L.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",L.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions",L.USE_CUSTOMIZATIONS_IN_PARENT_REPOS="chat.useCustomizationsInParentRepositories";function E(U,z){let Y=IZ(z),j=U.getValue(Y);if(!(j==null||Array.isArray(j))&&typeof j=="object"){let Q={};for(let[Z,me]of Object.entries(j)){let vt=Z.trim(),ut=k9(me);ut!==void 0&&vt&&(Q[vt]=ut)}return Q}}L.getLocationsValue=E;function w(U,z){let Y=E(U,z),j=w9(z);if(Y&&typeof Y=="object"){let Q=[],Z=new Set(j.map(me=>me.path));for(let me of j)Y[me.path]!==!1&&Q.push(me);for(let[me,vt]of Object.entries(Y)){if(vt===!1||Z.has(me))continue;let ut=xZ(me)?"user":"local";Q.push({path:me,source:ut==="local"?"config-workspace":"config-personal",storage:ut})}return Q}return[]}L.promptSourceFolders=w;function R(U,z){let Y=U.getValue(L.PROMPT_FILES_SUGGEST_KEY,{resource:z});if(!Y||typeof Y!="object"||Array.isArray(Y))return;let j={};for(let[Q,Z]of Object.entries(Y)){let me=Q.trim();if(!me)continue;if(typeof Z=="boolean"){j[me]=Z;continue}if(typeof Z=="string"){let ut=Z.trim();ut&&(j[me]=ut);continue}let vt=k9(Z);vt!==void 0&&(j[me]=vt)}return Object.keys(j).length>0?j:void 0}L.getPromptFilesRecommendationsValue=R})(rs||={});function IZ(i){switch(i){case"instructions":return rs.INSTRUCTIONS_LOCATION_KEY;case"prompt":return rs.PROMPT_LOCATIONS_KEY;case"agent":return rs.AGENTS_LOCATION_KEY;case"skill":return rs.SKILLS_LOCATION_KEY;case"hook":return rs.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function k9(i){if(typeof i=="boolean")return i;if(typeof i=="string"){let t=i.trim().toLowerCase();return t==="true"?!0:t==="false"?!1:void 0}}function xZ(i){return i.startsWith("~/")}var P9=A("agentPluginService");var bU=class{constructor(){this._discovery=[];this._order=0}register(t,e){let n={descriptor:t,priority:e,order:this._order++};return this._discovery.push(n),q(()=>{let o=this._discovery.indexOf(n);o>=0&&this._discovery.splice(o,1)})}getAll(){return[...this._discovery].sort((t,e)=>t.priority-e.priority||t.order-e.order)}},pIt=new bU;var SZ,Ch=class{constructor(t,e,n,o,r,s,a,l,d,c,u,m,g,h){this._modeKind=t;this._enabledTools=e;this._enabledSubagents=n;this._currentSessionType=o;this._promptsService=r;this._logService=s;this._labelService=a;this._configurationService=l;this._workspaceService=d;this._fileService=c;this._remoteAgentService=u;this._telemetryService=m;this._languageModelToolsService=g;this._agentPluginService=h;this._parseResults=new Ve}async _parseInstructionsFile(t,e){if(this._parseResults.has(t))return this._parseResults.get(t);try{let n=await this._promptsService.parseNew(t,e);return this._parseResults.set(t,n),n}catch(n){this._logService.error(`[InstructionsContextComputer] Failed to parse instruction file: ${t}`,n);return}}async collect(t,e){let n=performance.now(),o=await this._promptsService.getInstructionFiles(e);this._logService.trace(`[InstructionsContextComputer] ${o.length} instruction files available.`);let r=gU(),s=fU(),a=this._getContext(t);await this.addApplyingInstructions(o,a,t,r,s,e),await this._addReferencedInstructions(t,r,s,e),await this._addAgentInstructions(t,r,s,e);let l=await this._getCustomizationsIndex(o,t,r,s,e);l&&(t.add(l),r.listedInstructionsCount++),s.durationInMillis=performance.now()-n,this.sendTelemetry(r),SZ={telemetryEvent:r,debugInfo:s}}sendTelemetry(t){t.totalInstructionsCount=t.agentInstructionsCount+t.referencedInstructionsCount+t.applyingInstructionsCount+t.listedInstructionsCount,this._telemetryService.publicLog2("instructionsCollected",t)}async _logSkillLoadedTelemetry(t){try{let e=new Ve,n=this._agentPluginService.plugins.get();for(let r of n)e.set(r.uri,r);let o=r=>r!==void 0?String(to(r)):"";for(let r of t){let s=r.pluginUri?e.get(r.pluginUri):void 0;this._telemetryService.publicLog2("skillLoadedIntoContext",{skillNameHash:o(r.name),skillStorage:r.storage,extensionIdHash:o(r.extension?.identifier.value),extensionVersion:r.extension?.version??"",pluginNameHash:o(s?.label),pluginVersion:s?.fromMarketplace?.version??""})}}catch(e){this._logService.error("[InstructionsContextComputer] Failed to log skill telemetry",e)}}async addApplyingInstructions(t,e,n,o,r,s){if(!this._configurationService.getValue(rs.INCLUDE_APPLYING_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeApplyingInstructions is disabled and agent kind is not Edit. No applying instructions will be added.");return}let l=this._currentSessionType;for(let d of t){if(s.isCancellationRequested)return;let{uri:c,pattern:u}=d;if(!Sh(d.sessionTypes,l))continue;if(!u){this._logService.trace(`[InstructionsContextComputer] No pattern (applyTo / paths) found: ${c}`),r.debugDetails.push({category:"skipped",name:Ze(c).toString(),uri:c,reason:p(13152,null)});continue}let m=vU(c);if(e.instructions.has(c)){this._logService.trace(`[InstructionsContextComputer] Skipping already processed instruction file: ${c}`),r.debugDetails.push({category:"skipped",name:Ze(c).toString(),uri:c,reason:p(13150,null)});continue}let g=this._matches(e.files,u);if(g){this._logService.trace(`[InstructionsContextComputer] Match for ${c} with ${g.pattern}${g.file?` for file ${g.file}`:""}`);let h=g.file?p(13161,null,u,this._labelService.getUriLabel(g.file,{relative:!0})):p(13159,null);n.add(ld(c,"vscode.instructions.file.root",h,!0)),o.applyingInstructionsCount++,r.debugDetails.push({category:"applying",name:Ze(c).toString(),uri:c,reason:h}),m&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${c} with ${u}`),r.debugDetails.push({category:"skipped",name:Ze(c).toString(),uri:c,reason:p(13151,null,u)})}}_getContext(t){let e=new Lr,n=new Lr;for(let o of t.asArray())if(dy(o))n.add(o.value);else{let r=ad.toUri(o);r&&e.add(r)}return{files:e,instructions:n}}async _addAgentInstructions(t,e,n,o){let r={logInfo:d=>this._logService.trace(`[InstructionsContextComputer] ${d}`)},s=await this._promptsService.listAgentInstructions(o,r),a=new iu,l=new iu;for(let{uri:d,type:c}of s){let u=ld(d,"vscode.instructions.file.root",void 0,!0);a.add(u),c==="copilotInstructionsMd"&&l.add(u),e.agentInstructionsCount++,c==="claudeMd"&&e.claudeMdCount++,n.debugDetails.push({category:"applying",name:Ze(d).toString(),uri:d,reason:p(13148,null)}),r.logInfo(`Agent instruction file added: ${d.toString()}`)}if(l.length>0){await this._addReferencedInstructions(l,e,n,o);for(let d of l.asArray())t.add(d)}for(let d of a.asArray())t.add(d)}_matches(t,e){let n=Ba(e,","),o=r=>{if(r=r.trim(),r.length!==0){if(r==="**"||r==="**/*"||r==="*")return{pattern:r};!r.startsWith("/")&&!r.startsWith("**/")&&(r="**/"+r);for(let s of t)if(_r(r,s.path,{ignoreCase:!0}))return{pattern:r,file:s}}};for(let r of n){let s=o(r);if(s)return s}}_getTool(t){if(!this._enabledTools)return;let e=this._languageModelToolsService.getToolByName(t);if(e&&this._enabledTools[e.id])return{tool:e,variable:`#tool:${this._languageModelToolsService.getFullReferenceName(e)}`}}async _getCustomizationsIndex(t,e,n,o,r){let s=this._getTool("readFile"),a=this._getTool("runInTerminal"),l=s??a,d=this._getTool(Ay.runSubagent),c=this._getTool("skill"),u=this._currentSessionType,g=(await this._remoteAgentService.getEnvironment())?.os,h=this._remoteAgentService.getConnection()!==null,f=R=>CZ(R,g,h),I=[];if(l){let L=this._configurationService.getValue(rs.USE_NESTED_AGENT_MD)?this._promptsService.listNestedAgentMDs(r):Promise.resolve([]);I.push("<instructions>"),I.push("Here is a list of instruction files that contain rules for working with this codebase."),I.push("These files are important for understanding the codebase structure, conventions, and best practices."),I.push("When an instruction file applies to your task (based on its description or applyTo pattern), follow the rules specified in it."),I.push(`If the file content is not already included in the context, use the ${l.variable} tool to read it before proceeding. Use the exact value from the <file> element as-is with the tool; do not add or remove prefixes or otherwise modify it.`),I.push("Only load instruction files when they are relevant to the current task. Do not eagerly load all instructions upfront."),I.push("When modifying or creating files, check for instructions whose applyTo pattern matches the file path and follow them.");let U=!1;for(let Z of t)Sh(Z.sessionTypes,u)&&(I.push("<instruction>"),I.push(`<file>${f(Z.uri)}</file>`),Z.description&&I.push(`<description>${ti(Z.description)}</description>`),Z.pattern&&I.push(`<applyTo>${ti(Z.pattern)}</applyTo>`),I.push("</instruction>"),U=!0);let z=await L;for(let{uri:Z}of z){let me=this._labelService.getUriLabel(Ho(Z),{relative:!0}),vt=me.trim().length===0?p(13158,null):p(13157,null,me);I.push("<instruction>"),I.push(`<file>${f(Z)}</file>`),I.push(`<description>${ti(vt)}</description>`),I.push("</instruction>"),U=!0}U?I.push("</instructions>","",""):I.length=0;let Y=await this._promptsService.findAgentSkills(r),j=this._configurationService.getValue(o$),Q=Y?.filter(Z=>Z.description?Z.disableModelInvocation?(o.debugDetails.push({category:"skipped",name:Z.name,uri:Z.uri,reason:p(13155,null)}),!1):Sh(Z.sessionTypes,u)?!j&&Z.uri.path.includes(r$)?(o.debugDetails.push({category:"skipped",name:Z.name,uri:Z.uri,reason:p(13153,null)}),!1):!0:(o.debugDetails.push({category:"skipped",name:Z.name,uri:Z.uri,reason:p(13156,null)}),!1):(o.debugDetails.push({category:"skipped",name:Z.name,uri:Z.uri,reason:p(13154,null)}),!1));if(Q&&Q.length>0){this._logSkillLoadedTelemetry(Q);for(let ne of Q)o.debugDetails.push({category:"skill",name:ne.name,uri:ne.uri,reason:ne.storage});let Z=this._configurationService.getValue(rs.USE_SKILL_ADHERENCE_PROMPT),me=c??l;I.push("<skills>"),Z?(I.push("Skills provide specialized capabilities, domain knowledge, and refined workflows for producing high-quality outputs. Each skill folder contains tested instructions for specific domains like testing strategies, API design, or performance optimization. Multiple skills can be combined when a task spans different domains."),c?I.push(`BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST invoke it IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${c.variable} with the skill name to load the relevant skill(s).`):I.push(`BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST load and read the SKILL.md file IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${l.variable} to load the relevant skill(s).`),I.push("NEVER just mention or reference a skill in your response without actually loading it first. If a skill is relevant, load it before proceeding."),I.push("How to determine if a skill applies:"),I.push("1. Review the available skills below and match their descriptions against the user's request"),I.push("2. If any skill's domain overlaps with the task, load that skill immediately"),I.push("3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"),I.push("Examples:"),I.push(`- "Help me write unit tests for this module" -> Load the testing skill via ${me.variable} FIRST, then proceed`),I.push(`- "Optimize this slow function" -> Load the performance-profiling skill via ${me.variable} FIRST, then proceed`),I.push('- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST'),I.push("Available skills:")):c?(I.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),I.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${c.variable} tool with the skill name to load it.`)):(I.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),I.push("Each skill comes with a description of the topic and a file path that contains the detailed instructions."),I.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${l.variable} tool to acquire the full instructions from the file URI.`));let vt=15e3,ut=5e3,ie=0,ee=Q.length;for(let ne=0;ne<Q.length;ne++){let se=Q[ne],X=["<skill>",`<name>${ti(se.name)}</name>`];se.description&&X.push(`<description>${ti(se.description)}</description>`),X.push(`<file>${f(se.uri)}</file>`),X.push("</skill>");let ae=X.join(`
`).length+1;if(c&&ie+ae>vt){ee=ne;break}ie+=ae,I.push(...X)}if(ee<Q.length){let ne=Q.slice(ee),se=[],X=0;for(let yt of ne){let Qe=ti(yt.name),He=(se.length>0?2:0)+Qe.length;if(X+He>ut)break;X+=He,se.push(Qe)}let ae=ne.length-se.length,be=se.join(", ");I.push(ae>0?`Additional skills available (invoke by name): ${be}... and ${ae} more`:`Additional skills available (invoke by name): ${be}`)}I.push("</skills>","","")}}if(d){let R=(()=>{if(!this._enabledSubagents||this._enabledSubagents.includes("*"))return U=>U.visibility.agentInvocable&&Sh(U.sessionTypes,u);{let U=this._enabledSubagents;return z=>U.includes(z.name)&&Sh(z.sessionTypes,u)}})(),L=(await this._promptsService.getCustomAgents(r)).filter(U=>U.enabled);if(L.length>0){I.push("<agents>"),I.push("Here is a list of agents that can be used when running a subagent."),I.push("Each agent has optionally a description with the agent's purpose and expertise. When asked to run a subagent, choose the most appropriate agent from this list."),I.push(`Use the ${d.variable} tool with the agent name to run the subagent.`);for(let U of L)R(U)?(I.push("<agent>"),I.push(`<name>${ti(U.name)}</name>`),U.description&&I.push(`<description>${ti(U.description)}</description>`),U.argumentHint&&I.push(`<argumentHint>${ti(U.argumentHint)}</argumentHint>`),I.push("</agent>"),o.debugDetails.push({category:"custom-agent",name:U.name,uri:U.uri}),E9(U.uri)&&n.claudeAgentsCount++):o.debugDetails.push({category:"skipped",name:U.name,uri:U.uri,reason:p(13149,null)});I.push("</agents>","","")}}if(I.length===0)return;let x=I.join(`
`),E=[],w=R=>{if(R){let L=x.indexOf(R.variable);for(;L>=0;)E.push(KV(R.tool,new ko(L,L+R.variable.length))),L=x.indexOf(R.variable,L+1)}};return w(l),w(d),w(c),qV(x,!0,E)}async _addReferencedInstructions(t,e,n,o){if(!this._configurationService.getValue(rs.INCLUDE_REFERENCED_INSTRUCTIONS)&&this._modeKind!=="edit"){this._logService.trace("[InstructionsContextComputer] includeReferencedInstructions is disabled and agent kind is not Edit. No referenced instructions will be added.");return}let s=new Lr,a=[];for(let d of t.asArray())dy(d)&&(s.has(d.value)||(a.push(d.value),s.add(d.value)));let l=a.pop();for(;l;){let d=await this._parseInstructionsFile(l,o);if(d&&d.body){let c=[];for(let u of d.body.fileReferences){let m=d.body.resolveFilePath(u.content);m&&!s.has(m)&&(yU(m)||this._workspaceService.getWorkspaceFolder(m)!==void 0)&&(c.push({resource:m}),s.add(m))}if(c.length>0){let u=await this._fileService.resolveAll(c);for(let m=0;m<u.length;m++){let g=u[m],h=c[m].resource;if(g.success&&g.stat?.isFile){yU(h)&&a.push(h);let f=p(13160,null,Ze(l));t.add(ld(h,"vscode.instructions.file.reference",f,!0)),e.referencedInstructionsCount++,n.debugDetails.push({category:"referenced",name:Ze(h).toString(),uri:h,reason:f}),this._logService.trace(`[InstructionsContextComputer] ${h.toString()} added, referenced by ${l.toString()}`)}}}}l=a.pop()}}};Ch=_([S(4,OP),S(5,te),S(6,x9),S(7,$t),S(8,Cr),S(9,zo),S(10,Ds),S(11,ui),S(12,Em),S(13,P9)],Ch);function CZ(i,t,e=!1){if(e&&i.scheme===B.file)return i.with({scheme:"vscode-local"}).toString();if(i.scheme===B.file||i.scheme===B.vscodeRemote){let n=i.fsPath;return t!==void 0?t===1?n.replace(/\//g,"\\"):n.replace(/\\/g,"/"):n}return i.toString()}function TZ(i,t,e){let n=e.defaultChatAgent?.chatExtensionId;if(!n)return!1;let o=xe.equals(t,n),r=i.path.includes("/github/");return o&&r}function IU(i,t,e){if(i.storage!=="extension")return!1;let n=e.defaultChatAgent?.chatExtensionId;return!n||!xe.equals(i.extensionId,n)?!1:!TZ(t,i.extensionId,e)}function UP(i){return{content:[{kind:"text",value:i}]}}var EZ=`Launch a new agent to handle complex, multi-step tasks autonomously. This tool is good at researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use this agent to perform the search for you.

- Agents do not run async or in the background, you will wait for the agent's result.
- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
- Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
- The agent's outputs should generally be trusted
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
- If the user asks for a certain agent, you MUST provide that EXACT agent name (case-sensitive) to invoke that specific agent.`,wZ=5,is=class extends N{constructor(e,n,o,r,s,a,l,d,c){super();this.chatAgentService=e;this.chatService=n;this.languageModelToolsService=o;this.languageModelsService=r;this.logService=s;this.configurationService=a;this.promptsService=l;this.instantiationService=d;this.productService=c;this._onDidUpdateToolData=this._register(new T);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._resolvedModels=new Map;this._sessionDepth=new Map}static{this.Id="runSubagent"}getToolData(){let e=EZ,n={prompt:{type:"string",description:"A detailed description of the task for the agent to perform"},description:{type:"string",description:"A short (3-5 word) description of the task"}};n.agentName={type:"string",description:"Optional name of a specific agent to invoke. If not provided, uses the current agent."},n.model={type:"string",description:'Optional model for the subagent. Format: "Model Name (Vendor)", vendor is usually "copilot". Only use to enforce a specific model.'};let o={type:"object",properties:n,required:["prompt","description"]};return{id:is.Id,toolReferenceName:Ay.runSubagent,icon:ct.fromId(de.organization.id),displayName:p(13558,null),userDescription:p(13559,null),modelDescription:e,source:pn.Internal,inputSchema:o}}async invoke(e,n,o,r){let s=e.parameters;if(this.logService.debug(`RunSubagentTool: Invoking with prompt: ${s.prompt.substring(0,100)}...`),!e.context)throw new Error("toolInvocationToken is required for this tool");let a=this.chatService.getSession(e.context.sessionResource);if(!a)throw new Error("Chat model not found for session");let l=a.getRequests().at(-1),d,c=new $;try{let u=this.chatAgentService.getDefaultAgent("panel","agent");if(!u)return UP("Error: No default agent available");let m=e.modelId,g=e.userSelectedTools,h,f,I,x=l.modeInfo?.modeInstructions,E=this.normalizeRequestedAgentName(s.agentName),w=E??x?.name;if(E)if(this.validateSubagentAllowed(E,x),f=await this.getSubAgentByName(E),f){let X=this._resolvedModels.get(e.callId);if(X)this._resolvedModels.delete(e.callId),m=X.modeModelId,I=X.resolvedModelName;else{let yt=this.resolveSubagentModel(f,e.modelId,s.model);m=yt.modeModelId,I=yt.resolvedModelName}let ae=f.tools;if(ae){let yt=this.languageModelToolsService.toToolAndToolSetEnablementMap(ae,void 0);g={};for(let[Qe,He]of yt)K4(Qe)||(g[Qe.id]=He)}let be=f.agentInstructions;h=be&&{name:E,content:be.content,toolReferences:be.toolReferences.length?this.languageModelToolsService.toToolReferences(be.toolReferences):[],allowedSubagents:f.agents,metadata:be.metadata,isBuiltin:IU(f.source,f.uri,this.productService)}}else throw this._resolvedModels.delete(e.callId),new Error(`Requested agent '${E}' not found. Try again with the correct agent name, or omit agentName to use the current agent.`);else{h=x;let X=this._resolvedModels.get(e.callId);if(X)this._resolvedModels.delete(e.callId),m=X.modeModelId,I=X.resolvedModelName;else{let ae=this.resolveSubagentModel(void 0,e.modelId,s.model);m=ae.modeModelId,I=ae.resolvedModelName}}let R=[],L=e.chatStreamToolCallId??e.callId??`subagent-${_e()}`,U=!1,z=X=>{for(let ae of X){if(ae.kind==="usage"){typeof ae.copilotCredits=="number"&&Number.isFinite(ae.copilotCredits)&&ae.copilotCredits>=0&&(d=Math.max(d??0,ae.copilotCredits));continue}ae.kind==="textEdit"||ae.kind==="notebookEdit"||ae.kind==="codeblockUri"?(ae.kind==="codeblockUri"&&!U&&(U=!0,a.acceptResponseProgress(l,{kind:"markdownContent",content:new _t("```\n")})),ae.kind==="codeblockUri"?a.acceptResponseProgress(l,{...ae,subAgentInvocationId:L}):a.acceptResponseProgress(l,ae)):ae.kind==="hook"?a.acceptResponseProgress(l,{...ae,subAgentInvocationId:L}):ae.kind==="markdownContent"&&(U&&(a.acceptResponseProgress(l,{kind:"markdownContent",content:new _t("\n```\n\n")}),U=!1),R.push(ae.content.value))}},Y=this.configurationService.getValue("chat.subagents.allowInvocationsFromSubagents")??!1,j=Y?wZ:0,Q=e.context.sessionResource.toString(),Z=this._sessionDepth.get(Q)??0,me=Z+1<=j;g||(g={}),g[is.Id]!==!1&&(g[is.Id]=me),g[pU]=!1,g.copilot_askQuestions=!1,j>0&&this.logService.debug(`RunSubagentTool: Nested subagents enabling ${g[is.Id]}: session ${Q}, currentDepth: ${Z}, maxDepth: ${j}, allowInvocationsFromSubagents: ${Y}`);let ut=new iu;this.configurationService.getValue("chat.experimental.collectInstructionsInExtension")!==!0&&await this.instantiationService.createInstance(Ch,"agent",g,h?.allowedSubagents,ou(e.context.sessionResource)).collect(ut,r);let ie;try{ie=(await this.promptsService.getHooks(r))?.hooks}catch(X){this.logService.warn("[ChatService] Failed to collect hooks:",X)}if(f?.hooks){let X={...f.hooks};if(X.Stop){let ae=X.Stop;X.SubagentStop=X.SubagentStop?[...X.SubagentStop,...ae]:ae,X.Stop=void 0}ie=a$(ie,X)}let ee={sessionResource:e.context.sessionResource,requestId:e.callId??`subagent-${Date.now()}`,agentId:u.id,message:s.prompt,variables:{variables:ut.asArray()},location:"panel",subAgentInvocationId:L,subAgentName:w,userSelectedModelId:m,modelConfiguration:m?this.languageModelsService.getModelConfiguration(m):void 0,userSelectedTools:g,modeInstructions:h,parentRequestId:e.chatRequestId,hooks:ie,hasHooksEnabled:!!ie&&Object.values(ie).some(X=>X&&X.length>0)};c.add(this.languageModelToolsService.onDidInvokeTool(X=>{X.subagentInvocationId===L&&(R.length=0)})),this._sessionDepth.set(Q,Z+1);let ne;try{ne=await this.chatAgentService.invokeAgent(u.id,ee,z,[],r)}finally{let X=(this._sessionDepth.get(Q)??1)-1;X<=0?this._sessionDepth.delete(Q):this._sessionDepth.set(Q,X)}if(ne?.errorDetails)return UP(`Agent error: ${ne.errorDetails.message}`);let se=R.join("").replace(/^\n*```\n+```\n*/g,"").trim()||"Agent completed with no output";return e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.result=se,e.toolSpecificData.modelName=I),{content:[{kind:"text",value:se}],toolMetadata:{subAgentInvocationId:L,description:s.description,agentName:ee.subAgentName,modelName:I}}}catch(u){let m=`Error invoking subagent: ${u instanceof Error?u.message:"Unknown error"}`;return this.logService.error(m,u),UP(m)}finally{d!==void 0&&(l.response?.setSubagentCopilotCredits(e.callId,d),e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.credits=d)),c.dispose()}}async getSubAgentByName(e){return(await this.promptsService.getCustomAgents(pe.None)).find(o=>o.name===e&&o.enabled)}checkMultiplierConstraint(e,n){if(!n||e===n)return{exceeds:!1};let o=this.languageModelsService.lookupLanguageModel(n),r=this.languageModelsService.lookupLanguageModel(e),s=o?.multiplierNumeric,a=r?.multiplierNumeric;return s!==void 0&&a!==void 0&&a>s?{exceeds:!0,reason:`exceeds the current model's cost tier (${a}x vs ${s}x)`}:{exceeds:!1}}getAvailableModelsInfo(e){let n=this.languageModelsService.getLanguageModelIds().map(a=>({id:a,metadata:this.languageModelsService.lookupLanguageModel(a)})).filter(a=>!!a.metadata&&Im.suitableForAgentMode(a.metadata)&&a.metadata.isUserSelectable!==!1&&!a.metadata.targetChatSessionType);if(n.length===0)return"No models available.";let o=[],r=[];for(let{id:a,metadata:l}of n){let d=Im.asQualifiedName(l);this.checkMultiplierConstraint(a,e).exceeds?r.push(d):o.push(d)}let s=[];return o.length>0&&s.push(`Available models: ${o.join(", ")}`),r.length>0&&s.push(`Unavailable (exceeds current model's cost tier): ${r.join(", ")}`),s.join(". ")||"No models available."}resolveSubagentModel(e,n,o){let r=n,s=!1;if(o){let l=this.languageModelsService.lookupLanguageModelByQualifiedName(o);if(l?.identifier)r=l.identifier,s=!0;else throw new Error(`Requested model '${o}' not found. ${this.getAvailableModelsInfo(n)}`)}if(e&&!s){let l=e.model;if(l){let d=n?this.languageModelsService.lookupLanguageModel(n):void 0,u=!!d&&I9(d)&&IU(e.source,e.uri,this.productService);for(let m of l){let g=this.languageModelsService.lookupLanguageModelByQualifiedName(m);if(g?.identifier){if(u&&g.metadata.vendor===Ps)continue;r=g.identifier;break}}}}if(r){let l=this.checkMultiplierConstraint(r,n);if(l.exceeds){let d=this.languageModelsService.lookupLanguageModel(r);throw new Error(`Requested model '${d?.name}' ${l.reason}. ${this.getAvailableModelsInfo(n)}`)}}let a=r?this.languageModelsService.lookupLanguageModel(r):void 0;return{modeModelId:r,resolvedModelName:a?.name}}async prepareToolInvocation(e,n){let o=e.parameters,r=this.normalizeRequestedAgentName(o.agentName),s=e.chatSessionResource?this.getCurrentModeInstructions(e.chatSessionResource):void 0;r&&this.validateSubagentAllowed(r,s);let a=r?await this.getSubAgentByName(r):void 0,l=this.resolveSubagentModel(a,e.modelId,o.model);return this._resolvedModels.set(e.toolCallId,l),{invocationMessage:o.description,toolSpecificData:{kind:"subagent",description:o.description,agentName:a?.name??r??s?.name,prompt:o.prompt,modelName:l.resolvedModelName}}}normalizeRequestedAgentName(e){let n=e?.trim();return n||void 0}getCurrentModeInstructions(e){return typeof this.chatService.getSession!="function"?void 0:this.chatService.getSession(e)?.getRequests().at(-1)?.modeInfo?.modeInstructions}validateSubagentAllowed(e,n){let o=n?.allowedSubagents;if(o&&!o.includes("*")&&!o.includes(e))throw new Error(`Requested agent '${e}' is not allowed by the current agent.`)}};is=_([S(0,_C),S(1,wr),S(2,Em),S(3,EC),S(4,te),S(5,$t),S(6,OP),S(7,Dn),S(8,Es)],is);var _9="chat-memory-file",kZ="copilot_memory",D9;(n=>{function i(o,r){return y.from({scheme:_9,path:o,query:r.toString()})}n.createUri=i;function t(o){return o.scheme===_9}n.isChatMemoryFileUri=t;function e(o){return{memoryPath:o.path,sessionResource:o.query}}n.parse=e})(D9||={});function PZ(i,t){if(i===t)return!0;let[e,n]=i.split("/"),[o]=t.split("/");return n==="*"&&e===o}function xI(i,t){let e=ot(i);for(let[n,o]of Object.entries(t))if(_r(n,i)||_r(n,e))return o}function R9(i,t){for(let[e,n]of Object.entries(t))if(PZ(e,i))return n}function _Z(i){return typeof i=="object"&&i!==null&&"output"in i&&typeof i.output=="object"&&i.output?.type==="data"&&typeof i.output?.mimeType=="string"}function RZ(i){if(typeof i!="object"||i===null)return;let t=i.path;return typeof t=="string"?t:void 0}var DZ=new Set(["create","str_replace","insert"]);function AZ(i){if(typeof i!="object"||i===null)return!1;let t=i.command;return typeof t=="string"&&DZ.has(t)}function A9(i,t,e,n,o={}){let r=[],s=new Set;for(let a of i.value){if(a.kind==="codeblockUri"){let l=a.uri,d=l.toString();if(s.has(d))continue;let c=xI(l.path,n);c&&(s.add(d),r.push({label:Ze(l),uri:d,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if(a.kind==="textEditGroup"){let l=a.uri,d=l.toString();if(s.has(d))continue;let c=xI(l.path,n);c&&(s.add(d),r.push({label:Ze(l),uri:d,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if(a.kind==="workspaceEdit")for(let l of a.edits){let d=l.newResource??l.oldResource;if(!d)continue;let c=d.toString();if(s.has(c))continue;let u=xI(d.path,n);u&&(s.add(c),r.push({label:Ze(d),uri:c,type:"plan",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup}))}if(a.kind==="externalEdit"){let l=a.uri,d=l.toString();if(s.has(d))continue;let c=xI(l.path,n);c&&(s.add(d),r.push({label:Ze(l),uri:d,type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}if((a.kind==="toolInvocation"||a.kind==="toolInvocationSerialized")&&a.toolId===kZ){let l=Fe.getParameters(a),d=RZ(l);if(d&&AZ(l)){let c=xI(d,o);if(c){let u=`memory:${a.toolCallId}:${d}`;s.has(u)||(s.add(u),r.push({label:ot(d),uri:D9.createUri(d,t).toString(),type:"plan",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup}))}}}if(a.kind==="toolInvocation"||a.kind==="toolInvocationSerialized"){let l=Fe.resultDetails(a);if(!l)continue;if(A1(l))for(let d=0;d<l.output.length;d++){let c=l.output[d];if(c.type==="embed"&&!c.isText&&c.mimeType){let u=R9(c.mimeType,e);if(u){let m=`${a.toolCallId}:${d}`;if(!s.has(m)){s.add(m);let g=kS(c.mimeType),h=g?`file${g}`:"file.bin",f=Oy.createUri(t,a.toolCallId,d,h);r.push({label:c.uri?.path.split("/").pop()??`${u.groupName} ${d+1}`,uri:f.toString(),toolCallId:a.toolCallId,dataPartIndex:d,type:"screenshot",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup})}}}}if(_Z(l)){let d=R9(l.output.mimeType,e);if(d){let c=`${a.toolCallId}:0`;if(!s.has(c)){s.add(c);let u=kS(l.output.mimeType),m=u?`file${u}`:"file.bin",g=Oy.createUri(t,a.toolCallId,0,m);r.push({label:`${d.groupName}`,uri:g.toString(),toolCallId:a.toolCallId,dataPartIndex:0,type:"screenshot",groupName:d.groupName,onlyShowGroup:d.onlyShowGroup})}}}}}return r}var HP=A("chatArtifactsService"),SI=class{constructor(t){this._memento=new bh("chat-artifacts",t)}get(t){return this._memento.getMemento(1,1)[t]||[]}set(t,e){let n=this._memento.getMemento(1,1);n[t]=e,this._memento.saveMemento()}delete(t){let e=this._memento.getMemento(1,1);delete e[t],this._memento.saveMemento()}};SI=_([S(0,yo)],SI);var xU=class extends N{constructor(e,n,o,r,s){super();this._storageKey=n;this._storage=o;this._responseCache=new Map;this._ruleOverrides=Ua({owner:this,equalsFn:()=>!1},void 0);this._agentArtifacts=Ua({owner:this,equalsFn:()=>!1},[]);this._subagentArtifacts=Ua({owner:this,equalsFn:()=>!1},new Map);this._nextSequence=1;this._sourceSequences=new Map;let a=this._storage.get(this._storageKey);this._agentArtifacts.set(a,void 0),this._sourceSequences.set("rules",0),a.length>0&&this._sourceSequences.set("agent",this._nextSequence++);let l=wo(this,s.onDidChangeConfiguration,()=>s.getValue("chat.artifacts.rules.byMimeType")??{}),d=wo(this,s.onDidChangeConfiguration,()=>s.getValue("chat.artifacts.rules.byFilePath")??{}),c=wo(this,s.onDidChangeConfiguration,()=>s.getValue("chat.artifacts.rules.byMemoryFilePath")??{}),u=wo(this,r.onDidCreateModel,()=>r.getSession(e)),m=Ha(g=>{let h=this._ruleOverrides.read(g),f=h?.byMimeType??l.read(g),I=h?.byFilePath??d.read(g),x=h?.byMemoryFilePath??c.read(g),E=u.read(g);if(!E)return[];gy(this,E.onDidChange).read(g);let R=E.getRequests(),L=[],U=new Set,z=new Set;for(let Y of R){let j=Y.response;if(!j)continue;U.add(j.id);let Q=j.response,Z=Q.value.length,me=0;for(let ie of Q.value)(ie.kind==="toolInvocation"||ie.kind==="toolInvocationSerialized")&&Fe.resultDetails(ie)!==void 0&&me++;let vt=this._responseCache.get(j.id),ut;vt&&vt.partsLength===Z&&vt.completedToolCount===me&&vt.byMimeType===f&&vt.byFilePath===I&&vt.byMemoryFilePath===x?ut=vt.artifacts:(ut=A9(Q,e,f,I,x),this._responseCache.set(j.id,{partsLength:Z,completedToolCount:me,byMimeType:f,byFilePath:I,byMemoryFilePath:x,artifacts:ut}));for(let ie of ut){let ee=ie.toolCallId?`${ie.toolCallId}:${ie.dataPartIndex}`:ie.uri;if(z.has(ee)){let ne=L.findIndex(se=>se.toolCallId?`${se.toolCallId}:${se.dataPartIndex}`===ee:se.uri===ee);ne!==-1&&L.splice(ne,1)}z.add(ee),L.push(ie)}}for(let Y of this._responseCache.keys())U.has(Y)||this._responseCache.delete(Y);return L});this.artifactGroups=Ha(g=>{let h=[],f=m.read(g);f.length>0&&h.push({key:"rules",seq:this._sourceSequences.get("rules")??0,group:{source:{kind:"rules"},artifacts:f}});let I=this._agentArtifacts.read(g);I.length>0&&h.push({key:"agent",seq:this._sourceSequences.get("agent")??1/0,group:{source:{kind:"agent"},artifacts:I}});let x=this._subagentArtifacts.read(g);for(let[R,L]of x)if(L.artifacts.length>0){let U=`subagent:${R}`;h.push({key:U,seq:this._sourceSequences.get(U)??1/0,group:{source:{kind:"subagent",invocationId:R,name:L.name},artifacts:L.artifacts}})}h.sort((R,L)=>R.seq-L.seq);let E=new Set,w=[];for(let R of h){let L=R.group.artifacts.filter(U=>{let z=U.toolCallId?`${U.toolCallId}:${U.dataPartIndex}`:U.uri;if(!z)return!1;let Y=z.toLowerCase();return E.has(Y)?!1:(E.add(Y),!0)});L.length>0&&w.push({source:R.group.source,artifacts:L})}return w})}setAgentArtifacts(e){this._sourceSequences.has("agent")||this._sourceSequences.set("agent",this._nextSequence++),this._agentArtifacts.set(e,void 0),this._storage.set(this._storageKey,e)}setSubagentArtifacts(e,n,o){let r=`subagent:${e}`;this._sourceSequences.has(r)||this._sourceSequences.set(r,this._nextSequence++);let s=new Map(this._subagentArtifacts.get());o.length===0?s.delete(e):s.set(e,{name:n,artifacts:o}),this._subagentArtifacts.set(s,void 0)}setRuleOverrides(e){this._ruleOverrides.set(e,void 0)}clearAgentArtifacts(){this._agentArtifacts.set([],void 0),this._storage.set(this._storageKey,[])}clearSubagentArtifacts(e){let n=new Map(this._subagentArtifacts.get());n.delete(e),this._subagentArtifacts.set(n,void 0)}migrate(e){let n=this._agentArtifacts.get();n.length>0&&e.setAgentArtifacts([...n]),this._agentArtifacts.set([],void 0),this._storage.delete(this._storageKey)}},FP=class extends N{constructor(e,n,o){super();this._chatService=n;this._configurationService=o;this._instances=this._register(new bn);this._storage=new SI(e)}getArtifacts(e){let n=sd(e),o=this._instances.get(n);return o||(o=new xU(e,n,this._storage,this._chatService,this._configurationService),this._instances.set(n,o)),o}};FP=_([S(0,yo),S(1,wr),S(2,$t)],FP);var MZ="setArtifacts",LZ={type:"object",properties:{artifacts:{type:"array",description:"The complete list of artifacts for this session. Overwrites any existing artifacts.",items:{type:"object",properties:{label:{type:"string",description:"Display label for the artifact."},uri:{type:"string",description:"Fully qualified URI of the artifact (e.g. https://localhost:3000 or file:///path/to/file). Must include the scheme."},type:{type:"string",enum:["devServer","screenshot","plan"],description:"The type of artifact."}},required:["label"]}}},required:["artifacts"]},M9={id:MZ,toolReferenceName:"artifacts",legacyToolReferenceFullNames:["Set Session Artifacts"],displayName:p(13563,null),modelDescription:`Set the list of artifacts for the current session. Each artifact has a label and either a uri or a toolCallId+dataPartIndex reference, plus an optional type (devServer, screenshot, plan). This overwrites the entire artifact list. URIs must be fully qualified with a scheme (e.g. https://localhost:3000, file:///tmp/plan.md). To reference a screenshot or image from a previous tool result, use toolCallId and dataPartIndex instead of uri.

When to use this tool:
- When creating or updating a plan saved to session memory \u2014 set a plan artifact so the user can view it in the artifact panel
- When taking screenshots or producing visual output \u2014 set a screenshot artifact to surface the image
- When starting a dev server \u2014 set a devServer artifact with the URL so the user can access it
- When producing important documents, drafts, or temporary markdown files \u2014 set an artifact to make them easily accessible
- After verification steps that produce visual results \u2014 update artifacts with screenshots showing the outcome

Workflow:
- Prefer artifacts over printing long content inline in chat. Save content to a file or memory, then set an artifact pointing to it.
- When updating plans or documents, update both the underlying file AND the artifact list.
- Keep artifact labels concise and descriptive.`,canBeReferencedInPrompt:!0,source:pn.Internal,inputSchema:LZ},Th=class{constructor(t,e,n){this._chatArtifactsService=t;this._fileService=e;this._chatService=n}async prepareToolInvocation(t,e){return{pastTenseMessage:new _t(p(13564,null)),presentation:"hidden"}}async invoke(t,e,n,o){let r=t.parameters,s=t.context?.sessionResource;if(!s)return{content:[{kind:"text",value:"Error: No session resource available"}]};let a=[];for(let c of r.artifacts??[]){let u=c.uri;if(u||(u=""),u){let m=y.parse(u);if(m.scheme!=="http"&&m.scheme!=="https"&&!await this._fileService.exists(m))throw new Error(p(13566,null,u))}a.push({label:c.label,uri:u,type:c.type})}let l=this._chatArtifactsService.getArtifacts(s),d=t.subAgentInvocationId;if(d){let c=this._resolveSubagentName(s,d);l.setSubagentArtifacts(d,c,a)}else l.setAgentArtifacts(a);return{content:[{kind:"text",value:p(13565,null,a.length)}]}}_resolveSubagentName(t,e){let n=this._chatService.getSession(t);if(n)for(let o of n.getRequests()){let r=o.response;if(r){for(let s of r.response.value)if((s.kind==="toolInvocation"||s.kind==="toolInvocationSerialized")&&s.toolCallId===e&&s.toolSpecificData?.kind==="subagent")return s.toolSpecificData.agentName}}}};Th=_([S(0,HP),S(1,zo),S(2,wr)],Th);var OZ="setArtifactRules",SU={type:"object",properties:{groupName:{type:"string",description:"Display name for the artifact group."},onlyShowGroup:{type:"boolean",description:"When true, show only the group header instead of individual items."}},required:["groupName"]},NZ={type:"object",properties:{byMimeType:{type:"object",description:"Rules for extracting artifacts from tool results by MIME type. Maps MIME type patterns (e.g. 'image/*') to group configuration.",additionalProperties:SU},byFilePath:{type:"object",description:"Rules for extracting artifacts from written files by file path glob pattern. Maps glob patterns (e.g. '**/*plan*.md') to group configuration.",additionalProperties:SU},byMemoryFilePath:{type:"object",description:"Rules for extracting artifacts from memory tool writes by memory file path glob pattern. Maps glob patterns to group configuration.",additionalProperties:SU}}},L9={id:OZ,toolReferenceName:"artifactRules",legacyToolReferenceFullNames:[],displayName:p(13560,null),modelDescription:`Override the artifact extraction rules for this session. Rules control which tool results, files, and memory writes are automatically surfaced as artifacts.

Provide rules as MIME type patterns, file path globs, or memory file path globs, each mapped to a group configuration with a groupName and optional onlyShowGroup flag.

Examples:
- byMimeType: { "image/*": { "groupName": "Screenshots", "onlyShowGroup": true } }
- byFilePath: { "**/*plan*.md": { "groupName": "Plans" } }
- byMemoryFilePath: { "**/*plan*.md": { "groupName": "Plans" } }

This fully replaces any settings-based rules for the duration of this session.`,canBeReferencedInPrompt:!0,source:pn.Internal,inputSchema:NZ},Eh=class{constructor(t){this._chatArtifactsService=t}async prepareToolInvocation(t,e){return{pastTenseMessage:new _t(p(13561,null)),presentation:"hidden"}}async invoke(t,e,n,o){let r=t.parameters,s=t.context?.sessionResource;if(!s)return{content:[{kind:"text",value:"Error: No session resource available"}]};let a={byMimeType:r.byMimeType,byFilePath:r.byFilePath,byMemoryFilePath:r.byMemoryFilePath};return this._chatArtifactsService.getArtifacts(s).setRuleOverrides(a),{content:[{kind:"text",value:p(13562,null)}]}}};Eh=_([S(0,HP)],Eh);var UZ="task_complete";var O9={id:UZ,displayName:"Task Complete",modelDescription:`Signal that the user's task is fully done. You MUST call this tool when your work is complete \u2014 whether you made code changes, answered a question, or completed any other kind of task. Provide a brief summary of what was accomplished. Do not restate the summary in your message text \u2014 it is shown to the user directly.

IMPORTANT: Before calling this tool, you MUST output a brief text message summarizing what was done. The task is not complete until both your summary message AND this tool call are present.

When to call:
- After answering the user's question or completing a conversational request
- After you have completed ALL requested changes
- After verifying results: tests pass, terminal commands succeeded, tool calls returned expected output

When NOT to call:
- If a terminal command failed or produced unexpected output
- If an MCP or external tool call returned an error
- If you encountered errors you have not resolved
- If there are remaining steps to complete
- If you have not verified your changes work`,source:pn.Internal,inputSchema:{type:"object",properties:{summary:{type:"string",description:"Brief summary of what was accomplished. Omit for trivial interactions."}}}},WP=class{async prepareToolInvocation(t,e){return{presentation:"hidden"}}async invoke(t,e,n,o){return{content:[{kind:"text",value:t.parameters?.summary??"All done!"}]}}};var VP=class extends N{static{this.ID="chat.builtinTools"}constructor(t,e,n){super();let o=e.createInstance(hh);this._register(t.registerTool(m9,o));let r=this._register(e.createInstance(vh));this._register(t.registerTool(uU,r)),this._register(t.vscodeToolSet.addTool(uU));let s=this._register(e.createInstance(xh));this._register(t.registerTool(b9,s));let a=mU(),l=this._register(e.createInstance(Ih));this._register(t.registerTool(a,l));let d=e.createInstance(AP);this._register(t.registerTool(f9,d)),this._register(t.registerTool(h9,d));let c=e.createInstance(MP);this._register(t.registerTool(v9,c));let u=e.createInstance(WP);this._register(t.registerTool(O9,u));let m=e.createInstance(Th),g=e.createInstance(Eh),h=this._register(new tn),f=this._register(new tn),I=()=>{n.getValue("chat.artifacts.enabled")?(h.value||(h.value=t.registerTool(M9,m)),f.value||(f.value=t.registerTool(L9,g))):(h.clear(),f.clear())};I(),this._register(n.onDidChangeConfiguration(L=>{L.affectsConfiguration("chat.artifacts.enabled")&&I()}));let x=this._register(e.createInstance(is)),E,w,R=()=>{E?.dispose(),w?.dispose(),t.flushToolUpdates();let L=x.getToolData();E=t.registerTool(L,x),w=t.agentToolSet.addTool(L)};R(),this._register(x.onDidUpdateToolData(R)),this._register({dispose:()=>{E?.dispose(),w?.dispose()}})}};VP=_([S(0,Em),S(1,Dn),S(2,$t)],VP);var N9="vscode_fetchWebPage_internal";var CU=A("commandService"),CI=new class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new T;this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(i,t){if(!i)throw new Error("invalid command");if(typeof i=="string"){if(!t)throw new Error("invalid command");return this.registerCommand({id:i,handler:t})}if(i.metadata&&Array.isArray(i.metadata.args)){let s=[];for(let l of i.metadata.args)s.push(l.constraint);let a=i.handler;i.handler=function(l,...d){return RH(d,s),a(l,...d)}}let{id:e}=i,n=this._commands.get(e);n||(n=new mo,this._commands.set(e,n));let o=n.unshift(i),r=q(()=>{o(),this._commands.get(e)?.isEmpty()&&this._commands.delete(e)});return this._onDidRegisterCommand.fire(e),av(r)}registerCommandAlias(i,t){return CI.registerCommand(i,(e,...n)=>e.get(CU).executeCommand(t,...n))}getCommand(i){let t=this._commands.get(i);if(!(!t||t.isEmpty()))return Mt.first(t)}getCommands(){let i=new Map;for(let t of this._commands.keys()){let e=this.getCommand(t);e&&i.set(t,e)}return i}};CI.registerCommand("noop",()=>{});var TI=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},BP=new TI,TU=new TI,EU=new TI,FZ=new Array(230),HZ={},WZ={},VZ=[],BZ=Object.create(null),$Z=Object.create(null);var U9=[],wU=[];for(let i=0;i<=193;i++)U9[i]=-1;for(let i=0;i<=132;i++)wU[i]=-1;(function(){let t=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN","",""],[1,1,"Hyper",0,"",0,"","",""],[1,2,"Super",0,"",0,"","",""],[1,3,"Fn",0,"",0,"","",""],[1,4,"FnLock",0,"",0,"","",""],[1,5,"Suspend",0,"",0,"","",""],[1,6,"Resume",0,"",0,"","",""],[1,7,"Turbo",0,"",0,"","",""],[1,8,"Sleep",0,"",0,"VK_SLEEP","",""],[1,9,"WakeUp",0,"",0,"","",""],[0,10,"KeyA",31,"A",65,"VK_A","",""],[0,11,"KeyB",32,"B",66,"VK_B","",""],[0,12,"KeyC",33,"C",67,"VK_C","",""],[0,13,"KeyD",34,"D",68,"VK_D","",""],[0,14,"KeyE",35,"E",69,"VK_E","",""],[0,15,"KeyF",36,"F",70,"VK_F","",""],[0,16,"KeyG",37,"G",71,"VK_G","",""],[0,17,"KeyH",38,"H",72,"VK_H","",""],[0,18,"KeyI",39,"I",73,"VK_I","",""],[0,19,"KeyJ",40,"J",74,"VK_J","",""],[0,20,"KeyK",41,"K",75,"VK_K","",""],[0,21,"KeyL",42,"L",76,"VK_L","",""],[0,22,"KeyM",43,"M",77,"VK_M","",""],[0,23,"KeyN",44,"N",78,"VK_N","",""],[0,24,"KeyO",45,"O",79,"VK_O","",""],[0,25,"KeyP",46,"P",80,"VK_P","",""],[0,26,"KeyQ",47,"Q",81,"VK_Q","",""],[0,27,"KeyR",48,"R",82,"VK_R","",""],[0,28,"KeyS",49,"S",83,"VK_S","",""],[0,29,"KeyT",50,"T",84,"VK_T","",""],[0,30,"KeyU",51,"U",85,"VK_U","",""],[0,31,"KeyV",52,"V",86,"VK_V","",""],[0,32,"KeyW",53,"W",87,"VK_W","",""],[0,33,"KeyX",54,"X",88,"VK_X","",""],[0,34,"KeyY",55,"Y",89,"VK_Y","",""],[0,35,"KeyZ",56,"Z",90,"VK_Z","",""],[0,36,"Digit1",22,"1",49,"VK_1","",""],[0,37,"Digit2",23,"2",50,"VK_2","",""],[0,38,"Digit3",24,"3",51,"VK_3","",""],[0,39,"Digit4",25,"4",52,"VK_4","",""],[0,40,"Digit5",26,"5",53,"VK_5","",""],[0,41,"Digit6",27,"6",54,"VK_6","",""],[0,42,"Digit7",28,"7",55,"VK_7","",""],[0,43,"Digit8",29,"8",56,"VK_8","",""],[0,44,"Digit9",30,"9",57,"VK_9","",""],[0,45,"Digit0",21,"0",48,"VK_0","",""],[1,46,"Enter",3,"Enter",13,"VK_RETURN","",""],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE","",""],[1,48,"Backspace",1,"Backspace",8,"VK_BACK","",""],[1,49,"Tab",2,"Tab",9,"VK_TAB","",""],[1,50,"Space",10,"Space",32,"VK_SPACE","",""],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,"",0,"","",""],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL","",""],[1,64,"F1",59,"F1",112,"VK_F1","",""],[1,65,"F2",60,"F2",113,"VK_F2","",""],[1,66,"F3",61,"F3",114,"VK_F3","",""],[1,67,"F4",62,"F4",115,"VK_F4","",""],[1,68,"F5",63,"F5",116,"VK_F5","",""],[1,69,"F6",64,"F6",117,"VK_F6","",""],[1,70,"F7",65,"F7",118,"VK_F7","",""],[1,71,"F8",66,"F8",119,"VK_F8","",""],[1,72,"F9",67,"F9",120,"VK_F9","",""],[1,73,"F10",68,"F10",121,"VK_F10","",""],[1,74,"F11",69,"F11",122,"VK_F11","",""],[1,75,"F12",70,"F12",123,"VK_F12","",""],[1,76,"PrintScreen",0,"",0,"","",""],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL","",""],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE","",""],[1,79,"Insert",19,"Insert",45,"VK_INSERT","",""],[1,80,"Home",14,"Home",36,"VK_HOME","",""],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR","",""],[1,82,"Delete",20,"Del",46,"VK_DELETE","Delete",""],[1,83,"End",13,"End",35,"VK_END","",""],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT","",""],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",""],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",""],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",""],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",""],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK","",""],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE","",""],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY","",""],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT","",""],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD","",""],[1,94,"NumpadEnter",3,"",0,"","",""],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1","",""],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2","",""],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3","",""],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4","",""],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5","",""],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6","",""],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7","",""],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8","",""],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9","",""],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0","",""],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL","",""],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102","",""],[1,107,"ContextMenu",58,"ContextMenu",93,"","",""],[1,108,"Power",0,"",0,"","",""],[1,109,"NumpadEqual",0,"",0,"","",""],[1,110,"F13",71,"F13",124,"VK_F13","",""],[1,111,"F14",72,"F14",125,"VK_F14","",""],[1,112,"F15",73,"F15",126,"VK_F15","",""],[1,113,"F16",74,"F16",127,"VK_F16","",""],[1,114,"F17",75,"F17",128,"VK_F17","",""],[1,115,"F18",76,"F18",129,"VK_F18","",""],[1,116,"F19",77,"F19",130,"VK_F19","",""],[1,117,"F20",78,"F20",131,"VK_F20","",""],[1,118,"F21",79,"F21",132,"VK_F21","",""],[1,119,"F22",80,"F22",133,"VK_F22","",""],[1,120,"F23",81,"F23",134,"VK_F23","",""],[1,121,"F24",82,"F24",135,"VK_F24","",""],[1,122,"Open",0,"",0,"","",""],[1,123,"Help",0,"",0,"","",""],[1,124,"Select",0,"",0,"","",""],[1,125,"Again",0,"",0,"","",""],[1,126,"Undo",0,"",0,"","",""],[1,127,"Cut",0,"",0,"","",""],[1,128,"Copy",0,"",0,"","",""],[1,129,"Paste",0,"",0,"","",""],[1,130,"Find",0,"",0,"","",""],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE","",""],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP","",""],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN","",""],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR","",""],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1","",""],[1,136,"KanaMode",0,"",0,"","",""],[0,137,"IntlYen",0,"",0,"","",""],[1,138,"Convert",0,"",0,"","",""],[1,139,"NonConvert",0,"",0,"","",""],[1,140,"Lang1",0,"",0,"","",""],[1,141,"Lang2",0,"",0,"","",""],[1,142,"Lang3",0,"",0,"","",""],[1,143,"Lang4",0,"",0,"","",""],[1,144,"Lang5",0,"",0,"","",""],[1,145,"Abort",0,"",0,"","",""],[1,146,"Props",0,"",0,"","",""],[1,147,"NumpadParenLeft",0,"",0,"","",""],[1,148,"NumpadParenRight",0,"",0,"","",""],[1,149,"NumpadBackspace",0,"",0,"","",""],[1,150,"NumpadMemoryStore",0,"",0,"","",""],[1,151,"NumpadMemoryRecall",0,"",0,"","",""],[1,152,"NumpadMemoryClear",0,"",0,"","",""],[1,153,"NumpadMemoryAdd",0,"",0,"","",""],[1,154,"NumpadMemorySubtract",0,"",0,"","",""],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR","",""],[1,156,"NumpadClearEntry",0,"",0,"","",""],[1,0,"",5,"Ctrl",17,"VK_CONTROL","",""],[1,0,"",4,"Shift",16,"VK_SHIFT","",""],[1,0,"",6,"Alt",18,"VK_MENU","",""],[1,0,"",57,"Meta",91,"VK_COMMAND","",""],[1,157,"ControlLeft",5,"",0,"VK_LCONTROL","",""],[1,158,"ShiftLeft",4,"",0,"VK_LSHIFT","",""],[1,159,"AltLeft",6,"",0,"VK_LMENU","",""],[1,160,"MetaLeft",57,"",0,"VK_LWIN","",""],[1,161,"ControlRight",5,"",0,"VK_RCONTROL","",""],[1,162,"ShiftRight",4,"",0,"VK_RSHIFT","",""],[1,163,"AltRight",6,"",0,"VK_RMENU","",""],[1,164,"MetaRight",57,"",0,"VK_RWIN","",""],[1,165,"BrightnessUp",0,"",0,"","",""],[1,166,"BrightnessDown",0,"",0,"","",""],[1,167,"MediaPlay",0,"",0,"","",""],[1,168,"MediaRecord",0,"",0,"","",""],[1,169,"MediaFastForward",0,"",0,"","",""],[1,170,"MediaRewind",0,"",0,"","",""],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK","",""],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK","",""],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP","",""],[1,174,"Eject",0,"",0,"","",""],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE","",""],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT","",""],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL","",""],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2","",""],[1,179,"LaunchApp1",0,"",0,"VK_MEDIA_LAUNCH_APP1","",""],[1,180,"SelectTask",0,"",0,"","",""],[1,181,"LaunchScreenSaver",0,"",0,"","",""],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH","",""],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME","",""],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK","",""],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD","",""],[1,186,"BrowserStop",0,"",0,"VK_BROWSER_STOP","",""],[1,187,"BrowserRefresh",0,"",0,"VK_BROWSER_REFRESH","",""],[1,188,"BrowserFavorites",0,"",0,"VK_BROWSER_FAVORITES","",""],[1,189,"ZoomToggle",0,"",0,"","",""],[1,190,"MailReply",0,"",0,"","",""],[1,191,"MailForward",0,"",0,"","",""],[1,192,"MailSend",0,"",0,"","",""],[1,0,"",114,"KeyInComposition",229,"","",""],[1,0,"",116,"ABNT_C2",194,"VK_ABNT_C2","",""],[1,0,"",96,"OEM_8",223,"VK_OEM_8","",""],[1,0,"",0,"",0,"VK_KANA","",""],[1,0,"",0,"",0,"VK_HANGUL","",""],[1,0,"",0,"",0,"VK_JUNJA","",""],[1,0,"",0,"",0,"VK_FINAL","",""],[1,0,"",0,"",0,"VK_HANJA","",""],[1,0,"",0,"",0,"VK_KANJI","",""],[1,0,"",0,"",0,"VK_CONVERT","",""],[1,0,"",0,"",0,"VK_NONCONVERT","",""],[1,0,"",0,"",0,"VK_ACCEPT","",""],[1,0,"",0,"",0,"VK_MODECHANGE","",""],[1,0,"",0,"",0,"VK_SELECT","",""],[1,0,"",0,"",0,"VK_PRINT","",""],[1,0,"",0,"",0,"VK_EXECUTE","",""],[1,0,"",0,"",0,"VK_SNAPSHOT","",""],[1,0,"",0,"",0,"VK_HELP","",""],[1,0,"",0,"",0,"VK_APPS","",""],[1,0,"",0,"",0,"VK_PROCESSKEY","",""],[1,0,"",0,"",0,"VK_PACKET","",""],[1,0,"",0,"",0,"VK_DBE_SBCSCHAR","",""],[1,0,"",0,"",0,"VK_DBE_DBCSCHAR","",""],[1,0,"",0,"",0,"VK_ATTN","",""],[1,0,"",0,"",0,"VK_CRSEL","",""],[1,0,"",0,"",0,"VK_EXSEL","",""],[1,0,"",0,"",0,"VK_EREOF","",""],[1,0,"",0,"",0,"VK_PLAY","",""],[1,0,"",0,"",0,"VK_ZOOM","",""],[1,0,"",0,"",0,"VK_NONAME","",""],[1,0,"",0,"",0,"VK_PA1","",""],[1,0,"",0,"",0,"VK_OEM_CLEAR","",""]],e=[],n=[];for(let o of t){let[r,s,a,l,d,c,u,m,g]=o;if(n[s]||(n[s]=!0,VZ[s]=a,BZ[a]=s,$Z[a.toLowerCase()]=s,r&&(U9[s]=l,l!==0&&l!==3&&!qZ(l)&&(wU[l]=s))),!e[l]){if(e[l]=!0,!d)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);BP.define(l,d),TU.define(l,m||d),EU.define(l,g||m||d)}c&&(FZ[c]=l),a&&(WZ[a]=c),u&&(HZ[u]=l)}wU[3]=46})();var zZ;(s=>{function i(a){return BP.keyCodeToStr(a)}s.toString=i;function t(a){return BP.strToKeyCode(a)}s.fromString=t;function e(a){return TU.keyCodeToStr(a)}s.toUserSettingsUS=e;function n(a){return EU.keyCodeToStr(a)}s.toUserSettingsGeneral=n;function o(a){return TU.strToKeyCode(a)||EU.strToKeyCode(a)}s.fromUserSettings=o;function r(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return BP.keyCodeToStr(a)}s.toElectronAccelerator=r})(zZ||={});function qZ(i){return i===5||i===4||i===6||i===57}function EI(i,t){if(typeof i=="number"){if(i===0)return null;let e=(i&65535)>>>0,n=(i&4294901760)>>>16;return n!==0?new wh([$P(e,t),$P(n,t)]):new wh([$P(e,t)])}else{let e=[];for(let n=0;n<i.length;n++)e.push($P(i[n],t));return new wh(e)}}function $P(i,t){let e=!!(i&2048),n=!!(i&256),o=t===2?n:e,r=!!(i&1024),s=!!(i&512),a=t===2?e:n,l=i&255;return new kU(o,r,s,a,l)}var kU=class i{constructor(t,e,n,o,r){this.ctrlKey=t;this.shiftKey=e;this.altKey=n;this.metaKey=o;this.keyCode=r}equals(t){return t instanceof i&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",n=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${e}${n}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new wh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var wh=class{constructor(t){if(t.length===0)throw $e("chords");this.chords=t}getHashCode(){let t="";for(let e=0,n=this.chords.length;e<n;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};var PU=class i{constructor(){this._coreKeybindings=new mo,this._coreKeybindingRules=new mo,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToPlatform(t,e){if(e===1){if(t&&t.win)return t.win}else if(e===2){if(t&&t.mac)return t.mac}else if(t&&t.linux)return t.linux;return t}static bindToCurrentPlatform(t){return i.bindToPlatform(t,gr)}registerKeybindingRule(t){let e=i.bindToCurrentPlatform(t),n=new $;if(e&&e.primary){let r=EI(e.primary,gr);r&&n.add(this._registerDefaultKeybinding(r,t.id,t.args,t.weight,0,t.when))}if(e&&Array.isArray(e.secondary))for(let r=0,s=e.secondary.length;r<s;r++){let a=e.secondary[r],l=EI(a,gr);l&&n.add(this._registerDefaultKeybinding(l,t.id,t.args,t.weight,-r-1,t.when))}let o=this._coreKeybindingRules.push(t);return n.add(q(()=>{o()})),n}setExtensionKeybindings(t){let e=[],n=0;for(let o of t)o.keybinding&&(e[n++]={keybinding:o.keybinding,command:o.id,commandArgs:o.args,when:o.when,weight1:o.weight,weight2:0,extensionId:o.extensionId||null,isBuiltinExtension:o.isBuiltinExtension||!1});this._extensionKeybindings=e,this._cachedMergedKeybindings=null}registerCommandAndKeybindingRule(t){return Op(this.registerKeybindingRule(t),CI.registerCommand(t))}_registerDefaultKeybinding(t,e,n,o,r,s){let a=this._coreKeybindings.push({keybinding:t,command:e,commandArgs:n,when:s,weight1:o,weight2:r,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,q(()=>{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(F9)),this._cachedMergedKeybindings.slice(0)}getDefaultKeybindingsForOS(t){let e=[];for(let n of this._coreKeybindingRules){let o=i.bindToPlatform(n,t);if(o&&o.primary){let r=EI(o.primary,t);r&&e.push({keybinding:r,command:n.id,commandArgs:n.args,when:n.when,weight1:n.weight,weight2:0,extensionId:null,isBuiltinExtension:!1})}if(o&&Array.isArray(o.secondary))for(let r=0,s=o.secondary.length;r<s;r++){let a=o.secondary[r],l=EI(a,t);l&&e.push({keybinding:l,command:n.id,commandArgs:n.args,when:n.when,weight1:n.weight,weight2:-r-1,extensionId:null,isBuiltinExtension:!1})}}return e.sort(F9),e}},H9=new PU,KZ={EditorModes:"platform.keybindingsRegistry"};wt.add(KZ.EditorModes,H9);function F9(i,t){if(i.weight1!==t.weight1)return i.weight1-t.weight1;if(i.command&&t.command){if(i.command<t.command)return-1;if(i.command>t.command)return 1}return i.weight2-t.weight2}function jZ(i){return i.command!==void 0}var xc=class i{static{this._instances=new Map}static{this.CommandPalette=new i("CommandPalette")}static{this.DebugBreakpointsContext=new i("DebugBreakpointsContext")}static{this.DebugCallStackContext=new i("DebugCallStackContext")}static{this.DebugConsoleContext=new i("DebugConsoleContext")}static{this.DebugVariablesContext=new i("DebugVariablesContext")}static{this.NotebookVariablesContext=new i("NotebookVariablesContext")}static{this.DebugHoverContext=new i("DebugHoverContext")}static{this.DebugWatchContext=new i("DebugWatchContext")}static{this.DebugToolBar=new i("DebugToolBar")}static{this.DebugToolBarStop=new i("DebugToolBarStop")}static{this.DebugDisassemblyContext=new i("DebugDisassemblyContext")}static{this.DebugCallStackToolbar=new i("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new i("DebugCreateConfiguration")}static{this.DebugScopesContext=new i("DebugScopesContext")}static{this.EditorContext=new i("EditorContext")}static{this.SimpleEditorContext=new i("SimpleEditorContext")}static{this.EditorContent=new i("EditorContent")}static{this.EditorLineNumberContext=new i("EditorLineNumberContext")}static{this.EditorContextCopy=new i("EditorContextCopy")}static{this.EditorContextPeek=new i("EditorContextPeek")}static{this.EditorContextShare=new i("EditorContextShare")}static{this.EditorTitle=new i("EditorTitle")}static{this.EditorTitleLayout=new i("EditorTitleLayout")}static{this.ModalEditorTitle=new i("ModalEditorTitle")}static{this.ModalEditorTitleContext=new i("ModalEditorTitleContext")}static{this.ModalEditorEditorTitle=new i("ModalEditorEditorTitle")}static{this.CompactWindowEditorTitle=new i("CompactWindowEditorTitle")}static{this.EditorTitleRun=new i("EditorTitleRun")}static{this.EditorTitleContext=new i("EditorTitleContext")}static{this.EditorTitleContextShare=new i("EditorTitleContextShare")}static{this.EmptyEditorGroup=new i("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new i("EmptyEditorGroupContext")}static{this.EditorGroupWatermarkToolbar=new i("EditorGroupWatermarkToolbar")}static{this.EditorTabsBarContext=new i("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new i("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new i("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new i("EditorActionsPositionSubmenu")}static{this.EditorRenderWhitespaceSubmenu=new i("EditorRenderWhitespaceSubmenu")}static{this.EditorSplitMoveSubmenu=new i("EditorSplitMoveSubmenu")}static{this.ExplorerContext=new i("ExplorerContext")}static{this.ExplorerContextShare=new i("ExplorerContextShare")}static{this.ExtensionContext=new i("ExtensionContext")}static{this.ExtensionEditorContextMenu=new i("ExtensionEditorContextMenu")}static{this.GlobalActivity=new i("GlobalActivity")}static{this.CommandCenter=new i("CommandCenter")}static{this.CommandCenterCenter=new i("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new i("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new i("LayoutControlMenu")}static{this.MenubarMainMenu=new i("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new i("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new i("MenubarDebugMenu")}static{this.MenubarEditMenu=new i("MenubarEditMenu")}static{this.MenubarCopy=new i("MenubarCopy")}static{this.MenubarFileMenu=new i("MenubarFileMenu")}static{this.MenubarGoMenu=new i("MenubarGoMenu")}static{this.MenubarHelpMenu=new i("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new i("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new i("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new i("PanelAlignmentMenu")}static{this.PanelPositionMenu=new i("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new i("ActivityBarPositionMenu")}static{this.NotificationsCenterPositionMenu=new i("NotificationsCenterPositionMenu")}static{this.MenubarPreferencesMenu=new i("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new i("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new i("MenubarSelectionMenu")}static{this.MenubarShare=new i("MenubarShare")}static{this.MenubarSwitchEditorMenu=new i("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new i("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new i("MenubarTerminalMenu")}static{this.MenubarTerminalSuggestStatusMenu=new i("MenubarTerminalSuggestStatusMenu")}static{this.MenubarViewMenu=new i("MenubarViewMenu")}static{this.MenubarHomeMenu=new i("MenubarHomeMenu")}static{this.OpenEditorsContext=new i("OpenEditorsContext")}static{this.OpenEditorsContextShare=new i("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new i("ProblemsPanelContext")}static{this.SCMInputBox=new i("SCMInputBox")}static{this.SCMChangeContext=new i("SCMChangeContext")}static{this.SCMResourceContext=new i("SCMResourceContext")}static{this.SCMResourceContextShare=new i("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new i("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new i("SCMResourceGroupContext")}static{this.SCMSourceControl=new i("SCMSourceControl")}static{this.SCMSourceControlInline=new i("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new i("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new i("SCMHistoryTitle")}static{this.SCMHistoryItemContext=new i("SCMHistoryItemContext")}static{this.SCMHistoryItemChangeContext=new i("SCMHistoryItemChangeContext")}static{this.SCMHistoryItemRefContext=new i("SCMHistoryItemRefContext")}static{this.SCMArtifactGroupContext=new i("SCMArtifactGroupContext")}static{this.SCMArtifactContext=new i("SCMArtifactContext")}static{this.SCMQuickDiffDecorations=new i("SCMQuickDiffDecorations")}static{this.SCMTitle=new i("SCMTitle")}static{this.SearchContext=new i("SearchContext")}static{this.SearchActionMenu=new i("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new i("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new i("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new i("StickyScrollContext")}static{this.TestItem=new i("TestItem")}static{this.TestItemGutter=new i("TestItemGutter")}static{this.TestProfilesContext=new i("TestProfilesContext")}static{this.TestMessageContext=new i("TestMessageContext")}static{this.TestMessageContent=new i("TestMessageContent")}static{this.TestPeekElement=new i("TestPeekElement")}static{this.TestPeekTitle=new i("TestPeekTitle")}static{this.TestCallStack=new i("TestCallStack")}static{this.TestCoverageFilterItem=new i("TestCoverageFilterItem")}static{this.TouchBarContext=new i("TouchBarContext")}static{this.TitleBar=new i("TitleBar")}static{this.TitleBarAdjacentCenter=new i("TitleBarAdjacentCenter")}static{this.TitleBarUpdate=new i("TitleBarUpdate")}static{this.TitleBarContext=new i("TitleBarContext")}static{this.TitleBarTitleContext=new i("TitleBarTitleContext")}static{this.TunnelContext=new i("TunnelContext")}static{this.TunnelPrivacy=new i("TunnelPrivacy")}static{this.TunnelProtocol=new i("TunnelProtocol")}static{this.TunnelPortInline=new i("TunnelInline")}static{this.TunnelTitle=new i("TunnelTitle")}static{this.TunnelLocalAddressInline=new i("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new i("TunnelOriginInline")}static{this.ViewItemContext=new i("ViewItemContext")}static{this.ViewContainerTitle=new i("ViewContainerTitle")}static{this.ViewContainerTitleContext=new i("ViewContainerTitleContext")}static{this.ViewTitle=new i("ViewTitle")}static{this.ViewTitleContext=new i("ViewTitleContext")}static{this.CommentEditorActions=new i("CommentEditorActions")}static{this.CommentThreadTitle=new i("CommentThreadTitle")}static{this.CommentThreadActions=new i("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new i("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new i("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new i("CommentThreadCommentContext")}static{this.CommentTitle=new i("CommentTitle")}static{this.CommentActions=new i("CommentActions")}static{this.CommentsViewThreadActions=new i("CommentsViewThreadActions")}static{this.InteractiveToolbar=new i("InteractiveToolbar")}static{this.InteractiveCellTitle=new i("InteractiveCellTitle")}static{this.InteractiveCellDelete=new i("InteractiveCellDelete")}static{this.InteractiveCellExecute=new i("InteractiveCellExecute")}static{this.InteractiveInputExecute=new i("InteractiveInputExecute")}static{this.InteractiveInputConfig=new i("InteractiveInputConfig")}static{this.ReplInputExecute=new i("ReplInputExecute")}static{this.IssueReporter=new i("IssueReporter")}static{this.NotebookToolbar=new i("NotebookToolbar")}static{this.NotebookToolbarContext=new i("NotebookToolbarContext")}static{this.NotebookStickyScrollContext=new i("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new i("NotebookCellTitle")}static{this.NotebookCellDelete=new i("NotebookCellDelete")}static{this.NotebookCellInsert=new i("NotebookCellInsert")}static{this.NotebookCellBetween=new i("NotebookCellBetween")}static{this.NotebookCellListTop=new i("NotebookCellTop")}static{this.NotebookCellExecute=new i("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new i("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new i("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new i("NotebookDiffCellInputTitle")}static{this.NotebookDiffDocumentMetadata=new i("NotebookDiffDocumentMetadata")}static{this.NotebookDiffCellMetadataTitle=new i("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new i("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new i("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new i("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new i("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new i("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new i("NotebookKernelSource")}static{this.BulkEditTitle=new i("BulkEditTitle")}static{this.BulkEditContext=new i("BulkEditContext")}static{this.TimelineItemContext=new i("TimelineItemContext")}static{this.TimelineTitle=new i("TimelineTitle")}static{this.TimelineTitleContext=new i("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new i("TimelineFilterSubMenu")}static{this.AccountsContext=new i("AccountsContext")}static{this.SidebarTitle=new i("SidebarTitle")}static{this.PanelTitle=new i("PanelTitle")}static{this.AuxiliaryBarTitle=new i("AuxiliaryBarTitle")}static{this.TerminalInstanceContext=new i("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new i("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new i("TerminalNewDropdownContext")}static{this.TerminalTabContext=new i("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new i("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new i("TerminalStickyScrollContext")}static{this.WebviewContext=new i("WebviewContext")}static{this.InlineCompletionsActions=new i("InlineCompletionsActions")}static{this.InlineEditsActions=new i("InlineEditsActions")}static{this.NewFile=new i("NewFile")}static{this.MergeInput1Toolbar=new i("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new i("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new i("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new i("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new i("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new i("InlineEditToolbar")}static{this.ChatContext=new i("ChatContext")}static{this.ChatCodeBlock=new i("ChatCodeblock")}static{this.ChatCompareBlock=new i("ChatCompareBlock")}static{this.ChatMessageTitle=new i("ChatMessageTitle")}static{this.ChatWelcomeContext=new i("ChatWelcomeContext")}static{this.ChatMessageFooter=new i("ChatMessageFooter")}static{this.ChatSubagentContent=new i("ChatSubagentContent")}static{this.ChatExecute=new i("ChatExecute")}static{this.ChatExecuteQueue=new i("ChatExecuteQueue")}static{this.ChatInput=new i("ChatInput")}static{this.ChatInputSecondary=new i("ChatInputSecondary")}static{this.ChatInputStatus=new i("ChatInputStatus")}static{this.ChatInputSide=new i("ChatInputSide")}static{this.AutomationsDialogInput=new i("AutomationsDialogInput")}static{this.ChatModePicker=new i("ChatModePicker")}static{this.ChatEditingWidgetToolbar=new i("ChatEditingWidgetToolbar")}static{this.ChatEditingSessionChangesToolbar=new i("ChatEditingSessionChangesToolbar")}static{this.ChatEditingSessionTitleToolbar=new i("ChatEditingSessionTitleToolbar")}static{this.ChatEditingSessionChangesVersionsSubmenu=new i("ChatEditingSessionChangesVersionsSubmenu")}static{this.ChatEditingSessionChangesFileHeaderToolbar=new i("ChatEditingSessionChangesFileHeaderToolbar")}static{this.ChatEditingSessionChangesFileHeaderRightToolbar=new i("ChatEditingSessionChangesFileHeaderRightToolbar")}static{this.ChatEditingEditorContent=new i("ChatEditingEditorContent")}static{this.ChatEditingEditorHunk=new i("ChatEditingEditorHunk")}static{this.ChatEditingDeletedNotebookCell=new i("ChatEditingDeletedNotebookCell")}static{this.ChatInputAttachmentToolbar=new i("ChatInputAttachmentToolbar")}static{this.ChatEditingWidgetModifiedFilesToolbar=new i("ChatEditingWidgetModifiedFilesToolbar")}static{this.ChatInputResourceAttachmentContext=new i("ChatInputResourceAttachmentContext")}static{this.ChatInputSymbolAttachmentContext=new i("ChatInputSymbolAttachmentContext")}static{this.ChatInlineResourceAnchorContext=new i("ChatInlineResourceAnchorContext")}static{this.ChatInlineSymbolAnchorContext=new i("ChatInlineSymbolAnchorContext")}static{this.ChatMessageCheckpoint=new i("ChatMessageCheckpoint")}static{this.ChatMessageRestoreCheckpoint=new i("ChatMessageRestoreCheckpoint")}static{this.ChatNewMenu=new i("ChatNewMenu")}static{this.ChatEditingCodeBlockContext=new i("ChatEditingCodeBlockContext")}static{this.ChatTitleBarMenu=new i("ChatTitleBarMenu")}static{this.ChatAttachmentsContext=new i("ChatAttachmentsContext")}static{this.ChatTipContext=new i("ChatTipContext")}static{this.ChatTipToolbar=new i("ChatTipToolbar")}static{this.ChatToolOutputResourceToolbar=new i("ChatToolOutputResourceToolbar")}static{this.ChatTextEditorMenu=new i("ChatTextEditorMenu")}static{this.ChatToolOutputResourceContext=new i("ChatToolOutputResourceContext")}static{this.ChatMultiDiffContext=new i("ChatMultiDiffContext")}static{this.ChatConfirmationMenu=new i("ChatConfirmationMenu")}static{this.ChatEditorInlineMenu=new i("ChatEditorInlineGutter")}static{this.ChatEditorInlineExecute=new i("ChatEditorInputExecute")}static{this.ChatEditorInlineInputSide=new i("ChatEditorInputSide")}static{this.InlineChatEditorAffordance=new i("InlineChatEditorAffordance")}static{this.AccessibleView=new i("AccessibleView")}static{this.MultiDiffEditorContent=new i("MultiDiffEditorContent")}static{this.MultiDiffEditorFileToolbar=new i("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new i("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new i("DiffEditorSelectionToolbar")}static{this.BrowserNavigationToolbar=new i("BrowserNavigationToolbar")}static{this.BrowserActionsToolbar=new i("BrowserActionsToolbar")}static{this.BrowserChatActionsMenu=new i("BrowserChatActionsMenu")}static{this.BrowserEmulationToolbar=new i("BrowserEmulationToolbar")}static{this.AgentSessionsViewerFilterSubMenu=new i("AgentSessionsViewerFilterSubMenu")}static{this.AgentSessionsExternalFilterSubMenu=new i("AgentSessionsExternalFilterSubMenu")}static{this.AgentSessionsContext=new i("AgentSessionsContext")}static{this.AgentSessionSectionContext=new i("AgentSessionSectionContext")}static{this.AgentSessionsCreateSubMenu=new i("AgentSessionsCreateSubMenu")}static{this.AgentSessionsToolbar=new i("AgentSessionsToolbar")}static{this.AgentSessionItemToolbar=new i("AgentSessionItemToolbar")}static{this.AgentSessionSectionToolbar=new i("AgentSessionSectionToolbar")}static{this.SessionItemContextMenu=new i("SessionItemContextMenu")}static{this.SessionHeaderContext=new i("SessionsSessionHeaderContext")}static{this.AgentsTitleBarControlMenu=new i("AgentsTitleBarControlMenu")}static{this.AgentsChangesToolbar=new i("AgentsChangesToolbar")}static{this.AgentsChangesPrimaryActionSubMenu=new i("AgentsChangesPrimaryActionSubMenu")}static{this.AgentsChangeInlineToolbar=new i("AgentsChangeInlineToolbar")}static{this.ChatViewSessionTitleNavigationToolbar=new i("ChatViewSessionTitleNavigationToolbar")}static{this.ChatViewSessionTitleToolbar=new i("ChatViewSessionTitleToolbar")}static{this.ChatContextUsageActions=new i("ChatContextUsageActions")}static{this.MarkerHoverStatusBar=new i("MarkerHoverParticipant.StatusBar")}static for(t){return i._instances.get(t)??new i(t)}constructor(t){if(i._instances.has(t))throw new TypeError(`MenuId with identifier '${t}' already exists. Use MenuId.for(ident) or a unique identifier`);i._instances.set(t,this),this.id=t}},sTt=A("menuService"),Cp=class i{constructor(t){this.id=t;this.has=e=>e===t}static{this._all=new Map}static for(t){let e=this._all.get(t);return e||(e=new i(t),this._all.set(t,e)),e}static merge(t){let e=new Set;for(let n of t)n instanceof i&&e.add(n.id);return e}},aTt=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new px({merge:Cp.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(i){return this._commands.set(i.id,i),this._onDidChangeMenu.fire(Cp.for(xc.CommandPalette)),av(q(()=>{this._commands.delete(i.id)&&this._onDidChangeMenu.fire(Cp.for(xc.CommandPalette))}))}getCommand(i){return this._commands.get(i)}getCommands(){let i=new Map;return this._commands.forEach((t,e)=>i.set(e,t)),i}appendMenuItem(i,t){let e=this._menuItems.get(i);e||(e=new mo,this._menuItems.set(i,e));let n=e.push(t);return this._onDidChangeMenu.fire(Cp.for(i)),av(q(()=>{n(),this._onDidChangeMenu.fire(Cp.for(i))}))}appendMenuItems(i){let t=new $;for(let{id:e,item:n}of i)t.add(this.appendMenuItem(e,n));return t}getMenuItems(i){let t;return this._menuItems.has(i)?t=[...this._menuItems.get(i)]:t=[],i===xc.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(i){let t=new Set;for(let e of i)jZ(e)&&(t.add(e.command.id),e.alt&&t.add(e.alt.id));this._commands.forEach((e,n)=>{t.has(n)||i.push({command:e})})}};var Tp=class{constructor(t,e,n,o,r,s,a){this.hideActions=o;this.menuKeybinding=r;this._commandService=a;this.id=t.id,this.label=Tp.label(t,n),this.tooltip=(typeof t.tooltip=="string"?t.tooltip:t.tooltip?.value)??"",this.enabled=!t.precondition||s.contextMatchesRules(t.precondition),this.checked=void 0;let l;if(t.toggled){let d=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=s.contextMatchesRules(d.condition),this.checked&&d.tooltip&&(this.tooltip=typeof d.tooltip=="string"?d.tooltip:d.tooltip.value),this.checked&&ct.isThemeIcon(d.icon)&&(l=d.icon),this.checked&&d.title&&(this.label=typeof d.title=="string"?d.title:d.title.value)}l||(l=ct.isThemeIcon(t.icon)?t.icon:void 0),this.item=t,this.alt=e?new Tp(e,void 0,n,o,void 0,s,a):void 0,this._options=n,this.class=l&&ct.asClassName(l)}static label(t,e){return e?.renderShortTitle&&t.shortTitle?typeof t.shortTitle=="string"?t.shortTitle:t.shortTitle.value:typeof t.title=="string"?t.title:t.title.value}run(...t){let e=[];return this._options?.args?e=[...e,...this._options.args]:this._options?.arg&&(e=[...e,this._options.arg]),this._options?.shouldForwardArgs&&(e=[...e,...t]),this._commandService.executeCommand(this.id,...e)}};Tp=_([S(5,Ir),S(6,CU)],Tp);var pTt=A("IExtensionGalleryManifestService");var CTt=xa(15714,"Extensions");var _U=A("extensionsWorkbenchService");var zP=class extends N{constructor(e,n){super();this.containers=e;this._register(n.onChange(this.update,this))}set extension(e){this.containers.forEach(n=>n.extension=e)}update(e){for(let n of this.containers)e&&n.extension?u4(n.extension.identifier,e.identifier)&&(n.extension.server&&e.server&&n.extension.server!==e.server?n.updateWhenCounterExtensionChanges&&n.update():n.extension=e):n.update()}};zP=_([S(1,_U)],zP);var TTt=new k("defaultExtensionViews",!0),ETt=new k("hasOutdatedExtensions",!1),wTt=new k("hasGallery",!1),kTt=new k("extensionsGalleryStatus","unavailable"),PTt=new k("extensionResultListFocused ",!0),_Tt=new k("searchMcpServers",!1),RTt=new k("searchAgentPlugins",!1);var DTt=new xc("extensionsSearchActionsMenu"),ATt=new xc("extensionsFilterSubMenu");var RU="vscode_searchExtensions_internal",YTt={id:RU,toolReferenceName:"extensions",legacyToolReferenceFullNames:["extensions"],icon:ct.fromId(de.extensions.id),displayName:p(15727,null),modelDescription:"This is a tool for browsing Visual Studio Code Extensions Marketplace. It allows the model to search for extensions and retrieve detailed information about them. The model should use this tool whenever it needs to discover extensions or resolve information about known ones. To use the tool, the model has to provide the category of the extensions, relevant search keywords, or known extension IDs. Note that search results may include false positives, so reviewing and filtering is recommended.",userDescription:p(15729,null),source:pn.Internal,inputSchema:{type:"object",properties:{category:{type:"string",description:"The category of extensions to search for",enum:sS},keywords:{type:"array",items:{type:"string"},description:"The keywords to search for"},ids:{type:"array",items:{type:"string"},description:"The ids of the extensions to search for"}}}},qP=class{constructor(t){this.extensionWorkbenchService=t}async invoke(t,e,n,o){let r=t.parameters;if(!r.keywords?.length&&!r.category&&!r.ids?.length)return{content:[{kind:"text",value:p(15728,null)}]};let s=new Map,a=c=>{for(let u of c)u.deprecationInfo||u.isMalicious||s.set(u.identifier.id.toLowerCase(),{id:u.identifier.id,name:u.displayName,description:u.description,installed:u.state===1,installCount:u.installCount??0,rating:u.rating??0,categories:u.categories??[],tags:u.gallery?.tags??[]})},l=async c=>{let u=await this.extensionWorkbenchService.queryGallery({text:c,pageSize:10,sortBy:"InstallCount"},o);u.firstPage.length&&a(u.firstPage)};if(r.ids?.length){let c=await this.extensionWorkbenchService.getExtensions(r.ids.map(u=>({id:u})),o);a(c)}if(r.keywords?.length)for(let c of r.keywords??[])if(c==="featured")await l("featured");else{let u=r.category?`category:"${r.category}"`:"";u=c?`${u} ${c}`.trim():u,await l(u)}else await l(`category:"${r.category}"`);let d=Array.from(s.values());return{content:[{kind:"text",value:`Here are the list of extensions:
${JSON.stringify(d)}
. Important: Use the following format to display extensions to the user because there is a renderer available to parse these extensions in this format and display them with all details. So, do not describe about the extensions to the user.
\`\`\`vscode-extensions
extensionId1,extensionId2
\`\`\`
.`}],toolResultDetails:{input:JSON.stringify(r),output:[{type:"embed",isText:!0,value:JSON.stringify(d.map(c=>c.id))}]}}}};qP=_([S(0,_U)],qP);var KP=class{constructor(t){this._data=t}update(t){this._data=t,this._apiObject=void 0,this._apiObjectWithChatParticipantAdditions=void 0}get data(){return this._data}get apiObject(){return this._apiObject||(this._apiObject=Object.freeze({name:this._data.id,description:this._data.modelDescription,inputSchema:this._data.inputSchema,fullReferenceName:this._data.fullReferenceName,tags:this._data.tags??[],source:void 0})),this._apiObject}get apiObjectWithChatParticipantAdditions(){return this._apiObjectWithChatParticipantAdditions||(this._apiObjectWithChatParticipantAdditions=Object.freeze({name:this._data.id,description:this._data.modelDescription,inputSchema:this._data.inputSchema,tags:this._data.tags??[],source:LL.to(this._data.source),fullReferenceName:this._data.fullReferenceName})),this._apiObjectWithChatParticipantAdditions}},jP=class{constructor(t,e){this._languageModels=e;this._registeredTools=new Map;this._tokenCountFuncs=new Map;this._allTools=new Map;this._proxy=t.getProxy(F.MainThreadLanguageModelTools),this._proxy.$getTools().then(n=>{for(let o of n)this._allTools.set(o.id,new KP(Tt(o)))})}async $countTokensForInvocation(t,e,n){let o=this._tokenCountFuncs.get(t);if(!o)throw new Error(`Tool invocation call ${t} not found`);return await o(e,n)}async invokeTool(t,e,n,o){let r=typeof e=="string"?e:e.name,s=_e();n.tokenizationOptions&&this._tokenCountFuncs.set(s,n.tokenizationOptions.countTokens);try{if(n.toolInvocationToken&&!q4(n.toolInvocationToken))throw new Error("Invalid tool invocation token");if((r===_P||r===cU)&&!Le(t,"chatParticipantPrivate"))throw new Error(`Invalid tool: ${r}`);let a=await this._proxy.$invokeTool({toolId:r,callId:s,parameters:n.input,tokenBudget:n.tokenizationOptions?.tokenBudget,context:n.toolInvocationToken,chatRequestId:Le(t,"chatParticipantPrivate")?n.chatRequestId:void 0,chatInteractionId:Le(t,"chatParticipantPrivate")?n.chatInteractionId:void 0,subAgentInvocationId:Le(t,"chatParticipantPrivate")?n.subAgentInvocationId:void 0,chatStreamToolCallId:Le(t,"chatParticipantAdditions")?n.chatStreamToolCallId:void 0,preToolUseResult:Le(t,"chatParticipantPrivate")?n.preToolUseResult:void 0,traceparent:Le(t,"chatParticipantPrivate")?n.traceparent:void 0,tracestate:Le(t,"chatParticipantPrivate")?n.tracestate:void 0},o),l=a instanceof Zt?a.value:a;return pw.to(Tt(l))}finally{this._tokenCountFuncs.delete(s)}}$onDidChangeTools(t){let e=new Set(this._allTools.keys());for(let n of t){e.delete(n.id);let o=this._allTools.get(n.id);o?o.update(n):this._allTools.set(n.id,new KP(Tt(n)))}for(let n of e)this._allTools.delete(n)}getTools(t){let e=Le(t,"chatParticipantPrivate");return Array.from(this._allTools.values()).map(n=>e?n.apiObjectWithChatParticipantAdditions:n.apiObject).filter(n=>{switch(n.name){case _P:case cU:case N9:case RU:return Le(t,"chatParticipantPrivate");default:return!0}})}async $invokeTool(t,e){let n=this._registeredTools.get(t.toolId);if(!n)throw new Error(`Unknown tool ${t.toolId}`);let o={input:t.parameters,toolInvocationToken:Tt(t.context)};Le(n.extension,"chatParticipantPrivate")&&(o.chatRequestId=t.chatRequestId,o.chatInteractionId=t.chatInteractionId,o.chatSessionResource=y.revive(t.context?.sessionResource),o.workingDirectory=y.revive(t.context?.workingDirectory),o.subAgentInvocationId=t.subAgentInvocationId,o.traceparent=t.traceparent,o.tracestate=t.tracestate),Le(n.extension,"chatParticipantAdditions")&&t.modelId&&(o.model=await this.getModel(t.modelId,n.extension)),Le(n.extension,"chatParticipantAdditions")&&t.chatStreamToolCallId&&(o.chatStreamToolCallId=t.chatStreamToolCallId),t.tokenBudget!==void 0&&(o.tokenizationOptions={tokenBudget:t.tokenBudget,countTokens:this._tokenCountFuncs.get(t.callId)||((a,l=pe.None)=>this._proxy.$countTokensForInvocation(t.callId,a,l))});let r;if(Le(n.extension,"toolProgress")){let a;r={report:l=>{l.increment!==void 0&&(a=(a??0)+l.increment),this._proxy.$acceptToolProgress(t.callId,{message:fe.fromStrict(l.message),progress:a===void 0?void 0:a/100})}}}let s=await Jl(Promise.resolve(n.tool.invoke(o,e,r)),e);if(!s)throw new Oe;return pw.from(s,n.extension)}async getModel(t,e){let n;if(t&&(n=await this._languageModels.getLanguageModelByIdentifier(e,t)),!n&&(n=await this._languageModels.getDefaultLanguageModel(e),!n))throw new Error("Language model unavailable");return n}async $handleToolStream(t,e,n){let o=this._registeredTools.get(t);if(!o)throw new Error(`Unknown tool ${t}`);if(!o.tool.handleToolStream)return;M(o.extension,"chatParticipantAdditions");let r={rawInput:e.rawInput,chatRequestId:e.chatRequestId,chatSessionResource:e.chatSessionResource,chatInteractionId:e.chatInteractionId},s=await o.tool.handleToolStream(r,n);if(s)return{invocationMessage:fe.fromStrict(s.invocationMessage)}}async $prepareToolInvocation(t,e,n){let o=this._registeredTools.get(t);if(!o)throw new Error(`Unknown tool ${t}`);let r={input:e.parameters,chatRequestId:e.chatRequestId,chatSessionResource:e.chatSessionResource,chatInteractionId:e.chatInteractionId,workingDirectory:y.revive(e.workingDirectory),forceConfirmationReason:e.forceConfirmationReason};if(e.forceConfirmationReason&&M(o.extension,"chatParticipantPrivate"),o.tool.prepareInvocation){let s=await o.tool.prepareInvocation(r,n);if(!s)return;(s.pastTenseMessage||s.presentation)&&M(o.extension,"chatParticipantPrivate"),s.confirmationMessages?.approveCombination!==void 0&&M(o.extension,"toolInvocationApproveCombination");let a=s.confirmationMessages?.approveCombination,l=a?fe.fromStrict(a.message):void 0,d=l?await c9(t,e.parameters):void 0;return{confirmationMessages:s.confirmationMessages?{title:typeof s.confirmationMessages.title=="string"?s.confirmationMessages.title:fe.from(s.confirmationMessages.title),message:typeof s.confirmationMessages.message=="string"?s.confirmationMessages.message:fe.from(s.confirmationMessages.message),approveCombination:l&&d?{label:l,key:d,arguments:a.arguments}:void 0}:void 0,invocationMessage:fe.fromStrict(s.invocationMessage),pastTenseMessage:fe.fromStrict(s.pastTenseMessage),presentation:s.presentation}}}registerTool(t,e,n){return this._registeredTools.set(e,{extension:t,tool:n}),this._proxy.$registerTool(e,typeof n.handleToolStream=="function"),q(()=>{this._registeredTools.delete(e),this._proxy.$unregisterTool(e)})}registerToolDefinition(t,e,n){M(t,"languageModelToolSupportsModel");let o=e.name,r={id:o,displayName:e.displayName,toolReferenceName:e.toolReferenceName,userDescription:e.userDescription,modelDescription:e.description,inputSchema:e.inputSchema,source:{type:"extension",label:t.displayName??t.name,extensionId:t.identifier},icon:Xi.from(e.icon),models:e.models,toolSet:e.toolSet,tags:e.tags,fullReferenceName:void 0};return this._registeredTools.set(o,{extension:t,tool:n}),this._proxy.$registerToolWithDefinition(t.identifier,r,typeof n.handleToolStream=="function"),q(()=>{this._registeredTools.delete(o),this._proxy.$unregisterTool(o)})}};var GP=class{constructor(t,e,n,o){this._documents=e;this._commands=n;this._uriTransformer=o;this._languageIds=[];this._onDidChangeSyntaxHighlighting=new T;this.onDidChangeSyntaxHighlighting=this._onDidChangeSyntaxHighlighting.event;this._handlePool=0;this._ids=new Set;this._proxy=t.getProxy(F.MainThreadLanguages)}$acceptLanguageIds(t){this._languageIds=t}$acceptSyntaxHighlightingThemeChanged(){this._onDidChangeSyntaxHighlighting.fire()}async computeFullSyntaxHighlighting(t,e){return await this._proxy.$computeFullSyntaxHighlighting(t,e)}async getLanguages(){return this._languageIds.slice(0)}async changeLanguage(t,e){await this._proxy.$changeLanguage(t,e);let n=this._documents.getDocumentData(t);if(!n)throw new Error(`document '${t.toString()}' NOT found`);return n.document}async tokenAtPosition(t,e){let n=t.version,o=ht.from(e),r=await this._proxy.$tokensAtPosition(t.uri,o),s={type:0,range:t.getWordRangeAtPosition(e)??new ve(e.line,e.character,e.line,e.character)};if(!r)return s;let a={range:K.to(r.range),type:rL.to(r.type)};return!a.range.contains(e)||n!==t.version?s:a}createLanguageStatusItem(t,e,n){let o=this._handlePool++,r=this._proxy,s=this._ids,a=`${t.identifier.value}/${e}`;if(s.has(a))throw new Error(`LanguageStatusItem with id '${e}' ALREADY exists`);s.add(a);let l={selector:n,id:e,name:t.displayName??t.name,severity:0,command:void 0,text:"",detail:"",busy:!1},d,c=new $,u=()=>{if(d?.dispose(),!s.has(a)){console.warn(`LanguageStatusItem (${e}) from ${t.identifier.value} has been disposed and CANNOT be updated anymore`);return}d=wv(()=>{c.clear(),this._proxy.$setLanguageStatus(o,{id:a,name:l.name??t.displayName??t.name,source:t.displayName??t.name,selector:Zs.from(l.selector,this._uriTransformer),label:l.text,detail:l.detail??"",severity:l.severity===2?rt.Error:l.severity===1?rt.Warning:rt.Info,command:l.command&&this._commands.toInternal(l.command,c),accessibilityInfo:l.accessibilityInformation,busy:l.busy})},0)},m={dispose(){c.dispose(),d?.dispose(),r.$removeLanguageStatus(o),s.delete(a)},get id(){return l.id},get name(){return l.name},set name(g){l.name=g,u()},get selector(){return l.selector},set selector(g){l.selector=g,u()},get text(){return l.text},set text(g){l.text=g,u()},set text2(g){M(t,"languageStatusText"),l.text=g,u()},get text2(){return M(t,"languageStatusText"),l.text},get detail(){return l.detail},set detail(g){l.detail=g,u()},get severity(){return l.severity},set severity(g){l.severity=g,u()},get accessibilityInformation(){return l.accessibilityInformation},set accessibilityInformation(g){l.accessibilityInformation=g,u()},get command(){return l.command},set command(g){l.command=g,u()},get busy(){return l.busy},set busy(g){l.busy=g,u()}};return u(),m}};function GZ(i){return i&&i.title}var kh=class{constructor(t,e){this._logService=e;this._proxy=t.getProxy(F.MainThreadMessageService)}showMessage(t,e,n,o,r){let s={source:{identifier:t.identifier,label:t.displayName||t.name}},a;typeof o=="string"||GZ(o)?a=[o,...r]:(s.modal=o?.modal,s.useCustom=o?.useCustom,s.detail=o?.detail,a=r),s.useCustom&&M(t,"resolvers");let l=[],d=!1;for(let c=0;c<a.length;c++){let u=a[c];if(typeof u=="string")l.push({title:u,handle:c,isCloseAffordance:!1});else if(typeof u=="object"){let{title:m,isCloseAffordance:g}=u;l.push({title:m,isCloseAffordance:!!g,handle:c}),g&&(d?this._logService.warn(`[${t.identifier}] Only one message item can have 'isCloseAffordance':`,u):d=!0)}else this._logService.warn(`[${t.identifier}] Invalid message item:`,u)}return this._proxy.$showMessage(e,n,s,l).then(c=>{if(typeof c=="number")return a[c]})}};kh=_([S(1,te)],kh);var wI=class{constructor(t,e,n,o){this.start=t;this.deletedCount=e;this.deletedItems=n;this.items=o}asApiEvent(){return{range:new uo(this.start,this.start+this.deletedCount),addedCells:this.items.map(t=>t.apiCell),removedCells:this.deletedItems}}},Ph=class{constructor(t,e,n){this.notebook=t;this._extHostDocument=e;this._cellData=n;this.handle=n.handle,this.uri=y.revive(n.uri),this.cellKind=n.cellKind,this._outputs=n.outputs.map(pl.to),this._internalMetadata=n.internalMetadata??{},this._metadata=Object.freeze(n.metadata??{}),this._previousResult=Object.freeze(Dg.to(n.internalMetadata??{}))}static asModelAddData(t){return{EOL:t.eol,lines:t.source,languageId:t.language,uri:t.uri,isDirty:!1,versionId:1,encoding:"utf8"}}get internalMetadata(){return this._internalMetadata}get apiCell(){if(!this._apiCell){let t=this,e=this._extHostDocument.getDocument(this.uri);if(!e)throw new Error(`MISSING extHostDocument for notebook cell: ${this.uri}`);let n={get index(){return t.notebook.getCellIndex(t)},notebook:t.notebook.apiNotebook,kind:ib.to(this._cellData.cellKind),document:e.document,get mime(){return t._mime},set mime(o){t._mime=o},get outputs(){return t._outputs.slice(0)},get metadata(){return t._metadata},get executionSummary(){return t._previousResult}};this._apiCell=Object.freeze(n)}return this._apiCell}setOutputs(t){this._outputs=t.map(pl.to)}setOutputItems(t,e,n){let o=n.map(Ku.to),r=this._outputs.find(s=>s.id===t);if(r&&(e||(r.items.length=0),r.items.push(...o),r.items.length>1&&r.items.every(s=>PS(s.mime)))){let s=new Map,a=[];r.items.forEach(l=>{let d;s.has(l.mime)?d=s.get(l.mime):(d=[],s.set(l.mime,d),a.push(l.mime)),d.push(l.data)}),r.items.length=0,a.forEach(l=>{let d=W4(s.get(l));r.items.push({mime:l,data:d.data.buffer})})}}setMetadata(t){this._metadata=Object.freeze(t)}setInternalMetadata(t){this._internalMetadata=t,this._previousResult=Object.freeze(Dg.to(t))}setMime(t){}},QP=class i{constructor(t,e,n,o,r){this._proxy=t;this._textDocumentsAndEditors=e;this._textDocuments=n;this.uri=o;this.handle=i._handlePool++;this._cells=[];this._versionId=0;this._isDirty=!1;this._disposed=!1;this._notebookType=r.viewType,this._metadata=Object.freeze(r.metadata??Object.create(null)),this._spliceNotebookCells([[0,0,r.cells]],!0,void 0),this._versionId=r.versionId}static{this._handlePool=0}dispose(){this._disposed=!0}get versionId(){return this._versionId}get apiNotebook(){if(!this._notebook){let t=this,e={get uri(){return t.uri},get version(){return t._versionId},get notebookType(){return t._notebookType},get isDirty(){return t._isDirty},get isUntitled(){return t.uri.scheme===B.untitled},get isClosed(){return t._disposed},get metadata(){return t._metadata},get cellCount(){return t._cells.length},cellAt(n){return n=t._validateIndex(n),t._cells[n].apiCell},getCells(n){return(n?t._getCells(n):t._cells).map(r=>r.apiCell)},save(){return t._save()},[Symbol.for("debug.description")](){return`NotebookDocument(${this.uri.toString()})`}};this._notebook=Object.freeze(e)}return this._notebook}acceptDocumentPropertiesChanged(t){t.metadata&&(this._metadata=Object.freeze({...this._metadata,...t.metadata}))}acceptDirty(t){this._isDirty=t}acceptModelChanged(t,e,n){this._versionId=t.versionId,this._isDirty=e,this.acceptDocumentPropertiesChanged({metadata:n});let o={notebook:this.apiNotebook,metadata:n,cellChanges:[],contentChanges:[]},r=[];for(let a of t.rawEvents)a.kind===1?this._spliceNotebookCells(a.changes,!1,o.contentChanges):a.kind===2?this._moveCells(a.index,a.length,a.newIdx,o.contentChanges):a.kind===8?(this._setCellOutputs(a.index,a.outputs),r.push({cell:this._cells[a.index].apiCell,outputs:this._cells[a.index].apiCell.outputs})):a.kind===9?(this._setCellOutputItems(a.index,a.outputId,a.append,a.outputItems),r.push({cell:this._cells[a.index].apiCell,outputs:this._cells[a.index].apiCell.outputs})):a.kind===5?(this._changeCellLanguage(a.index,a.language),r.push({cell:this._cells[a.index].apiCell,document:this._cells[a.index].apiCell.document})):a.kind===10?r.push({cell:this._cells[a.index].apiCell,document:this._cells[a.index].apiCell.document}):a.kind===13?this._changeCellMime(a.index,a.mime):a.kind===7?(this._changeCellMetadata(a.index,a.metadata),r.push({cell:this._cells[a.index].apiCell,metadata:this._cells[a.index].apiCell.metadata})):a.kind===12&&(this._changeCellInternalMetadata(a.index,a.internalMetadata),r.push({cell:this._cells[a.index].apiCell,executionSummary:this._cells[a.index].apiCell.executionSummary}));let s=new Map;for(let a=0;a<r.length;a++){let l=r[a],d=s.get(l.cell);if(d===void 0){let c=o.cellChanges.push({document:void 0,executionSummary:void 0,metadata:void 0,outputs:void 0,...l});s.set(l.cell,c-1)}else o.cellChanges[d]={...o.cellChanges[d],...l}}return Object.freeze(o),Object.freeze(o.cellChanges),Object.freeze(o.contentChanges),o}_validateIndex(t){return t=t|0,t<0?0:t>=this._cells.length?this._cells.length-1:t}_validateRange(t){let e=t.start|0,n=t.end|0;return e<0&&(e=0),n>this._cells.length&&(n=this._cells.length),t.with({start:e,end:n})}_getCells(t){t=this._validateRange(t);let e=[];for(let n=t.start;n<t.end;n++)e.push(this._cells[n]);return e}async _save(){return this._disposed?Promise.reject(new Error("Notebook has been closed")):this._proxy.$trySaveNotebook(this.uri)}_spliceNotebookCells(t,e,n){if(this._disposed)return;let o=[],r=[],s=[];if(t.reverse().forEach(a=>{let d=a[2].map(m=>{let g=new Ph(this,this._textDocumentsAndEditors,m);return e||r.push(Ph.asModelAddData(m)),g}),c=new wI(a[0],a[1],[],d),u=this._cells.splice(a[0],a[1],...d);for(let m of u)s.push(m.uri),c.deletedItems.push(m.apiCell);o.push(c)}),this._textDocumentsAndEditors.acceptDocumentsAndEditorsDelta({addedDocuments:r,removedDocuments:s}),n)for(let a of o)n.push(a.asApiEvent())}_moveCells(t,e,n,o){let r=this._cells.splice(t,e);this._cells.splice(n,0,...r);let s=[new wI(t,e,r.map(a=>a.apiCell),[]),new wI(n,0,[],r)];for(let a of s)o.push(a.asApiEvent())}_setCellOutputs(t,e){this._cells[t].setOutputs(e)}_setCellOutputItems(t,e,n,o){this._cells[t].setOutputItems(e,n,o)}_changeCellLanguage(t,e){let n=this._cells[t];n.apiCell.document.languageId!==e&&this._textDocuments.$acceptModelLanguageChanged(n.uri,e)}_changeCellMime(t,e){let n=this._cells[t];n.apiCell.mime=e}_changeCellMetadata(t,e){this._cells[t].setMetadata(e)}_changeCellInternalMetadata(t,e){this._cells[t].setInternalMetadata(e)}getCellFromApiCell(t){return this._cells.find(e=>e.apiCell===t)}getCellFromIndex(t){return this._cells[t]}getCell(t){return this._cells.find(e=>e.handle===t)}getCellIndex(t){return this._cells.indexOf(t)}};var Ep=class i{constructor(t,e,n,o,r,s,a){this.id=t;this._proxy=e;this.notebookData=n;this._visibleRanges=o;this._selections=r;this._viewColumn=s;this.viewType=a;this._visible=!1}static{this.apiEditorsToExtHost=new WeakMap}get apiEditor(){if(!this._editor){let t=this;this._editor={get notebook(){return t.notebookData.apiNotebook},get selection(){return t._selections[0]},set selection(e){this.selections=[e]},get selections(){return t._selections},set selections(e){if(!Array.isArray(e)||!e.every(uo.isNotebookRange))throw $e("selections");t._selections=e.length===0?[new uo(0,0)]:e,t._trySetSelections(t._selections)},get visibleRanges(){return t._visibleRanges},revealRange(e,n){t._proxy.$tryRevealRange(t.id,qr.from(e),n??0)},get viewColumn(){return t._viewColumn},get replOptions(){if(t.viewType==="repl")return{appendIndex:this.notebook.cellCount-1}},[Symbol.for("debug.description")](){return`NotebookEditor(${this.notebook.uri.toString()})`}},i.apiEditorsToExtHost.set(this._editor,this)}return this._editor}get visible(){return this._visible}_acceptVisibility(t){this._visible=t}_acceptVisibleRanges(t){this._visibleRanges=t}_acceptSelections(t){this._selections=t}_trySetSelections(t){this._proxy.$trySetSelections(this.id,t.map(qr.from))}_acceptViewColumn(t){this._viewColumn=t}};var _h=class{constructor(t,e){this.piece=t,this.color=e,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==ke)return JP(this.right);let t=this;for(;t.parent!==ke&&t.parent.left!==t;)t=t.parent;return t.parent===ke?ke:t.parent}prev(){if(this.left!==ke)return AU(this.left);let t=this;for(;t.parent!==ke&&t.parent.right!==t;)t=t.parent;return t.parent===ke?ke:t.parent}detach(){this.parent=null,this.left=null,this.right=null}};var ke=new _h(null,0);ke.parent=ke;ke.left=ke;ke.right=ke;ke.color=0;function JP(i){for(;i.left!==ke;)i=i.left;return i}function AU(i){for(;i.right!==ke;)i=i.right;return i}function MU(i){return i===ke?0:i.size_left+i.piece.length+MU(i.right)}function LU(i){return i===ke?0:i.lf_left+i.piece.lineFeedCnt+LU(i.right)}function DU(){ke.parent=ke}function PI(i,t){let e=t.right;e.size_left+=t.size_left+(t.piece?t.piece.length:0),e.lf_left+=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),t.right=e.left,e.left!==ke&&(e.left.parent=t),e.parent=t.parent,t.parent===ke?i.root=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}function _I(i,t){let e=t.left;t.left=e.right,e.right!==ke&&(e.right.parent=t),e.parent=t.parent,t.size_left-=e.size_left+(e.piece?e.piece.length:0),t.lf_left-=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),t.parent===ke?i.root=e:t===t.parent.right?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}function RI(i,t){let e,n;if(t.left===ke?(n=t,e=n.right):t.right===ke?(n=t,e=n.left):(n=JP(t.right),e=n.right),n===i.root){i.root=e,e.color=0,t.detach(),DU(),i.root.parent=ke;return}let o=n.color===1;if(n===n.parent.left?n.parent.left=e:n.parent.right=e,n===t?(e.parent=n.parent,kI(i,e)):(n.parent===t?e.parent=n:e.parent=n.parent,kI(i,e),n.left=t.left,n.right=t.right,n.parent=t.parent,n.color=t.color,t===i.root?i.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left!==ke&&(n.left.parent=n),n.right!==ke&&(n.right.parent=n),n.size_left=t.size_left,n.lf_left=t.lf_left,kI(i,n)),t.detach(),e.parent.left===e){let s=MU(e),a=LU(e);if(s!==e.parent.size_left||a!==e.parent.lf_left){let l=s-e.parent.size_left,d=a-e.parent.lf_left;e.parent.size_left=s,e.parent.lf_left=a,aa(i,e.parent,l,d)}}if(kI(i,e.parent),o){DU();return}let r;for(;e!==i.root&&e.color===0;)e===e.parent.left?(r=e.parent.right,r.color===1&&(r.color=0,e.parent.color=1,PI(i,e.parent),r=e.parent.right),r.left.color===0&&r.right.color===0?(r.color=1,e=e.parent):(r.right.color===0&&(r.left.color=0,r.color=1,_I(i,r),r=e.parent.right),r.color=e.parent.color,e.parent.color=0,r.right.color=0,PI(i,e.parent),e=i.root)):(r=e.parent.left,r.color===1&&(r.color=0,e.parent.color=1,_I(i,e.parent),r=e.parent.left),r.left.color===0&&r.right.color===0?(r.color=1,e=e.parent):(r.left.color===0&&(r.right.color=0,r.color=1,PI(i,r),r=e.parent.left),r.color=e.parent.color,e.parent.color=0,r.left.color=0,_I(i,e.parent),e=i.root));e.color=0,DU()}function OU(i,t){for(kI(i,t);t!==i.root&&t.parent.color===1;)if(t.parent===t.parent.parent.left){let e=t.parent.parent.right;e.color===1?(t.parent.color=0,e.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.right&&(t=t.parent,PI(i,t)),t.parent.color=0,t.parent.parent.color=1,_I(i,t.parent.parent))}else{let e=t.parent.parent.left;e.color===1?(t.parent.color=0,e.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.left&&(t=t.parent,_I(i,t)),t.parent.color=0,t.parent.parent.color=1,PI(i,t.parent.parent))}i.root.color=0}function aa(i,t,e,n){for(;t!==i.root&&t!==ke;)t.parent.left===t&&(t.parent.size_left+=e,t.parent.lf_left+=n),t=t.parent}function kI(i,t){let e=0,n=0;if(t!==i.root){for(;t!==i.root&&t===t.parent.right;)t=t.parent;if(t!==i.root)for(t=t.parent,e=MU(t.left)-t.size_left,n=LU(t.left)-t.lf_left,t.size_left+=e,t.lf_left+=n;t!==i.root&&(e!==0||n!==0);)t.parent.left===t&&(t.parent.size_left+=e,t.parent.lf_left+=n),t=t.parent}}var Tl=65535;function W9(i){let t;return i[i.length-1]<65536?t=new Uint16Array(i.length):t=new Uint32Array(i.length),t.set(i,0),t}var NU=class{constructor(t,e,n,o,r){this.lineStarts=t;this.cr=e;this.lf=n;this.crlf=o;this.isBasicASCII=r}};function la(i,t=!0){let e=[0],n=1;for(let o=0,r=i.length;o<r;o++){let s=i.charCodeAt(o);s===13?o+1<r&&i.charCodeAt(o+1)===10?(e[n++]=o+2,o++):e[n++]=o+1:s===10&&(e[n++]=o+1)}return t?W9(e):e}function V9(i,t){i.length=0,i[0]=0;let e=1,n=0,o=0,r=0,s=!0;for(let l=0,d=t.length;l<d;l++){let c=t.charCodeAt(l);c===13?l+1<d&&t.charCodeAt(l+1)===10?(r++,i[e++]=l+2,l++):(n++,i[e++]=l+1):c===10?(o++,i[e++]=l+1):s&&c!==9&&(c<32||c>126)&&(s=!1)}let a=new NU(W9(i),n,o,r,s);return i.length=0,a}var Mo=class{constructor(t,e,n,o,r){this.bufferIndex=t,this.start=e,this.end=n,this.lineFeedCnt=o,this.length=r}},da=class{constructor(t,e){this.buffer=t,this.lineStarts=e}},UU=class{constructor(t,e){this._pieces=[],this._tree=t,this._BOM=e,this._index=0,t.root!==ke&&t.iterate(t.root,n=>(n!==ke&&this._pieces.push(n.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}},FU=class{constructor(t){this._limit=t,this._cache=[]}get(t){for(let e=this._cache.length-1;e>=0;e--){let n=this._cache[e];if(n.nodeStartOffset<=t&&n.nodeStartOffset+n.node.piece.length>=t)return n}return null}get2(t){for(let e=this._cache.length-1;e>=0;e--){let n=this._cache[e];if(n.nodeStartLineNumber&&n.nodeStartLineNumber<t&&n.nodeStartLineNumber+n.node.piece.lineFeedCnt>=t)return n}return null}set(t){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(t)}validate(t){let e=!1,n=this._cache;for(let o=0;o<n.length;o++){let r=n[o];if(r.node.parent===null||r.nodeStartOffset>=t){n[o]=null,e=!0;continue}}if(e){let o=[];for(let r of n)r!==null&&o.push(r);this._cache=o}}},YP=class{constructor(t,e,n){this.create(t,e,n)}create(t,e,n){this._buffers=[new da("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=ke,this._lineCnt=1,this._length=0,this._EOL=e,this._EOLLength=e.length,this._EOLNormalized=n;let o=null;for(let r=0,s=t.length;r<s;r++)if(t[r].buffer.length>0){t[r].lineStarts||(t[r].lineStarts=la(t[r].buffer));let a=new Mo(r+1,{line:0,column:0},{line:t[r].lineStarts.length-1,column:t[r].buffer.length-t[r].lineStarts[t[r].lineStarts.length-1]},t[r].lineStarts.length-1,t[r].buffer.length);this._buffers.push(t[r]),o=this.rbInsertRight(o,a)}this._searchCache=new FU(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(t){let e=Tl,n=e-Math.floor(e/3),o=n*2,r="",s=0,a=[];if(this.iterate(this.root,l=>{let d=this.getNodeContent(l),c=d.length;if(s<=n||s+c<o)return r+=d,s+=c,!0;let u=r.replace(/\r\n|\r|\n/g,t);return a.push(new da(u,la(u))),r=d,s=c,!0}),s>0){let l=r.replace(/\r\n|\r|\n/g,t);a.push(new da(l,la(l)))}this.create(a,t,!0)}getEOL(){return this._EOL}setEOL(t){this._EOL=t,this._EOLLength=this._EOL.length,this.normalizeEOL(t)}createSnapshot(t){return new UU(this,t)}equal(t){if(this.getLength()!==t.getLength()||this.getLineCount()!==t.getLineCount())return!1;let e=0;return this.iterate(this.root,o=>{if(o===ke)return!0;let r=this.getNodeContent(o),s=r.length,a=t.nodeAt(e),l=t.nodeAt(e+s),d=t.getValueInRange2(a,l);return e+=s,r===d})}getOffsetAt(t,e){let n=0,o=this.root;for(;o!==ke;)if(o.left!==ke&&o.lf_left+1>=t)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=t){n+=o.size_left;let r=this.getAccumulatedValue(o,t-o.lf_left-2);return n+=r+e-1}else t-=o.lf_left+o.piece.lineFeedCnt,n+=o.size_left+o.piece.length,o=o.right;return n}getPositionAt(t){t=Math.floor(t),t=Math.max(0,t);let e=this.root,n=0,o=t;for(;e!==ke;)if(e.size_left!==0&&e.size_left>=t)e=e.left;else if(e.size_left+e.piece.length>=t){let r=this.getIndexOf(e,t-e.size_left);if(n+=e.lf_left+r.index,r.index===0){let s=this.getOffsetAt(n+1,1),a=o-s;return new Un(n+1,a+1)}return new Un(n+1,r.remainder+1)}else if(t-=e.size_left+e.piece.length,n+=e.lf_left+e.piece.lineFeedCnt,e.right===ke){let r=this.getOffsetAt(n+1,1),s=o-t-r;return new Un(n+1,s+1)}else e=e.right;return new Un(1,1)}getValueInRange(t,e){if(t.startLineNumber===t.endLineNumber&&t.startColumn===t.endColumn)return"";let n=this.nodeAt2(t.startLineNumber,t.startColumn),o=this.nodeAt2(t.endLineNumber,t.endColumn),r=this.getValueInRange2(n,o);return e?e!==this._EOL||!this._EOLNormalized?r.replace(/\r\n|\r|\n/g,e):e===this.getEOL()&&this._EOLNormalized?r:r.replace(/\r\n|\r|\n/g,e):r}getValueInRange2(t,e){if(t.node===e.node){let a=t.node,l=this._buffers[a.piece.bufferIndex].buffer,d=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(d+t.remainder,d+e.remainder)}let n=t.node,o=this._buffers[n.piece.bufferIndex].buffer,r=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start),s=o.substring(r+t.remainder,r+n.piece.length);for(n=n.next();n!==ke;){let a=this._buffers[n.piece.bufferIndex].buffer,l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);if(n===e.node){s+=a.substring(l,l+e.remainder);break}else s+=a.substr(l,n.piece.length);n=n.next()}return s}getLinesContent(){let t=[],e=0,n="",o=!1;return this.iterate(this.root,r=>{if(r===ke)return!0;let s=r.piece,a=s.length;if(a===0)return!0;let l=this._buffers[s.bufferIndex].buffer,d=this._buffers[s.bufferIndex].lineStarts,c=s.start.line,u=s.end.line,m=d[c]+s.start.column;if(o&&(l.charCodeAt(m)===10&&(m++,a--),t[e++]=n,n="",o=!1,a===0))return!0;if(c===u)return!this._EOLNormalized&&l.charCodeAt(m+a-1)===13?(o=!0,n+=l.substr(m,a-1)):n+=l.substr(m,a),!0;n+=this._EOLNormalized?l.substring(m,Math.max(m,d[c+1]-this._EOLLength)):l.substring(m,d[c+1]).replace(/(\r\n|\r|\n)$/,""),t[e++]=n;for(let g=c+1;g<u;g++)n=this._EOLNormalized?l.substring(d[g],d[g+1]-this._EOLLength):l.substring(d[g],d[g+1]).replace(/(\r\n|\r|\n)$/,""),t[e++]=n;return!this._EOLNormalized&&l.charCodeAt(d[u]+s.end.column-1)===13?(o=!0,s.end.column===0?e--:n=l.substr(d[u],s.end.column-1)):n=l.substr(d[u],s.end.column),!0}),o&&(t[e++]=n,n=""),t[e++]=n,t}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(t){return this._lastVisitedLine.lineNumber===t?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=t,t===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(t):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(t,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(t).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(t){if(t.remainder===t.node.piece.length){let e=t.node.next();if(!e)return 0;let n=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start);return n.buffer.charCodeAt(o)}else{let e=this._buffers[t.node.piece.bufferIndex],o=this.offsetInBuffer(t.node.piece.bufferIndex,t.node.piece.start)+t.remainder;return e.buffer.charCodeAt(o)}}getLineCharCode(t,e){let n=this.nodeAt2(t,e+1);return this._getCharCode(n)}getLineLength(t){if(t===this.getLineCount()){let e=this.getOffsetAt(t,1);return this.getLength()-e}return this.getOffsetAt(t+1,1)-this.getOffsetAt(t,1)-this._EOLLength}getCharCode(t){let e=this.nodeAt(t);return this._getCharCode(e)}getNearestChunk(t){let e=this.nodeAt(t);if(e.remainder===e.node.piece.length){let n=e.node.next();if(!n||n===ke)return"";let o=this._buffers[n.piece.bufferIndex],r=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return o.buffer.substring(r,r+n.piece.length)}else{let n=this._buffers[e.node.piece.bufferIndex],o=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start),r=o+e.remainder,s=o+e.node.piece.length;return n.buffer.substring(r,s)}}findMatchesInNode(t,e,n,o,r,s,a,l,d,c,u){let m=this._buffers[t.piece.bufferIndex],g=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),h=this.offsetInBuffer(t.piece.bufferIndex,r),f=this.offsetInBuffer(t.piece.bufferIndex,s),I,x={line:0,column:0},E,w;e._wordSeparators?(E=m.buffer.substring(h,f),w=R=>R+h,e.reset(0)):(E=m.buffer,w=R=>R,e.reset(h));do if(I=e.next(E),I){if(w(I.index)>=f)return c;this.positionInBuffer(t,w(I.index)-g,x);let R=this.getLineFeedCnt(t.piece.bufferIndex,r,x),L=x.line===r.line?x.column-r.column+o:x.column+1,U=L+I[0].length;if(u[c++]=bO(new ze(n+R,L,n+R,U),I,l),w(I.index)+I[0].length>=f||c>=d)return c}while(I);return c}findMatchesLineByLine(t,e,n,o){let r=[],s=0,a=new Nw(e.wordSeparators,e.regex),l=this.nodeAt2(t.startLineNumber,t.startColumn);if(l===null)return[];let d=this.nodeAt2(t.endLineNumber,t.endColumn);if(d===null)return[];let c=this.positionInBuffer(l.node,l.remainder),u=this.positionInBuffer(d.node,d.remainder);if(l.node===d.node)return this.findMatchesInNode(l.node,a,t.startLineNumber,t.startColumn,c,u,e,n,o,s,r),r;let m=t.startLineNumber,g=l.node;for(;g!==d.node;){let f=this.getLineFeedCnt(g.piece.bufferIndex,c,g.piece.end);if(f>=1){let x=this._buffers[g.piece.bufferIndex].lineStarts,E=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),w=x[c.line+f],R=m===t.startLineNumber?t.startColumn:1;if(s=this.findMatchesInNode(g,a,m,R,c,this.positionInBuffer(g,w-E),e,n,o,s,r),s>=o)return r;m+=f}let I=m===t.startLineNumber?t.startColumn-1:0;if(m===t.endLineNumber){let x=this.getLineContent(m).substring(I,t.endColumn-1);return s=this._findMatchesInLine(e,a,x,t.endLineNumber,I,s,r,n,o),r}if(s=this._findMatchesInLine(e,a,this.getLineContent(m).substr(I),m,I,s,r,n,o),s>=o)return r;m++,l=this.nodeAt2(m,1),g=l.node,c=this.positionInBuffer(l.node,l.remainder)}if(m===t.endLineNumber){let f=m===t.startLineNumber?t.startColumn-1:0,I=this.getLineContent(m).substring(f,t.endColumn-1);return s=this._findMatchesInLine(e,a,I,t.endLineNumber,f,s,r,n,o),r}let h=m===t.startLineNumber?t.startColumn:1;return s=this.findMatchesInNode(d.node,a,m,h,c,u,e,n,o,s,r),r}_findMatchesInLine(t,e,n,o,r,s,a,l,d){let c=t.wordSeparators;if(!l&&t.simpleSearch){let m=t.simpleSearch,g=m.length,h=n.length,f=-g;for(;(f=n.indexOf(m,f+g))!==-1;)if((!c||IO(c,n,h,f,g))&&(a[s++]=new nu(new ze(o,f+1+r,o,f+1+g+r),null),s>=d))return s;return s}let u;e.reset(0);do if(u=e.next(n),u&&(a[s++]=bO(new ze(o,u.index+1+r,o,u.index+1+u[0].length+r),u,l),s>=d))return s;while(u);return s}insert(t,e,n=!1){if(this._EOLNormalized=this._EOLNormalized&&n,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==ke){let{node:o,remainder:r,nodeStartOffset:s}=this.nodeAt(t),a=o.piece,l=a.bufferIndex,d=this.positionInBuffer(o,r);if(o.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&s+a.length===t&&e.length<Tl){this.appendToNode(o,e),this.computeBufferMetadata();return}if(s===t)this.insertContentToNodeLeft(e,o),this._searchCache.validate(t);else if(s+o.piece.length>t){let c=[],u=new Mo(a.bufferIndex,d,a.end,this.getLineFeedCnt(a.bufferIndex,d,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,d));if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.nodeCharCodeAt(o,r)===10){let f={line:u.start.line+1,column:0};u=new Mo(u.bufferIndex,f,u.end,this.getLineFeedCnt(u.bufferIndex,f,u.end),u.length-1),e+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(e))if(this.nodeCharCodeAt(o,r-1)===13){let f=this.positionInBuffer(o,r-1);this.deleteNodeTail(o,f),e="\r"+e,o.piece.length===0&&c.push(o)}else this.deleteNodeTail(o,d);else this.deleteNodeTail(o,d);let m=this.createNewPieces(e);u.length>0&&this.rbInsertRight(o,u);let g=o;for(let h=0;h<m.length;h++)g=this.rbInsertRight(g,m[h]);this.deleteNodes(c)}else this.insertContentToNodeRight(e,o)}else{let o=this.createNewPieces(e),r=this.rbInsertLeft(null,o[0]);for(let s=1;s<o.length;s++)r=this.rbInsertRight(r,o[s])}this.computeBufferMetadata()}delete(t,e){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",e<=0||this.root===ke)return;let n=this.nodeAt(t),o=this.nodeAt(t+e),r=n.node,s=o.node;if(r===s){let m=this.positionInBuffer(r,n.remainder),g=this.positionInBuffer(r,o.remainder);if(n.nodeStartOffset===t){if(e===r.piece.length){let h=r.next();RI(this,r),this.validateCRLFWithPrevNode(h),this.computeBufferMetadata();return}this.deleteNodeHead(r,g),this._searchCache.validate(t),this.validateCRLFWithPrevNode(r),this.computeBufferMetadata();return}if(n.nodeStartOffset+r.piece.length===t+e){this.deleteNodeTail(r,m),this.validateCRLFWithNextNode(r),this.computeBufferMetadata();return}this.shrinkNode(r,m,g),this.computeBufferMetadata();return}let a=[],l=this.positionInBuffer(r,n.remainder);this.deleteNodeTail(r,l),this._searchCache.validate(t),r.piece.length===0&&a.push(r);let d=this.positionInBuffer(s,o.remainder);this.deleteNodeHead(s,d),s.piece.length===0&&a.push(s);let c=r.next();for(let m=c;m!==ke&&m!==s;m=m.next())a.push(m);let u=r.piece.length===0?r.prev():r;this.deleteNodes(a),this.validateCRLFWithNextNode(u),this.computeBufferMetadata()}insertContentToNodeLeft(t,e){let n=[];if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.startWithLF(e)){let s=e.piece,a={line:s.start.line+1,column:0},l=new Mo(s.bufferIndex,a,s.end,this.getLineFeedCnt(s.bufferIndex,a,s.end),s.length-1);e.piece=l,t+=`
`,aa(this,e,-1,-1),e.piece.length===0&&n.push(e)}let o=this.createNewPieces(t),r=this.rbInsertLeft(e,o[o.length-1]);for(let s=o.length-2;s>=0;s--)r=this.rbInsertLeft(r,o[s]);this.validateCRLFWithPrevNode(r),this.deleteNodes(n)}insertContentToNodeRight(t,e){this.adjustCarriageReturnFromNext(t,e)&&(t+=`
`);let n=this.createNewPieces(t),o=this.rbInsertRight(e,n[0]),r=o;for(let s=1;s<n.length;s++)r=this.rbInsertRight(r,n[s]);this.validateCRLFWithPrevNode(o)}positionInBuffer(t,e,n){let o=t.piece,r=t.piece.bufferIndex,s=this._buffers[r].lineStarts,l=s[o.start.line]+o.start.column+e,d=o.start.line,c=o.end.line,u=0,m=0,g=0;for(;d<=c&&(u=d+(c-d)/2|0,g=s[u],u!==c);)if(m=s[u+1],l<g)c=u-1;else if(l>=m)d=u+1;else break;return n?(n.line=u,n.column=l-g,null):{line:u,column:l-g}}getLineFeedCnt(t,e,n){if(n.column===0)return n.line-e.line;let o=this._buffers[t].lineStarts;if(n.line===o.length-1)return n.line-e.line;let r=o[n.line+1],s=o[n.line]+n.column;if(r>s+1)return n.line-e.line;let a=s-1;return this._buffers[t].buffer.charCodeAt(a)===13?n.line-e.line+1:n.line-e.line}offsetInBuffer(t,e){return this._buffers[t].lineStarts[e.line]+e.column}deleteNodes(t){for(let e=0;e<t.length;e++)RI(this,t[e])}createNewPieces(t){if(t.length>Tl){let c=[];for(;t.length>Tl;){let m=t.charCodeAt(Tl-1),g;m===13||m>=55296&&m<=56319?(g=t.substring(0,Tl-1),t=t.substring(Tl-1)):(g=t.substring(0,Tl),t=t.substring(Tl));let h=la(g);c.push(new Mo(this._buffers.length,{line:0,column:0},{line:h.length-1,column:g.length-h[h.length-1]},h.length-1,g.length)),this._buffers.push(new da(g,h))}let u=la(t);return c.push(new Mo(this._buffers.length,{line:0,column:0},{line:u.length-1,column:t.length-u[u.length-1]},u.length-1,t.length)),this._buffers.push(new da(t,u)),c}let e=this._buffers[0].buffer.length,n=la(t,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===e&&e!==0&&this.startWithLF(t)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let c=0;c<n.length;c++)n[c]+=e+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(n.slice(1)),this._buffers[0].buffer+="_"+t,e+=1}else{if(e!==0)for(let c=0;c<n.length;c++)n[c]+=e;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(n.slice(1)),this._buffers[0].buffer+=t}let r=this._buffers[0].buffer.length,s=this._buffers[0].lineStarts.length-1,a=r-this._buffers[0].lineStarts[s],l={line:s,column:a},d=new Mo(0,o,l,this.getLineFeedCnt(0,o,l),r-e);return this._lastChangeBufferPos=l,[d]}getLinesRawContent(){return this.getContentOfSubTree(this.root)}getLineRawContent(t,e=0){let n=this.root,o="",r=this._searchCache.get2(t);if(r){n=r.node;let s=this.getAccumulatedValue(n,t-r.nodeStartLineNumber-1),a=this._buffers[n.piece.bufferIndex].buffer,l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);if(r.nodeStartLineNumber+n.piece.lineFeedCnt===t)o=a.substring(l+s,l+n.piece.length);else{let d=this.getAccumulatedValue(n,t-r.nodeStartLineNumber);return a.substring(l+s,l+d-e)}}else{let s=0,a=t;for(;n!==ke;)if(n.left!==ke&&n.lf_left>=t-1)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt>t-1){let l=this.getAccumulatedValue(n,t-n.lf_left-2),d=this.getAccumulatedValue(n,t-n.lf_left-1),c=this._buffers[n.piece.bufferIndex].buffer,u=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return s+=n.size_left,this._searchCache.set({node:n,nodeStartOffset:s,nodeStartLineNumber:a-(t-1-n.lf_left)}),c.substring(u+l,u+d-e)}else if(n.lf_left+n.piece.lineFeedCnt===t-1){let l=this.getAccumulatedValue(n,t-n.lf_left-2),d=this._buffers[n.piece.bufferIndex].buffer,c=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);o=d.substring(c+l,c+n.piece.length);break}else t-=n.lf_left+n.piece.lineFeedCnt,s+=n.size_left+n.piece.length,n=n.right}for(n=n.next();n!==ke;){let s=this._buffers[n.piece.bufferIndex].buffer;if(n.piece.lineFeedCnt>0){let a=this.getAccumulatedValue(n,0),l=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);return o+=s.substring(l,l+a-e),o}else{let a=this.offsetInBuffer(n.piece.bufferIndex,n.piece.start);o+=s.substr(a,n.piece.length)}n=n.next()}return o}computeBufferMetadata(){let t=this.root,e=1,n=0;for(;t!==ke;)e+=t.lf_left+t.piece.lineFeedCnt,n+=t.size_left+t.piece.length,t=t.right;this._lineCnt=e,this._length=n,this._searchCache.validate(this._length)}getIndexOf(t,e){let n=t.piece,o=this.positionInBuffer(t,e),r=o.line-n.start.line;if(this.offsetInBuffer(n.bufferIndex,n.end)-this.offsetInBuffer(n.bufferIndex,n.start)===e){let s=this.getLineFeedCnt(t.piece.bufferIndex,n.start,o);if(s!==r)return{index:s,remainder:0}}return{index:r,remainder:o.column}}getAccumulatedValue(t,e){if(e<0)return 0;let n=t.piece,o=this._buffers[n.bufferIndex].lineStarts,r=n.start.line+e+1;return r>n.end.line?o[n.end.line]+n.end.column-o[n.start.line]-n.start.column:o[r]-o[n.start.line]-n.start.column}deleteNodeTail(t,e){let n=t.piece,o=n.lineFeedCnt,r=this.offsetInBuffer(n.bufferIndex,n.end),s=e,a=this.offsetInBuffer(n.bufferIndex,s),l=this.getLineFeedCnt(n.bufferIndex,n.start,s),d=l-o,c=a-r,u=n.length+c;t.piece=new Mo(n.bufferIndex,n.start,s,l,u),aa(this,t,c,d)}deleteNodeHead(t,e){let n=t.piece,o=n.lineFeedCnt,r=this.offsetInBuffer(n.bufferIndex,n.start),s=e,a=this.getLineFeedCnt(n.bufferIndex,s,n.end),l=this.offsetInBuffer(n.bufferIndex,s),d=a-o,c=r-l,u=n.length+c;t.piece=new Mo(n.bufferIndex,s,n.end,a,u),aa(this,t,c,d)}shrinkNode(t,e,n){let o=t.piece,r=o.start,s=o.end,a=o.length,l=o.lineFeedCnt,d=e,c=this.getLineFeedCnt(o.bufferIndex,o.start,d),u=this.offsetInBuffer(o.bufferIndex,e)-this.offsetInBuffer(o.bufferIndex,r);t.piece=new Mo(o.bufferIndex,o.start,d,c,u),aa(this,t,u-a,c-l);let m=new Mo(o.bufferIndex,n,s,this.getLineFeedCnt(o.bufferIndex,n,s),this.offsetInBuffer(o.bufferIndex,s)-this.offsetInBuffer(o.bufferIndex,n)),g=this.rbInsertRight(t,m);this.validateCRLFWithPrevNode(g)}appendToNode(t,e){this.adjustCarriageReturnFromNext(e,t)&&(e+=`
`);let n=this.shouldCheckCRLF()&&this.startWithLF(e)&&this.endWithCR(t),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=e;let r=la(e,!1);for(let g=0;g<r.length;g++)r[g]+=o;if(n){let g=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:o-g}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(r.slice(1));let s=this._buffers[0].lineStarts.length-1,a=this._buffers[0].buffer.length-this._buffers[0].lineStarts[s],l={line:s,column:a},d=t.piece.length+e.length,c=t.piece.lineFeedCnt,u=this.getLineFeedCnt(0,t.piece.start,l),m=u-c;t.piece=new Mo(t.piece.bufferIndex,t.piece.start,l,u,d),this._lastChangeBufferPos=l,aa(this,t,e.length,m)}nodeAt(t){let e=this.root,n=this._searchCache.get(t);if(n)return{node:n.node,nodeStartOffset:n.nodeStartOffset,remainder:t-n.nodeStartOffset};let o=0;for(;e!==ke;)if(e.size_left>t)e=e.left;else if(e.size_left+e.piece.length>=t){o+=e.size_left;let r={node:e,remainder:t-e.size_left,nodeStartOffset:o};return this._searchCache.set(r),r}else t-=e.size_left+e.piece.length,o+=e.size_left+e.piece.length,e=e.right;return null}nodeAt2(t,e){let n=this.root,o=0;for(;n!==ke;)if(n.left!==ke&&n.lf_left>=t-1)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt>t-1){let r=this.getAccumulatedValue(n,t-n.lf_left-2),s=this.getAccumulatedValue(n,t-n.lf_left-1);return o+=n.size_left,{node:n,remainder:Math.min(r+e-1,s),nodeStartOffset:o}}else if(n.lf_left+n.piece.lineFeedCnt===t-1){let r=this.getAccumulatedValue(n,t-n.lf_left-2);if(r+e-1<=n.piece.length)return{node:n,remainder:r+e-1,nodeStartOffset:o};e-=n.piece.length-r;break}else t-=n.lf_left+n.piece.lineFeedCnt,o+=n.size_left+n.piece.length,n=n.right;for(n=n.next();n!==ke;){if(n.piece.lineFeedCnt>0){let r=this.getAccumulatedValue(n,0),s=this.offsetOfNode(n);return{node:n,remainder:Math.min(e-1,r),nodeStartOffset:s}}else if(n.piece.length>=e-1){let r=this.offsetOfNode(n);return{node:n,remainder:e-1,nodeStartOffset:r}}else e-=n.piece.length;n=n.next()}return null}nodeCharCodeAt(t,e){if(t.piece.lineFeedCnt<1)return-1;let n=this._buffers[t.piece.bufferIndex],o=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start)+e;return n.buffer.charCodeAt(o)}offsetOfNode(t){if(!t)return 0;let e=t.size_left;for(;t!==this.root;)t.parent.right===t&&(e+=t.parent.size_left+t.parent.piece.length),t=t.parent;return e}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(t){if(typeof t=="string")return t.charCodeAt(0)===10;if(t===ke||t.piece.lineFeedCnt===0)return!1;let e=t.piece,n=this._buffers[e.bufferIndex].lineStarts,o=e.start.line,r=n[o]+e.start.column;return o===n.length-1||n[o+1]>r+1?!1:this._buffers[e.bufferIndex].buffer.charCodeAt(r)===10}endWithCR(t){return typeof t=="string"?t.charCodeAt(t.length-1)===13:t===ke||t.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(t,t.piece.length-1)===13}validateCRLFWithPrevNode(t){if(this.shouldCheckCRLF()&&this.startWithLF(t)){let e=t.prev();this.endWithCR(e)&&this.fixCRLF(e,t)}}validateCRLFWithNextNode(t){if(this.shouldCheckCRLF()&&this.endWithCR(t)){let e=t.next();this.startWithLF(e)&&this.fixCRLF(t,e)}}fixCRLF(t,e){let n=[],o=this._buffers[t.piece.bufferIndex].lineStarts,r;t.piece.end.column===0?r={line:t.piece.end.line-1,column:o[t.piece.end.line]-o[t.piece.end.line-1]-1}:r={line:t.piece.end.line,column:t.piece.end.column-1};let s=t.piece.length-1,a=t.piece.lineFeedCnt-1;t.piece=new Mo(t.piece.bufferIndex,t.piece.start,r,a,s),aa(this,t,-1,-1),t.piece.length===0&&n.push(t);let l={line:e.piece.start.line+1,column:0},d=e.piece.length-1,c=this.getLineFeedCnt(e.piece.bufferIndex,l,e.piece.end);e.piece=new Mo(e.piece.bufferIndex,l,e.piece.end,c,d),aa(this,e,-1,-1),e.piece.length===0&&n.push(e);let u=this.createNewPieces(`\r
`);this.rbInsertRight(t,u[0]);for(let m=0;m<n.length;m++)RI(this,n[m])}adjustCarriageReturnFromNext(t,e){if(this.shouldCheckCRLF()&&this.endWithCR(t)){let n=e.next();if(this.startWithLF(n)){if(t+=`
`,n.piece.length===1)RI(this,n);else{let o=n.piece,r={line:o.start.line+1,column:0},s=o.length-1,a=this.getLineFeedCnt(o.bufferIndex,r,o.end);n.piece=new Mo(o.bufferIndex,r,o.end,a,s),aa(this,n,-1,-1)}return!0}}return!1}iterate(t,e){if(t===ke)return e(ke);let n=this.iterate(t.left,e);return n&&e(t)&&this.iterate(t.right,e)}getNodeContent(t){if(t===ke)return"";let e=this._buffers[t.piece.bufferIndex],n=t.piece,o=this.offsetInBuffer(n.bufferIndex,n.start),r=this.offsetInBuffer(n.bufferIndex,n.end);return e.buffer.substring(o,r)}getPieceContent(t){let e=this._buffers[t.bufferIndex],n=this.offsetInBuffer(t.bufferIndex,t.start),o=this.offsetInBuffer(t.bufferIndex,t.end);return e.buffer.substring(n,o)}rbInsertRight(t,e){let n=new _h(e,1);if(n.left=ke,n.right=ke,n.parent=ke,n.size_left=0,n.lf_left=0,this.root===ke)this.root=n,n.color=0;else if(t.right===ke)t.right=n,n.parent=t;else{let r=JP(t.right);r.left=n,n.parent=r}return OU(this,n),n}rbInsertLeft(t,e){let n=new _h(e,1);if(n.left=ke,n.right=ke,n.parent=ke,n.size_left=0,n.lf_left=0,this.root===ke)this.root=n,n.color=0;else if(t.left===ke)t.left=n,n.parent=t;else{let o=AU(t.left);o.right=n,n.parent=o}return OU(this,n),n}getContentOfSubTree(t){let e="";return this.iterate(t,n=>(e+=this.getNodeContent(n),!0)),e}};function XP(i){let t=0,e=0,n=0,o=0;for(let r=0,s=i.length;r<s;r++){let a=i.charCodeAt(r);a===13?(t===0&&(e=r),t++,r+1<s&&i.charCodeAt(r+1)===10?(o|=2,r++):o|=3,n=r+1):a===10&&(o|=1,t===0&&(e=r),t++,n=r+1)}return t===0&&(e=i.length),[t,e,i.length-n,o]}var HU;function QZ(){return HU||(HU=new TextDecoder("UTF-16LE")),HU}function B9(i,t,e){let n=new Uint16Array(i.buffer,t,e);return e>0&&(n[0]===65279||n[0]===65534)?JZ(i,t,e):QZ().decode(n)}function JZ(i,t,e){let n=[],o=0;for(let r=0;r<e;r++){let s=$2(i,t);t+=2,n[o++]=String.fromCharCode(s)}return n.join("")}function ZP(i){return i.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var e_=class i{constructor(t,e,n,o){this.oldPosition=t;this.oldText=e;this.newPosition=n;this.newText=o}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${ZP(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${ZP(this.oldText)}")`:`(replace@${this.oldPosition} "${ZP(this.oldText)}" with "${ZP(this.newText)}")`}static _writeStringSize(t){return 4+2*t.length}static _writeString(t,e,n){let o=e.length;_v(t,o,n),n+=4;for(let r=0;r<o;r++)z2(t,e.charCodeAt(r),n),n+=2;return n}static _readString(t,e){let n=Pv(t,e);return e+=4,B9(t,e,n)}writeSize(){return 8+i._writeStringSize(this.oldText)+i._writeStringSize(this.newText)}write(t,e){return _v(t,this.oldPosition,e),e+=4,_v(t,this.newPosition,e),e+=4,e=i._writeString(t,this.oldText,e),e=i._writeString(t,this.newText,e),e}static read(t,e,n){let o=Pv(t,e);e+=4;let r=Pv(t,e);e+=4;let s=i._readString(t,e);e+=i._writeStringSize(s);let a=i._readString(t,e);return e+=i._writeStringSize(a),n.push(new i(o,s,r,a)),e}};var t_=class i extends N{constructor(e,n,o,r,s,a,l){super();this._onDidChangeContent=this._register(new T);this._BOM=n,this._mightContainNonBasicASCII=!a,this._mightContainRTL=r,this._mightContainUnusualLineTerminators=s,this._pieceTree=new YP(e,o,l)}get onDidChangeContent(){return this._onDidChangeContent.event}equals(e){return!(e instanceof i)||this._BOM!==e._BOM||this.getEOL()!==e.getEOL()?!1:this._pieceTree.equal(e._pieceTree)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,n){return this._pieceTree.getOffsetAt(e,n)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,n){let o=e+n,r=this.getPositionAt(e),s=this.getPositionAt(o);return new ze(r.lineNumber,r.column,s.lineNumber,s.column)}getValueInRange(e,n=0){if(e.isEmpty())return"";let o=this._getEndOfLine(n);return this._pieceTree.getValueInRange(e,o)}getValueLengthInRange(e,n=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let o=this.getOffsetAt(e.startLineNumber,e.startColumn),r=this.getOffsetAt(e.endLineNumber,e.endColumn),s=0,a=this._getEndOfLine(n),l=this.getEOL();if(a.length!==l.length){let d=a.length-l.length,c=e.endLineNumber-e.startLineNumber;s=d*c}return r-o+s}getCharacterCountInRange(e,n=0){if(this._mightContainNonBasicASCII){let o=0,r=e.startLineNumber,s=e.endLineNumber;for(let a=r;a<=s;a++){let l=this.getLineContent(a),d=a===r?e.startColumn-1:0,c=a===s?e.endColumn-1:l.length;for(let u=d;u<c;u++)Lc(l.charCodeAt(u))?(o=o+1,u=u+1):o=o+1}return o+=this._getEndOfLine(n).length*(s-r),o}return this.getValueLengthInRange(e,n)}getNearestChunk(e){return this._pieceTree.getNearestChunk(e)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,n){return this._pieceTree.getLineCharCode(e,n)}getCharCode(e){return this._pieceTree.getCharCode(e)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineMinColumn(e){return 1}getLineMaxColumn(e){return this.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){let n=Sx(this.getLineContent(e));return n===-1?0:n+1}getLineLastNonWhitespaceColumn(e){let n=c2(this.getLineContent(e));return n===-1?0:n+2}_getEndOfLine(e){switch(e){case 1:return`
`;case 2:return`\r
`;case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,n,o){let r=this._mightContainRTL,s=this._mightContainUnusualLineTerminators,a=this._mightContainNonBasicASCII,l=!0,d=[];for(let I=0;I<e.length;I++){let x=e[I];l&&x._isTracked&&(l=!1);let E=x.range;if(x.text){let z=!0;a||(z=!m2(x.text),a=z),!r&&z&&(r=Ex(x.text)),!s&&z&&(s=wx(x.text))}let w="",R=0,L=0,U=0;if(x.text){let z;[R,L,U,z]=XP(x.text);let Y=this.getEOL(),j=Y===`\r
`?2:1;z===0||z===j?w=x.text:w=x.text.replace(/\r\n|\r|\n/g,Y)}d[I]={sortIndex:I,identifier:x.identifier||null,range:E,rangeOffset:this.getOffsetAt(E.startLineNumber,E.startColumn),rangeLength:this.getValueLengthInRange(E),text:w,eolCount:R,firstLineLength:L,lastLineLength:U,forceMoveMarkers:!!x.forceMoveMarkers,isAutoWhitespaceEdit:x.isAutoWhitespaceEdit||!1}}d.sort(i._sortOpsAscending);let c=!1;for(let I=0,x=d.length-1;I<x;I++){let E=d[I].range.getEndPosition(),w=d[I+1].range.getStartPosition();if(w.isBeforeOrEqual(E)){if(w.isBefore(E))throw new Error("Overlapping ranges are not allowed!");c=!0}}l&&(d=this._reduceOperations(d));let u=o||n?i._getInverseEditRanges(d):[],m=[];if(n)for(let I=0;I<d.length;I++){let x=d[I],E=u[I];if(x.isAutoWhitespaceEdit&&x.range.isEmpty())for(let w=E.startLineNumber;w<=E.endLineNumber;w++){let R="";w===E.startLineNumber&&(R=this.getLineContent(x.range.startLineNumber),Sx(R)!==-1)||m.push({lineNumber:w,oldContent:R})}}let g=null;if(o){let I=0;g=[];for(let x=0;x<d.length;x++){let E=d[x],w=u[x],R=this.getValueInRange(E.range),L=E.rangeOffset+I;I+=E.text.length-R.length,g[x]={sortIndex:E.sortIndex,identifier:E.identifier,range:w,text:R,textChange:new e_(E.rangeOffset,R,L,E.text)}}c||g.sort((x,E)=>x.sortIndex-E.sortIndex)}this._mightContainRTL=r,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=a;let h=this._doApplyEdits(d),f=null;if(n&&m.length>0){m.sort((I,x)=>x.lineNumber-I.lineNumber),f=[];for(let I=0,x=m.length;I<x;I++){let E=m[I].lineNumber;if(I>0&&m[I-1].lineNumber===E)continue;let w=m[I].oldContent,R=this.getLineContent(E);R.length===0||R===w||Sx(R)!==-1||f.push(E)}}return this._onDidChangeContent.fire(),new MS(g,h,f)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let n=!1,o=e[0].range,r=e[e.length-1].range,s=new ze(o.startLineNumber,o.startColumn,r.endLineNumber,r.endColumn),a=o.startLineNumber,l=o.startColumn,d=[];for(let h=0,f=e.length;h<f;h++){let I=e[h],x=I.range;n=n||I.forceMoveMarkers,d.push(this.getValueInRange(new ze(a,l,x.startLineNumber,x.startColumn))),I.text.length>0&&d.push(I.text),a=x.endLineNumber,l=x.endColumn}let c=d.join(""),[u,m,g]=XP(c);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:c,eolCount:u,firstLineLength:m,lastLineLength:g,forceMoveMarkers:n,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(i._sortOpsDescending);let n=[];for(let o=0;o<e.length;o++){let r=e[o],s=r.range.startLineNumber,a=r.range.startColumn,l=r.range.endLineNumber,d=r.range.endColumn;if(s===l&&a===d&&r.text.length===0)continue;r.text?(this._pieceTree.delete(r.rangeOffset,r.rangeLength),this._pieceTree.insert(r.rangeOffset,r.text,!0)):this._pieceTree.delete(r.rangeOffset,r.rangeLength);let c=new ze(s,a,l,d);n.push({range:c,rangeLength:r.rangeLength,text:r.text,rangeOffset:r.rangeOffset,forceMoveMarkers:r.forceMoveMarkers})}return n}findMatchesLineByLine(e,n,o,r){return this._pieceTree.findMatchesLineByLine(e,n,o,r)}getPieceTree(){return this._pieceTree}static _getInverseEditRange(e,n){let o=e.startLineNumber,r=e.startColumn,[s,a,l]=XP(n),d;if(n.length>0){let c=s+1;c===1?d=new ze(o,r,o,r+a):d=new ze(o,r,o+c-1,l+1)}else d=new ze(o,r,o,r);return d}static _getInverseEditRanges(e){let n=[],o=0,r=0,s=null;for(let a=0,l=e.length;a<l;a++){let d=e[a],c,u;s?s.range.endLineNumber===d.range.startLineNumber?(c=o,u=r+(d.range.startColumn-s.range.endColumn)):(c=o+(d.range.startLineNumber-s.range.endLineNumber),u=d.range.startColumn):(c=d.range.startLineNumber,u=d.range.startColumn);let m;if(d.text.length>0){let g=d.eolCount+1;g===1?m=new ze(c,u,c,u+d.firstLineLength):m=new ze(c,u,c+g-1,d.lastLineLength+1)}else m=new ze(c,u,c,u);o=m.endLineNumber,r=m.endColumn,n.push(m),s=d}return n}static _sortOpsAscending(e,n){let o=ze.compareRangesUsingEnds(e.range,n.range);return o===0?e.sortIndex-n.sortIndex:o}static _sortOpsDescending(e,n){let o=ze.compareRangesUsingEnds(e.range,n.range);return o===0?n.sortIndex-e.sortIndex:-o}};var WU=class{constructor(t,e,n,o,r,s,a,l,d){this._chunks=t;this._bom=e;this._cr=n;this._lf=o;this._crlf=r;this._containsRTL=s;this._containsUnusualLineTerminators=a;this._isBasicASCII=l;this._normalizeEOL=d}_getEOL(t){let e=this._cr+this._lf+this._crlf,n=this._cr+this._crlf;return e===0?t===1?`
`:`\r
`:n>e/2?`\r
`:`
`}create(t){let e=this._getEOL(t),n=this._chunks;if(this._normalizeEOL&&(e===`\r
`&&(this._cr>0||this._lf>0)||e===`
`&&(this._cr>0||this._crlf>0)))for(let r=0,s=n.length;r<s;r++){let a=n[r].buffer.replace(/\r\n|\r|\n/g,e),l=la(a);n[r]=new da(a,l)}let o=new t_(n,this._bom,e,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:o,disposable:o}}getFirstLineText(t){return this._chunks[0].buffer.substr(0,t).split(/\r\n|\r|\n/)[0]}},DI=class{constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(t){if(t.length===0)return;this.chunks.length===0&&f2(t)&&(this.BOM=g2,t=t.substr(1));let e=t.charCodeAt(t.length-1);e===13||e>=55296&&e<=56319?(this._acceptChunk1(t.substr(0,t.length-1),!1),this._hasPreviousChar=!0,this._previousChar=e):(this._acceptChunk1(t,!1),this._hasPreviousChar=!1,this._previousChar=e)}_acceptChunk1(t,e){!e&&t.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+t):this._acceptChunk2(t))}_acceptChunk2(t){let e=V9(this._tmpLineStarts,t);this.chunks.push(new da(t,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=Ex(t)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=wx(t)))}finish(t=!0){return this._finish(),new WU(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,t)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let t=this.chunks[this.chunks.length-1];t.buffer+=String.fromCharCode(this._previousChar);let e=la(t.buffer);t.lineStarts=e,this._previousChar===13&&this.cr++}}};var n_=class extends N{constructor(e,n,o){super();this._source=e;this._inputTextBuffer=n;this._outputs=o;this._outputTextBuffers=void 0}_getFullModelRange(e){let n=e.getLineCount();return new ze(1,1,n,this._getLineMaxColumn(e,n))}_getLineMaxColumn(e,n){if(n<1||n>e.getLineCount())throw new Error("Illegal value for lineNumber");return e.getLineLength(n)+1}get inputTextBuffer(){if(!this._inputTextBuffer){let e=new DI;e.acceptChunk(this._source);let n=e.finish(!0),{textBuffer:o,disposable:r}=n.create(1);this._inputTextBuffer=o,this._register(r)}return this._inputTextBuffer}get outputTextBuffers(){return this._outputTextBuffers||(this._outputTextBuffers=this._outputs.map(e=>{let n=new DI;n.acceptChunk(e);let o=n.finish(!0),{textBuffer:r,disposable:s}=o.create(1);return this._register(s),r})),this._outputTextBuffers}findInInputs(e){let o=new Wb(e,!1,!1,null).parseSearchRequest();if(!o)return[];let r=this._getFullModelRange(this.inputTextBuffer);return this.inputTextBuffer.findMatchesLineByLine(r,o,!0,5e3)}findInOutputs(e){let o=new Wb(e,!1,!1,null).parseSearchRequest();return o?this.outputTextBuffers.map(r=>{let s=r.findMatchesLineByLine(this._getFullModelRange(r),o,!0,5e3);if(s.length!==0)return{textBuffer:r,matches:s}}).filter(r=>!!r):[]}};function VU(i,t){let e=-1,n=[],o=[];return i.forEach(s=>{s.range.startLineNumber!==e&&o.length>0&&(n.push([...o]),o=[]),o.push(s),e=s.range.endLineNumber}),o.length>0&&n.push([...o]),n.map(s=>{let a=[],l=s[0].range.startLineNumber,d=s[s.length-1].range.endLineNumber;for(let c=l;c<=d;c++)a.push(t.getLineContent(c));return new qg(a.join(`
`)+`
`,s.map(c=>new ze(c.range.startLineNumber-1,c.range.startColumn-1,c.range.endLineNumber-1,c.range.endColumn-1)))})}var kkt=Object.freeze({id:"application",order:100,title:p(7279,null),type:"object"}),$9=Object.freeze({id:"workbench",order:7,title:p(7287,null),type:"object"}),XZ=Object.freeze({id:"security",scope:1,title:p(7285,null),type:"object",order:7}),Pkt=Object.freeze({id:"problems",title:p(7281,null),type:"object",order:101}),ZZ=Object.freeze({id:"window",order:8,title:p(7286,null),type:"object"}),eee={ConfigurationMigration:"base.contributions.configuration.migration"},BU=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new T;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(t){this.migrations.push(...t)}},s_=new BU;wt.add(eee.ConfigurationMigration,s_);var o_=class extends N{constructor(e,n){super();this.configurationService=e;this.workspaceService=n;this._register(this.workspaceService.onDidChangeWorkspaceFolders(async o=>{for(let r of o.added)await this.migrateConfigurationsForFolder(r,s_.migrations)})),this.migrateConfigurations(s_.migrations),this._register(s_.onDidRegisterConfigurationMigration(o=>this.migrateConfigurations(o)))}static{this.ID="workbench.contrib.configurationMigration"}async migrateConfigurations(e){await this.migrateConfigurationsForFolder(void 0,e);for(let n of this.workspaceService.getWorkspace().folders)await this.migrateConfigurationsForFolder(n,e)}async migrateConfigurationsForFolder(e,n){await Promise.all([n.map(o=>this.migrateConfigurationsForFolderAndOverride(o,e?.uri))])}async migrateConfigurationsForFolderAndOverride(e,n){let o=this.configurationService.inspect(e.key,{resource:n}),r=this.workspaceService.getWorkbenchState()===3?[["user",2],["userLocal",3],["userRemote",4],["workspace",5],["workspaceFolder",6]]:[["user",2],["userLocal",3],["userRemote",4],["workspace",5]];e.includeApplication&&r.unshift(["application",1]);for(let[s,a]of r){let l=o[s];if(!l)continue;let d=[];if(l.value!==void 0){let c=await this.runMigration(e,s,l.value,n,void 0);for(let u of c??[])d.push([u,[]])}for(let{identifiers:c,value:u}of l.overrides??[])if(u!==void 0){let m=await this.runMigration(e,s,u,n,c);for(let g of m??[])d.push([g,c])}d.length&&await Promise.allSettled(d.map(async([[c,u],m])=>this.configurationService.updateValue(c,u.value,{resource:n,overrideIdentifiers:m},a)))}}async runMigration(e,n,o,r,s){let a=d=>{let u=this.configurationService.inspect(d,{resource:r})[n];if(u)return s?u.overrides?.find(({identifiers:m})=>Et(m,s))?.value:u.value},l=await e.migrateFn(o,a);return Array.isArray(l)?l:[[e.key,l]]}};o_=_([S(0,$t),S(1,Cr)],o_);var r_=class extends N{constructor(e){super();this.remoteAgentService=e;this._ready=new jt;this.ready=this._ready.p;this.create()}static{this.ID="workbench.contrib.dynamicWorkbenchSecurityConfiguration"}async create(){try{await this.doCreate()}finally{this._ready.complete()}}async doCreate(){if(!Te&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;wt.as(kr.Configuration).registerConfiguration({...XZ,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:p(7283,null)},default:[],markdownDescription:p(7282,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:p(7284,null),scope:3}}})}};r_=_([S(0,Ds)],r_);var AI="window.newWindowProfile",i_=class extends N{constructor(e,n){super();this.userDataProfilesService=e;this.configurationService=n;this.registerNewWindowProfileConfiguration(),this._register(this.userDataProfilesService.onDidChangeProfiles(o=>this.registerNewWindowProfileConfiguration())),this.setNewWindowProfile(),this.checkAndResetNewWindowProfileConfig(),this._register(n.onDidChangeConfiguration(o=>{o.source!==7&&o.affectsConfiguration(AI)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=wt.as(kr.Configuration),n={...ZZ,properties:{[AI]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),p(7278,null)],description:p(7280,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[n],remove:[this.configurationNode]}):e.registerConfiguration(n),this.configurationNode=n}setNewWindowProfile(){let e=this.configurationService.getValue(AI);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(n=>n.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(AI);if(!e)return;let n=this.newWindowProfile?this.userDataProfilesService.profiles.find(o=>o.id===this.newWindowProfile.id):void 0;e!==n?.name&&this.configurationService.updateValue(AI,n?.name)}};i_=_([S(0,pd),S(1,$t)],i_);var Vkt=A("editorResolverService"),tee="workbench.editorAssociations",nee="workbench.diffEditorAssociations",oee="workbench.editor.hiddenEditorTypes",ree="workbench.editor.markdownDefaultEditorInAgentsWindow";function z9(i){return{"*.md":i?.markdownDefaultEditor===!0?"vscode.markdown.editor":"vscode.markdown.preview.editor"}}function iee(i){return z9(i)}var see=wt.as(kr.Configuration),aee={...$9,properties:{[ree]:{type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"startup"},markdownDescription:p(23007,null)},[tee]:{type:"object",markdownDescription:p(23005,null),additionalProperties:{type:"string"},agentsWindow:{default:z9()}},[nee]:{type:"object",markdownDescription:p(23004,null),additionalProperties:{type:"string"},agentsWindow:{default:iee()}},[oee]:{type:"array",default:[],items:{type:"string"},markdownDescription:p(23006,null),agentsWindow:{default:["vscode.markdown.preview.editor"]}}}};see.registerConfiguration(aee);function q9(i,t){if(new Set([B.extension,B.webviewPanel,B.vscodeWorkspaceTrust,B.vscodeSettings]).has(t.scheme))return!1;let o=typeof i=="string"&&i.indexOf(qe.sep)>=0?`${t.scheme}:${t.path}`:Ze(t);return _r(i,o,{ignoreCase:!0})}var a_=class i{constructor(t,e,n,o,r,s,a){this._textDocumentsAndEditors=n;this._textDocuments=o;this._extHostFileSystem=r;this._extHostSearch=s;this._logService=a;this._notebookStatusBarItemProviders=new Map;this._documents=new Ve;this._editors=new Map;this._onDidChangeActiveNotebookEditor=new T;this.onDidChangeActiveNotebookEditor=this._onDidChangeActiveNotebookEditor.event;this._visibleNotebookEditors=[];this._onDidOpenNotebookDocument=new T;this.onDidOpenNotebookDocument=this._onDidOpenNotebookDocument.event;this._onDidCloseNotebookDocument=new T;this.onDidCloseNotebookDocument=this._onDidCloseNotebookDocument.event;this._onDidChangeVisibleNotebookEditors=new T;this.onDidChangeVisibleNotebookEditors=this._onDidChangeVisibleNotebookEditors.event;this._statusBarCache=new Xo("NotebookCellStatusBarCache");this._handlePool=0;this._notebookSerializer=new Map;this._notebookProxy=t.getProxy(F.MainThreadNotebook),this._notebookDocumentsProxy=t.getProxy(F.MainThreadNotebookDocuments),this._notebookEditorsProxy=t.getProxy(F.MainThreadNotebookEditors),this._commandsConverter=e.converter,e.registerArgumentProcessor({processArgument:l=>{if(l&&l.$mid===13){let d=l.notebookEditor?.notebookUri,c=l.cell.handle,m=this._documents.get(d)?.getCell(c);if(m)return m.apiCell}if(l&&l.$mid===14){let d=l.uri,c=this._documents.get(d);if(c)return c.apiNotebook}return l}}),i._registerApiCommands(e)}static{this._notebookStatusBarItemProviderHandlePool=0}get activeNotebookEditor(){return this._activeNotebookEditor?.apiEditor}get visibleNotebookEditors(){return this._visibleNotebookEditors.map(t=>t.apiEditor)}getEditorById(t){let e=this._editors.get(t);if(!e)throw new Error(`unknown text editor: ${t}. known editors: ${[...this._editors.keys()]} `);return e}getIdByEditor(t){for(let[e,n]of this._editors)if(n.apiEditor===t)return e}get notebookDocuments(){return[...this._documents.values()]}getNotebookDocument(t,e){let n=this._documents.get(t);if(!n&&!e)throw new Error(`NO notebook document for '${t}'`);return n}static _convertNotebookRegistrationData(t,e){if(!e)return;let n=e.filenamePattern.map(o=>yb.from(o)).filter(o=>o!==void 0);if(e.filenamePattern&&!n){console.warn(`Notebook content provider view options file name pattern is invalid ${e.filenamePattern}`);return}return{extension:t.identifier,providerDisplayName:t.displayName||t.name,displayName:e.displayName,filenamePattern:n,priority:e.exclusive?"exclusive":void 0}}registerNotebookCellStatusBarItemProvider(t,e,n){let o=i._notebookStatusBarItemProviderHandlePool++,r=typeof n.onDidChangeCellStatusBarItems=="function"?i._notebookStatusBarItemProviderHandlePool++:void 0;this._notebookStatusBarItemProviders.set(o,n),this._notebookProxy.$registerNotebookCellStatusBarItemProvider(o,r,e);let s;return r!==void 0&&(s=n.onDidChangeCellStatusBarItems(a=>this._notebookProxy.$emitCellStatusBarEvent(r))),new Se(()=>{this._notebookStatusBarItemProviders.delete(o),this._notebookProxy.$unregisterNotebookCellStatusBarItemProvider(o,r),s?.dispose()})}async createNotebookDocument(t){let e=await this._notebookDocumentsProxy.$tryCreateNotebook({viewType:t.viewType,content:t.content&&Qd.from(t.content)});return y.revive(e)}async openNotebookDocument(t){let e=this._documents.get(t);if(e)return e.apiNotebook;let n=await this._notebookDocumentsProxy.$tryOpenNotebook(t),o=this._documents.get(y.revive(n));return ki(o?.apiNotebook)}async showNotebookDocument(t,e){let n;typeof e=="object"?n={position:zt.from(e.viewColumn),preserveFocus:e.preserveFocus,selections:e.selections&&e.selections.map(qr.from),pinned:typeof e.preview=="boolean"?!e.preview:void 0,label:typeof e.asRepl=="string"?e.asRepl:typeof e.asRepl=="object"?e.asRepl.label:void 0}:n={preserveFocus:!1,pinned:!0};let o=e?.asRepl?"repl":t.notebookType,r=await this._notebookEditorsProxy.$tryShowNotebookDocument(t.uri,o,n),s=r&&this._editors.get(r)?.apiEditor;if(s)return s;throw r?new Error(`Could NOT open editor for "${t.uri.toString()}" because another editor opened in the meantime.`):new Error(`Could NOT open editor for "${t.uri.toString()}".`)}async $provideNotebookCellStatusBarItems(t,e,n,o){let r=this._notebookStatusBarItemProviders.get(t),s=y.revive(e),a=this._documents.get(s);if(!a||!r)return;let l=a.getCellFromIndex(n);if(!l)return;let d=await r.provideCellStatusBarItems(l.apiCell,o);if(!d)return;let c=new $,u=this._statusBarCache.add([c]),g=(Array.isArray(d)?d:[d]).map(h=>bL.from(h,this._commandsConverter,c));return{cacheId:u,items:g}}$releaseNotebookCellStatusBarItems(t){this._statusBarCache.delete(t)}registerNotebookSerializer(t,e,n,o,r){if(fs(e))throw new Error("viewType cannot be empty or just whitespace");let s=this._handlePool++;return this._notebookSerializer.set(s,{viewType:e,serializer:n,options:o}),this._notebookProxy.$registerNotebookSerializer(s,{id:t.identifier,location:t.extensionLocation},e,xL.from(o),i._convertNotebookRegistrationData(t,r)),q(()=>{this._notebookProxy.$unregisterNotebookSerializer(s)})}async $dataToNotebook(t,e,n){let o=this._notebookSerializer.get(t);if(!o)throw new Error("NO serializer found");let r=await o.serializer.deserializeNotebook(e.buffer,n);return new Zt(Qd.from(r))}async $notebookToData(t,e,n){let o=this._notebookSerializer.get(t);if(!o)throw new Error("NO serializer found");let r=await o.serializer.serializeNotebook(Qd.to(e.value),n);return H.wrap(r)}async $saveNotebook(t,e,n,o,r){let s=y.revive(e),a=this._notebookSerializer.get(t);this.trace(`enter saveNotebook(versionId: ${n}, ${s.toString()})`);try{if(!a)throw new MI("NO serializer found");let l=this._documents.get(s);if(!l)throw new MI("Document NOT found");if(l.versionId!==n)throw new MI("Document version mismatch, expected: "+n+", actual: "+l.versionId);if(!this._extHostFileSystem.value.isWritableFileSystem(s.scheme))throw new Ss(p(5886,null,this._resourceForError(s)),6);let d={metadata:OD(l.apiNotebook.metadata,h=>!(a.options?.transientDocumentMetadata??{})[h]),cells:[]};for(let h of l.apiNotebook.getCells()){let f=new Ls(h.kind,h.document.getText(),h.document.languageId,h.mime,a.options?.transientOutputs?[]:[...h.outputs],h.metadata,h.executionSummary);f.metadata=OD(h.metadata,I=>!(a.options?.transientCellMetadata??{})[I]),d.cells.push(f)}if(await this._validateWriteFile(s,o),r.isCancellationRequested)throw new Oe;let c=await a.serializer.serializeNotebook(d,r);if(r.isCancellationRequested)throw new Oe;this.trace(`serialized versionId: ${n} ${s.toString()}`),await this._extHostFileSystem.value.writeFile(s,c),this.trace(`Finished write versionId: ${n} ${s.toString()}`);let u=this._extHostFileSystem.getFileSystemProviderExtUri(s.scheme),m=await this._extHostFileSystem.value.stat(s),g={name:u.basename(s),isFile:(m.type&1)!==0,isDirectory:(m.type&2)!==0,isSymbolicLink:(m.type&64)!==0,mtime:m.mtime,ctime:m.ctime,size:m.size,readonly:!!((m.permissions??0)&1)||!this._extHostFileSystem.value.isWritableFileSystem(s.scheme),locked:!!((m.permissions??0)&2),executable:!!((m.permissions??0)&4),etag:JA({mtime:m.mtime,size:m.size})};return this.trace(`exit saveNotebook(versionId: ${n}, ${s.toString()})`),g}catch(l){if(l instanceof Ss)return{...l,message:l.message};throw l}}async $searchInNotebooks(t,e,n,o,r){let s=this._notebookSerializer.get(t)?.serializer;if(!s)return{limitHit:!1,results:[]};let a=new Lr;await(async(m,g,h)=>{await Promise.all(m.map(async f=>await Promise.all(f.filenamePatterns.map(I=>{let x={_reason:h._reason,folderQueries:h.folderQueries,includePattern:h.includePattern,excludePattern:h.excludePattern,maxResults:h.maxResults,type:1,filePattern:I};return this._extHostSearch.doInternalFileSearchWithCustomCallback(x,g,E=>{E.forEach(w=>{a.has(w)||o.some(L=>f.isFromSettings&&!L.isFromSettings?!1:L.filenamePatterns.some(U=>q9(U,w)))||a.add(w)})}).catch(E=>{if(E.code==="ENOENT")return console.warn("Could not find notebook search results, ignoring notebook results."),{limitHit:!1,messages:[]};throw E})}))))})(n,r,e);let d=new Ve,c=!1,u=Array.from(a).map(async m=>{let g=[];try{if(r.isCancellationRequested)return;if(e.maxResults&&[...d.values()].reduce((x,E)=>x+E.cellResults.length,0)>e.maxResults){c=!0;return}let h=[],f=this._documents.get(m);if(f)f.apiNotebook.getCells().forEach(E=>h.push({input:E.document.getText(),outputs:E.outputs.flatMap(w=>w.items.map(R=>R.data.toString()))}));else{let x=await this._extHostFileSystem.value.readFile(m),E=H.fromString(x.toString()),w=await s.deserializeNotebook(E.buffer,r);if(r.isCancellationRequested)return;Qd.from(w).cells.forEach(L=>h.push({input:L.source,outputs:L.outputs.flatMap(U=>U.items.map(z=>z.valueBytes.toString()))}))}if(r.isCancellationRequested)return;h.forEach((x,E)=>{let w=e.contentPattern.pattern,R=new n_(x.input,void 0,x.outputs),L=R.findInInputs(w),U=R.findInOutputs(w),z=U.flatMap(Y=>VU(Y.matches,Y.textBuffer)).map((Y,j)=>(Y.webviewIndex=j,Y));if(L.length>0||U.length>0){let Y={index:E,contentResults:VU(L,R.inputTextBuffer),webviewResults:z};g.push(Y)}});let I={resource:m,cellResults:g};d.set(m,I);return}catch{return}});return await Promise.all(u),{limitHit:c,results:[...d.values()]}}async _validateWriteFile(t,e){let n=await this._extHostFileSystem.value.stat(t);if(typeof e?.mtime=="number"&&typeof e.etag=="string"&&e.etag!==YW&&typeof n.mtime=="number"&&typeof n.size=="number"&&e.mtime<n.mtime&&e.etag!==JA({mtime:e.mtime,size:n.size}))throw new Ss(p(5887,null),3,e)}_resourceForError(t){return t.scheme===B.file?t.fsPath:t.toString()}_createExtHostEditor(t,e,n){if(this._editors.has(e))throw new Error(`editor with id ALREADY EXSIST: ${e}`);let o=new Ep(e,this._notebookEditorsProxy,t,n.visibleRanges.map(qr.to),n.selections.map(qr.to),typeof n.viewColumn=="number"?zt.to(n.viewColumn):void 0,n.viewType);this._editors.set(e,o)}$acceptDocumentAndEditorsDelta(t){if(t.value.removedDocuments)for(let n of t.value.removedDocuments){let o=y.revive(n),r=this._documents.get(o);r&&(r.dispose(),this._documents.delete(o),this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({removedDocuments:r.apiNotebook.getCells().map(s=>s.document.uri)}),this._onDidCloseNotebookDocument.fire(r.apiNotebook));for(let s of this._editors.values())s.notebookData.uri.toString()===o.toString()&&this._editors.delete(s.id)}if(t.value.addedDocuments){let n=[];for(let o of t.value.addedDocuments){let r=y.revive(o.uri);if(this._documents.has(r))throw new Error(`adding EXISTING notebook ${r} `);let s=new QP(this._notebookDocumentsProxy,this._textDocumentsAndEditors,this._textDocuments,r,o);n.push(...o.cells.map(a=>Ph.asModelAddData(a))),this._documents.get(r)?.dispose(),this._documents.set(r,s),this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({addedDocuments:n}),this._onDidOpenNotebookDocument.fire(s.apiNotebook)}}if(t.value.addedEditors)for(let n of t.value.addedEditors){if(this._editors.has(n.id))return;let o=y.revive(n.documentUri),r=this._documents.get(o);r&&this._createExtHostEditor(r,n.id,n)}let e=[];if(t.value.removedEditors)for(let n of t.value.removedEditors){let o=this._editors.get(n);o&&(this._editors.delete(n),this._activeNotebookEditor?.id===o.id&&(this._activeNotebookEditor=void 0),e.push(o))}if(t.value.visibleEditors){this._visibleNotebookEditors=t.value.visibleEditors.map(o=>this._editors.get(o)).filter(o=>!!o);let n=new Set;this._visibleNotebookEditors.forEach(o=>n.add(o.id));for(let o of this._editors.values()){let r=n.has(o.id);o._acceptVisibility(r)}this._visibleNotebookEditors=[...this._editors.values()].map(o=>o).filter(o=>o.visible),this._onDidChangeVisibleNotebookEditors.fire(this.visibleNotebookEditors)}t.value.newActiveEditor===null?this._activeNotebookEditor=void 0:t.value.newActiveEditor&&(this._editors.get(t.value.newActiveEditor)||console.error(`FAILED to find active notebook editor ${t.value.newActiveEditor}`),this._activeNotebookEditor=this._editors.get(t.value.newActiveEditor)),t.value.newActiveEditor!==void 0&&this._onDidChangeActiveNotebookEditor.fire(this._activeNotebookEditor?.apiEditor)}static _registerApiCommands(t){let e=oe.String.with("notebookType","A notebook type"),n=new Me("vscode.executeDataToNotebook","_executeDataToNotebook","Invoke notebook serializer",[e,new oe("data","Bytes to convert to data",r=>r instanceof Uint8Array,r=>H.wrap(r))],new Ae("Notebook Data",r=>Qd.to(r.value))),o=new Me("vscode.executeNotebookToData","_executeNotebookToData","Invoke notebook serializer",[e,new oe("NotebookData","Notebook data to convert to bytes",r=>!0,r=>new Zt(Qd.from(r)))],new Ae("Bytes",r=>r.buffer));t.registerApiCommand(n),t.registerApiCommand(o)}trace(t){this._logService.trace(`[Extension Host Notebook] ${t}`)}},MI=class extends Error{constructor(t){super(t),this.name="NotebookSaveError"}};var l_=class{constructor(t,e,n,o={timeout:1500,errors:3}){this._logService=t;this._notebooksAndEditors=e;this._mainThreadBulkEdits=n;this._thresholds=o;this._onWillSaveNotebookDocumentEvent=new ms}dispose(){}getOnWillSaveNotebookDocumentEvent(t){return(e,n,o)=>{let r=function(a){e.call(n,a)};return r.extension=t,this._onWillSaveNotebookDocumentEvent.event(r,void 0,o)}}async $participateInSave(t,e,n){let o=y.revive(t),r=this._notebooksAndEditors.getNotebookDocument(o);if(!r)throw new Error("Unable to resolve notebook document");let s=[];if(await this._onWillSaveNotebookDocumentEvent.fireAsync({notebook:r.apiNotebook,reason:fb.to(e)},n,async(l,d)=>{let c=Date.now(),u=await await Promise.resolve(l);Date.now()-c>this._thresholds.timeout&&this._logService.warn("onWillSaveNotebookDocument-listener from extension",d.extension.identifier),!n.isCancellationRequested&&u&&(u instanceof Dr?s.push(u):this._logService.warn("onWillSaveNotebookDocument-listener from extension",d.extension.identifier,"ignored due to invalid data"))}),n.isCancellationRequested)return!1;if(s.length===0)return!0;let a={edits:[]};for(let l of s){let{edits:d}=Io.from(l);a.edits=a.edits.concat(d)}return this._mainThreadBulkEdits.$tryApplyWorkspaceEdit(new Zt(a))}};var d_=class{constructor(t){this._notebooksAndEditors=t;this._onDidSaveNotebookDocument=new T;this.onDidSaveNotebookDocument=this._onDidSaveNotebookDocument.event;this._onDidChangeNotebookDocument=new T;this.onDidChangeNotebookDocument=this._onDidChangeNotebookDocument.event}$acceptModelChanged(t,e,n,o){let s=this._notebooksAndEditors.getNotebookDocument(y.revive(t)).acceptModelChanged(e.value,n,o);this._onDidChangeNotebookDocument.fire(s)}$acceptDirtyStateChanged(t,e){this._notebooksAndEditors.getNotebookDocument(y.revive(t)).acceptDirty(e)}$acceptModelSaved(t){let e=this._notebooksAndEditors.getNotebookDocument(y.revive(t));this._onDidSaveNotebookDocument.fire(e.apiNotebook)}};var Rh=class{constructor(t,e){this._logService=t;this._notebooksAndEditors=e;this._onDidChangeNotebookEditorSelection=new T;this._onDidChangeNotebookEditorVisibleRanges=new T;this.onDidChangeNotebookEditorSelection=this._onDidChangeNotebookEditorSelection.event;this.onDidChangeNotebookEditorVisibleRanges=this._onDidChangeNotebookEditorVisibleRanges.event}$acceptEditorPropertiesChanged(t,e){this._logService.debug("ExtHostNotebook#$acceptEditorPropertiesChanged",t,e);let n=this._notebooksAndEditors.getEditorById(t);e.visibleRanges&&n._acceptVisibleRanges(e.visibleRanges.ranges.map(qr.to)),e.selections&&n._acceptSelections(e.selections.selections.map(qr.to)),e.visibleRanges&&this._onDidChangeNotebookEditorVisibleRanges.fire({notebookEditor:n.apiEditor,visibleRanges:n.apiEditor.visibleRanges}),e.selections&&this._onDidChangeNotebookEditorSelection.fire(Object.freeze({notebookEditor:n.apiEditor,selections:n.apiEditor.selections}))}$acceptEditorViewColumns(t){for(let e in t)this._notebooksAndEditors.getEditorById(e)._acceptViewColumn(zt.to(t[e]))}};Rh=_([S(0,te)],Rh);var XPt=A("INotebookExecutionService");var K9=100;var t_t=A("INotebookKernelService"),n_t=A("INotebookKernelHistoryService");var Dh=class{constructor(t,e,n,o,r){this._initData=e;this._extHostNotebook=n;this._commands=o;this._logService=r;this._activeExecutions=new Ve;this._activeNotebookExecutions=new Ve;this._kernelDetectionTask=new Map;this._kernelDetectionTaskHandlePool=0;this._kernelSourceActionProviders=new Map;this._kernelSourceActionProviderHandlePool=0;this._kernelData=new Map;this._handlePool=0;this.id=0;this.variableStore={};this._proxy=t.getProxy(F.MainThreadNotebookKernels);let s=new Me("notebook.selectKernel","_notebook.selectKernel","Trigger kernel picker for specified notebook editor widget",[new oe("options","Select kernel options",l=>!0,l=>{if(l&&"notebookEditor"in l&&"id"in l){let d=this._extHostNotebook.getIdByEditor(l.notebookEditor);return{id:l.id,extension:l.extension,notebookEditorId:d}}else if(l&&"notebookEditor"in l){let d=this._extHostNotebook.getIdByEditor(l.notebookEditor);if(d===void 0)throw new Error(`Cannot invoke 'notebook.selectKernel' for unrecognized notebook editor ${l.notebookEditor.notebook.uri.toString()}`);return"skipIfAlreadySelected"in l?{notebookEditorId:d,skipIfAlreadySelected:l.skipIfAlreadySelected}:{notebookEditorId:d}}return l})],Ae.Void),a=new Me("vscode.executeNotebookVariableProvider","_executeNotebookVariableProvider","Execute notebook variable provider",[oe.Uri],new Ae("A promise that resolves to an array of variables",(l,d)=>l.map(c=>({variable:{name:c.name,value:c.value,expression:c.expression,type:c.type,language:c.language},hasNamedChildren:c.hasNamedChildren,indexedChildrenCount:c.indexedChildrenCount}))));this._commands.registerApiCommand(s),this._commands.registerApiCommand(a)}createNotebookController(t,e,n,o,r,s){for(let U of this._kernelData.values())if(U.controller.id===e&&xe.equals(t.identifier,U.extensionId))throw new Error(`notebook controller with id '${e}' ALREADY exist`);let a=this._handlePool++,l=this;this._logService.trace(`NotebookController[${a}], CREATED by ${t.identifier.value}, ${e}`);let d=()=>console.warn(`NO execute handler from notebook controller '${g.id}' of extension: '${t.identifier}'`),c=!1,u=new T,m=new T,g={id:c_(t.identifier,e),notebookType:n,extensionId:t.identifier,extensionLocation:t.extensionLocation,label:o||t.identifier.value,preloads:s?s.map(jE.from):[]},h=r??d,f,I,x;this._proxy.$addKernel(a,g).catch(U=>{console.log(U),c=!0});let E=0,w=()=>{if(c)return;let U=++E;Promise.resolve().then(()=>{U===E&&this._proxy.$updateKernel(a,g)})},R=new Ve,L={get id(){return e},get notebookType(){return g.notebookType},onDidChangeSelectedNotebooks:u.event,get label(){return g.label},set label(U){g.label=U??t.displayName??t.name,w()},get detail(){return g.detail??""},set detail(U){g.detail=U,w()},get description(){return g.description??""},set description(U){g.description=U,w()},get supportedLanguages(){return g.supportedLanguages},set supportedLanguages(U){g.supportedLanguages=U,w()},get supportsExecutionOrder(){return g.supportsExecutionOrder??!1},set supportsExecutionOrder(U){g.supportsExecutionOrder=U,w()},get rendererScripts(){return g.preloads?g.preloads.map(jE.to):[]},get executeHandler(){return h},set executeHandler(U){h=U??d},get interruptHandler(){return f},set interruptHandler(U){f=U,g.supportsInterrupt=!!U,w()},set variableProvider(U){M(t,"notebookVariableProvider"),x?.dispose(),I=U,g.hasVariableProvider=!!U,x=U?.onDidChangeVariables(z=>l._proxy.$variablesUpdated(z.uri)),w()},get variableProvider(){return I},createNotebookCellExecution(U){if(c)throw new Error("notebook controller is DISPOSED");if(!R.has(U.notebook.uri))throw l._logService.trace(`NotebookController[${a}] NOT associated to notebook, associated to THESE notebooks:`,Array.from(R.keys()).map(z=>z.toString())),new Error(`notebook controller is NOT associated to notebook: ${U.notebook.uri.toString()}`);return l._createNotebookCellExecution(U,c_(t.identifier,this.id))},createNotebookExecution(U){if(M(t,"notebookExecution"),c)throw new Error("notebook controller is DISPOSED");if(!R.has(U.uri))throw l._logService.trace(`NotebookController[${a}] NOT associated to notebook, associated to THESE notebooks:`,Array.from(R.keys()).map(z=>z.toString())),new Error(`notebook controller is NOT associated to notebook: ${U.uri.toString()}`);return l._createNotebookExecution(U,c_(t.identifier,this.id))},dispose:()=>{c||(this._logService.trace(`NotebookController[${a}], DISPOSED`),c=!0,this._kernelData.delete(a),u.dispose(),m.dispose(),x?.dispose(),this._proxy.$removeKernel(a))},updateNotebookAffinity(U,z){z===-1&&M(t,"notebookControllerAffinityHidden"),l._proxy.$updateNotebookPriority(a,U.uri,z)},onDidReceiveMessage:m.event,postMessage(U,z){return M(t,"notebookMessaging"),l._proxy.$postMessage(a,z&&l._extHostNotebook.getIdByEditor(z),U)},asWebviewUri(U){return M(t,"notebookMessaging"),Ic(U,l._initData.remote)}};return this._kernelData.set(a,{extensionId:t.identifier,controller:L,onDidReceiveMessage:m,onDidChangeSelection:u,associatedNotebooks:R}),L}getIdByController(t){for(let[e,n]of this._kernelData)if(n.controller===t)return c_(n.extensionId,t.id);return null}createNotebookControllerDetectionTask(t,e){let n=this._kernelDetectionTaskHandlePool++,o=this;this._logService.trace(`NotebookControllerDetectionTask[${n}], CREATED by ${t.identifier.value}`),this._proxy.$addKernelDetectionTask(n,e);let r={dispose:()=>{this._kernelDetectionTask.delete(n),o._proxy.$removeKernelDetectionTask(n)}};return this._kernelDetectionTask.set(n,r),r}registerKernelSourceActionProvider(t,e,n){let o=this._kernelSourceActionProviderHandlePool++,r=typeof n.onDidChangeNotebookKernelSourceActions=="function"?o:void 0,s=this;this._kernelSourceActionProviders.set(o,n),this._logService.trace(`NotebookKernelSourceActionProvider[${o}], CREATED by ${t.identifier.value}`),this._proxy.$addKernelSourceActionProvider(o,o,e);let a;return r!==void 0&&(a=n.onDidChangeNotebookKernelSourceActions(l=>this._proxy.$emitNotebookKernelSourceActionsChangeEvent(r))),{dispose:()=>{this._kernelSourceActionProviders.delete(o),s._proxy.$removeKernelSourceActionProvider(o,o),a?.dispose()}}}async $provideKernelSourceActions(t,e){let n=this._kernelSourceActionProviders.get(t);if(n){let o=new $;return(await n.provideNotebookKernelSourceActions(e)??[]).map(s=>IL.from(s,this._commands.converter,o))}return[]}$acceptNotebookAssociation(t,e,n){let o=this._kernelData.get(t);if(o){let r=this._extHostNotebook.getNotebookDocument(y.revive(e));n?o.associatedNotebooks.set(r.uri,!0):o.associatedNotebooks.delete(r.uri),this._logService.trace(`NotebookController[${t}] ASSOCIATE notebook`,r.uri.toString(),n),o.onDidChangeSelection.fire({selected:n,notebook:r.apiNotebook})}}async $executeCells(t,e,n){let o=this._kernelData.get(t);if(!o)return;let r=this._extHostNotebook.getNotebookDocument(y.revive(e)),s=[];for(let a of n){let l=r.getCell(a);l&&s.push(l.apiCell)}try{this._logService.trace(`NotebookController[${t}] EXECUTE cells`,r.uri.toString(),s.length),await o.controller.executeHandler.call(o.controller,s,r.apiNotebook,o.controller)}catch(a){this._logService.error(`NotebookController[${t}] execute cells FAILED`,a),console.error(a)}}async $cancelCells(t,e,n){let o=this._kernelData.get(t);if(!o)return;let r=this._extHostNotebook.getNotebookDocument(y.revive(e));if(o.controller.interruptHandler)await o.controller.interruptHandler.call(o.controller,r.apiNotebook);else for(let s of n){let a=r.getCell(s);a&&this._activeExecutions.get(a.uri)?.cancel()}if(o.controller.interruptHandler){let s=this._activeNotebookExecutions.get(r.uri);this._activeNotebookExecutions.delete(r.uri),n.length&&Array.isArray(s)&&s.length&&s.forEach(a=>a.dispose())}}async $provideVariables(t,e,n,o,r,s,a){let l=this._kernelData.get(t);if(!l)return;let d=this._extHostNotebook.getNotebookDocument(y.revive(n)),c=l.controller.variableProvider;if(!c)return;let u;if(o!==void 0){if(u=this.variableStore[o],!u)return}else this.variableStore={};let m=r==="named"?1:2,g=c.provideVariables(d.apiNotebook,u,m,s,a),h=0;for await(let f of g){if(a.isCancellationRequested)return;let I={id:this.id++,name:f.variable.name,value:f.variable.value,type:f.variable.type,interfaces:f.variable.interfaces,language:f.variable.language,expression:f.variable.expression,hasNamedChildren:f.hasNamedChildren,indexedChildrenCount:f.indexedChildrenCount,extensionId:l.extensionId.value};if(this.variableStore[I.id]=f.variable,this._proxy.$receiveVariable(e,I),h++>=K9)return}}$acceptKernelMessageFromRenderer(t,e,n){let o=this._kernelData.get(t);if(!o)return;let r=this._extHostNotebook.getEditorById(e);o.onDidReceiveMessage.fire(Object.freeze({editor:r.apiEditor,message:n}))}_createNotebookCellExecution(t,e){if(t.index<0)throw new Error("CANNOT execute cell that has been REMOVED from notebook");let o=this._extHostNotebook.getNotebookDocument(t.notebook.uri).getCellFromApiCell(t);if(!o)throw new Error("invalid cell");if(this._activeExecutions.has(o.uri))throw new Error(`duplicate execution for ${o.uri}`);let r=new $U(e,o,this._proxy);this._activeExecutions.set(o.uri,r);let s=r.onDidChangeState(()=>{r.state===2&&(r.dispose(),s.dispose(),this._activeExecutions.delete(o.uri))});return r.asApiObject()}_createNotebookExecution(t,e){let n=this._extHostNotebook.getNotebookDocument(t.uri),o=t.getCells().find(a=>{let l=n.getCellFromApiCell(a);return l&&this._activeExecutions.has(l.uri)});if(o)throw new Error(`duplicate cell execution for ${o.document.uri}`);if(this._activeNotebookExecutions.has(n.uri))throw new Error(`duplicate notebook execution for ${n.uri}`);let r=new zU(e,n,this._proxy),s=r.onDidChangeState(()=>{r.state===2&&(r.dispose(),s.dispose(),this._activeNotebookExecutions.delete(n.uri))});return this._activeNotebookExecutions.set(n.uri,[r,s]),r.asApiObject()}};Dh=_([S(4,te)],Dh);var $U=class i extends N{constructor(e,n,o){super();this._cell=n;this._proxy=o;this._handle=i.HANDLE++;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this._state=0;this._tokenSource=this._register(new Ee);this._collector=new qU(10,r=>this.update(r)),this._executionOrder=n.internalMetadata.executionOrder,this._proxy.$createExecution(this._handle,e,this._cell.notebook.uri,this._cell.handle)}static{this.HANDLE=0}get state(){return this._state}cancel(){this._tokenSource.cancel()}async updateSoon(e){await this._collector.addItem(e)}async update(e){let n=Array.isArray(e)?e:[e];return this._proxy.$updateExecution(this._handle,new Zt(n))}verifyStateForOutput(){if(this._state===0)throw new Error("Must call start before modifying cell output");if(this._state===2)throw new Error("Cannot modify cell output after calling resolve")}cellIndexToHandle(e){let n=this._cell;if(e&&(n=this._cell.notebook.getCellFromApiCell(e)),!n)throw new Error("INVALID cell");return n.handle}validateAndConvertOutputs(e){return e.map(n=>{let o=Os.ensureUniqueMimeTypes(n.items,!0);return o===n.items?pl.from(n):pl.from({items:o,id:n.id,metadata:n.metadata})})}async updateOutputs(e,n,o){let r=this.cellIndexToHandle(n),s=this.validateAndConvertOutputs(On(e));return this.updateSoon({editType:1,cellHandle:r,append:o,outputs:s})}async updateOutputItems(e,n,o){return e=Os.ensureUniqueMimeTypes(On(e),!0),this.updateSoon({editType:2,items:e.map(Ku.from),outputId:n.id,append:o})}asApiObject(){let e=this;return Object.freeze({get token(){return e._tokenSource.token},get cell(){return e._cell.apiCell},get executionOrder(){return e._executionOrder},set executionOrder(o){e._executionOrder=o,e.update([{editType:3,executionOrder:e._executionOrder}])},start(o){if(e._state===2||e._state===1)throw new Error("Cannot call start again");e._state=1,e._onDidChangeState.fire(),e.update({editType:3,runStartTime:o})},end(o,r,s){if(e._state===2)throw new Error("Cannot call resolve twice");e._state=2,e._onDidChangeState.fire(),e._collector.flush();let a=lee(s);e._proxy.$completeExecution(e._handle,new Zt({runEndTime:r,lastRunSuccess:o,error:a}))},clearOutput(o){return e.verifyStateForOutput(),e.updateOutputs([],o,!1)},appendOutput(o,r){return e.verifyStateForOutput(),e.updateOutputs(o,r,!0)},replaceOutput(o,r){return e.verifyStateForOutput(),e.updateOutputs(o,r,!1)},appendOutputItems(o,r){return e.verifyStateForOutput(),e.updateOutputItems(o,r,!0)},replaceOutputItems(o,r){return e.verifyStateForOutput(),e.updateOutputItems(o,r,!1)}})}};function lee(i){let t=o=>o?{startLineNumber:o.start.line,startColumn:o.start.character,endLineNumber:o.end.line,endColumn:o.end.character}:void 0,e=o=>({uri:o.uri,position:o.position,label:o.label});return i?{name:i.name,message:i.message,stack:i.stack instanceof Array?i.stack.map(o=>e(o)):i.stack,location:t(i.location),uri:i.uri}:void 0}var zU=class i extends N{constructor(e,n,o){super();this._notebook=n;this._proxy=o;this._handle=i.HANDLE++;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this._state=0;this._tokenSource=this._register(new Ee);this._proxy.$createNotebookExecution(this._handle,e,this._notebook.uri)}static{this.HANDLE=0}get state(){return this._state}cancel(){this._tokenSource.cancel()}asApiObject(){return Object.freeze({start:()=>{if(this._state===2||this._state===1)throw new Error("Cannot call start again");this._state=1,this._onDidChangeState.fire(),this._proxy.$beginNotebookExecution(this._handle)},end:()=>{if(this._state===2)throw new Error("Cannot call resolve twice");this._state=2,this._onDidChangeState.fire(),this._proxy.$completeNotebookExecution(this._handle)}})}},qU=class{constructor(t,e){this.delay=t;this.callback=e;this.batch=[];this.startedTimer=Date.now()}addItem(t){return this.batch.push(t),this.currentDeferred||(this.currentDeferred=new jt,this.startedTimer=Date.now(),Vt(this.delay).then(()=>this.flush())),Date.now()-this.startedTimer>this.delay?this.flush():this.currentDeferred.p}flush(){if(this.batch.length===0||!this.currentDeferred)return Promise.resolve();let t=this.currentDeferred;this.currentDeferred=void 0;let e=this.batch;return this.batch=[],this.callback(e).finally(()=>t.complete())}};function c_(i,t){return`${i.value}/${t}`}var u_=class{constructor(t,e){this._extHostNotebook=e;this._rendererMessageEmitters=new Map;this.proxy=t.getProxy(F.MainThreadNotebookRenderers)}$postRendererMessage(t,e,n){let o=this._extHostNotebook.getEditorById(t);this._rendererMessageEmitters.get(e)?.fire({editor:o.apiEditor,message:n})}createRendererMessaging(t,e){if(!t.contributes?.notebookRenderer?.some(o=>o.id===e))throw new Error(`Extensions may only call createRendererMessaging() for renderers they contribute (got ${e})`);return{onDidReceiveMessage:(o,r,s)=>this.getOrCreateEmitterFor(e).event(o,r,s),postMessage:(o,r)=>{Ep.apiEditorsToExtHost.has(o)&&([o,r]=[r,o]);let s=r&&Ep.apiEditorsToExtHost.get(r);return this.proxy.$postMessage(s?.id,e,o)}}}getOrCreateEmitterFor(t){let e=this._rendererMessageEmitters.get(t);return e||(e=new T({onDidRemoveLastListener:()=>{e?.dispose(),this._rendererMessageEmitters.delete(t)}}),this._rendererMessageEmitters.set(t,e),e)}};var p_=class{constructor(t){this.handlers=new Map;this.proxy=t.getProxy(F.MainThreadProfileContentHandlers)}registerProfileContentHandler(t,e,n){if(M(t,"profileContentHandlers"),this.handlers.has(e))throw new Error(`Handler with id '${e}' already registered`);return this.handlers.set(e,n),this.proxy.$registerProfileContentHandler(e,n.name,n.description,t.identifier.value),q(()=>{this.handlers.delete(e),this.proxy.$unregisterProfileContentHandler(e)})}async $saveProfile(t,e,n,o){let r=this.handlers.get(t);if(!r)throw new Error(`Unknown handler with id: ${t}`);return r.saveProfile(e,n,o)}async $readProfile(t,e,n){let o=this.handlers.get(t);if(!o)throw new Error(`Unknown handler with id: ${t}`);return o.readProfile(Pe(e)?e:y.revive(e),n)}};var KU=class{constructor(t,e,n,o){this.handle=t;this.proxy=e;this.documents=n;this.onDispose=o;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}get diffInformation(){return this._diffInformation}$acceptDiffInformation(t){if(!t){this._diffInformation=void 0,this._onDidChange.fire();return}let e=this.documents,n=y.revive(t.original),o=y.revive(t.modified),r=t.changes.map(s=>{let[a,l,d,c]=s,u;return a===l?u=1:d===c?u=2:u=3,{original:{startLineNumber:a,endLineNumberExclusive:l},modified:{startLineNumber:d,endLineNumberExclusive:c},kind:u}});this._diffInformation=Object.freeze({documentVersion:t.documentVersion,original:n,modified:o,changes:r,get isStale(){return e.getDocumentData(o)?.document.version!==t.documentVersion}}),this._onDidChange.fire()}dispose(){this.proxy.$disposeSourceControlDiffInformation(this.handle),this._onDidChange.dispose(),this.onDispose(this.handle)}},m_=class i{constructor(t,e,n){this.documents=e;this.uriTransformer=n;this.providers=new Map;this.informations=new Map;this.proxy=t.getProxy(F.MainThreadQuickDiff)}static{this.handlePool=0}$provideOriginalResource(t,e,n){let o=y.revive(e),r=this.providers.get(t);return r?Cn(()=>r.provideOriginalResource(o,n)).then(s=>s||null):Promise.resolve(null)}$acceptSourceControlDiffInformation(t,e){this.informations.get(t)?.$acceptDiffInformation(e)}registerQuickDiffProvider(t,e,n,o,r,s){let a=i.handlePool++;this.providers.set(a,n);let l=xe.toKey(t.identifier);return this.proxy.$registerQuickDiffProvider(a,Zs.from(e,this.uriTransformer),`${l}.${o}`,r,s),{dispose:()=>{this.proxy.$unregisterQuickDiffProvider(a),this.providers.delete(a)}}}createSourceControlDiffInformation(t){let e=i.handlePool++,n=new KU(e,this.proxy,this.documents,o=>this.informations.delete(o));return this.informations.set(e,n),this.proxy.$createSourceControlDiffInformation(e,t),n}};var jU=class{constructor(t,e,n){this.handle=t;this.proxy=e;this.onDispose=n;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._onDidRevealComment=new T;this.onDidRevealComment=this._onDidRevealComment.event;this._comments=[];this._acceptsComments=!1}get comments(){return this._comments}get acceptsComments(){return this._acceptsComments}$acceptComments(t,e){this._comments=t.map(n=>Object.freeze({id:n.id,range:K.to(n.range),body:n.body,author:n.author})),this._acceptsComments=e,this._onDidChange.fire()}$revealComment(t){this._onDidRevealComment.fire(t)}addComment(t,e){this.proxy.$addComment(this.handle,K.from(t),e)}deleteComment(t){this.proxy.$deleteComment(this.handle,t)}dispose(){this.proxy.$disposeAgentEditorComments(this.handle),this._onDidChange.dispose(),this._onDidRevealComment.dispose(),this.onDispose(this.handle)}},g_=class i{constructor(t){this.providers=new Map;this.proxy=t.getProxy(F.MainThreadAgentEditorComments)}static{this.handlePool=0}createAgentEditorComments(t){let e=i.handlePool++,n=new jU(e,this.proxy,o=>this.providers.delete(o));return this.providers.set(e,n),this.proxy.$createAgentEditorComments(e,t),n}$acceptAgentEditorComments(t,e,n){this.providers.get(t)?.$acceptComments(e,n)}$revealAgentEditorComment(t,e){this.providers.get(t)?.$revealComment(e)}};function j9(i,t,e){let n=i.getProxy(F.MainThreadQuickOpen);class o{constructor(d,c){this._sessions=new Map;this._instances=0;this._workspace=d,this._commands=c}showQuickPick(d,c,u,m=pe.None){this._onDidSelectItem=void 0;let g=Promise.resolve(c),h=++this._instances,f=n.$show(h,{title:u?.title,placeHolder:u?.placeHolder,prompt:u?.prompt,matchOnDescription:u?.matchOnDescription,matchOnDetail:u?.matchOnDetail,ignoreFocusLost:u?.ignoreFocusOut,canPickMany:u?.canPickMany},m),I={},x=f.then(()=>I);return Promise.race([x,g]).then(E=>{if(E!==I)return g.then(w=>{let R=[];for(let L=0;L<w.length;L++){let U=w[L];typeof U=="string"?R.push({label:U,handle:L}):U.kind===-1?R.push({type:"separator",label:U.label}):(U.tooltip&&M(d,"quickPickItemTooltip"),R.push({label:U.label,iconPathDto:Xi.from(U.iconPath),description:U.description,detail:U.detail,picked:U.picked,alwaysShow:U.alwaysShow,tooltip:fe.fromStrict(U.tooltip),resourceUri:U.resourceUri,handle:L}))}return u&&typeof u.onDidSelectItem=="function"&&(this._onDidSelectItem=L=>{u.onDidSelectItem(w[L])}),n.$setItems(h,R),f.then(L=>{if(typeof L=="number")return w[L];if(Array.isArray(L))return L.map(U=>w[U])})})}).then(void 0,E=>{if(!Yt(E))return n.$setError(h,E),Promise.reject(E)})}$onItemSelected(d){this._onDidSelectItem?.(d)}showInput(d,c=pe.None){return this._validateInput=d?.validateInput,n.$input(d,typeof this._validateInput=="function",c).then(void 0,u=>{if(!Yt(u))return Promise.reject(u)})}async $validateInput(d){if(!this._validateInput)return;let c=await this._validateInput(d);if(!c||typeof c=="string")return c;let u;switch(c.severity){case 1:u=rt.Info;break;case 2:u=rt.Warning;break;case 3:u=rt.Error;break;default:u=c.message?rt.Error:rt.Ignore;break}return{content:c.message,severity:u}}async showWorkspaceFolderPick(d,c=pe.None){let u=await this._commands.executeCommand("_workbench.pickWorkspaceFolder",[d]);if(!u)return;let m=await this._workspace.getWorkspaceFolders2();if(m)return m.find(g=>g.uri.toString()===u.uri.toString())}createQuickPick(d){let c=new s(d,()=>this._sessions.delete(c._id));return this._sessions.set(c._id,c),c}createInputBox(d){let c=new a(d,()=>this._sessions.delete(c._id));return this._sessions.set(c._id,c),c}$onDidChangeValue(d,c){this._sessions.get(d)?._fireDidChangeValue(c)}$onDidAccept(d){this._sessions.get(d)?._fireDidAccept()}$onDidChangeActive(d,c){let u=this._sessions.get(d);u instanceof s&&u._fireDidChangeActive(c)}$onDidChangeSelection(d,c){let u=this._sessions.get(d);u instanceof s&&u._fireDidChangeSelection(c)}$onDidTriggerButton(d,c,u){this._sessions.get(d)?._fireDidTriggerButton(c,u)}$onDidTriggerItemButton(d,c,u,m){let g=this._sessions.get(d);g instanceof s&&g._fireDidTriggerItemButton(c,u,m)}$onDidHide(d){this._sessions.get(d)?._fireDidHide()}}class r{constructor(d,c){this._extension=d;this._onDidDispose=c;this._id=s._nextId++;this._visible=!1;this._expectingHide=!1;this._enabled=!0;this._busy=!1;this._ignoreFocusOut=!0;this._value="";this._valueSelection=void 0;this._buttons=[];this._handlesToButtons=new Map;this._onDidAcceptEmitter=new T;this._onDidChangeValueEmitter=new T;this._onDidTriggerButtonEmitter=new T;this._onDidHideEmitter=new T;this._pendingUpdate={id:this._id};this._disposed=!1;this._disposables=[this._onDidTriggerButtonEmitter,this._onDidHideEmitter,this._onDidAcceptEmitter,this._onDidChangeValueEmitter];this.onDidChangeValue=this._onDidChangeValueEmitter.event;this.onDidAccept=this._onDidAcceptEmitter.event;this.onDidTriggerButton=this._onDidTriggerButtonEmitter.event;this.onDidHide=this._onDidHideEmitter.event}static{this._nextId=1}get title(){return this._title}set title(d){this._title=d,this.update({title:d})}get step(){return this._steps}set step(d){this._steps=d,this.update({step:d})}get totalSteps(){return this._totalSteps}set totalSteps(d){this._totalSteps=d,this.update({totalSteps:d})}get enabled(){return this._enabled}set enabled(d){this._enabled=d,this.update({enabled:d})}get busy(){return this._busy}set busy(d){this._busy=d,this.update({busy:d})}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(d){this._ignoreFocusOut=d,this.update({ignoreFocusOut:d})}get value(){return this._value}set value(d){this._value=d,this.update({value:d})}get valueSelection(){return this._valueSelection}set valueSelection(d){this._valueSelection=d,this.update({valueSelection:d})}get placeholder(){return this._placeholder}set placeholder(d){this._placeholder=d,this.update({placeholder:d})}get buttons(){return this._buttons}set buttons(d){this._buttons=d.slice(),this._handlesToButtons.clear(),d.forEach((c,u)=>{let m=c===Ns.Back?-1:u;this._handlesToButtons.set(m,c)}),this.update({buttons:d.map((c,u)=>({iconPathDto:Xi.from(c.iconPath),tooltip:c.tooltip,handle:c===Ns.Back?-1:u,location:typeof c.location=="number"?c.location:void 0,toggle:typeof c.toggle=="object"&&typeof c.toggle.checked=="boolean"?{checked:c.toggle.checked}:void 0}))})}show(){this._visible=!0,this._expectingHide=!0,this.update({visible:!0})}hide(){this._visible=!1,this.update({visible:!1})}_fireDidAccept(){this._onDidAcceptEmitter.fire()}_fireDidChangeValue(d){this._value=d,this._onDidChangeValueEmitter.fire(d)}_fireDidTriggerButton(d,c){let u=this._handlesToButtons.get(d);u&&(c!==void 0&&u.toggle&&(u.toggle.checked=c),this._onDidTriggerButtonEmitter.fire(u))}_fireDidHide(){this._expectingHide&&(this._expectingHide=this._visible,this._onDidHideEmitter.fire())}dispose(){this._disposed||(this._disposed=!0,this._fireDidHide(),this._disposables=In(this._disposables),this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=void 0),this._onDidDispose(),n.$dispose(this._id))}update(d){if(!this._disposed){for(let c of Object.keys(d)){let u=d[c];this._pendingUpdate[c]=u===void 0?null:u}"visible"in this._pendingUpdate?(this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=void 0),this.dispatchUpdate()):this._visible&&!this._updateTimeout&&(this._updateTimeout=setTimeout(()=>{this._updateTimeout=void 0,this.dispatchUpdate()},0))}}dispatchUpdate(){n.$createOrUpdate(this._pendingUpdate),this._pendingUpdate={id:this._id}}}class s extends r{constructor(c,u){super(c,u);this._items=[];this._handlesToItems=new Map;this._itemsToHandles=new Map;this._canSelectMany=!1;this._matchOnDescription=!0;this._matchOnDetail=!0;this._sortByLabel=!0;this._keepScrollPosition=!1;this._activeItems=[];this._onDidChangeActiveEmitter=new T;this._selectedItems=[];this._onDidChangeSelectionEmitter=new T;this._onDidTriggerItemButtonEmitter=new T;this.onDidChangeActive=this._onDidChangeActiveEmitter.event;this.onDidChangeSelection=this._onDidChangeSelectionEmitter.event;this.onDidTriggerItemButton=this._onDidTriggerItemButtonEmitter.event;this._disposables.push(this._onDidChangeActiveEmitter,this._onDidChangeSelectionEmitter,this._onDidTriggerItemButtonEmitter),this.update({type:"quickPick"})}get items(){return this._items}set items(c){this._items=c.slice(),this._handlesToItems.clear(),this._itemsToHandles.clear(),c.forEach((m,g)=>{this._handlesToItems.set(g,m),this._itemsToHandles.set(m,g)});let u=[];for(let m=0;m<c.length;m++){let g=c[m];g.kind===-1?u.push({type:"separator",label:g.label}):(g.tooltip&&M(this._extension,"quickPickItemTooltip"),u.push({handle:m,label:g.label,iconPathDto:Xi.from(g.iconPath),description:g.description,detail:g.detail,picked:g.picked,alwaysShow:g.alwaysShow,tooltip:fe.fromStrict(g.tooltip),resourceUri:g.resourceUri,buttons:g.buttons?.map((h,f)=>({iconPathDto:Xi.from(h.iconPath),tooltip:h.tooltip,handle:f,toggle:typeof h.toggle=="object"&&typeof h.toggle.checked=="boolean"?{checked:h.toggle.checked}:void 0}))}))}this.update({items:u})}get canSelectMany(){return this._canSelectMany}set canSelectMany(c){this._canSelectMany=c,this.update({canSelectMany:c})}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(c){this._matchOnDescription=c,this.update({matchOnDescription:c})}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(c){this._matchOnDetail=c,this.update({matchOnDetail:c})}get sortByLabel(){return this._sortByLabel}set sortByLabel(c){this._sortByLabel=c,this.update({sortByLabel:c})}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(c){this._keepScrollPosition=c,this.update({keepScrollPosition:c})}get prompt(){return this._prompt}set prompt(c){this._prompt=c,this.update({prompt:c})}get activeItems(){return this._activeItems}set activeItems(c){this._activeItems=c.filter(u=>this._itemsToHandles.has(u)),this.update({activeItems:this._activeItems.map(u=>this._itemsToHandles.get(u))})}get selectedItems(){return this._selectedItems}set selectedItems(c){this._selectedItems=c.filter(u=>this._itemsToHandles.has(u)),this.update({selectedItems:this._selectedItems.map(u=>this._itemsToHandles.get(u))})}_fireDidChangeActive(c){let u=nt(c.map(m=>this._handlesToItems.get(m)));this._activeItems=u,this._onDidChangeActiveEmitter.fire(u)}_fireDidChangeSelection(c){let u=nt(c.map(m=>this._handlesToItems.get(m)));this._selectedItems=u,this._onDidChangeSelectionEmitter.fire(u)}_fireDidTriggerItemButton(c,u,m){let g=this._handlesToItems.get(c);if(!g||!g.buttons||!g.buttons.length)return;let h=g.buttons[u];h&&(m!==void 0&&h.toggle&&(h.toggle.checked=m),this._onDidTriggerItemButtonEmitter.fire({button:h,item:g}))}}class a extends r{constructor(c,u){super(c,u);this._password=!1;this.update({type:"inputBox"})}get password(){return this._password}set password(c){this._password=c,this.update({password:c})}get prompt(){return this._prompt}set prompt(c){this._prompt=c,this.update({prompt:c})}get validationMessage(){return this._validationMessage}set validationMessage(c){this._validationMessage=c,c?typeof c=="string"?this.update({validationMessage:c,severity:rt.Error}):this.update({validationMessage:c.message,severity:c.severity??rt.Error}):this.update({validationMessage:void 0,severity:rt.Ignore})}}return new o(t,e)}function G9(i){return i instanceof y}function dee(i,t){return i.scheme===B.file&&t.scheme===B.file&&Xe?i.toString()===t.toString():i.toString().toLowerCase()===t.toString().toLowerCase()}function GU(i){if(i)return typeof i.iconPath=="string"?y.file(i.iconPath):y.isUri(i.iconPath)||ct.isThemeIcon(i.iconPath)?i.iconPath:void 0}function ca(i){if(i){if(y.isUri(i))return i;if(ct.isThemeIcon(i))return i;{let t=i;return{light:t.light,dark:t.dark}}}else return}function Q9(i){let t=ca(i.authorIcon),e=Array.isArray(i.tooltip)?fe.fromMany(i.tooltip):i.tooltip?fe.from(i.tooltip):void 0,n=i.references?.map(o=>({...o,icon:ca(o.icon)}));return{...i,authorIcon:t,references:n,tooltip:e}}function QU(i){return i?{...i,icon:ca(i.icon)}:void 0}function JU(i,t){if(!i.iconPath&&!t.iconPath)return 0;if(i.iconPath){if(!t.iconPath)return 1}else return-1;let e=typeof i.iconPath=="string"?i.iconPath:y.isUri(i.iconPath)?i.iconPath.fsPath:i.iconPath.id,n=typeof t.iconPath=="string"?t.iconPath:y.isUri(t.iconPath)?t.iconPath.fsPath:t.iconPath.id;return iI(e,n)}function cee(i,t){let e=0;if(i.strikeThrough!==t.strikeThrough)return i.strikeThrough?1:-1;if(i.faded!==t.faded)return i.faded?1:-1;if(i.tooltip!==t.tooltip)return(i.tooltip||"").localeCompare(t.tooltip||"");if(e=JU(i,t),e!==0)return e;if(i.light&&t.light)e=JU(i.light,t.light);else{if(i.light)return 1;if(t.light)return-1}if(e!==0)return e;if(i.dark&&t.dark)e=JU(i.dark,t.dark);else{if(i.dark)return 1;if(t.dark)return-1}return e}function uee(i,t){if(i.command!==t.command)return i.command<t.command?-1:1;if(i.title!==t.title)return i.title<t.title?-1:1;if(i.tooltip!==t.tooltip){if(i.tooltip!==void 0&&t.tooltip!==void 0)return i.tooltip<t.tooltip?-1:1;if(i.tooltip!==void 0)return 1;if(t.tooltip!==void 0)return-1}if(i.arguments===t.arguments)return 0;if(i.arguments)if(t.arguments){if(i.arguments.length!==t.arguments.length)return i.arguments.length-t.arguments.length}else return 1;else return-1;for(let e=0;e<i.arguments.length;e++){let n=i.arguments[e],o=t.arguments[e];if(n!==o&&!(G9(n)&&G9(o)&&dee(n,o)))return n<o?-1:1}return 0}function J9(i,t){let e=iI(i.resourceUri.fsPath,t.resourceUri.fsPath,!0);if(e!==0)return e;if(i.command&&t.command)e=uee(i.command,t.command);else{if(i.command)return 1;if(t.command)return-1}if(e!==0)return e;if(i.decorations&&t.decorations)e=cee(i.decorations,t.decorations);else{if(i.decorations)return 1;if(t.decorations)return-1}if(e!==0)return e;if(i.multiFileDiffEditorModifiedUri&&t.multiFileDiffEditorModifiedUri)e=iI(i.multiFileDiffEditorModifiedUri.fsPath,t.multiFileDiffEditorModifiedUri.fsPath,!0);else{if(i.multiFileDiffEditorModifiedUri)return 1;if(t.multiFileDiffEditorModifiedUri)return-1}if(e!==0)return e;if(i.multiDiffEditorOriginalUri&&t.multiDiffEditorOriginalUri)e=iI(i.multiDiffEditorOriginalUri.fsPath,t.multiDiffEditorOriginalUri.fsPath,!0);else{if(i.multiDiffEditorOriginalUri)return 1;if(t.multiDiffEditorOriginalUri)return-1}return e}function pee(i,t){for(let e=0;e<i.length;e++)if(i[e]!==t[e])return!1;return!0}function mee(i,t){return i.command===t.command&&i.title===t.title&&i.tooltip===t.tooltip&&(i.arguments&&t.arguments?pee(i.arguments,t.arguments):i.arguments===t.arguments)}function gee(i,t){return dn(i,t,mee)}var YU=class{constructor(t,e,n,o,r){this._extension=t;this._sourceControlHandle=o;this._documentUri=r;this._value="";this._onDidChange=new T;this._placeholder="";this._enabled=!0;this._visible=!0;this.#t=e,this.#e=n}#e;#t;get value(){return this._value}set value(t){t=t??"",this.#e.$setInputBoxValue(this._sourceControlHandle,t),this.updateValue(t)}get onDidChange(){return this._onDidChange.event}get placeholder(){return this._placeholder}set placeholder(t){this.#e.$setInputBoxPlaceholder(this._sourceControlHandle,t),this._placeholder=t}get validateInput(){return M(this._extension,"scmValidation"),this._validateInput}set validateInput(t){if(M(this._extension,"scmValidation"),t&&typeof t!="function")throw new Error(`[${this._extension.identifier.value}]: Invalid SCM input box validation function`);this._validateInput=t,this.#e.$setValidationProviderIsEnabled(this._sourceControlHandle,!!t)}get enabled(){return this._enabled}set enabled(t){t=!!t,this._enabled!==t&&(this._enabled=t,this.#e.$setInputBoxEnablement(this._sourceControlHandle,t))}get visible(){return this._visible}set visible(t){t=!!t,this._visible!==t&&(this._visible=t,this.#e.$setInputBoxVisibility(this._sourceControlHandle,t))}get document(){return M(this._extension,"scmTextDocument"),this.#t.getDocument(this._documentUri)}showValidationMessage(t,e){M(this._extension,"scmValidation"),this.#e.$showValidationMessage(this._sourceControlHandle,t,NL.from(e))}$onInputBoxValueChange(t){this.updateValue(t)}updateValue(t){this._value=t,this._onDidChange.fire(t)}},XU=class i{constructor(t,e,n,o,r,s,a){this._proxy=t;this._commands=e;this._sourceControlHandle=n;this._id=o;this._label=r;this.multiDiffEditorEnableViewChanges=s;this._extension=a;this._resourceHandlePool=0;this._resourceStates=[];this._resourceStatesMap=new Map;this._resourceStatesCommandsMap=new Map;this._resourceStatesDisposablesMap=new Map;this._onDidUpdateResourceStates=new T;this.onDidUpdateResourceStates=this._onDidUpdateResourceStates.event;this._disposed=!1;this._onDidDispose=new T;this.onDidDispose=this._onDidDispose.event;this._handlesSnapshot=[];this._resourceSnapshot=[];this._contextValue=void 0;this._hideWhenEmpty=void 0;this.handle=i._handlePool++}static{this._handlePool=0}get disposed(){return this._disposed}get id(){return this._id}get label(){return this._label}set label(t){this._label=t,this._proxy.$updateGroupLabel(this._sourceControlHandle,this.handle,t)}get contextValue(){return this._contextValue}set contextValue(t){this._contextValue=t,this._proxy.$updateGroup(this._sourceControlHandle,this.handle,this.features)}get hideWhenEmpty(){return this._hideWhenEmpty}set hideWhenEmpty(t){this._hideWhenEmpty=t,this._proxy.$updateGroup(this._sourceControlHandle,this.handle,this.features)}get features(){return{contextValue:this.contextValue,hideWhenEmpty:this.hideWhenEmpty}}get resourceStates(){return[...this._resourceStates]}set resourceStates(t){this._resourceStates=[...t],this._onDidUpdateResourceStates.fire()}getResourceState(t){return this._resourceStatesMap.get(t)}$executeResourceCommand(t,e){let n=this._resourceStatesCommandsMap.get(t);return n?Cn(()=>this._commands.executeCommand(n.command,...n.arguments||[],e)):Promise.resolve(void 0)}_takeResourceStateSnapshot(){let t=[...this._resourceStates].sort(J9),n=pR(this._resourceSnapshot,t,J9).map(s=>{let a=s.toInsert.map(l=>{let d=this._resourceHandlePool++;this._resourceStatesMap.set(d,l);let c=l.resourceUri,u;if(l.command)if(l.command.command==="vscode.open"||l.command.command==="vscode.diff"||l.command.command==="vscode.changes"){let Y=new $;u=this._commands.converter.toInternal(l.command,Y),this._resourceStatesDisposablesMap.set(d,Y)}else this._resourceStatesCommandsMap.set(d,l.command);let m=Le(this._extension,"scmMultiDiffEditor"),g=m?l.multiDiffEditorOriginalUri:void 0,h=m?l.multiFileDiffEditorModifiedUri:void 0,f=GU(l.decorations),I=l.decorations&&GU(l.decorations.light)||f,x=l.decorations&&GU(l.decorations.dark)||f,E=[I,x],w=l.decorations&&l.decorations.tooltip||"",R=l.decorations&&!!l.decorations.strikeThrough,L=l.decorations&&!!l.decorations.faded,U=l.contextValue||"";return{rawResource:[d,c,E,w,R,L,U,u,g,h],handle:d}});return{start:s.start,deleteCount:s.deleteCount,toInsert:a}}),o=n.map(({start:s,deleteCount:a,toInsert:l})=>[s,a,l.map(d=>d.rawResource)]),r=n.reverse();for(let{start:s,deleteCount:a,toInsert:l}of r){let d=l.map(u=>u.handle),c=this._handlesSnapshot.splice(s,a,...d);for(let u of c)this._resourceStatesMap.delete(u),this._resourceStatesCommandsMap.delete(u),this._resourceStatesDisposablesMap.get(u)?.dispose(),this._resourceStatesDisposablesMap.delete(u)}return this._resourceSnapshot=t,o}dispose(){this._disposed=!0,this._onDidDispose.fire(),this._onDidUpdateResourceStates.dispose(),this._onDidDispose.dispose()}},LI=class LI{constructor(t,e,n,o,r,s,a,l,d,c){this._extension=t;this._commands=o;this._id=r;this._label=s;this._rootUri=a;this._onDidDispose=new T;this.onDidDispose=this._onDidDispose.event;this._groups=new Map;this._contextValue=void 0;this._count=void 0;this._quickDiffProvider=void 0;this._secondaryQuickDiffProvider=void 0;this._historyProviderDisposable=new tn;this._artifactProviderDisposable=new tn;this._commitTemplate=void 0;this._acceptInputDisposables=new tn;this._acceptInputCommand=void 0;this._actionButtonDisposables=new $;this._statusBarDisposables=new $;this._statusBarCommands=void 0;this._selected=!1;this._onDidChangeSelection=new T;this.onDidChangeSelection=this._onDidChangeSelection.event;this._artifactCommandsDisposables=new bn;this.handle=LI._handlePool++;this.createdResourceGroups=new Map;this.updatedResourceGroups=new Set;this.#e=n;let u=y.from({scheme:B.vscodeSourceControl,path:`${r}/scm${this.handle}/input`,query:a?`rootUri=${encodeURIComponent(a.toString())}`:void 0});this._inputBox=new YU(t,e,this.#e,this.handle,u),this.#e.$registerSourceControl(this.handle,c?.handle,r,s,a,ca(l),d,u),this.onDidDisposeParent=c?c.onDidDispose:ye.None}static{this._handlePool=0}#e;get id(){return this._id}get label(){return this._label}get rootUri(){return this._rootUri}get contextValue(){return M(this._extension,"scmProviderOptions"),this._contextValue}set contextValue(t){M(this._extension,"scmProviderOptions"),this._contextValue!==t&&(this._contextValue=t,this.#e.$updateSourceControl(this.handle,{contextValue:t}))}get inputBox(){return this._inputBox}get count(){return this._count}set count(t){this._count!==t&&(this._count=t,this.#e.$updateSourceControl(this.handle,{count:t}))}get quickDiffProvider(){return this._quickDiffProvider}set quickDiffProvider(t){this._quickDiffProvider=t;let e;Le(this._extension,"quickDiffProvider")&&(e=t?.label),this.#e.$updateSourceControl(this.handle,{hasQuickDiffProvider:!!t,quickDiffLabel:e})}get secondaryQuickDiffProvider(){return M(this._extension,"quickDiffProvider"),this._secondaryQuickDiffProvider}set secondaryQuickDiffProvider(t){M(this._extension,"quickDiffProvider"),this._secondaryQuickDiffProvider=t;let e=t?.label;this.#e.$updateSourceControl(this.handle,{hasSecondaryQuickDiffProvider:!!t,secondaryQuickDiffLabel:e})}get historyProvider(){return M(this._extension,"scmHistoryProvider"),this._historyProvider}set historyProvider(t){M(this._extension,"scmHistoryProvider"),this._historyProvider=t,this._historyProviderDisposable.value=new $,this.#e.$updateSourceControl(this.handle,{hasHistoryProvider:!!t}),t&&(this._historyProviderDisposable.value.add(t.onDidChangeCurrentHistoryItemRefs(()=>{let e=QU(t?.currentHistoryItemRef),n=QU(t?.currentHistoryItemRemoteRef),o=QU(t?.currentHistoryItemBaseRef);this.#e.$onDidChangeHistoryProviderCurrentHistoryItemRefs(this.handle,e,n,o)})),this._historyProviderDisposable.value.add(t.onDidChangeHistoryItemRefs(e=>{if(e.added.length===0&&e.modified.length===0&&e.removed.length===0)return;let n=e.added.map(s=>({...s,icon:ca(s.icon)})),o=e.modified.map(s=>({...s,icon:ca(s.icon)})),r=e.removed.map(s=>({...s,icon:ca(s.icon)}));this.#e.$onDidChangeHistoryProviderHistoryItemRefs(this.handle,{added:n,modified:o,removed:r,silent:e.silent})})))}get artifactProvider(){return M(this._extension,"scmArtifactProvider"),this._artifactProvider}set artifactProvider(t){M(this._extension,"scmArtifactProvider"),this._artifactProvider=t,this._artifactProviderDisposable.value=new $,this.#e.$updateSourceControl(this.handle,{hasArtifactProvider:!!t}),t&&this._artifactProviderDisposable.value.add(t.onDidChangeArtifacts(e=>{e.length!==0&&this.#e.$onDidChangeArtifacts(this.handle,e)}))}get commitTemplate(){return this._commitTemplate}set commitTemplate(t){t!==this._commitTemplate&&(this._commitTemplate=t,this.#e.$updateSourceControl(this.handle,{commitTemplate:t}))}get acceptInputCommand(){return this._acceptInputCommand}set acceptInputCommand(t){this._acceptInputDisposables.value=new $,this._acceptInputCommand=t;let e=this._commands.converter.toInternal(t,this._acceptInputDisposables.value);this.#e.$updateSourceControl(this.handle,{acceptInputCommand:e})}get actionButton(){return M(this._extension,"scmActionButton"),this._actionButton}set actionButton(t){if(M(this._extension,"scmActionButton"),mm(this._actionButton,t))return;let e=this._actionButtonDisposables;this._actionButtonDisposables=new $,this._actionButton=t;let n=t!==void 0?{command:{...this._commands.converter.toInternal(t.command,this._actionButtonDisposables),shortTitle:t.command.shortTitle},secondaryCommands:t.secondaryCommands?.map(o=>o.map(r=>this._commands.converter.toInternal(r,this._actionButtonDisposables))),enabled:t.enabled}:null;this.#e.$updateSourceControl(this.handle,{actionButton:n}).finally(()=>e.dispose())}get statusBarCommands(){return this._statusBarCommands}set statusBarCommands(t){if(this._statusBarCommands&&t&&gee(this._statusBarCommands,t))return;let e=this._statusBarDisposables;this._statusBarDisposables=new $,this._statusBarCommands=t;let n=(t||[]).map(o=>this._commands.converter.toInternal(o,this._statusBarDisposables));this.#e.$updateSourceControl(this.handle,{statusBarCommands:n}).finally(()=>e.dispose())}get selected(){return this._selected}createResourceGroup(t,e,n){let o=Le(this._extension,"scmMultiDiffEditor")&&n?.multiDiffEditorEnableViewChanges===!0,r=new XU(this.#e,this._commands,this.handle,t,e,o,this._extension),s=ye.once(r.onDidDispose)(()=>this.createdResourceGroups.delete(r));return this.createdResourceGroups.set(r,s),this.eventuallyAddResourceGroups(),r}eventuallyAddResourceGroups(){let t=[],e=[];for(let[n,o]of this.createdResourceGroups){o.dispose();let r=n.onDidUpdateResourceStates(()=>{this.updatedResourceGroups.add(n),this.eventuallyUpdateResourceStates()});ye.once(n.onDidDispose)(()=>{this.updatedResourceGroups.delete(n),r.dispose(),this._groups.delete(n.handle),this.#e.$unregisterGroup(this.handle,n.handle)}),t.push([n.handle,n.id,n.label,n.features,n.multiDiffEditorEnableViewChanges]);let s=n._takeResourceStateSnapshot();s.length>0&&e.push([n.handle,s]),this._groups.set(n.handle,n)}this.#e.$registerGroups(this.handle,t,e),this.createdResourceGroups.clear()}eventuallyUpdateResourceStates(){let t=[];this.updatedResourceGroups.forEach(e=>{let n=e._takeResourceStateSnapshot();n.length!==0&&t.push([e.handle,n])}),t.length>0&&this.#e.$spliceResourceStates(this.handle,t),this.updatedResourceGroups.clear()}getResourceGroup(t){return this._groups.get(t)}setSelectionState(t){this._selected=t,this._onDidChangeSelection.fire(t)}async provideArtifacts(t,e){let n=new $,r=(await this.artifactProvider?.provideArtifacts(t,e))?.map(s=>({...s,icon:ca(s.icon),command:s.command?this._commands.converter.toInternal(s.command,n):void 0}));return this._artifactCommandsDisposables.get(t)?.dispose(),this._artifactCommandsDisposables.set(t,n),r}dispose(){this._acceptInputDisposables.dispose(),this._actionButtonDisposables.dispose(),this._statusBarDisposables.dispose(),this._historyProviderDisposable.dispose(),this._artifactProviderDisposable.dispose(),this._artifactCommandsDisposables.dispose(),this._groups.forEach(t=>t.dispose()),this.#e.$unregisterSourceControl(this.handle),this._onDidChangeSelection.dispose(),this._onDidDispose.fire(),this._onDidDispose.dispose()}};_([Hc(100)],LI.prototype,"eventuallyAddResourceGroups",1),_([Hc(100)],LI.prototype,"eventuallyUpdateResourceStates",1);var ZU=LI,Ah=class{constructor(t,e,n,o){this._commands=e;this._extHostDocuments=n;this.logService=o;this._sourceControls=new Map;this._sourceControlsByExtension=new vo;this._onDidChangeActiveProvider=new T;this._proxy=t.getProxy(F.MainThreadSCM),this._telemetry=t.getProxy(F.MainThreadTelemetry),e.registerArgumentProcessor({processArgument:r=>{if(r&&r.$mid===3){let s=this._sourceControls.get(r.sourceControlHandle);if(!s)return r;let a=s.getResourceGroup(r.groupHandle);return a?a.getResourceState(r.handle):r}else if(r&&r.$mid===4){let s=this._sourceControls.get(r.sourceControlHandle);return s?s.getResourceGroup(r.groupHandle):r}else if(r&&r.$mid===5){let s=this._sourceControls.get(r.handle);return s||r}return r}})}get onDidChangeActiveProvider(){return this._onDidChangeActiveProvider.event}createSourceControl(t,e,n,o,r,s,a){this.logService.trace("ExtHostSCM#createSourceControl",t.identifier.value,e,n,o),this._telemetry.$publicLog2("api/scm/createSourceControl",{extensionId:t.identifier.value});let l=a?Mt.find(this._sourceControls.values(),u=>u===a):void 0,d=new ZU(t,this._extHostDocuments,this._proxy,this._commands,e,n,o,r,s,l);this._sourceControls.set(d.handle,d);let c=this._sourceControlsByExtension.get(t.identifier)||[];return c.push(d),this._sourceControlsByExtension.set(t.identifier,c),ye.once(d.onDidDispose)(()=>{this.logService.trace("ExtHostSCM#disposeSourceControl",t.identifier.value,e,n,o),this._sourceControls.delete(d.handle);let u=this._sourceControlsByExtension.get(t.identifier);if(u){let m=u.indexOf(d);m!==-1&&u.splice(m,1),u.length===0&&this._sourceControlsByExtension.delete(t.identifier)}}),d}getLastInputBox(t){this.logService.trace("ExtHostSCM#getLastInputBox",t.identifier.value);let e=this._sourceControlsByExtension.get(t.identifier),n=e&&e[e.length-1];return n&&n.inputBox}$provideOriginalResource(t,e,n){let o=y.revive(e);this.logService.trace("ExtHostSCM#$provideOriginalResource",t,o.toString());let r=this._sourceControls.get(t);return!r||!r.quickDiffProvider||!r.quickDiffProvider.provideOriginalResource?Promise.resolve(null):Cn(()=>r.quickDiffProvider.provideOriginalResource(o,n)).then(s=>s||null)}$provideSecondaryOriginalResource(t,e,n){let o=y.revive(e);this.logService.trace("ExtHostSCM#$provideSecondaryOriginalResource",t,o.toString());let r=this._sourceControls.get(t);return!r||!r.secondaryQuickDiffProvider||!r.secondaryQuickDiffProvider.provideOriginalResource?Promise.resolve(null):Cn(()=>r.secondaryQuickDiffProvider.provideOriginalResource(o,n)).then(s=>s||null)}$onInputBoxValueChange(t,e){this.logService.trace("ExtHostSCM#$onInputBoxValueChange",t);let n=this._sourceControls.get(t);return n&&n.inputBox.$onInputBoxValueChange(e),Promise.resolve(void 0)}$executeResourceCommand(t,e,n,o){this.logService.trace("ExtHostSCM#$executeResourceCommand",t,e,n);let r=this._sourceControls.get(t);if(!r)return Promise.resolve(void 0);let s=r.getResourceGroup(e);return s?s.$executeResourceCommand(n,o):Promise.resolve(void 0)}$validateInput(t,e,n){this.logService.trace("ExtHostSCM#$validateInput",t);let o=this._sourceControls.get(t);return!o||!o.inputBox.validateInput?Promise.resolve(void 0):Cn(()=>o.inputBox.validateInput(e,n)).then(r=>{if(!r)return Promise.resolve(void 0);let s=fe.fromStrict(r.message);return s?Promise.resolve([s,r.type]):Promise.resolve(void 0)})}$setSelectedSourceControl(t){return this.logService.trace("ExtHostSCM#$setSelectedSourceControl",t),this._selectedSourceControlHandle===t||(t!==void 0&&this._sourceControls.get(t)?.setSelectionState(!0),this._selectedSourceControlHandle!==void 0&&this._sourceControls.get(this._selectedSourceControlHandle)?.setSelectionState(!1),this._selectedSourceControlHandle=t),Promise.resolve(void 0)}async $resolveHistoryItem(t,e,n){try{let r=await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItem(e,n);return r?Q9(r):void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItem",o);return}}async $resolveHistoryItemChatContext(t,e,n){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemChatContext(e,n)??void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItemChatContext",o);return}}async $resolveHistoryItemChangeRangeChatContext(t,e,n,o,r){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemChangeRangeChatContext?.(e,n,o,r)??void 0}catch(s){this.logService.error("ExtHostSCM#$resolveHistoryItemChangeRangeChatContext",s);return}}async $resolveHistoryItemRefsCommonAncestor(t,e,n){try{return await this._sourceControls.get(t)?.historyProvider?.resolveHistoryItemRefsCommonAncestor(e,n)??void 0}catch(o){this.logService.error("ExtHostSCM#$resolveHistoryItemRefsCommonAncestor",o);return}}async $provideHistoryItemRefs(t,e,n){try{return(await this._sourceControls.get(t)?.historyProvider?.provideHistoryItemRefs(e,n))?.map(s=>({...s,icon:ca(s.icon)}))??void 0}catch(o){this.logService.error("ExtHostSCM#$provideHistoryItemRefs",o);return}}async $provideHistoryItems(t,e,n){try{return(await this._sourceControls.get(t)?.historyProvider?.provideHistoryItems(e,n))?.map(s=>Q9(s))??void 0}catch(o){this.logService.error("ExtHostSCM#$provideHistoryItems",o);return}}async $provideHistoryItemChanges(t,e,n,o){try{return await this._sourceControls.get(t)?.historyProvider?.provideHistoryItemChanges(e,n,o)??void 0}catch(r){this.logService.error("ExtHostSCM#$provideHistoryItemChanges",r);return}}async $provideArtifactGroups(t,e){try{return(await this._sourceControls.get(t)?.artifactProvider?.provideArtifactGroups(e))?.map(r=>({...r,icon:ca(r.icon)}))}catch(n){this.logService.error("ExtHostSCM#$provideArtifactGroups",n);return}}async $provideArtifacts(t,e,n){try{return this._sourceControls.get(t)?.provideArtifacts(e,n)}catch(o){this.logService.error("ExtHostSCM#$provideArtifacts",o);return}}};Ah=_([S(3,te)],Ah);var f_=class i{constructor(t,e){this.uriTransformer=e;this.providers=new Map;this.proxy=t.getProxy(F.MainThreadShare)}static{this.handlePool=0}async $provideShare(t,e,n){return await this.providers.get(t)?.provideShare({selection:K.to(e.selection),resourceUri:y.revive(e.resourceUri)},n)??void 0}registerShareProvider(t,e){let n=i.handlePool++;return this.providers.set(n,e),this.proxy.$registerShareProvider(n,Zs.from(t,this.uriTransformer),e.id,e.label,e.priority),{dispose:()=>{this.proxy.$unregisterShareProvider(n),this.providers.delete(n)}}}};var h_=class i{constructor(t){this.providers=new Map;this.sessions=new Map;this.synthesizers=new Map;this.proxy=t.getProxy(F.MainThreadSpeech)}static{this.ID_POOL=1}async $createSpeechToTextSession(t,e,n){let o=this.providers.get(t);if(!o)return;let r=new $,s=new Ee;this.sessions.set(e,s);let a=await o.provideSpeechToTextSession(s.token,n?{language:n}:void 0);a&&(r.add(a.onDidChange(l=>{s.token.isCancellationRequested||this.proxy.$emitSpeechToTextEvent(e,l)})),r.add(s.token.onCancellationRequested(()=>r.dispose())))}async $cancelSpeechToTextSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t)}async $createTextToSpeechSession(t,e,n){let o=this.providers.get(t);if(!o)return;let r=new $,s=new Ee;this.sessions.set(e,s);let a=await o.provideTextToSpeechSession(s.token,n?{language:n}:void 0);a&&(this.synthesizers.set(e,a),r.add(a.onDidChange(l=>{s.token.isCancellationRequested||this.proxy.$emitTextToSpeechEvent(e,l)})),r.add(s.token.onCancellationRequested(()=>r.dispose())))}async $synthesizeSpeech(t,e){this.synthesizers.get(t)?.synthesize(e)}async $cancelTextToSpeechSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t),this.synthesizers.delete(t)}async $createKeywordRecognitionSession(t,e){let n=this.providers.get(t);if(!n)return;let o=new $,r=new Ee;this.sessions.set(e,r);let s=await n.provideKeywordRecognitionSession(r.token);s&&(o.add(s.onDidChange(a=>{r.token.isCancellationRequested||this.proxy.$emitKeywordRecognitionEvent(e,a)})),o.add(r.token.onCancellationRequested(()=>o.dispose())))}async $cancelKeywordRecognitionSession(t){this.sessions.get(t)?.dispose(!0),this.sessions.delete(t)}registerProvider(t,e,n){let o=i.ID_POOL++;return this.providers.set(o,n),this.proxy.$registerProvider(o,e,{extension:t,displayName:t.value}),q(()=>{this.proxy.$unregisterProvider(o),this.providers.delete(o)})}};var eF=class{constructor(t,e,n,o){this.id=t;this._proxy=e;this._sessions=n;this._url=o.url,this._title=o.title,this._favicon=o.favicon;let r=this;this.value={get url(){return r._url},get title(){return r._title},get icon(){return r._favicon?y.parse(r._favicon):new fn(de.globe.id)},startCDPSession(){return r._startCDPSession()},close(){return r._close()}}}update(t){let e=!1;return t.url!==this._url&&(this._url=t.url,e=!0),t.title!==this._title&&(this._title=t.title,e=!0),t.favicon!==this._favicon&&(this._favicon=t.favicon,e=!0),e}async _startCDPSession(){let t=_e();await this._proxy.$startCDPSession(t,this.id);let e=new tF(t,this._proxy);return this._sessions.set(t,e),e.value}async _close(){await this._proxy.$closeBrowserTab(this.id)}},tF=class{constructor(t,e){this.id=t;this._proxy=e;this._onDidReceiveMessage=new T;this._onDidClose=new T;this._closed=!1;let n=this;this.value={get onDidReceiveMessage(){return n._onDidReceiveMessage.event},get onDidClose(){return n._onDidClose.event},sendMessage(o){return n._sendMessage(o)},close(){return n._close()}}}dispose(){this._onDidReceiveMessage.dispose(),this._onDidClose.dispose()}async _sendMessage(t){if(this._closed)throw new Error("Session is closed");if(!t||typeof t!="object")throw new Error("Message must be an object");if(typeof t.id!="number")throw new Error("Message must have a numeric id");if(typeof t.method!="string")throw new Error("Message must have a method string");if(t.params!==void 0&&typeof t.params!="object")throw new Error("Message params must be an object");if(t.sessionId!==void 0&&typeof t.sessionId!="string")throw new Error("Message sessionId must be a string");await this._proxy.$sendCDPMessage(this.id,{id:t.id,method:t.method,params:t.params,sessionId:t.sessionId})}async _close(){this._closed=!0,await this._proxy.$closeCDPSession(this.id)}_acceptMessage(t){this._onDidReceiveMessage.fire(t)}_acceptClosed(){this._closed=!0,this._onDidClose.fire()}},v_=class extends N{constructor(e){super();this._browserTabs=new Map;this._sessions=this._register(new bn);this._onDidOpenBrowserTab=this._register(new T);this.onDidOpenBrowserTab=this._onDidOpenBrowserTab.event;this._onDidCloseBrowserTab=this._register(new T);this.onDidCloseBrowserTab=this._onDidCloseBrowserTab.event;this._onDidChangeActiveBrowserTab=this._register(new T);this.onDidChangeActiveBrowserTab=this._onDidChangeActiveBrowserTab.event;this._onDidChangeBrowserTabState=this._register(new T);this.onDidChangeBrowserTabState=this._onDidChangeBrowserTabState.event;this._proxy=e.getProxy(F.MainThreadBrowsers)}get browserTabs(){return[...this._browserTabs.values()].map(e=>e.value)}get activeBrowserTab(){if(this._activeBrowserTabId)return this._browserTabs.get(this._activeBrowserTabId)?.value}async openBrowserTab(e,n){let o=zt.from(n?.viewColumn),r=await this._proxy.$openBrowserTab(e,o,{preserveFocus:n?.preserveFocus,inactive:n?.background});return this._getOrCreateTab(r).value}_getOrCreateTab(e){let n=this._browserTabs.get(e.id);return n?n.update(e):(n=new eF(e.id,this._proxy,this._sessions,e),this._browserTabs.set(e.id,n),this._onDidOpenBrowserTab.fire(n.value)),n}$onDidOpenBrowserTab(e){this._getOrCreateTab(e)}$onDidCloseBrowserTab(e){let n=this._browserTabs.get(e);n&&(this._browserTabs.delete(e),this._activeBrowserTabId===e&&(this._activeBrowserTabId=void 0),this._onDidCloseBrowserTab.fire(n.value))}$onDidChangeActiveBrowserTab(e){this._activeBrowserTabId=e,this._onDidChangeActiveBrowserTab.fire(this.activeBrowserTab)}$onDidChangeBrowserTabState(e){let n=this._browserTabs.get(e.id);n&&n.update(e)&&this._onDidChangeBrowserTabState.fire(n.value)}$onCDPSessionMessage(e,n){let o=this._sessions.get(e);o&&o._acceptMessage(n)}$onCDPSessionClosed(e){let n=this._sessions.get(e);n&&(n._acceptClosed(),this._sessions.deleteAndDispose(e))}};var nF=class i{constructor(t,e,n,o,r,s=1,a,l){this._onDispose=l;this._disposed=!1;this._text="";this._staleCommandRegistrations=new $;if(this.#e=t,this.#t=e,r&&o){this._entryId=R$(o.identifier,r);let d=n.get(this._entryId);d&&(s=d.alignLeft?1:2,a=d.priority,this._visible=!0,this.name=d.name,this.text=d.text,this.tooltip=d.tooltip,this.command=d.command,this.accessibilityInformation=d.accessibilityInformation)}else this._entryId=String(i.ID_GEN++);this._extension=o,this._id=r,this._alignment=s,this._priority=this.validatePriority(a)}static{this.ID_GEN=0}static{this.ALLOWED_BACKGROUND_COLORS=new Map([["statusBarItem.errorBackground",new Qa("statusBarItem.errorForeground")],["statusBarItem.warningBackground",new Qa("statusBarItem.warningForeground")]])}#e;#t;validatePriority(t){if(jn(t))return t===Number.POSITIVE_INFINITY?Number.MAX_VALUE:t===Number.NEGATIVE_INFINITY?-Number.MAX_VALUE:t}get id(){return this._id??this._extension.identifier.value}get entryId(){return this._entryId}get alignment(){return this._alignment}get priority(){return this._priority}get text(){return this._text}get name(){return this._name}get tooltip(){return this._tooltip}get tooltip2(){return this._extension&&M(this._extension,"statusBarItemTooltip"),this._tooltip2}get color(){return this._color}get backgroundColor(){return this._backgroundColor}get command(){return this._command?.fromApi}get accessibilityInformation(){return this._accessibilityInformation}set text(t){this._text=t,this.update()}set name(t){this._name=t,this.update()}set tooltip(t){this._tooltip=t,this.update()}set tooltip2(t){this._extension&&M(this._extension,"statusBarItemTooltip"),this._tooltip2=t,this.update()}set color(t){this._color=t,this.update()}set backgroundColor(t){t&&!i.ALLOWED_BACKGROUND_COLORS.has(t.id)&&(t=void 0),this._backgroundColor=t,this.update()}set command(t){this._command?.fromApi!==t&&(this._latestCommandRegistration&&this._staleCommandRegistrations.add(this._latestCommandRegistration),this._latestCommandRegistration=new $,typeof t=="string"?this._command={fromApi:t,internal:this.#t.toInternal({title:"",command:t},this._latestCommandRegistration)}:t?this._command={fromApi:t,internal:this.#t.toInternal(t,this._latestCommandRegistration)}:this._command=void 0,this.update())}set accessibilityInformation(t){this._accessibilityInformation=t,this.update()}show(){this._visible=!0,this.update()}hide(){clearTimeout(this._timeoutHandle),this._visible=!1,this.#e.$disposeEntry(this._entryId)}update(){this._disposed||!this._visible||(clearTimeout(this._timeoutHandle),this._timeoutHandle=setTimeout(()=>{this._timeoutHandle=void 0;let t;this._extension?this._id?t=`${this._extension.identifier.value}.${this._id}`:t=this._extension.identifier.value:t=this._id;let e;this._name?e=this._name:e=p(5888,null,this._extension.displayName||this._extension.name);let n=this._color;this._backgroundColor&&(n=i.ALLOWED_BACKGROUND_COLORS.get(this._backgroundColor.id));let o,r;typeof this._tooltip2=="function"?(o=fe.fromStrict(this._tooltip),r=!0):(o=fe.fromStrict(this._tooltip2??this._tooltip),r=!1),this.#e.$setEntry(this._entryId,t,this._extension?.identifier.value,e,this._text,o,r,this._command?.internal,n,this._backgroundColor,this._alignment===1,this._priority,this._accessibilityInformation),this._staleCommandRegistrations.clear()},0))}dispose(){this.hide(),this._staleCommandRegistrations.dispose(),this._latestCommandRegistration?.dispose(),this._onDispose?.(),this._disposed=!0}},oF=class{constructor(t){this._messages=[];this._item=t.createStatusBarEntry(void 0,"status.extensionMessage",1,Number.MIN_VALUE),this._item.name=p(5889,null)}dispose(){this._messages.length=0,this._item.dispose()}setMessage(t){let e={message:t};return this._messages.unshift(e),this._update(),new Se(()=>{let n=this._messages.indexOf(e);n>=0&&(this._messages.splice(n,1),this._update())})}_update(){this._messages.length>0?(this._item.text=this._messages[0].message,this._item.show()):this._item.hide()}},y_=class{constructor(t,e){this._entries=new Map;this._existingItems=new Map;this._proxy=t.getProxy(F.MainThreadStatusBar),this._commands=e,this._statusMessage=new oF(this)}$acceptStaticEntries(t){for(let e of t)this._existingItems.set(e.entryId,e)}async $provideTooltip(t,e){let n=this._entries.get(t);if(!n)return;let o=typeof n.tooltip2=="function"?await n.tooltip2(e):n.tooltip2;return e.isCancellationRequested?void 0:fe.fromStrict(o)}createStatusBarEntry(t,e,n,o){let r=new nF(this._proxy,this._commands,this._existingItems,t,e,n,o,()=>this._entries.delete(r.entryId));return this._entries.set(r.entryId,r),r}setStatusBarMessage(t,e){let n=this._statusMessage.setMessage(t),o;return typeof e=="number"?o=setTimeout(()=>n.dispose(),e):typeof e<"u"&&e.then(()=>n.dispose(),()=>n.dispose()),new Se(()=>{n.dispose(),clearTimeout(o)})}};var b_=class extends N{constructor(e,n){super();this._extHostDocumentsAndEditors=n;this._onDidChangeTextEditorSelection=this._register(new T);this._onDidChangeTextEditorOptions=this._register(new T);this._onDidChangeTextEditorVisibleRanges=this._register(new T);this._onDidChangeTextEditorViewColumn=this._register(new T);this._onDidChangeTextEditorDiffInformation=this._register(new T);this._onDidChangeActiveTextEditor=this._register(new T);this._onDidChangeVisibleTextEditors=this._register(new T);this.onDidChangeTextEditorSelection=this._onDidChangeTextEditorSelection.event;this.onDidChangeTextEditorOptions=this._onDidChangeTextEditorOptions.event;this.onDidChangeTextEditorVisibleRanges=this._onDidChangeTextEditorVisibleRanges.event;this.onDidChangeTextEditorViewColumn=this._onDidChangeTextEditorViewColumn.event;this.onDidChangeTextEditorDiffInformation=this._onDidChangeTextEditorDiffInformation.event;this.onDidChangeActiveTextEditor=this._onDidChangeActiveTextEditor.event;this.onDidChangeVisibleTextEditors=this._onDidChangeVisibleTextEditors.event;this._proxy=e.getProxy(F.MainThreadTextEditors),this._register(this._extHostDocumentsAndEditors.onDidChangeVisibleTextEditors(o=>this._onDidChangeVisibleTextEditors.fire(o))),this._register(this._extHostDocumentsAndEditors.onDidChangeActiveTextEditor(o=>this._onDidChangeActiveTextEditor.fire(o)))}getActiveTextEditor(){return this._extHostDocumentsAndEditors.activeEditor()}getVisibleTextEditors(e){let n=this._extHostDocumentsAndEditors.allEditors();return e?n:n.map(o=>o.value)}async showTextDocument(e,n,o){let r;typeof n=="number"?r={position:zt.from(n),preserveFocus:o}:typeof n=="object"?r={position:zt.from(n.viewColumn),preserveFocus:n.preserveFocus,selection:typeof n.selection=="object"?K.from(n.selection):void 0,pinned:typeof n.preview=="boolean"?!n.preview:void 0}:r={preserveFocus:!1};let s=await this._proxy.$tryShowTextDocument(e.uri,r),a=s&&this._extHostDocumentsAndEditors.getEditor(s);if(a)return a.value;throw s?new Error(`Could NOT open editor for "${e.uri.toString()}" because another editor opened in the meantime.`):new Error(`Could NOT open editor for "${e.uri.toString()}".`)}createTextEditorDecorationType(e,n){return new jw(this._proxy,e,n).value}$acceptEditorPropertiesChanged(e,n){let o=this._extHostDocumentsAndEditors.getEditor(e);if(!o)throw new Error("unknown text editor");if(n.options&&o._acceptOptions(n.options),n.selections){let r=n.selections.selections.map(Do.to);o._acceptSelections(r)}if(n.visibleRanges){let r=nt(n.visibleRanges.map(K.to));o._acceptVisibleRanges(r)}if(n.options&&this._onDidChangeTextEditorOptions.fire({textEditor:o.value,options:{...n.options,lineNumbers:Ju.to(n.options.lineNumbers)}}),n.selections){let r=Vu.fromValue(n.selections.source),s=n.selections.selections.map(Do.to);this._onDidChangeTextEditorSelection.fire({textEditor:o.value,selections:s,kind:r})}if(n.visibleRanges){let r=nt(n.visibleRanges.map(K.to));this._onDidChangeTextEditorVisibleRanges.fire({textEditor:o.value,visibleRanges:r})}}$acceptEditorPositionData(e){for(let n in e){let o=this._extHostDocumentsAndEditors.getEditor(n);if(!o)throw new Error("Unknown text editor");let r=zt.to(e[n]);o.value.viewColumn!==r&&(o._acceptViewColumn(r),this._onDidChangeTextEditorViewColumn.fire({textEditor:o.value,viewColumn:r}))}}$acceptEditorDiffInformation(e,n){let o=this._extHostDocumentsAndEditors.getEditor(e);if(!o)throw new Error("unknown text editor");if(!n){o._acceptDiffInformation(void 0),this._onDidChangeTextEditorDiffInformation.fire({textEditor:o.value,diffInformation:void 0});return}let r=this,s=n.map(a=>{let l=y.revive(a.original),d=y.revive(a.modified),c=a.changes.map(u=>{let[m,g,h,f]=u,I;return m===g?I=1:h===f?I=2:I=3,{original:{startLineNumber:m,endLineNumberExclusive:g},modified:{startLineNumber:h,endLineNumberExclusive:f},kind:I}});return Object.freeze({documentVersion:a.documentVersion,original:l,modified:d,changes:c,get isStale(){return r._extHostDocumentsAndEditors.getDocument(d)?.version!==a.documentVersion}})});o._acceptDiffInformation(s),this._onDidChangeTextEditorDiffInformation.fire({textEditor:o.value,diffInformation:s})}getDiffInformation(e){return Promise.resolve(this._proxy.$getDiffInformation(e))}};var Mh=class{constructor(t){this._actual=new wu(2),this._onDidChangeActiveColorTheme=new T}get activeColorTheme(){return this._actual}$onColorThemeChange(t){let e;switch(t){case"light":e=1;break;case"hcDark":e=3;break;case"hcLight":e=4;break;default:e=2}this._actual=new wu(e),this._onDidChangeActiveColorTheme.fire(this._actual)}get onDidChangeActiveColorTheme(){return this._onDidChangeActiveColorTheme.event}};Mh=_([S(0,le)],Mh);var qAt=A("IExtHostTimeline"),I_=class{constructor(t,e){this._providers=new Map;this._itemsBySourceAndUriMap=new Map;this._proxy=t.getProxy(F.MainThreadTimeline),e.registerArgumentProcessor({processArgument:(n,o)=>{if(n&&n.$mid===12)if(this._providers.get(n.source)&&o&&Le(o,"timeline")){let r=n.uri===void 0?void 0:y.revive(n.uri);return this._itemsBySourceAndUriMap.get(n.source)?.get(Y9(r))?.get(n.handle)}else return;return n}})}async $getTimeline(t,e,n,o){return this._providers.get(t)?.provider.provideTimeline(y.revive(e),n,o)}registerTimelineProvider(t,e,n,o){let r=new $,s=this.convertTimelineItem(e.id,o,r).bind(this),a;e.onDidChange&&(a=e.onDidChange(d=>this._proxy.$emitTimelineChangeEvent({uri:void 0,reset:!0,...d,id:e.id}),this));let l=this._itemsBySourceAndUriMap;return this.registerTimelineProviderCore({...e,scheme:t,onDidChange:void 0,async provideTimeline(d,c,u){c?.resetCache&&(r.clear(),l.get(e.id)?.clear());let m=await e.provideTimeline(d,c,u);if(m==null)return;let g=s(d,c);return{...m,source:e.id,items:m.items.map(g)}},dispose(){for(let d of l.values())d.get(e.id)?.clear();a?.dispose(),r.dispose()}},n)}convertTimelineItem(t,e,n){return(o,r)=>{let s;if(r?.cacheResults){let a=this._itemsBySourceAndUriMap.get(t);a===void 0&&(a=new Map,this._itemsBySourceAndUriMap.set(t,a));let l=Y9(o);s=a.get(l),s===void 0&&(s=new Map,a.set(l,s))}return a=>{let{iconPath:l,...d}=a,c=`${t}|${a.id??a.timestamp}`;s?.set(c,a);let u,m,g;a.iconPath&&(l instanceof fn?g={id:l.id,color:l.color}:y.isUri(l)?(u=l,m=l):{light:u,dark:m}=l);let h;return en.isMarkdownString(d.tooltip)?h=fe.from(d.tooltip):Pe(d.tooltip)?h=d.tooltip:en.isMarkdownString(d.detail)?(console.warn("Using deprecated TimelineItem.detail, migrate to TimelineItem.tooltip"),h=fe.from(d.detail)):Pe(d.detail)&&(console.warn("Using deprecated TimelineItem.detail, migrate to TimelineItem.tooltip"),h=d.detail),{...d,id:d.id??void 0,handle:c,source:t,command:a.command?e.toInternal(a.command,n):void 0,icon:u,iconDark:m,themeIcon:g,tooltip:h,accessibilityInformation:a.accessibilityInformation}}}}registerTimelineProviderCore(t,e){if(this._providers.get(t.id))throw new Error(`Timeline Provider ${t.id} already exists.`);return this._proxy.$registerTimelineProvider({id:t.id,label:t.label,scheme:t.scheme}),this._providers.set(t.id,{provider:t,extension:e}),q(()=>{for(let o of this._itemsBySourceAndUriMap.values())o.get(t.id)?.clear();this._providers.delete(t.id),this._proxy.$unregisterTimelineProvider(t.id),t.dispose()})}};function Y9(i){return i?.toString()}var rMt=p(7579,null),iMt=za("default-view-icon",de.window,p(7576,null)),sF;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(sF||={});var rF=class extends N{constructor(){super(...arguments);this._onDidRegister=this._register(new T);this.onDidRegister=this._onDidRegister.event;this._onDidDeregister=this._register(new T);this.onDidDeregister=this._onDidDeregister.event;this.viewContainers=new Map;this.defaultViewContainers=[]}get all(){return[...this.viewContainers.values()].flat()}registerViewContainer(e,n,o){let r=this.get(e.id);if(r)return r;let s=e;return s.openCommandActionDescriptor=o?.doNotRegisterOpenCommand?void 0:s.openCommandActionDescriptor??{id:s.id},yR(this.viewContainers,n,[]).push(s),o?.isDefault&&this.defaultViewContainers.push(s),this._onDidRegister.fire({viewContainer:s,viewContainerLocation:n}),s}deregisterViewContainer(e){for(let n of this.viewContainers.keys()){let o=this.viewContainers.get(n),r=o?.indexOf(e);if(r!==-1){o?.splice(r,1),o.length===0&&this.viewContainers.delete(n),this._onDidDeregister.fire({viewContainer:e,viewContainerLocation:n});return}}}get(e){return this.all.filter(n=>n.id===e)[0]}getViewContainers(e){return[...this.viewContainers.get(e)||[]]}getViewContainerLocation(e){return[...this.viewContainers.keys()].filter(n=>this.getViewContainers(n).filter(o=>o?.id===e.id).length>0)[0]}getDefaultViewContainers(e){return this.defaultViewContainers.filter(n=>this.getViewContainerLocation(n)===e)}};wt.add(sF.ViewContainersRegistry,new rF);function fee(i,t){let e=i.group??"9_more",n=t.group??"9_more";return e!==n?e.localeCompare(n):(i.order??5)-(t.order??5)}var iF=class extends N{constructor(){super(...arguments);this._onViewsRegistered=this._register(new T);this.onViewsRegistered=this._onViewsRegistered.event;this._onViewsDeregistered=this._register(new T);this.onViewsDeregistered=this._onViewsDeregistered.event;this._onDidChangeContainer=this._register(new T);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeViewWelcomeContent=this._register(new T);this.onDidChangeViewWelcomeContent=this._onDidChangeViewWelcomeContent.event;this._viewContainers=[];this._views=new Map;this._viewWelcomeContents=new Mp}registerViews(e,n){this.registerViews2([{views:e,viewContainer:n}])}registerViews2(e){e.forEach(({views:n,viewContainer:o})=>this.addViews(n,o)),this._onViewsRegistered.fire(e)}deregisterViews(e,n){let o=this.removeViews(e,n);o.length&&this._onViewsDeregistered.fire({views:o,viewContainer:n})}moveViews(e,n){for(let o of this._views.keys())if(o!==n){let r=this.removeViews(e,o);r.length&&(this.addViews(r,n),this._onDidChangeContainer.fire({views:r,from:o,to:n}))}}getViews(e){return this._views.get(e)||[]}getView(e){for(let n of this._viewContainers){let o=(this._views.get(n)||[]).filter(r=>r.id===e)[0];if(o)return o}return null}getViewContainer(e){for(let n of this._viewContainers)if((this._views.get(n)||[]).filter(r=>r.id===e)[0])return n;return null}registerViewWelcomeContent(e,n){return this._viewWelcomeContents.add(e,n),this._onDidChangeViewWelcomeContent.fire(e),q(()=>{this._viewWelcomeContents.delete(e,n),this._onDidChangeViewWelcomeContent.fire(e)})}registerViewWelcomeContent2(e,n){let o=new Map;for(let[r,s]of n)this._viewWelcomeContents.add(e,s),o.set(r,q(()=>{this._viewWelcomeContents.delete(e,s),this._onDidChangeViewWelcomeContent.fire(e)}));return this._onDidChangeViewWelcomeContent.fire(e),o}getViewWelcomeContent(e){let n=[];return this._viewWelcomeContents.forEach(e,o=>n.push(o)),n.sort(fee)}addViews(e,n){let o=this._views.get(n);o||(o=[],this._views.set(n,o),this._viewContainers.push(n));for(let r of e){if(this.getView(r.id)!==null)throw new Error(p(7577,null,r.id));o.push(r)}}removeViews(e,n){let o=this._views.get(n);if(!o)return[];let r=[],s=[];for(let a of o)e.includes(a)?r.push(a):s.push(a);return r.length&&(s.length?this._views.set(n,s):(this._views.delete(n),this._viewContainers.splice(this._viewContainers.indexOf(n),1))),r}};wt.add(sF.ViewsRegistry,new iF);var sMt=A("viewDescriptorService");var Ci=class extends Error{constructor(e){super(p(7578,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var x_=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(t){if(t&&this._dragOperations.has(t)){let e=this._dragOperations.get(t);return this._dragOperations.delete(t),e}}addDragOperationTransfer(t,e){this._dragOperations.set(t,e)}};function X9(i,t){if(Pe(i))return{label:i};if(i&&typeof i=="object"&&i.label){let e;if(Array.isArray(i.highlights)&&(e=i.highlights.filter((n=>n.length===2&&typeof n[0]=="number"&&typeof n[1]=="number")),e=e.length?e:void 0),Pe(i.label))return{label:i.label,highlights:e};if(en.isMarkdownString(i.label))return M(t,"treeItemMarkdownLabel"),{label:fe.from(i.label),highlights:e}}}var S_=class extends N{constructor(e,n,o){super();this._proxy=e;this._commands=n;this._logService=o;this._treeViews=new Map;this._treeDragAndDropService=new x_;function r(s){return s&&s.$treeViewId&&(s.$treeItemHandle||s.$selectedTreeItems||s.$focusedTreeItem)}n.registerArgumentProcessor({processArgument:s=>r(s)?this._convertArgument(s):Array.isArray(s)&&s.length>0?s.map(a=>r(a)?this._convertArgument(a):a):s})}registerTreeDataProvider(e,n,o){let r=this.createTreeView(e,{treeDataProvider:n},o);return{dispose:()=>r.dispose()}}createTreeView(e,n,o){if(!n||!n.treeDataProvider)throw new Error("Options with treeDataProvider is mandatory");let r=n.dragAndDropController?.dropMimeTypes??[],s=n.dragAndDropController?.dragMimeTypes??[],a=!!n.dragAndDropController?.handleDrag,l=!!n.dragAndDropController?.handleDrop,d=this._createExtHostTreeView(e,n,o),c={showCollapseAll:!!n.showCollapseAll,canSelectMany:!!n.canSelectMany,dropMimeTypes:r,dragMimeTypes:s,hasHandleDrag:a,hasHandleDrop:l,manuallyManageCheckboxes:!!n.manageCheckboxStateManually},u=this._proxy.$registerTreeViewDataProvider(e,c),m={get onDidCollapseElement(){return d.onDidCollapseElement},get onDidExpandElement(){return d.onDidExpandElement},get selection(){return d.selectedElements},get onDidChangeSelection(){return d.onDidChangeSelection},get activeItem(){return M(o,"treeViewActiveItem"),d.focusedElement},get onDidChangeActiveItem(){return M(o,"treeViewActiveItem"),d.onDidChangeActiveItem},get visible(){return d.visible},get onDidChangeVisibility(){return d.onDidChangeVisibility},get onDidChangeCheckboxState(){return d.onDidChangeCheckboxState},get message(){return d.message},set message(g){qo(g)&&M(o,"treeViewMarkdownMessage"),d.message=g},get title(){return d.title},set title(g){d.title=g},get description(){return d.description},set description(g){d.description=g},get badge(){return d.badge},set badge(g){g!==void 0&&x0.isViewBadge(g)?d.badge={value:Math.floor(Math.abs(g.value)),tooltip:g.tooltip}:g===void 0&&(d.badge=void 0)},reveal:(g,h)=>d.reveal(g,h),dispose:async()=>{await u,this._treeViews.get(e)===d&&(this._treeViews.delete(e),this._proxy.$disposeTree(e)),d.dispose()}};return this._register(m),m}async $getChildren(e,n){let o=this._treeViews.get(e);if(!o)return Promise.reject(new Ci(e));if(!n){let s=await o.getChildren();return s?[[0,...s]]:void 0}let r=[];for(let s=0;s<n.length;s++){let a=n[s],l=await o.getChildren(a);l&&r.push([s,...l])}return r}async $handleDrop(e,n,o,r,s,a,l,d){let c=this._treeViews.get(e);if(!c)return Promise.reject(new Ci(e));let u=Yu.toDataTransfer(o,async m=>(await this._proxy.$resolveDropFileData(e,n,m)).buffer);return l===e&&d&&await this._addAdditionalTransferItems(u,c,d,s,a),c.onDrop(u,r,s)}async _addAdditionalTransferItems(e,n,o,r,s){let a=this._treeDragAndDropService.removeDragOperationTransfer(s);if(a)(await a)?.forEach((l,d)=>{l&&e.set(d,l)});else if(s&&n.handleDrag){let l=n.handleDrag(o,e,r);this._treeDragAndDropService.addDragOperationTransfer(s,l),await l}return e}async $handleDrag(e,n,o,r){let s=this._treeViews.get(e);if(!s)return Promise.reject(new Ci(e));let a=await this._addAdditionalTransferItems(new mi,s,n,r,o);if(!(!a||r.isCancellationRequested))return Yu.from(a)}async $hasResolve(e){let n=this._treeViews.get(e);if(!n)throw new Ci(e);return n.hasResolve}$resolve(e,n,o){let r=this._treeViews.get(e);if(!r)throw new Ci(e);return r.resolveTreeItem(n,o)}$setExpanded(e,n,o){let r=this._treeViews.get(e);if(!r)throw new Ci(e);r.setExpanded(n,o)}$setSelectionAndFocus(e,n,o){let r=this._treeViews.get(e);if(!r)throw new Ci(e);r.setSelectionAndFocus(n,o)}$setVisible(e,n){let o=this._treeViews.get(e);if(!o){if(!n)return;throw new Ci(e)}o.setVisible(n)}$changeCheckboxState(e,n){let o=this._treeViews.get(e);if(!o)throw new Ci(e);o.setCheckboxState(n)}_createExtHostTreeView(e,n,o){let r=this._register(new aF(e,n,this._proxy,this._commands.converter,this._logService,o));return this._treeViews.set(e,r),r}_convertArgument(e){let n=this._treeViews.get(e.$treeViewId),o=e;return n&&o.$treeItemHandle?n.getExtensionElement(o.$treeItemHandle):n&&e.$focusedTreeItem?n.focusedElement:null}},aF=class i extends N{constructor(e,n,o,r,s,a){super();this._viewId=e;this._proxy=o;this._commands=r;this._logService=s;this._extension=a;this._roots=void 0;this._elements=new Map;this._nodes=new Map;this._childrenFetchTokens=new Map;this._globalFetchTokenCounter=0;this._visible=!1;this._selectedHandles=[];this._focusedHandle=void 0;this._onDidExpandElement=this._register(new T);this.onDidExpandElement=this._onDidExpandElement.event;this._onDidCollapseElement=this._register(new T);this.onDidCollapseElement=this._onDidCollapseElement.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeActiveItem=this._register(new T);this.onDidChangeActiveItem=this._onDidChangeActiveItem.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidChangeData=this._register(new T);this._refreshPromise=Promise.resolve();this._refreshQueue=Promise.resolve();this._nodesToClear=new Set;this._message="";this._title="";this._refreshCancellationSource=new Ee;if(a.contributes&&a.contributes.views)for(let u in a.contributes.views)for(let m of a.contributes.views[u])m.id===e&&(this._title=m.name);this._dataProvider=n.treeDataProvider,this._dndController=n.dragAndDropController,this._dataProvider.onDidChangeTreeData&&this._register(this._dataProvider.onDidChangeTreeData(u=>{Array.isArray(u)&&u.length===0||this._onDidChangeData.fire({message:!1,element:u})}));let l,d,c=ye.debounce(this._onDidChangeData.event,(u,m)=>(u||(u={message:!1,elements:[]}),m.element!==!1&&(l||(l=new Promise(g=>d=g),this._refreshPromise=this._refreshPromise.then(()=>l)),Array.isArray(m.element)?u.elements.push(...m.element):u.elements.push(m.element)),m.message&&(u.message=!0),u),200,!0);this._register(c(({message:u,elements:m})=>{m.length&&(m=er(m),this._refreshQueue=this._refreshQueue.then(()=>{let g=d;l=null;let h=Array.from(this._nodesToClear);return this._nodesToClear.clear(),this._debugLogRefresh("start",m,h),this._refresh(m).then(()=>(this._debugLogRefresh("done",m,h),this._clearNodes(h),g())).catch(f=>{let I=f instanceof Error?f.message:JSON.stringify(f);return this._debugLogRefresh("error",m,h),this._clearNodes(h),this._logService.error(`Unable to refresh tree view ${this._viewId}: ${I}`),g()})})),u&&this._proxy.$setMessage(this._viewId,fe.fromStrict(this._message)??"")}))}static{this.LABEL_HANDLE_PREFIX="0"}static{this.ID_HANDLE_PREFIX="1"}static{this.ROOT_FETCH_KEY=Symbol("extHostTreeViewRoot")}get visible(){return this._visible}get selectedElements(){return this._selectedHandles.map(e=>this.getExtensionElement(e)).filter(e=>!Wt(e))}get focusedElement(){return this._focusedHandle?this.getExtensionElement(this._focusedHandle):void 0}_debugCollectHandles(e){let n=[];for(let r of e){if(!r){n.push("<root>");continue}let s=this._nodes.get(r);s&&n.push(s.item.handle)}let o=this._roots?.map(r=>r.item.handle)??[];return{changed:n,roots:o}}_debugLogRefresh(e,n,o){if(this._isDebugLogging())try{let r=this._debugCollectHandles(n);r.clearing=o.map(l=>l.item.handle);let s=r.changed.length,a=o.length;this._logService.debug(`[TreeView:${this._viewId}] refresh ${e} changed=${s} nodesToClear=${a} elements.size=${this._elements.size} nodes.size=${this._nodes.size} handles=${JSON.stringify(r)}`)}catch{this._logService.debug(`[TreeView:${this._viewId}] refresh ${e} (snapshot failed)`)}}_isDebugLogging(){try{let e=this._logService.getLevel();return e===2||e===1}catch{return!1}}async getChildren(e){let n=e?this.getExtensionElement(e):void 0;if(e&&!n)return this._logService.error(`No tree item with id '${e}' found.`),Promise.resolve([]);let o=this._getChildrenNodes(e);return o||(o=await this._fetchChildrenNodes(n)),o?o.map(r=>r.item):void 0}getExtensionElement(e){return this._elements.get(e)}reveal(e,n){n=n||{select:!0,focus:!1};let o=Wt(n.select)?!0:n.select,r=Wt(n.focus)?!1:n.focus,s=Wt(n.expand)?!1:n.expand;return typeof this._dataProvider.getParent!="function"?Promise.reject(new Error("Required registered TreeDataProvider to implement 'getParent' method to access 'reveal' method")):e?this._refreshPromise.then(()=>this._resolveUnknownParentChain(e)).then(a=>this._resolveTreeNode(e,a[a.length-1]).then(l=>this._proxy.$reveal(this._viewId,{item:l.item,parentChain:a.map(d=>d.item)},{select:o,focus:r,expand:s})),a=>this._logService.error(a)):this._proxy.$reveal(this._viewId,void 0,{select:o,focus:r,expand:s})}get message(){return this._message}set message(e){this._message=e,this._onDidChangeData.fire({message:!0,element:!1})}get title(){return this._title}set title(e){this._title=e,this._proxy.$setTitle(this._viewId,e,this._description)}get description(){return this._description}set description(e){this._description=e,this._proxy.$setTitle(this._viewId,this._title,e)}get badge(){return this._badge}set badge(e){this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip||(this._badge=Ib.from(e),this._proxy.$setBadge(this._viewId,e))}setExpanded(e,n){let o=this.getExtensionElement(e);o&&(n?this._onDidExpandElement.fire(Object.freeze({element:o})):this._onDidCollapseElement.fire(Object.freeze({element:o})))}setSelectionAndFocus(e,n){let o=!dn(this._selectedHandles,e);this._selectedHandles=e;let r=this._focusedHandle!==n;this._focusedHandle=n,o&&this._onDidChangeSelection.fire(Object.freeze({selection:this.selectedElements})),r&&this._onDidChangeActiveItem.fire(Object.freeze({activeItem:this.focusedElement}))}setVisible(e){e!==this._visible&&(this._visible=e,this._onDidChangeVisibility.fire(Object.freeze({visible:this._visible})))}async setCheckboxState(e){let n=(await Promise.all(e.map(async o=>{let r=this.getExtensionElement(o.treeItemHandle);return r?{extensionItem:r,treeItem:await this._dataProvider.getTreeItem(r),newState:o.newState?1:0}:Promise.resolve(void 0)}))).filter(o=>o!==void 0);n.forEach(o=>{o.treeItem.checkboxState=o.newState?1:0}),this._onDidChangeCheckboxState.fire({items:n.map(o=>[o.extensionItem,o.newState])})}async handleDrag(e,n,o){let r=[];for(let s of e){let a=this.getExtensionElement(s);a&&r.push(a)}if(!(!this._dndController?.handleDrag||r.length===0))return await this._dndController.handleDrag(r,n,o),n}get hasHandleDrag(){return!!this._dndController?.handleDrag}async onDrop(e,n,o){let r=n?this.getExtensionElement(n):void 0;if(!(!r&&n||!this._dndController?.handleDrop))return Cn(()=>this._dndController?.handleDrop?this._dndController.handleDrop(r,e,o):void 0)}get hasResolve(){return!!this._dataProvider.resolveTreeItem}async resolveTreeItem(e,n){if(!this._dataProvider.resolveTreeItem)return;let o=this._elements.get(e);if(o){let r=this._nodes.get(o);if(r){let s=await this._dataProvider.resolveTreeItem(r.extensionItem,o,n)??r.extensionItem;return this._validateTreeItem(s),r.item.tooltip=this._getTooltip(s.tooltip),r.item.command=this._getCommand(r.disposableStore,s.command),r.item}}}_resolveUnknownParentChain(e){return this._resolveParent(e).then(n=>n?this._resolveUnknownParentChain(n).then(o=>this._resolveTreeNode(n,o[o.length-1]).then(r=>(o.push(r),o))):Promise.resolve([]))}_resolveParent(e){let n=this._nodes.get(e);return n?Promise.resolve(n.parent?this._elements.get(n.parent.item.handle):void 0):Cn(()=>this._dataProvider.getParent(e))}async _resolveTreeNode(e,n){let o=this._nodes.get(e);if(o)return o;let r=await Cn(()=>this._dataProvider.getTreeItem(e)),s=this._createHandle(e,r,n,!0);await this.getChildren(n?n.item.handle:void 0);let a=this.getExtensionElement(s);if(a){let l=this._nodes.get(a);if(l)return l}throw this._logService.error(`[TreeView:${this._viewId}] Failed to resolve tree node for element ${s}`),this._proxy.$logResolveTreeNodeFailure(this._extension.identifier.value),new Error(`Cannot resolve tree item for element ${s} from extension ${this._extension.identifier.value}`)}_getChildrenNodes(e){if(e){let n;if(typeof e=="string"){let o=this.getExtensionElement(e);n=o?this._nodes.get(o):void 0}else n=e;return n&&n.children||void 0}return this._roots}_getFetchKey(e){return e??i.ROOT_FETCH_KEY}async _fetchChildrenNodes(e){this._addChildrenToClear(e);let n=this._getFetchKey(e),o=++this._globalFetchTokenCounter;this._childrenFetchTokens.set(n,o);let r=new Ee(this._refreshCancellationSource.token);try{let s=await this._dataProvider.getChildren(e);if(this._childrenFetchTokens.get(n)!==o)return;let a=e?this._nodes.get(e):void 0;if(r.token.isCancellationRequested)return;let l=nt(s||[]),d=await Promise.all(nt(l).map(u=>this._dataProvider.getTreeItem(u)));if(this._childrenFetchTokens.get(n)!==o||r.token.isCancellationRequested)return;let c=d.map((u,m)=>u?this._createAndRegisterTreeNode(l[m],u,a):null);return this._childrenFetchTokens.get(n)!==o?void 0:nt(c)}finally{r.dispose()}}_refresh(e){if(e.some(o=>!o))return this._refreshCancellationSource.dispose(!0),this._refreshCancellationSource=new Ee,this._addChildrenToClear(),this._proxy.$refresh(this._viewId);{let o=this._getHandlesToRefresh(e);if(o.length)return this._refreshHandles(o)}return Promise.resolve(void 0)}_getHandlesToRefresh(e){let n=new Set,o=e.map(s=>this._nodes.get(s));for(let s of o)if(s&&!n.has(s.item.handle)){let a=s;for(;a&&a.parent&&o.findIndex(l=>a&&a.parent&&l&&l.item.handle===a.parent.item.handle)===-1;){let l=this._elements.get(a.parent.item.handle);a=l?this._nodes.get(l):void 0}a&&!a.parent&&n.add(s.item.handle)}let r=[];return n.forEach(s=>{let a=this._elements.get(s);if(a){let l=this._nodes.get(a);l&&(!l.parent||!n.has(l.parent.item.handle))&&r.push(s)}}),r}_refreshHandles(e){let n={};return Promise.all(e.map(o=>this._refreshNode(o).then(r=>{r&&(n[o]=r.item)}))).then(()=>Object.keys(n).length?this._proxy.$refresh(this._viewId,n):void 0)}_refreshNode(e){let n=this.getExtensionElement(e);if(n){let o=this._nodes.get(n);if(o)return this._addChildrenToClear(n),Cn(()=>this._dataProvider.getTreeItem(n)).then(r=>{if(r){let s=this._createTreeNode(n,r,o.parent);return this._updateNodeCache(n,s,o,o.parent),o.dispose(),s}return null})}return Promise.resolve(null)}_createAndRegisterTreeNode(e,n,o){let r=n.id?`${i.ID_HANDLE_PREFIX}/${n.id}`:void 0;if(r){let a=this._elements.get(r);if(a){let l=this._nodes.get(a);if(a!==e&&this._nodes.delete(a),l){let d=this._createTreeNode(e,n,o);return this._updateNodeCache(e,d,l,o),l.dispose(),d}}}let s=this._createTreeNode(e,n,o);return this._addNodeToCache(e,s),this._addNodeToParentCache(s,o),s}_getTooltip(e){return en.isMarkdownString(e)?fe.from(e):e}_getCommand(e,n){return n?{...this._commands.toInternal(n,e),originalId:n.command}:void 0}_getCheckbox(e){if(e.checkboxState===void 0)return;let n,o,r;return typeof e.checkboxState=="number"?n=e.checkboxState:(n=e.checkboxState.state,o=e.checkboxState.tooltip,r=e.checkboxState.accessibilityInformation),{isChecked:n===1,tooltip:o,accessibilityInformation:r}}_validateTreeItem(e){if(!Ws.isTreeItem(e,this._extension))throw new Error(`Extension ${this._extension.identifier.value} has provided an invalid tree item.`)}_createTreeNode(e,n,o){this._validateTreeItem(n);let r=this._register(new $),s=this._createHandle(e,n,o),a=this._getLightIconPath(n);return{item:{handle:s,parentHandle:o?o.item.handle:void 0,label:X9(n.label,this._extension),description:n.description,resourceUri:n.resourceUri,tooltip:this._getTooltip(n.tooltip),command:this._getCommand(r,n.command),contextValue:n.contextValue,icon:a,iconDark:this._getDarkIconPath(n)||a,themeIcon:this._getThemeIcon(n),collapsibleState:Wt(n.collapsibleState)?0:n.collapsibleState,accessibilityInformation:n.accessibilityInformation,checkbox:this._getCheckbox(n)},extensionItem:n,parent:o,children:void 0,disposableStore:r,dispose(){r.dispose()}}}_getThemeIcon(e){return e.iconPath instanceof fn?e.iconPath:void 0}_createHandle(e,{id:n,label:o,resourceUri:r},s,a){if(n)return`${i.ID_HANDLE_PREFIX}/${n}`;let l=X9(o,this._extension),d=s?s.item.handle:i.LABEL_HANDLE_PREFIX,c="";l&&(qo(l.label)?c=l.label.value:c=l.label);let u=c||(r?Ze(r):"");u=u.indexOf("/")!==-1?u.replace("/","//"):u;let m=this._nodes.has(e)?this._nodes.get(e).item.handle:void 0,g=this._getChildrenNodes(s)||[],h,f=0;do{if(h=`${d}/${f}:${u}`,a||!this._elements.has(h)||m===h)break;f++}while(f<=g.length);return h}_getLightIconPath(e){if(e.iconPath&&!(e.iconPath instanceof fn))return typeof e.iconPath=="string"||y.isUri(e.iconPath)?this._getIconPath(e.iconPath):this._getIconPath(e.iconPath.light)}_getDarkIconPath(e){if(e.iconPath&&!(e.iconPath instanceof fn)&&e.iconPath.dark)return this._getIconPath(e.iconPath.dark)}_getIconPath(e){return y.isUri(e)?e:y.file(e)}_addNodeToCache(e,n){this._elements.set(n.item.handle,e),this._nodes.set(e,n)}_updateNodeCache(e,n,o,r){this._elements.delete(n.item.handle),this._nodes.delete(e),n.item.handle!==o.item.handle&&this._elements.delete(o.item.handle),this._addNodeToCache(e,n);let s=this._getChildrenNodes(r)||[],a=s.filter(l=>l.item.handle===o.item.handle)[0];a&&s.splice(s.indexOf(a),1,n)}_addNodeToParentCache(e,n){n?(n.children||(n.children=[]),n.children.push(e)):(this._roots||(this._roots=[]),this._roots.push(e))}_addChildrenToClear(e){if(e){let n=this._nodes.get(e);if(n){if(n.children)for(let o of n.children){this._nodesToClear.add(o);let r=this._elements.get(o.item.handle);r&&(this._addChildrenToClear(r),this._nodes.delete(r),this._elements.delete(o.item.handle))}n.children=void 0}}else this._addAllToClear()}_addAllToClear(){this._roots=void 0,this._nodes.forEach(e=>{this._nodesToClear.add(e)}),this._nodes.clear(),this._elements.clear(),this._childrenFetchTokens.clear()}_clearNodes(e){In(e)}_clearAll(){this._roots=void 0,this._elements.clear(),In(this._nodes.values()),this._nodes.clear(),In(this._nodesToClear),this._nodesToClear.clear(),this._childrenFetchTokens.clear()}dispose(){super.dispose(),this._refreshCancellationSource.dispose(),this._clearAll()}};var C_=class i{constructor(t){this._openers=new Map;this._proxy=t.getProxy(F.MainThreadUriOpeners)}static{this.supportedSchemes=new Set([B.http,B.https])}registerExternalUriOpener(t,e,n,o){if(this._openers.has(e))throw new Error(`Opener with id '${e}' already registered`);let r=o.schemes.find(s=>!i.supportedSchemes.has(s));if(r)throw new Error(`Scheme '${r}' is not supported. Only http and https are currently supported.`);return this._openers.set(e,n),this._proxy.$registerUriOpener(e,o.schemes,t,o.label),q(()=>{this._openers.delete(e),this._proxy.$unregisterUriOpener(e)})}async $canOpenUri(t,e,n){let o=this._openers.get(t);if(!o)throw new Error(`Unknown opener with id: ${t}`);let r=y.revive(e);return o.canOpenExternalUri(r,n)}async $openUri(t,e,n){let o=this._openers.get(t);if(!o)throw new Error(`Unknown opener id: '${t}'`);return o.openExternalUri(y.revive(e.resolvedUri),{sourceUri:y.revive(e.sourceUri)},n)}};var lF=class extends N{constructor(e,n,o,r){super();this.#a=void 0;this.#d=!0;this.#i=!1;this.#u=this._register(new T);this.onDidDispose=this.#u.event;this.#p=this._register(new T);this.onDidChangeViewState=this.#p.event;this.#e=e,this.#t=n,this.#o=o,this.#n=r.viewType,this.#s=r.panelOptions,this.#a=r.viewColumn,this.#r=r.title,this.#c=r.active}#e;#t;#n;#o;#s;#r;#l;#a;#d;#c;#i;#u;#p;dispose(){this.#i||(this.#i=!0,this.#u.fire(),this.#t.$disposeWebview(this.#e),this.#o.dispose(),super.dispose())}get webview(){return this.assertNotDisposed(),this.#o}get viewType(){return this.assertNotDisposed(),this.#n}get title(){return this.assertNotDisposed(),this.#r}set title(e){this.assertNotDisposed(),this.#r!==e&&(this.#r=e,this.#t.$setTitle(this.#e,e))}get iconPath(){return this.assertNotDisposed(),this.#l}set iconPath(e){this.assertNotDisposed(),this.#l!==e&&(this.#l=e,y.isUri(e)?this.#t.$setIconPath(this.#e,{light:e,dark:e}):this.#t.$setIconPath(this.#e,e))}get options(){return this.#s}get viewColumn(){if(this.assertNotDisposed(),!(typeof this.#a=="number"&&this.#a<0))return this.#a}get active(){return this.assertNotDisposed(),this.#c}get visible(){return this.assertNotDisposed(),this.#d}_updateViewState(e){this.#i||(this.active!==e.active||this.visible!==e.visible||this.viewColumn!==e.viewColumn)&&(this.#c=e.active,this.#d=e.visible,this.#a=e.viewColumn,this.#p.fire({webviewPanel:this}))}reveal(e,n){this.assertNotDisposed(),this.#t.$reveal(this.#e,{viewColumn:typeof e>"u"?void 0:zt.from(e),preserveFocus:!!n})}assertNotDisposed(){if(this.#i)throw new Error("Webview is disposed")}},T_=class i extends N{constructor(e,n,o){super();this.webviews=n;this.workspace=o;this._webviewPanels=new Map;this._serializers=new Map;this._proxy=e.getProxy(F.MainThreadWebviewPanels)}static newHandle(){return _e()}dispose(){super.dispose(),this._webviewPanels.forEach(e=>e.dispose()),this._webviewPanels.clear()}createWebviewPanel(e,n,o,r,s={}){let a=typeof r=="object"?r.viewColumn:r,l={viewColumn:zt.from(a),preserveFocus:typeof r=="object"&&!!r.preserveFocus},d=Cl(e),c=i.newHandle();this._proxy.$createWebviewPanel(vp(e),c,n,{title:o,panelOptions:hee(s),webviewOptions:QN(e,this.workspace,s),serializeBuffersForPostMessage:d},l);let u=this.webviews.createNewWebview(c,s,e);return this.createNewWebviewPanel(c,n,o,a,s,u,!0)}$onDidChangeWebviewPanelViewStates(e){let n=Object.keys(e);n.sort((o,r)=>{let s=e[o],a=e[r];return s.active?1:a.active?-1:+s.visible-+a.visible});for(let o of n){let r=this.getWebviewPanel(o);if(!r)continue;let s=e[o];r._updateViewState({active:s.active,visible:s.visible,viewColumn:zt.to(s.position)})}}async $onDidDisposeWebviewPanel(e){this.getWebviewPanel(e)?.dispose(),this._webviewPanels.delete(e),this.webviews.deleteWebview(e)}registerWebviewPanelSerializer(e,n,o){if(this._serializers.has(n))throw new Error(`Serializer for '${n}' already registered`);return this._serializers.set(n,{serializer:o,extension:e}),this._proxy.$registerSerializer(n,{serializeBuffersForPostMessage:Cl(e)}),new Se(()=>{this._serializers.delete(n),this._proxy.$unregisterSerializer(n)})}async $deserializeWebviewPanel(e,n,o,r){let s=this._serializers.get(n);if(!s)throw new Error(`No serializer found for '${n}'`);let{serializer:a,extension:l}=s,d=this.webviews.createNewWebview(e,o.webviewOptions,l),c=this.createNewWebviewPanel(e,n,o.title,r,o.panelOptions,d,o.active);await a.deserializeWebviewPanel(c,o.state)}createNewWebviewPanel(e,n,o,r,s,a,l){let d=new lF(e,this._proxy,a,{viewType:n,title:o,viewColumn:r,panelOptions:s,active:l});return this._webviewPanels.set(e,d),d}getWebviewPanel(e){return this._webviewPanels.get(e)}};function hee(i){return{enableFindWidget:i.enableFindWidget,retainContextWhenHidden:i.retainContextWhenHidden}}var dF=class extends N{constructor(e,n,o,r,s,a){super();this.#s=!1;this.#c=this._register(new T);this.onDidChangeVisibility=this.#c.event;this.#i=this._register(new T);this.onDidDispose=this.#i.event;this.#n=o,this.#l=r,this.#e=e,this.#t=n,this.#o=s,this.#r=a}#e;#t;#n;#o;#s;#r;#l;#a;#d;dispose(){this.#s||(this.#s=!0,this.#i.fire(),this.#o.dispose(),super.dispose())}#c;#i;get title(){return this.assertNotDisposed(),this.#l}set title(e){this.assertNotDisposed(),this.#l!==e&&(this.#l=e,this.#t.$setWebviewViewTitle(this.#e,e))}get description(){return this.assertNotDisposed(),this.#a}set description(e){this.assertNotDisposed(),this.#a!==e&&(this.#a=e,this.#t.$setWebviewViewDescription(this.#e,e))}get visible(){return this.#r}get webview(){return this.#o}get viewType(){return this.#n}_setVisible(e){e===this.#r||this.#s||(this.#r=e,this.#c.fire())}get badge(){return this.assertNotDisposed(),this.#d}set badge(e){this.assertNotDisposed(),!(e?.value===this.#d?.value&&e?.tooltip===this.#d?.tooltip)&&(this.#d=Ib.from(e),this.#t.$setWebviewViewBadge(this.#e,e))}show(e){this.assertNotDisposed(),this.#t.$show(this.#e,!!e)}assertNotDisposed(){if(this.#s)throw new Error("Webview is disposed")}},E_=class{constructor(t,e){this._extHostWebview=e;this._viewProviders=new Map;this._webviewViews=new Map;this._proxy=t.getProxy(F.MainThreadWebviewViews)}registerWebviewViewProvider(t,e,n,o){if(this._viewProviders.has(e))throw new Error(`View provider for '${e}' already registered`);return this._viewProviders.set(e,{provider:n,extension:t}),this._proxy.$registerWebviewViewProvider(vp(t),e,{retainContextWhenHidden:o?.retainContextWhenHidden,serializeBuffersForPostMessage:Cl(t)}),new Se(()=>{this._viewProviders.delete(e),this._proxy.$unregisterWebviewViewProvider(e)})}async $resolveWebviewView(t,e,n,o,r){let s=this._viewProviders.get(e);if(!s)throw new Error(`No view provider found for '${e}'`);let{provider:a,extension:l}=s,d=this._extHostWebview.createNewWebview(t,{},l),c=new dF(t,this._proxy,e,n,d,!0);this._webviewViews.set(t,c),await a.resolveWebviewView(c,{state:o},r)}async $onDidChangeWebviewViewVisibility(t,e){this.getWebviewView(t)._setVisible(e)}async $disposeWebviewView(t){let e=this.getWebviewView(t);this._webviewViews.delete(t),e.dispose(),this._extHostWebview.deleteWebview(t)}getWebviewView(t){let e=this._webviewViews.get(t);if(!e)throw new Error("No webview found");return e}};var Lh=class extends N{constructor(e,n,o){super();this._commands=n;this._editorTabs=o;this._handlePool=0;this._providers=new Map;this._itemPool=0;this._globalItems=new Map;this._providerItems=new Map;this._proxy=e.getProxy(F.MainThreadChatContext)}async $provideWorkspaceChatContext(e,n){this._clearProviderItems(e);let o=this._providers.get(e);if(!o||o.type!=="workspace")throw new Error("Workspace context provider not found");let s=await o.provider.provideWorkspaceChatContext?.(n)??[];return this._convertItems(e,s)}async $provideExplicitChatContext(e,n){this._clearProviderItems(e);let o=this._providers.get(e);if(!o||o.type!=="explicit")throw new Error("Explicit context provider not found");let s=await o.provider.provideAttachChatContext?.(n)??[];return this._convertItems(e,s)}async $resolveExplicitChatContext(e,n,o){let r=this._providers.get(e);if(!r||r.type!=="explicit")throw new Error("Explicit context provider not found");let s=r.provider,a=this._globalItems.get(n.handle);if(!a)throw new Error("Chat context item not found");return this._doResolve(s.resolveAttachChatContext?.bind(s),n,a,o)}async $provideResourceChatContext(e,n,o){let r=this._providers.get(e);if(!r||r.type!=="resource")throw new Error("Resource context provider not found");let s=r.provider,a=y.revive(n.resource),l=this._findTab(a,n.viewType);if(!l)return;let d=await s.provideChatTabContext?.({tab:l},o);if(!d)return;if(d.label===void 0&&d.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let u={handle:this._addTrackedItem(e,d),iconPath:d.iconPath,label:d.label,resourceUri:d.resourceUri,modelDescription:d.modelDescription,tooltip:d.tooltip?fe.from(d.tooltip):void 0,value:n.withValue?d.value:void 0,command:d.command?{id:d.command.command}:void 0};if(n.withValue&&!u.value){let m=await s.resolveChatTabContext?.bind(s)(d,o);u.value=m?.value,u.tooltip=m?.tooltip?fe.from(m.tooltip):u.tooltip}return u}async $resolveResourceChatContext(e,n,o){let r=this._providers.get(e);if(!r||r.type!=="resource")throw new Error("Resource context provider not found");let s=r.provider,a=this._globalItems.get(n.handle);if(!a)throw new Error("Chat context item not found");return this._doResolve(s.resolveChatTabContext?.bind(s),n,a,o)}async $executeChatContextItemCommand(e){let n=this._globalItems.get(e);if(!n)throw new Error("Chat context item not found");if(!n.command)throw new Error("Chat context item has no command");let o=n.command.arguments?[n,...n.command.arguments]:[n];await this._commands.executeCommand(n.command.command,...o)}registerChatWorkspaceContextProvider(e,n){let o=this._handlePool++,r=new $;return this._providers.set(o,{type:"workspace",provider:n,disposables:r}),this._listenForWorkspaceContextChanges(o,n,r),this._proxy.$registerChatWorkspaceContextProvider(o,e),{dispose:()=>{this._providers.delete(o),this._clearProviderItems(o),this._providerItems.delete(o),this._proxy.$unregisterChatContextProvider(o),r.dispose()}}}registerChatAttachContextProvider(e,n){let o=this._handlePool++,r=new $;return this._providers.set(o,{type:"explicit",provider:n,disposables:r}),this._proxy.$registerChatExplicitContextProvider(o,e),{dispose:()=>{this._providers.delete(o),this._clearProviderItems(o),this._providerItems.delete(o),this._proxy.$unregisterChatContextProvider(o),r.dispose()}}}registerChatTabContextProvider(e,n,o){let r=this._handlePool++,s=new $;return this._providers.set(r,{type:"resource",provider:o,disposables:s}),this._proxy.$registerChatResourceContextProvider(r,n,iL.from(e)),{dispose:()=>{this._providers.delete(r),this._clearProviderItems(r),this._providerItems.delete(r),this._proxy.$unregisterChatContextProvider(r),s.dispose()}}}_findTab(e,n){let o;for(let r of this._editorTabs.tabGroups.all)for(let s of r.tabs){let a=s.input;if(a){if(y.isUri(a.uri)&&Sn(a.uri,e))return s;n!==void 0&&a.viewType===n&&(!o||s.isActive)&&(o=s)}}return o}_clearProviderItems(e){let n=this._providerItems.get(e);if(n){for(let o of n)this._globalItems.delete(o);n.clear()}}_addTrackedItem(e,n){let o=this._itemPool++;return this._globalItems.set(o,n),this._providerItems.has(e)||this._providerItems.set(e,new Set),this._providerItems.get(e).add(o),o}_convertItems(e,n){let o=[];for(let r of n){if(r.label===void 0&&r.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let s=this._addTrackedItem(e,r);o.push({handle:s,iconPath:r.iconPath,label:r.label,resourceUri:r.resourceUri,modelDescription:r.modelDescription,tooltip:r.tooltip?fe.from(r.tooltip):void 0,value:r.value,command:r.command?{id:r.command.command}:void 0})}return o}async _doResolve(e,n,o,r){let s=await e(o,r);return s?{handle:n.handle,iconPath:s.iconPath,label:s.label,resourceUri:s.resourceUri,modelDescription:s.modelDescription,tooltip:s.tooltip?fe.from(s.tooltip):void 0,value:s.value,command:s.command?{id:s.command.command}:void 0}:n}_listenForWorkspaceContextChanges(e,n,o){if(!n.onDidChangeWorkspaceChatContext)return;let r=async()=>{let s=await n.provideWorkspaceChatContext?.(pe.None),a=this._convertItems(e,s??[]);return this._proxy.$updateWorkspaceContextItems(e,a)};o.add(n.onDidChangeWorkspaceChatContext(async()=>r())),r()}dispose(){super.dispose();for(let{disposables:e}of this._providers.values())e.dispose()}};Lh=_([S(0,le),S(1,Bn),S(2,jr)],Lh);var Oh=class extends N{constructor(e){super();this._nextHandle=0;this._activeProgress=new Map;this._onDidAddCoreEvent=this._register(new T({onWillAddFirstListener:()=>this._proxy.$subscribeToCoreDebugEvents(),onDidRemoveLastListener:()=>this._proxy.$unsubscribeFromCoreDebugEvents()}));this.onDidAddCoreEvent=this._onDidAddCoreEvent.event;this._proxy=e.getProxy(F.MainThreadChatDebug)}_progressKey(e,n){return`${e}:${y.revive(n).toString()}`}_cleanupProgress(e){let n=this._activeProgress.get(e);n&&(n.dispose(),this._activeProgress.delete(e))}registerChatDebugLogProvider(e){if(this._provider)throw new Error("A ChatDebugLogProvider is already registered.");this._provider=e;let n=this._nextHandle++;return this._proxy.$registerChatDebugLogProvider(n),q(()=>{this._provider=void 0;for(let[o,r]of this._activeProgress)o.startsWith(`${n}:`)&&(r.dispose(),this._activeProgress.delete(o));this._proxy.$unregisterChatDebugLogProvider(n)})}async $provideChatDebugLog(e,n,o){if(!this._provider)return;let r=this._progressKey(e,n);this._cleanupProgress(r);let s=new $;this._activeProgress.set(r,s);let a=s.add(new T);s.add(a.event(l=>{let d=this._serializeEvent(l);d.sessionResource||(d.sessionResource=n),this._proxy.$acceptChatDebugEvent(e,d)})),s.add(o.onCancellationRequested(()=>{this._cleanupProgress(r)}));try{let l={report:u=>a.fire(u)},d=y.revive(n),c=await this._provider.provideChatDebugLog(d,l,o);return c?c.map(u=>this._serializeEvent(u)):void 0}catch(l){throw this._cleanupProgress(r),l}}_serializeEvent(e){let n={id:e.id,sessionResource:e.sessionResource,created:e.created.getTime(),parentEventId:e.parentEventId};switch(e._kind){case"toolCall":{let r=e;return{...n,kind:"toolCall",toolName:r.toolName,toolCallId:r.toolCallId,input:r.input,output:r.output,result:r.result===0?"success":r.result===1?"error":void 0,durationInMillis:r.durationInMillis}}case"modelTurn":{let r=e;return{...n,kind:"modelTurn",model:r.model,requestName:r.requestName,inputTokens:r.inputTokens,outputTokens:r.outputTokens,cachedTokens:r.cachedTokens,totalTokens:r.totalTokens,copilotUsageNanoAiu:r.copilotUsageNanoAiu,durationInMillis:r.durationInMillis}}case"generic":{let r=e;return{...n,kind:"generic",name:r.name,details:r.details,level:r.level,category:r.category}}case"subagentInvocation":{let r=e;return{...n,kind:"subagentInvocation",agentName:r.agentName,description:r.description,status:r.status===0?"running":r.status===1?"completed":r.status===2?"failed":void 0,durationInMillis:r.durationInMillis,toolCallCount:r.toolCallCount,modelTurnCount:r.modelTurnCount}}case"userMessage":{let r=e;return{...n,kind:"userMessage",message:r.message,sections:r.sections.map(s=>({name:s.name,content:s.content}))}}case"agentResponse":{let r=e;return{...n,kind:"agentResponse",message:r.message,sections:r.sections.map(s=>({name:s.name,content:s.content}))}}default:{let r=e,s=r.name,a=r.details;return{...n,kind:"generic",name:typeof s=="string"?s:"",details:typeof a=="string"?a:void 0,level:r.level??1,category:r.category}}}}async $resolveChatDebugLogEvent(e,n,o){if(!this._provider?.resolveChatDebugLogEvent)return;let r=await this._provider.resolveChatDebugLogEvent(n,o);if(!r)return;switch(r._kind){case"text":return{kind:"text",value:r.value};case"messageContent":{let a=r;return{kind:"message",type:a.type===0?"user":"agent",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"userMessage":{let a=r;return{kind:"message",type:"user",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"agentResponse":{let a=r;return{kind:"message",type:"agent",message:a.message,sections:a.sections.map(l=>({name:l.name,content:l.content}))}}case"toolCallContent":{let a=r;return{kind:"toolCall",toolName:a.toolName,result:a.result===0?"success":a.result===1?"error":void 0,durationInMillis:a.durationInMillis,input:a.input,output:a.output}}case"modelTurnContent":{let a=r;return{kind:"modelTurn",requestName:a.requestName,model:a.model,status:a.status,durationInMillis:a.durationInMillis,timeToFirstTokenInMillis:a.timeToFirstTokenInMillis,requestId:a.requestId,maxInputTokens:a.maxInputTokens,maxOutputTokens:a.maxOutputTokens,inputTokens:a.inputTokens,outputTokens:a.outputTokens,cachedTokens:a.cachedTokens,totalTokens:a.totalTokens,requestOptions:a.requestOptions,errorMessage:a.errorMessage,sections:a.sections?.map(l=>({name:l.name,content:l.content}))}}case"hookContent":{let a=r;return{kind:"hook",hookType:a.hookType,command:a.command,result:a.result===0?"success":a.result===1?"error":a.result===2?"nonBlockingError":void 0,durationInMillis:a.durationInMillis,input:a.input,output:a.output,exitCode:a.exitCode,errorMessage:a.errorMessage}}default:return}}_deserializeEvent(e){let n=new Date(e.created),o=e.sessionResource?y.revive(e.sessionResource):void 0;switch(e.kind){case"toolCall":{let r=new bg(e.toolName,n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.toolCallId=e.toolCallId,r.input=e.input,r.output=e.output,r.result=e.result==="success"?0:e.result==="error"?1:void 0,r.durationInMillis=e.durationInMillis,r}case"modelTurn":{let r=new Ig(n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.model=e.model,r.requestName=e.requestName,r.inputTokens=e.inputTokens,r.outputTokens=e.outputTokens,r.cachedTokens=e.cachedTokens,r.totalTokens=e.totalTokens,r.copilotUsageNanoAiu=e.copilotUsageNanoAiu,r.durationInMillis=e.durationInMillis,r}case"generic":{let r=new xg(e.name,e.level,n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.details=e.details,r.category=e.category,r}case"subagentInvocation":{let r=new Sg(e.agentName,n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.description=e.description,r.status=e.status==="running"?0:e.status==="completed"?1:e.status==="failed"?2:void 0,r.durationInMillis=e.durationInMillis,r.toolCallCount=e.toolCallCount,r.modelTurnCount=e.modelTurnCount,r}case"userMessage":{let r=new Cg(e.message,n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.sections=e.sections.map(s=>new Uu(s.name,s.content)),r}case"agentResponse":{let r=new Tg(e.message,n);return r.id=e.id,r.sessionResource=o,r.parentEventId=e.parentEventId,r.sections=e.sections.map(s=>new Uu(s.name,s.content)),r}default:return}}$onCoreDebugEvent(e){let n=this._deserializeEvent(e);n&&this._onDidAddCoreEvent.fire(n)}async $exportChatDebugLog(e,n,o,r,s){if(!this._provider?.provideChatDebugLogExport)return;let a=y.revive(n),d={coreEvents:o.map(u=>this._deserializeEvent(u)).filter(u=>u!==void 0),sessionTitle:r},c=await this._provider.provideChatDebugLogExport(a,d,s);if(c)return H.wrap(c)}async $importChatDebugLog(e,n,o){if(!this._provider?.resolveChatDebugLogImport)return;let r=await this._provider.resolveChatDebugLogImport(n.buffer,o);if(r)return{uri:r.uri,sessionTitle:r.sessionTitle}}async $getAvailableDebugSessionResources(e,n){return this._provider?.provideAvailableDebugSessionResources?await this._provider.provideAvailableDebugSessionResources(n)??[]:[]}dispose(){for(let e of this._activeProgress.values())e.dispose();this._activeProgress.clear(),super.dispose()}};Oh=_([S(0,le)],Oh);function vee(i,t){if(t.isRemoteResolverTerminal)return M(i,"terminalRemoteResolver"),{isRemoteResolverTerminal:!0}}function Z9(i){let t=i.get(Ye),e=i.get(ai),n=i.get(oa),o=i.get(io),r=i.get(Vn),s=i.get(oc),a=i.get(_n),l=i.get(xs),d=i.get(le),c=i.get(tf),u=i.get(of),m=i.get(ir),g=i.get(te),h=i.get(tc),f=i.get(Zi),I=i.get(sp),x=i.get(ok),E=i.get(ap),w=i.get(Tf),R=i.get(jr),L=i.get(lc),U=i.get(zf),z=i.get(lp),Y=i.get(yf),j=i.get(bf),Q=i.get(mp),Z=i.get(dk),me=i.get(uk),vt=i.get(mk);d.set(ge.ExtHostFileSystemInfo,e),d.set(ge.ExtHostLogLevelServiceShape,m),d.set(ge.ExtHostWorkspace,r),d.set(ge.ExtHostConfiguration,a),d.set(ge.ExtHostExtensionService,o),d.set(ge.ExtHostStorage,c),d.set(ge.ExtHostTunnelService,h),d.set(ge.ExtHostWindow,I),d.set(ge.ExtHostPower,x),d.set(ge.ExtHostUrls,E),d.set(ge.ExtHostSecretState,w),d.set(ge.ExtHostTelemetry,s),d.set(ge.ExtHostEditorTabs,R),d.set(ge.ExtHostManagedSockets,L),d.set(ge.ExtHostBrowserTunnelProxy,U),d.set(ge.ExtHostProgress,z),d.set(ge.ExtHostAuthentication,Y),d.set(ge.ExtHostChatProvider,j),d.set(ge.ExtHostDataChannels,Z),d.set(ge.ExtHostMeteredConnection,me),d.set(ge.ExtHostGitExtension,vt);let ut=d.set(ge.ExtHostDecorations,i.get($w)),ie=d.set(ge.ExtHostDocumentsAndEditors,i.get(Kr)),ee=d.set(ge.ExtHostCommands,i.get(Bn)),ne=d.set(ge.ExtHostTerminalService,i.get(Ao)),se=d.set(ge.ExtHostTerminalShellIntegration,i.get(Kf)),X=d.set(ge.ExtHostDebugService,i.get(Hf)),ae=d.set(ge.ExtHostSearch,i.get(Bf)),be=d.set(ge.ExtHostTask,i.get(Lf)),yt=d.set(ge.ExtHostOutputService,i.get(Bw)),Qe=d.set(ge.ExtHostLocalization,i.get(wf)),He=d.set(ge.ExtHostDocuments,new Xk(d,ie)),qt=d.set(ge.ExtHostDocumentContentProviders,new Jk(d,ie,g)),Gt=d.set(ge.ExtHostDocumentSaveParticipant,new Yk(g,He,d.getProxy(F.MainThreadBulkEdits))),It=d.set(ge.ExtHostNotebook,new a_(d,ee,ie,He,n,ae,g)),Lo=d.set(ge.ExtHostNotebookDocuments,new d_(It)),ga=d.set(ge.ExtHostNotebookEditors,new Rh(g,It)),ss=d.set(ge.ExtHostNotebookKernels,new Dh(d,t,It,ee,g)),Ti=d.set(ge.ExtHostNotebookRenderers,new u_(d,It)),Ei=d.set(ge.ExtHostNotebookDocumentSaveParticipant,new l_(g,It,d.getProxy(F.MainThreadBulkEdits))),Je=d.set(ge.ExtHostEditors,new b_(d,ie)),We=d.set(ge.ExtHostTreeViews,new S_(d.getProxy(F.MainThreadTreeViews),ee,g)),fa=d.set(ge.ExtHostEditorInsets,new Bk(d.getProxy(F.MainThreadEditorInsets),Je,t.remote)),Oo=d.set(ge.ExtHostDiagnostics,new Si(d,g,e,ie)),Jr=d.set(ge.ExtHostLanguages,new GP(d,He,ee.converter,l)),tt=d.set(ge.ExtHostLanguageFeatures,new kP(d,l,He,ee,Oo,g,f,s)),_p=d.set(ge.ExtHostCodeMapper,new $k(d)),Yh=d.set(ge.ExtHostFileSystem,new nP(d,tt)),Yr=d.set(ge.ExtHostFileSystemEventService,new aP(d,g,ie)),as=d.set(ge.ExtHostQuickOpen,j9(d,r,ee)),Pl=d.set(ge.ExtHostSCM,new Ah(d,ee,He,g)),No=d.set(ge.ExtHostQuickDiff,new m_(d,He,l)),_l=d.set(ge.ExtHostAgentEditorComments,new g_(d)),hn=d.set(ge.ExtHostShare,new f_(d,l)),po=d.set(ge.ExtHostComments,Yz(d,ee,He)),KI=d.set(ge.ExtHostLabelService,new dP(d)),Xh=d.set(ge.ExtHostTheming,new Mh(d)),Cc=d.set(ge.ExtHostTimeline,new I_(d,ee)),ha=d.set(ge.ExtHostWebviews,new qk(d,t.remote,r,g,f)),O=d.set(ge.ExtHostWebviewPanels,new T_(d,ha,r)),G=d.set(ge.ExtHostCustomEditors,new jk(d,He,u,ha,O)),J=d.set(ge.ExtHostWebviewViews,new E_(d,ha)),we=d.set(ge.ExtHostTesting,i.get(Il)),Ke=d.set(ge.ExtHostUriOpeners,new C_(d)),zn=d.set(ge.ExtHostProfileContentHandlers,new p_(d)),Lt=d.set(ge.ExtHostChatOutputRenderer,new Nk(d,ha));d.set(ge.ExtHostInteractive,new lP(d,It,ie,ee,g));let qn=d.set(ge.ExtHostLanguageModelTools,new jP(d,j)),an=d.set(ge.ExtHostChatSessions,new lh(ee,j,d,g)),it=d.set(ge.ExtHostChatAgents2,new Mk(d,g,ee,He,ie,j,Oo,qn,an)),Zo=d.set(ge.ExtHostChatContext,new Lh(d,ee,R)),vn=d.set(ge.ExtHostChatDebug,new Oh(d)),Kn=d.set(ge.ExtHostAiRelatedInformation,new _k(d)),So=d.set(ge.ExtHostAiEmbeddingVector,new eP(d)),ur=d.set(ge.ExtHostAiSettingsSearch,new Rk(d)),je=d.set(ge.ExtHostStatusBar,new y_(d,ee.converter)),bt=d.set(ge.ExtHostSpeech,new h_(d)),Ft=d.set(ge.ExtHostEmbeddings,new Zk(d)),Ht=d.set(ge.ExtHostBrowsers,new v_(d)),Yn=d.set(ge.ExtHostChatQuota,new Hk(d));d.set(ge.ExtHostMcp,i.get(mp));let Zh=Object.values(ge);d.assertRegistered(Zh);let Rl=new sh(d,ie),Dl=new Vk(d),jI=new kh(d,g),iR=new Qk(d),$F=new Fk(d),zF=new Wk(d);return Ak.register(ee),function(P,va,GI){function ue(b){return(C,D,Ce)=>{let xt=b(ln=>{try{C.call(D,ln)}catch(nH){ba(new em(P.identifier,nH,"FAILED to handle event"))}});return Ce?.push(xt),xt}}let Kt=(function(){let b=!P.isUnderDevelopment;function C(){b||(g.info(`Extension '${P.identifier.value}' uses a document selector without scheme. Learn more about this: https://go.microsoft.com/fwlink/?linkid=872305`),b=!0)}return function D(Ce){if(Array.isArray(Ce))Ce.forEach(D);else if(typeof Ce=="string")C();else{let xt=Ce;typeof xt.scheme>"u"&&C(),typeof xt.exclusive=="boolean"&&M(P,"documentFiltersExclusive")}return Ce}})(),qF={getSession(b,C,D){return(typeof D?.forceNewSession=="object"&&D.forceNewSession.learnMore||typeof D?.createIfNone=="object"&&D.createIfNone.learnMore)&&M(P,"authLearnMore"),D?.authorizationServer&&M(P,"authIssuers"),Y.getSession(P,b,C,D)},getAccounts(b){return Y.getAccounts(b)},async hasSession(b,C){return M(P,"authSession"),!!await Y.getSession(P,b,C,{silent:!0})},get onDidChangeSessions(){return ue(Y.getExtensionScopedSessionsEvent(P.identifier.value))},registerAuthenticationProvider(b,C,D,Ce){return Ce?.supportedAuthorizationServers&&M(P,"authIssuers"),Y.registerAuthenticationProvider(b,C,D,Ce)}},KF={registerCommand(b,C,D){return ee.registerCommand(!0,b,C,D,void 0,P)},registerTextEditorCommand(b,C,D){return ee.registerCommand(!0,b,(...Ce)=>{let xt=Je.getActiveTextEditor();if(!xt){g.warn("Cannot execute "+b+" because there is no active text editor.");return}return xt.edit(ln=>{C.apply(D,[xt,ln,...Ce])}).then(ln=>{ln||g.warn("Edits from command "+b+" were not applied.")},ln=>{g.warn("An error occurred while running command "+b,ln)})},void 0,void 0,P)},registerDiffInformationCommand:(b,C,D)=>(M(P,"diffCommand"),ee.registerCommand(!0,b,async(...Ce)=>{let xt=ie.activeEditor(!0);if(!xt){g.warn("Cannot execute "+b+" because there is no active text editor.");return}let ln=await Je.getDiffInformation(xt.id);C.apply(D,[ln,...Ce])},void 0,void 0,P)),executeCommand(b,...C){return ee.executeCommand(b,...C)},getCommands(b=!1){return ee.getCommands(b)}},sR={get machineId(){return t.telemetryInfo.machineId},get devDeviceId(){return M(P,"devDeviceId"),t.telemetryInfo.devDeviceId??t.telemetryInfo.machineId},get isAppPortable(){return t.environment.isPortable??!1},get sessionId(){return t.telemetryInfo.sessionId},get language(){return t.environment.appLanguage},get appName(){return t.environment.appName},get appRoot(){return t.environment.appRoot?.fsPath??""},get appHost(){return t.environment.appHost},get uriScheme(){return t.environment.appUriScheme},get clipboard(){return Dl.value},get shell(){return ne.getDefaultShell(!1)},get onDidChangeShell(){return ue(ne.onDidChangeShell)},get isTelemetryEnabled(){return s.getTelemetryConfiguration()},get onDidChangeTelemetryEnabled(){return ue(s.onDidChangeTelemetryEnabled)},get telemetryConfiguration(){return M(P,"telemetry"),s.getTelemetryDetails()},get onDidChangeTelemetryConfiguration(){return M(P,"telemetry"),ue(s.onDidChangeTelemetryConfiguration)},get isMeteredConnection(){return M(P,"envIsConnectionMetered"),me.isConnectionMetered},get onDidChangeMeteredConnection(){return M(P,"envIsConnectionMetered"),ue(me.onDidChangeIsConnectionMetered)},get isNewAppInstall(){return nO(t.telemetryInfo.firstSessionDate)},createTelemetryLogger(b,C){return Fb.validateSender(b),s.instantiateLogger(P,b,C)},async openExternal(b,C){return I.openUri(b,{allowTunneling:t.remote.isRemote??(t.remote.authority?await h.hasTunnelProvider():!1),allowContributedOpeners:C?.allowContributedOpeners})},async asExternalUri(b){if(b.scheme===t.environment.appUriScheme)return E.createAppUri(b);try{return await I.asExternalUri(b,{allowTunneling:!!t.remote.authority})}catch(C){if(Rx(b,B.http)||Rx(b,B.https))return b;throw C}},get remoteName(){return jv(t.remote.authority)},get remoteAuthority(){return M(P,"resolvers"),t.remote.authority},get uiKind(){return t.uiKind},get logLevel(){return g.getLevel()},get onDidChangeLogLevel(){return ue(g.onDidChangeLogLevel)},get appQuality(){return M(P,"resolvers"),t.quality},get appCommit(){return M(P,"resolvers"),t.commit},getDataChannel(b){return M(P,"dataChannels"),Z.createDataChannel(P,b)},get power(){return M(P,"environmentPower"),{get onDidSuspend(){return ue(x.onDidSuspend)},get onDidResume(){return ue(x.onDidResume)},get onDidChangeOnBatteryPower(){return ue(x.onDidChangeOnBatteryPower)},get onDidChangeThermalState(){return ue(x.onDidChangeThermalState)},get onDidChangeSpeedLimit(){return ue(x.onDidChangeSpeedLimit)},get onWillShutdown(){return ue(x.onWillShutdown)},get onDidLockScreen(){return ue(x.onDidLockScreen)},get onDidUnlockScreen(){return ue(x.onDidUnlockScreen)},getSystemIdleState(b){return x.getSystemIdleState(b)},getSystemIdleTime(){return x.getSystemIdleTime()},getCurrentThermalState(){return x.getCurrentThermalState()},isOnBatteryPower(){return x.isOnBatteryPower()},async startPowerSaveBlocker(b){let C=await x.startPowerSaveBlocker(b);return{id:C.id,get isStarted(){return C.isStarted},dispose(){C.dispose()}}}}}};t.environment.extensionTestsLocationURI||Object.freeze(sR);let jF={createTestController(b,C,D){return we.createTestController(P,b,C,D)},createTestObserver(){return M(P,"testObserver"),we.createTestObserver()},runTests(b){return M(P,"testObserver"),we.runTests(b)},registerTestFollowupProvider(b){return M(P,"testObserver"),we.registerTestFollowupProvider(b)},get onDidChangeTestResults(){return M(P,"testObserver"),ue(we.onResultsChanged)},get testResults(){return M(P,"testObserver"),we.results}},ev=t.remote.isRemote?2:1,GF={getExtension(b,C){Le(P,"extensionsAny")||(C=!1);let D=va.mine.getExtensionDescription(b);if(D)return new cc(o,P.identifier,D,ev,!1);if(C){let Ce=va.all.getExtensionDescription(b);if(Ce)return new cc(o,P.identifier,Ce,ev,!0)}},get all(){let b=[];for(let C of va.mine.getAllExtensionDescriptions())b.push(new cc(o,P.identifier,C,ev,!1));return b},get allAcrossExtensionHosts(){M(P,"extensionsAny");let b=new $o(va.mine.getAllExtensionDescriptions().map(D=>D.identifier)),C=[];for(let D of va.all.getAllExtensionDescriptions()){let Ce=!b.has(D.identifier);C.push(new cc(o,P.identifier,D,ev,Ce))}return C},get onDidChange(){return Le(P,"extensionsAny")?ue(ye.any(va.mine.onDidChange,va.all.onDidChange)):ue(va.mine.onDidChange)}},QF={createDiagnosticCollection(b){return Oo.createDiagnosticCollection(P.identifier,b)},get onDidChangeDiagnostics(){return ue(Oo.onDidChangeDiagnostics)},getDiagnostics:b=>Oo.getDiagnostics(b),getLanguages(){return Jr.getLanguages()},setTextDocumentLanguage(b,C){return Jr.changeLanguage(b.uri,C)},match(b,C){let D=yL.from(b),Ce;return NN(D)&&(Ce=It.notebookDocuments.find(xt=>xt.apiNotebook.getCells().find(ln=>ln.document===C))?.apiNotebook),ON(D,C.uri,C.languageId,!0,Ce?.uri,Ce?.notebookType)},registerCodeActionsProvider(b,C,D){return tt.registerCodeActionProvider(P,Kt(b),C,D)},registerDocumentPasteEditProvider(b,C,D){return tt.registerDocumentPasteEditProvider(P,Kt(b),C,D)},registerCodeLensProvider(b,C){return tt.registerCodeLensProvider(P,Kt(b),C)},registerDefinitionProvider(b,C){return tt.registerDefinitionProvider(P,Kt(b),C)},registerDeclarationProvider(b,C){return tt.registerDeclarationProvider(P,Kt(b),C)},registerImplementationProvider(b,C){return tt.registerImplementationProvider(P,Kt(b),C)},registerTypeDefinitionProvider(b,C){return tt.registerTypeDefinitionProvider(P,Kt(b),C)},registerHoverProvider(b,C){return tt.registerHoverProvider(P,Kt(b),C,P.identifier)},registerEvaluatableExpressionProvider(b,C){return tt.registerEvaluatableExpressionProvider(P,Kt(b),C,P.identifier)},registerInlineValuesProvider(b,C){return tt.registerInlineValuesProvider(P,Kt(b),C,P.identifier)},registerDocumentHighlightProvider(b,C){return tt.registerDocumentHighlightProvider(P,Kt(b),C)},registerMultiDocumentHighlightProvider(b,C){return tt.registerMultiDocumentHighlightProvider(P,Kt(b),C)},registerLinkedEditingRangeProvider(b,C){return tt.registerLinkedEditingRangeProvider(P,Kt(b),C)},registerReferenceProvider(b,C){return tt.registerReferenceProvider(P,Kt(b),C)},registerRenameProvider(b,C){return tt.registerRenameProvider(P,Kt(b),C)},registerNewSymbolNamesProvider(b,C){return M(P,"newSymbolNamesProvider"),tt.registerNewSymbolNamesProvider(P,Kt(b),C)},registerDocumentSymbolProvider(b,C,D){return tt.registerDocumentSymbolProvider(P,Kt(b),C,D)},registerWorkspaceSymbolProvider(b){return tt.registerWorkspaceSymbolProvider(P,b)},registerDocumentFormattingEditProvider(b,C){return tt.registerDocumentFormattingEditProvider(P,Kt(b),C)},registerDocumentRangeFormattingEditProvider(b,C){return tt.registerDocumentRangeFormattingEditProvider(P,Kt(b),C)},registerOnTypeFormattingEditProvider(b,C,D,...Ce){return tt.registerOnTypeFormattingEditProvider(P,Kt(b),C,[D].concat(Ce))},registerDocumentSemanticTokensProvider(b,C,D){return tt.registerDocumentSemanticTokensProvider(P,Kt(b),C,D)},registerDocumentRangeSemanticTokensProvider(b,C,D){return tt.registerDocumentRangeSemanticTokensProvider(P,Kt(b),C,D)},registerSignatureHelpProvider(b,C,D,...Ce){return typeof D=="object"?tt.registerSignatureHelpProvider(P,Kt(b),C,D):tt.registerSignatureHelpProvider(P,Kt(b),C,typeof D>"u"?[]:[D,...Ce])},registerCompletionItemProvider(b,C,...D){return tt.registerCompletionItemProvider(P,Kt(b),C,D)},registerInlineCompletionItemProvider(b,C,D){return C.handleDidShowCompletionItem&&M(P,"inlineCompletionsAdditions"),C.handleDidPartiallyAcceptCompletionItem&&M(P,"inlineCompletionsAdditions"),D&&M(P,"inlineCompletionsAdditions"),tt.registerInlineCompletionsProvider(P,Kt(b),C,D)},get inlineCompletionsUnificationState(){return M(P,"inlineCompletionsAdditions"),tt.inlineCompletionsUnificationState},onDidChangeCompletionsUnificationState(b,C,D){return M(P,"inlineCompletionsAdditions"),ue(tt.onDidChangeInlineCompletionsUnificationState)(b,C,D)},registerDocumentLinkProvider(b,C){return tt.registerDocumentLinkProvider(P,Kt(b),C)},registerColorProvider(b,C){return tt.registerColorProvider(P,Kt(b),C)},registerFoldingRangeProvider(b,C){return tt.registerFoldingRangeProvider(P,Kt(b),C)},registerSelectionRangeProvider(b,C){return tt.registerSelectionRangeProvider(P,b,C)},registerCallHierarchyProvider(b,C){return tt.registerCallHierarchyProvider(P,b,C)},registerTypeHierarchyProvider(b,C){return tt.registerTypeHierarchyProvider(P,b,C)},setLanguageConfiguration:(b,C)=>tt.setLanguageConfiguration(P,b,C),getTokenInformationAtPosition(b,C){return M(P,"tokenInformation"),Jr.tokenAtPosition(b,C)},computeFullSyntaxHighlighting(b,C){return M(P,"documentSyntaxHighlighting"),Jr.computeFullSyntaxHighlighting(b,C)},get onDidChangeSyntaxHighlighting(){return M(P,"documentSyntaxHighlighting"),Jr.onDidChangeSyntaxHighlighting},registerInlayHintsProvider(b,C){return tt.registerInlayHintsProvider(P,b,C)},createLanguageStatusItem(b,C){return Jr.createLanguageStatusItem(P,b,C)},registerDocumentDropEditProvider(b,C,D){return tt.registerDocumentOnDropEditProvider(P,b,C,D)}},JF={get activeTextEditor(){return Je.getActiveTextEditor()},get visibleTextEditors(){return Je.getVisibleTextEditors()},get activeTerminal(){return ne.activeTerminal},get terminals(){return ne.terminals},async showTextDocument(b,C,D){y.isUri(b)&&b.scheme===B.vscodeRemote&&!b.authority&&f.report("workspace.showTextDocument",P,"A URI of 'vscode-remote' scheme requires an authority.");let Ce=await(y.isUri(b)?Promise.resolve(aR.openTextDocument(b)):Promise.resolve(b));return Je.showTextDocument(Ce,C,D)},createTextEditorDecorationType(b){return Je.createTextEditorDecorationType(P,b)},onDidChangeActiveTextEditor(b,C,D){return ue(Je.onDidChangeActiveTextEditor)(b,C,D)},onDidChangeVisibleTextEditors(b,C,D){return ue(Je.onDidChangeVisibleTextEditors)(b,C,D)},onDidChangeTextEditorSelection(b,C,D){return ue(Je.onDidChangeTextEditorSelection)(b,C,D)},onDidChangeTextEditorOptions(b,C,D){return ue(Je.onDidChangeTextEditorOptions)(b,C,D)},onDidChangeTextEditorVisibleRanges(b,C,D){return ue(Je.onDidChangeTextEditorVisibleRanges)(b,C,D)},onDidChangeTextEditorViewColumn(b,C,D){return ue(Je.onDidChangeTextEditorViewColumn)(b,C,D)},onDidChangeTextEditorDiffInformation(b,C,D){return M(P,"textEditorDiffInformation"),ue(Je.onDidChangeTextEditorDiffInformation)(b,C,D)},onDidCloseTerminal(b,C,D){return ue(ne.onDidCloseTerminal)(b,C,D)},onDidOpenTerminal(b,C,D){return ue(ne.onDidOpenTerminal)(b,C,D)},onDidChangeActiveTerminal(b,C,D){return ue(ne.onDidChangeActiveTerminal)(b,C,D)},onDidChangeTerminalDimensions(b,C,D){return M(P,"terminalDimensions"),ue(ne.onDidChangeTerminalDimensions)(b,C,D)},onDidChangeTerminalState(b,C,D){return ue(ne.onDidChangeTerminalState)(b,C,D)},onDidWriteTerminalData(b,C,D){return M(P,"terminalDataWriteEvent"),ue(ne.onDidWriteTerminalData)(b,C,D)},onDidExecuteTerminalCommand(b,C,D){return M(P,"terminalExecuteCommandEvent"),ue(ne.onDidExecuteTerminalCommand)(b,C,D)},onDidChangeTerminalShellIntegration(b,C,D){return ue(se.onDidChangeTerminalShellIntegration)(b,C,D)},onDidStartTerminalShellExecution(b,C,D){return ue(se.onDidStartTerminalShellExecution)(b,C,D)},onDidEndTerminalShellExecution(b,C,D){return ue(se.onDidEndTerminalShellExecution)(b,C,D)},get state(){return I.getState()},onDidChangeWindowState(b,C,D){return ue(I.onDidChangeWindowState)(b,C,D)},showInformationMessage(b,...C){return jI.showMessage(P,rt.Info,b,C[0],C.slice(1))},showWarningMessage(b,...C){return jI.showMessage(P,rt.Warning,b,C[0],C.slice(1))},showErrorMessage(b,...C){return jI.showMessage(P,rt.Error,b,C[0],C.slice(1))},showQuickPick(b,C,D){return as.showQuickPick(P,b,C,D)},showWorkspaceFolderPick(b){return as.showWorkspaceFolderPick(b)},showInputBox(b,C){return as.showInput(b,C)},showOpenDialog(b){return iR.showOpenDialog(b)},showSaveDialog(b){return iR.showSaveDialog(b)},createStatusBarItem(b,C,D){let Ce,xt,ln;return typeof b=="string"?(Ce=b,xt=C,ln=D):(xt=b,ln=C),je.createStatusBarEntry(P,Ce,xt,ln)},setStatusBarMessage(b,C){return je.setStatusBarMessage(b,C)},withScmProgress(b){return f.report("window.withScmProgress",P,"Use 'withProgress' instead."),z.withProgress(P,{location:1},(C,D)=>b({report(Ce){}}))},withProgress(b,C){return z.withProgress(P,b,C)},createOutputChannel(b,C){return yt.createOutputChannel(b,C,P)},createWebviewPanel(b,C,D,Ce){return O.createWebviewPanel(P,b,C,D,Ce)},createWebviewTextEditorInset(b,C,D,Ce){return M(P,"editorInsets"),fa.createWebviewEditorInset(b,C,D,Ce,P)},createTerminal(b,C,D){if(typeof b=="object"){let Ce=b;return!Le(P,"terminalTitle")&&"titleTemplate"in b&&b.titleTemplate!==void 0&&(console.error(`[${P.identifier.value}] \`titleTemplate\` was provided to window.createTerminal but is ignored because the \`terminalTitle\` proposed API is not enabled.`),Ce={...b,titleTemplate:void 0}),"pty"in Ce?ne.createExtensionTerminal(Ce):ne.createTerminalFromOptions(Ce,vee(P,Ce))}return ne.createTerminal(b,C,D)},registerTerminalLinkProvider(b){return ne.registerLinkProvider(b)},registerTerminalProfileProvider(b,C){return ne.registerProfileProvider(P,b,C)},registerTerminalCompletionProvider(b,...C){return M(P,"terminalCompletionProvider"),ne.registerTerminalCompletionProvider(P,b,...C)},registerTerminalQuickFixProvider(b,C){return M(P,"terminalQuickFixProvider"),ne.registerTerminalQuickFixProvider(b,P.identifier.value,C)},registerTreeDataProvider(b,C){return We.registerTreeDataProvider(b,C,P)},createTreeView(b,C){return We.createTreeView(b,C,P)},registerWebviewPanelSerializer:(b,C)=>O.registerWebviewPanelSerializer(P,b,C),registerCustomEditorProvider:(b,C,D={})=>G.registerCustomEditorProvider(P,b,C,D),registerFileDecorationProvider(b){return ut.registerFileDecorationProvider(b,P)},registerUriHandler(b){return E.registerUriHandler(P,b)},createQuickPick(){return as.createQuickPick(P)},createInputBox(){return as.createInputBox(P)},get activeColorTheme(){return Xh.activeColorTheme},onDidChangeActiveColorTheme(b,C,D){return ue(Xh.onDidChangeActiveColorTheme)(b,C,D)},registerWebviewViewProvider(b,C,D){return J.registerWebviewViewProvider(P,b,C,D?.webviewOptions)},get activeNotebookEditor(){return It.activeNotebookEditor},onDidChangeActiveNotebookEditor(b,C,D){return ue(It.onDidChangeActiveNotebookEditor)(b,C,D)},get visibleNotebookEditors(){return It.visibleNotebookEditors},get onDidChangeVisibleNotebookEditors(){return ue(It.onDidChangeVisibleNotebookEditors)},onDidChangeNotebookEditorSelection(b,C,D){return ue(ga.onDidChangeNotebookEditorSelection)(b,C,D)},onDidChangeNotebookEditorVisibleRanges(b,C,D){return ue(ga.onDidChangeNotebookEditorVisibleRanges)(b,C,D)},showNotebookDocument(b,C){return It.showNotebookDocument(b,C)},registerExternalUriOpener(b,C,D){return M(P,"externalUriOpener"),Ke.registerExternalUriOpener(P.identifier,b,C,D)},registerProfileContentHandler(b,C){return M(P,"profileContentHandlers"),zn.registerProfileContentHandler(P,b,C)},registerQuickDiffProvider(b,C,D,Ce,xt){return M(P,"quickDiffProvider"),No.registerQuickDiffProvider(P,Kt(b),C,D,Ce,xt)},createSourceControlDiffInformation(b){return M(P,"textEditorDiffInformation"),No.createSourceControlDiffInformation(b)},get linkPresentationRules(){return M(P,"linkPresentation"),Z.linkPresentationRules},get onDidChangeLinkPresentationRules(){return M(P,"linkPresentation"),Z.onDidChangeLinkPresentationRules},createLinkPresentationWatcher(b,C){return M(P,"linkPresentation"),Z.createLinkPresentationWatcher(P,b,C)},registerLinkPresentationProvider(b,C){return M(P,"linkPresentation"),Z.registerLinkPresentationProvider(P,b,C)},createAgentEditorComments(b){return M(P,"agentEditorComments"),_l.createAgentEditorComments(b)},get tabGroups(){return R.tabGroups},registerShareProvider(b,C){return M(P,"shareProvider"),hn.registerShareProvider(Kt(b),C)},get nativeHandle(){return M(P,"nativeWindowHandle"),I.nativeHandle},createChatStatusItem:b=>(M(P,"chatStatusItem"),$F.createChatStatusItem(P,b)),get activeChatPanelSessionResource(){return M(P,"chatParticipantPrivate"),it.activeChatPanelSessionResource},onDidChangeActiveChatPanelSessionResource:(b,C,D)=>(M(P,"chatParticipantPrivate"),ue(it.onDidChangeActiveChatPanelSessionResource)(b,C,D)),get browserTabs(){return M(P,"browser"),Ht.browserTabs},onDidOpenBrowserTab(b,C,D){return M(P,"browser"),ue(Ht.onDidOpenBrowserTab)(b,C,D)},onDidCloseBrowserTab(b,C,D){return M(P,"browser"),ue(Ht.onDidCloseBrowserTab)(b,C,D)},get activeBrowserTab(){return M(P,"browser"),Ht.activeBrowserTab},onDidChangeActiveBrowserTab(b,C,D){return M(P,"browser"),ue(Ht.onDidChangeActiveBrowserTab)(b,C,D)},onDidChangeBrowserTabState(b,C,D){return M(P,"browser"),ue(Ht.onDidChangeBrowserTabState)(b,C,D)},openBrowserTab(b,C){return M(P,"browser"),Ht.openBrowserTab(b,C)}},aR={get rootPath(){return f.report("workspace.rootPath",P,"Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath"),r.getPath()},set rootPath(b){throw new wi("rootPath")},getWorkspaceFolder(b){return r.getWorkspaceFolder(b)},get workspaceFolders(){return r.getWorkspaceFolders()},get name(){return r.name},set name(b){throw new wi("name")},get workspaceFile(){return r.workspaceFile},set workspaceFile(b){throw new wi("workspaceFile")},get isAgentSessionsWorkspace(){return M(P,"agentSessionsWorkspace"),!!t.environment.isSessionsWindow},updateWorkspaceFolders:(b,C,...D)=>r.updateWorkspaceFolders(P,b,C||0,...D),onDidChangeWorkspaceFolders:function(b,C,D){return ue(r.onDidChangeWorkspace)(b,C,D)},asRelativePath:(b,C)=>r.getRelativePath(b,C),findFiles:(b,C,D,Ce)=>r.findFiles(b,C,D,P.identifier,Ce),findFiles2:(b,C,D)=>(M(P,"findFiles2"),r.findFiles2(b,C,P.identifier,D)),findTextInFiles:(b,C,D,Ce)=>{M(P,"findTextInFiles");let xt,ln;return typeof C=="object"?(xt=C,ln=D):(xt={},ln=C,Ce=D),r.findTextInFiles(b,xt||{},ln,P.identifier,Ce)},findTextInFiles2:(b,C,D)=>(M(P,"findTextInFiles2"),M(P,"textSearchProvider2"),r.findTextInFiles2(b,C,P.identifier,D)),getTextDiff(b,C,D,Ce){M(P,"documentDiff");let xt=d.getProxy(F.MainThreadDocumentDiff);if(Ce?.isCancellationRequested){let pr=new Oe;return{changes:_a.EMPTY,complete:Promise.reject(pr)}}let ln=xt.$computeDocumentDiff(b.uri,C.uri,D?.ignoreTrimWhitespace??!1,D?.maxComputationTimeMs??5e3,D?.computeMoves??!1),oH=(Ce?ri(ln,Ce):ln).then(pr=>{if(!pr)throw new Error("Could not compute diff. Make sure both documents are available.");return pr}),rH=pr=>({originalRange:K.to(pr.originalRange),modifiedRange:K.to(pr.modifiedRange),innerChanges:pr.innerChanges?.map(Al=>({originalRange:K.to(Al.originalRange),modifiedRange:K.to(Al.modifiedRange)}))});return{changes:new _a(async pr=>{let Al=await oH;pr.emitMany(Al.changes.map(rH))}),complete:oH.then(pr=>({identical:pr.identical,mayBeIncomplete:pr.quitEarly,moves:pr.moves.map(Al=>({originalRange:K.to(Al.originalRange),modifiedRange:K.to(Al.modifiedRange),changes:Al.changes.map(rH)}))}))}},save:b=>r.save(b),saveAs:b=>r.saveAs(b),saveAll:b=>r.saveAll(b),applyEdit(b,C){return Rl.applyWorkspaceEdit(b,P,C)},createFileSystemWatcher:(b,C,D,Ce)=>{let xt={ignoreCreateEvents:!!C,ignoreChangeEvents:!!D,ignoreDeleteEvents:!!Ce};return Yr.createFileSystemWatcher(r,GI,e,P,b,xt)},get textDocuments(){return He.getAllDocumentData().map(b=>b.document)},set textDocuments(b){throw new wi("textDocuments")},openTextDocument(b,C){let D;if(C=C??b,typeof b=="string")D=Promise.resolve(y.file(b));else if(y.isUri(b))D=Promise.resolve(b);else if(!C||typeof C=="object")D=He.createDocumentData(C);else throw new Error("illegal argument - uriOrFileNameOrOptions");return D.then(Ce=>(g.trace(`openTextDocument from ${P.identifier}`),Ce.scheme===B.vscodeRemote&&!Ce.authority&&f.report("workspace.openTextDocument",P,"A URI of 'vscode-remote' scheme requires an authority."),He.ensureDocumentData(Ce,C).then(xt=>xt.document)))},onDidOpenTextDocument:(b,C,D)=>ue(He.onDidAddDocument)(b,C,D),onDidCloseTextDocument:(b,C,D)=>ue(He.onDidRemoveDocument)(b,C,D),onDidChangeTextDocument:(b,C,D)=>Le(P,"textDocumentChangeReason")?ue(He.onDidChangeDocumentWithReason)(b,C,D):ue(He.onDidChangeDocument)(b,C,D),onDidSaveTextDocument:(b,C,D)=>ue(He.onDidSaveDocument)(b,C,D),onWillSaveTextDocument:(b,C,D)=>ue(Gt.getOnWillSaveTextDocumentEvent(P))(b,C,D),get notebookDocuments(){return It.notebookDocuments.map(b=>b.apiNotebook)},async openNotebookDocument(b,C){let D;if(y.isUri(b))D=b,await It.openNotebookDocument(b);else if(typeof b=="string")D=y.revive(await It.createNotebookDocument({viewType:b,content:C}));else throw new Error("Invalid arguments");return It.getNotebookDocument(D).apiNotebook},onDidSaveNotebookDocument(b,C,D){return ue(Lo.onDidSaveNotebookDocument)(b,C,D)},onDidChangeNotebookDocument(b,C,D){return ue(Lo.onDidChangeNotebookDocument)(b,C,D)},onWillSaveNotebookDocument(b,C,D){return ue(Ei.getOnWillSaveNotebookDocumentEvent(P))(b,C,D)},get onDidOpenNotebookDocument(){return ue(It.onDidOpenNotebookDocument)},get onDidCloseNotebookDocument(){return ue(It.onDidCloseNotebookDocument)},registerNotebookSerializer(b,C,D,Ce){return It.registerNotebookSerializer(P,b,C,D,Le(P,"notebookLiveShare")?Ce:void 0)},onDidChangeConfiguration:(b,C,D)=>ue(GI.onDidChangeConfiguration)(b,C,D),getConfiguration(b,C){return C=arguments.length===1?void 0:C,GI.getConfiguration(b,C,P)},registerTextDocumentContentProvider(b,C){return qt.registerTextDocumentContentProvider(b,C)},registerTaskProvider:(b,C)=>(f.report("window.registerTaskProvider",P,"Use the corresponding function on the 'tasks' namespace instead"),be.registerTaskProvider(P,b,C)),registerFileSystemProvider(b,C,D){return Op(Yh.registerFileSystemProvider(P,b,C,D),n.addFileSystemProvider(b,C,D))},get fs(){return n.value},registerFileSearchProvider:(b,C)=>(M(P,"fileSearchProvider"),ae.registerFileSearchProviderOld(b,C)),registerTextSearchProvider:(b,C)=>(M(P,"textSearchProvider"),ae.registerTextSearchProviderOld(b,C)),registerAITextSearchProvider:(b,C)=>(M(P,"aiTextSearchProvider"),M(P,"textSearchProvider2"),ae.registerAITextSearchProvider(b,C)),registerFileSearchProvider2:(b,C)=>(M(P,"fileSearchProvider2"),ae.registerFileSearchProvider(b,C)),registerTextSearchProvider2:(b,C)=>(M(P,"textSearchProvider2"),ae.registerTextSearchProvider(b,C)),registerRemoteAuthorityResolver:(b,C)=>(M(P,"resolvers"),o.registerRemoteAuthorityResolver(b,C)),registerResourceLabelFormatter:b=>(M(P,"resolvers"),KI.$registerResourceLabelFormatter(b)),getRemoteExecServer:b=>(M(P,"resolvers"),o.getRemoteExecServer(b)),onDidCreateFiles:(b,C,D)=>ue(Yr.onDidCreateFile)(b,C,D),onDidDeleteFiles:(b,C,D)=>ue(Yr.onDidDeleteFile)(b,C,D),onDidRenameFiles:(b,C,D)=>ue(Yr.onDidRenameFile)(b,C,D),onWillCreateFiles:(b,C,D)=>ue(Yr.getOnWillCreateFileEvent(P))(b,C,D),onWillDeleteFiles:(b,C,D)=>ue(Yr.getOnWillDeleteFileEvent(P))(b,C,D),onWillRenameFiles:(b,C,D)=>ue(Yr.getOnWillRenameFileEvent(P))(b,C,D),openTunnel:b=>(M(P,"tunnels"),h.openTunnel(P,b).then(C=>{if(!C)throw new Error("cannot open tunnel");return C})),get tunnels(){return M(P,"tunnels"),h.getTunnels()},onDidChangeTunnels:(b,C,D)=>(M(P,"tunnels"),ue(h.onDidChangeTunnels)(b,C,D)),registerPortAttributesProvider:(b,C)=>(M(P,"portsAttributes"),h.registerPortsAttributesProvider(b,C)),registerTunnelProvider:(b,C)=>(M(P,"tunnelFactory"),h.registerTunnelProvider(b,C)),registerTimelineProvider:(b,C)=>(M(P,"timeline"),Cc.registerTimelineProvider(b,C,P.identifier,ee.converter)),get isTrusted(){return r.trusted},requestResourceTrust:b=>(M(P,"workspaceTrust"),r.requestResourceTrust(b)),requestWorkspaceTrust:b=>(M(P,"workspaceTrust"),r.requestWorkspaceTrust(b)),isResourceTrusted:b=>(M(P,"workspaceTrust"),r.isResourceTrusted(b)),onDidChangeWorkspaceTrustedFolders:(b,C,D)=>(M(P,"workspaceTrust"),ue(r.onDidChangeWorkspaceTrustedFolders)(b,C,D)),onDidGrantWorkspaceTrust:(b,C,D)=>ue(r.onDidGrantWorkspaceTrust)(b,C,D),registerEditSessionIdentityProvider:(b,C)=>(M(P,"editSessionIdentityProvider"),r.registerEditSessionIdentityProvider(b,C)),onWillCreateEditSessionIdentity:(b,C,D)=>(M(P,"editSessionIdentityProvider"),ue(r.getOnWillCreateEditSessionIdentityEvent(P))(b,C,D)),registerCanonicalUriProvider:(b,C)=>(M(P,"canonicalUriProvider"),r.registerCanonicalUriProvider(b,C)),getCanonicalUri:(b,C,D)=>(M(P,"canonicalUriProvider"),r.provideCanonicalUri(b,C,D)),decode(b,C){return r.decode(b,C)},encode(b,C){return r.encode(b,C)}},YF={get inputBox(){return f.report("scm.inputBox",P,"Use 'SourceControl.inputBox' instead"),Pl.getLastInputBox(P)},createSourceControl(b,C,D,Ce,xt,ln){return(Ce||xt||ln)&&M(P,"scmProviderOptions"),Pl.createSourceControl(P,b,C,D,Ce,xt,ln)}},XF={createCommentController(b,C){return po.createCommentController(P,b,C)}},ZF={get activeDebugSession(){return X.activeDebugSession},get activeDebugConsole(){return X.activeDebugConsole},get breakpoints(){return X.breakpoints},get activeStackItem(){return X.activeStackItem},registerDebugVisualizationProvider(b,C){return M(P,"debugVisualization"),X.registerDebugVisualizationProvider(P,b,C)},registerDebugVisualizationTreeProvider(b,C){return M(P,"debugVisualization"),X.registerDebugVisualizationTree(P,b,C)},onDidStartDebugSession(b,C,D){return ue(X.onDidStartDebugSession)(b,C,D)},onDidTerminateDebugSession(b,C,D){return ue(X.onDidTerminateDebugSession)(b,C,D)},onDidChangeActiveDebugSession(b,C,D){return ue(X.onDidChangeActiveDebugSession)(b,C,D)},onDidReceiveDebugSessionCustomEvent(b,C,D){return ue(X.onDidReceiveDebugSessionCustomEvent)(b,C,D)},onDidChangeBreakpoints(b,C,D){return ue(X.onDidChangeBreakpoints)(b,C,D)},onDidChangeActiveStackItem(b,C,D){return ue(X.onDidChangeActiveStackItem)(b,C,D)},registerDebugConfigurationProvider(b,C,D){return X.registerDebugConfigurationProvider(b,C,D||1)},registerDebugAdapterDescriptorFactory(b,C){return X.registerDebugAdapterDescriptorFactory(P,b,C)},registerDebugAdapterTrackerFactory(b,C){return X.registerDebugAdapterTrackerFactory(b,C)},startDebugging(b,C,D){return!D||typeof D=="object"&&"configuration"in D?X.startDebugging(b,C,{parentSession:D}):X.startDebugging(b,C,D||{})},stopDebugging(b){return X.stopDebugging(b)},addBreakpoints(b){return X.addBreakpoints(b)},removeBreakpoints(b){return X.removeBreakpoints(b)},asDebugSourceUri(b,C){return X.asDebugSourceUri(b,C)}},eH={registerTaskProvider:(b,C)=>be.registerTaskProvider(P,b,C),fetchTasks:b=>be.fetchTasks(b),executeTask:b=>be.executeTask(P,b),get taskExecutions(){return be.taskExecutions},onDidStartTask:(b,C,D)=>{let Ce=xt=>{Le(P,"taskExecutionTerminal")||xt?.execution?.terminal!==void 0&&(xt.execution.terminal=void 0);let ln={...xt,execution:xt.execution};return b.call(C,ln)};return ue(be.onDidStartTask)(Ce,C,D)},onDidEndTask:(b,C,D)=>ue(be.onDidEndTask)(b,C,D),onDidStartTaskProcess:(b,C,D)=>ue(be.onDidStartTaskProcess)(b,C,D),onDidEndTaskProcess:(b,C,D)=>ue(be.onDidEndTaskProcess)(b,C,D),onDidStartTaskProblemMatchers:(b,C,D)=>(M(P,"taskProblemMatcherStatus"),ue(be.onDidStartTaskProblemMatchers)(b,C,D)),onDidEndTaskProblemMatchers:(b,C,D)=>(M(P,"taskProblemMatcherStatus"),ue(be.onDidEndTaskProblemMatchers)(b,C,D))},tH={createNotebookController(b,C,D,Ce,xt){return ss.createNotebookController(P,b,C,D,Ce,Le(P,"notebookMessaging")?xt:void 0)},registerNotebookCellStatusBarItemProvider:(b,C)=>It.registerNotebookCellStatusBarItemProvider(P,b,C),createRendererMessaging(b){return Ti.createRendererMessaging(P,b)},createNotebookControllerDetectionTask(b){return M(P,"notebookKernelSource"),ss.createNotebookControllerDetectionTask(P,b)},registerKernelSourceActionProvider(b,C){return M(P,"notebookKernelSource"),ss.registerKernelSourceActionProvider(P,b,C)}},re={t(...b){if(typeof b[0]=="string"){let C=b.shift(),D=!b||typeof b[0]!="object"?b:b[0];return Qe.getMessage(P.identifier.value,{message:C,args:D})}return Qe.getMessage(P.identifier.value,b[0])},get bundle(){return Qe.getBundle(P.identifier.value)},get uri(){return Qe.getBundleUri(P.identifier.value)}},X8={transferActiveChat(b){return M(P,"interactive"),it.transferActiveChat(b)}},Z8={getRelatedInformation(b,C){return M(P,"aiRelatedInformation"),Kn.getRelatedInformation(P,b,C)},registerRelatedInformationProvider(b,C){return M(P,"aiRelatedInformation"),Kn.registerRelatedInformationProvider(P,b,C)},registerEmbeddingVectorProvider(b,C){return M(P,"aiRelatedInformation"),So.registerEmbeddingVectorProvider(P,b,C)},registerSettingsSearchProvider(b){return M(P,"aiSettingsSearch"),ur.registerSettingsSearchProvider(P,b)}},e7={registerMappedEditsProvider(b,C){return M(P,"mappedEditsProvider"),{dispose(){}}},registerMappedEditsProvider2(b){return M(P,"mappedEditsProvider"),_p.registerMappedEditsProvider(P,b)},createChatParticipant(b,C){return it.createChatAgent(P,b,C)},createDynamicChatParticipant(b,C,D){return M(P,"chatParticipantPrivate"),it.createDynamicChatAgent(P,b,C,D)},registerChatParticipantDetectionProvider(b){return M(P,"chatParticipantPrivate"),it.registerChatParticipantDetectionProvider(P,b)},onDidDisposeChatSession:(b,C,D)=>(M(P,"chatParticipantPrivate"),ue(it.onDidDisposeChatSession)(b,C,D)),updateQuotas:b=>{M(P,"chatParticipantPrivate"),Yn.updateQuotas(b)},registerChatSessionItemProvider:(b,C)=>(M(P,"chatSessionsProvider"),f.report("chat.registerChatSessionItemProvider",P,"Please migrate to the new chat session controller API",{usageId:b}),an.registerChatSessionItemProvider(P,b,C)),createChatSessionItemController:(b,C)=>(M(P,"chatSessionsProvider"),an.createChatSessionItemController(P,b,C)),registerChatSessionContentProvider(b,C,D,Ce){return M(P,"chatSessionsProvider"),an.registerChatSessionContentProvider(P,b,D,C,Ce)},registerChatOutputRenderer:(b,C)=>(M(P,"chatOutputRenderer"),Lt.registerChatOutputRenderer(P,b,C)),registerChatWorkspaceContextProvider(b,C){return M(P,"chatContextProvider"),Zo.registerChatWorkspaceContextProvider(`${P.id}-${b}`,C)},registerChatAttachContextProvider(b,C){return M(P,"chatContextProvider"),Zo.registerChatAttachContextProvider(`${P.id}-${b}`,C)},registerChatTabContextProvider(b,C,D){return M(P,"chatContextProvider"),Zo.registerChatTabContextProvider(b,`${P.id}-${C}`,D)},registerChatExplicitContextProvider(b,C){return M(P,"chatContextProvider"),{dispose:()=>{}}},registerChatResourceContextProvider(b,C,D){return M(P,"chatContextProvider"),{dispose:()=>{}}},registerCustomAgentProvider(b){return M(P,"chatPromptFiles"),it.registerPromptFileProvider(P,"agent",b)},registerInstructionsProvider(b){return M(P,"chatPromptFiles"),it.registerPromptFileProvider(P,"instructions",b)},registerPromptFileProvider(b){return M(P,"chatPromptFiles"),it.registerPromptFileProvider(P,"prompt",b)},registerSkillProvider(b){return M(P,"chatPromptFiles"),it.registerPromptFileProvider(P,"skill",b)},registerHookProvider(b){return M(P,"chatPromptFiles"),it.registerPromptFileProvider(P,"hook",b)},registerChatDebugLogProvider(b){return M(P,"chatDebug"),vn.registerChatDebugLogProvider(b)},onDidReceiveChatDebugEvent:(b,C,D)=>(M(P,"chatDebug"),vn.onDidAddCoreEvent(b,C,D)),getCustomAgents(b){return M(P,"chatPromptFiles"),it.provideCustomAgents(b)},onDidChangeCustomAgents:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangeCustomAgents(b,C,D)),getInstructions(b){return M(P,"chatPromptFiles"),it.provideInstructions(b)},onDidChangeInstructions:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangeInstructions(b,C,D)),getSkills(b){return M(P,"chatPromptFiles"),it.provideSkills(b)},onDidChangeSkills:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangeSkills(b,C,D)),getSlashCommands(b){return M(P,"chatPromptFiles"),it.provideSlashCommands(b)},onDidChangeSlashCommands:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangeSlashCommands(b,C,D)),getHooks(b){return M(P,"chatPromptFiles"),it.provideHooks(b)},onDidChangeHooks:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangeHooks(b,C,D)),getPlugins(b){return M(P,"chatPromptFiles"),it.providePlugins(b)},onDidChangePlugins:(b,C,D)=>(M(P,"chatPromptFiles"),it.onDidChangePlugins(b,C,D)),registerChatSessionCustomizationProvider(b,C,D){return M(P,"chatSessionCustomizationProvider"),it.registerChatSessionCustomizationProvider(P,b,C,D)},createInputNotification(b){return M(P,"chatInputNotification"),zF.createInputNotification(P,b)}},tv={selectChatModels:b=>j.selectLanguageModels(P,b??{}),onDidChangeChatModels:(b,C,D)=>j.onDidChangeProviders(b,C,D),registerLanguageModelChatProvider:(b,C)=>j.registerLanguageModelChatProvider(P,b,C),get isModelProxyAvailable(){return M(P,"languageModelProxy"),j.isModelProxyAvailable},onDidChangeModelProxyAvailability:(b,C,D)=>(M(P,"languageModelProxy"),j.onDidChangeModelProxyAvailability(b,C,D)),getModelProxy:()=>(M(P,"languageModelProxy"),j.getModelProxy(P)),registerLanguageModelProxyProvider:b=>(M(P,"chatParticipantPrivate"),j.registerLanguageModelProxyProvider(P,b)),get embeddingModels(){return M(P,"embeddings"),Ft.embeddingsModels},onDidChangeEmbeddingModels:(b,C,D)=>(M(P,"embeddings"),Ft.onDidChange(b,C,D)),registerEmbeddingsProvider(b,C){return M(P,"embeddings"),Ft.registerEmbeddingsProvider(P,b,C)},async computeEmbeddings(b,C,D){return M(P,"embeddings"),Ft.computeEmbeddings(b,C,D)},registerTool(b,C){return qn.registerTool(P,b,C)},registerToolDefinition(b,C){return qn.registerToolDefinition(P,b,C)},invokeTool(b,C,D){return typeof b!="string"&&M(P,"chatParticipantAdditions"),qn.invokeTool(P,b,C,D)},get tools(){return qn.getTools(P)},fileIsIgnored(b,C){return j.fileIsIgnored(P,b,C)},registerIgnoredFileProvider(b){return j.registerIgnoredFileProvider(P,b)},registerMcpServerDefinitionProvider(b,C){return Q.registerMcpConfigurationProvider(P,b,C)},onDidChangeMcpServerDefinitions:(...b)=>(M(P,"mcpServerDefinitions"),ue(Q.onDidChangeMcpServerDefinitions)(...b)),get mcpServerDefinitions(){return M(P,"mcpServerDefinitions"),Q.mcpServerDefinitions},startMcpGateway(b){return M(P,"mcpServerDefinitions"),Q.startMcpGateway(b)},onDidChangeChatRequestTools(...b){return M(P,"chatParticipantAdditions"),ue(it.onDidChangeChatRequestTools)(...b)}},t7={registerSpeechProvider(b,C){return M(P,"speech"),bt.registerProvider(P.identifier,b,C)}};return{version:t.version,ai:Z8,authentication:qF,commands:KF,comments:XF,chat:e7,debug:ZF,env:sR,extensions:GF,interactive:X8,l10n:re,languages:QF,lm:tv,notebooks:tH,scm:YF,speech:t7,tasks:eH,tests:jF,window:JF,workspace:aR,Breakpoint:Ja,TerminalOutputAnchor:l0,ChatResultFeedbackKind:DE,ChatVariableLevel:N0,ChatCompletionItem:_T,ChatReferenceDiagnostic:Kd,CallHierarchyIncomingCall:eg,CallHierarchyItem:Md,CallHierarchyOutgoingCall:tg,CancellationError:Oe,CancellationTokenSource:Ee,CandidatePortSource:FA,CodeAction:Us,CodeActionKind:Rt,CodeActionTriggerKind:$T,CodeLens:Id,Color:$i,ColorInformation:Ed,ColorPresentation:wd,ColorThemeKind:SE,CommentMode:T0,CommentState:E0,CommentThreadCollapsibleState:gE,CommentThreadState:fE,CommentThreadApplicability:hE,CommentThreadFocus:vE,CompletionItem:Cd,CompletionItemKind:Xy,CompletionItemTag:KT,CompletionList:Bi,CompletionTriggerKind:qT,ConfigurationTarget:lE,CustomExecution:Ru,DebugAdapterExecutable:ji,DebugAdapterInlineImplementation:Ya,DebugAdapterNamedPipeServer:Bs,DebugAdapterServer:Gi,DebugConfigurationProviderTriggerKind:B1,DebugConsoleMode:yE,DebugVisualization:ST,DecorationRangeBehavior:nE,Diagnostic:Ka,DiagnosticRelatedInformation:Ms,DiagnosticSeverity:bu,DiagnosticTag:Gy,Disposable:Se,DocumentHighlight:yd,DocumentHighlightKind:BT,MultiDocumentHighlight:bd,DocumentLink:Td,DocumentSymbol:$r,EndOfLine:Su,EnvironmentVariableMutatorType:VT,EvaluatableExpression:kd,InlineValueText:Pd,InlineValueVariableLookup:_d,InlineValueEvaluatableExpression:Rd,InlineCompletionTriggerKind:dE,InlineCompletionsDisposeReasonKind:cE,EventEmitter:T,ExtensionKind:xE,ExtensionMode:kE,ExternalUriOpenerPriority:D0,FileChangeType:pE,FileDecoration:Au,FileDecoration2:Au,FileSystemError:kt,FileType:Jc,FilePermission:Yc,FoldingRange:Xm,FoldingRangeKind:mE,FunctionBreakpoint:Ki,InlineCompletionItem:Gm,InlineCompletionList:Qm,Hover:Cu,VerboseHover:vd,HoverVerbosityAction:d0,IndentAction:UN,Location:rn,MarkdownString:en,OverviewRulerLane:bM,ParameterInformation:qm,PortAutoForwardAction:M0,Position:De,ProcessExecution:Hs,ProgressLocation:eb,QuickInputButtonLocation:w0,QuickInputButtons:Ns,Range:ve,RelativePattern:Vs,Selection:oo,SelectionRange:Fs,SemanticTokens:Qi,SemanticTokensBuilder:xT,SemanticTokensEdit:rg,SemanticTokensEdits:Od,SemanticTokensLegend:Du,ShellExecution:zi,ShellQuoting:b0,SignatureHelp:jm,SignatureHelpTriggerKind:c0,SignatureInformation:Km,SnippetString:ro,SourceBreakpoint:qi,StandardTokenType:tb,SyntaxHighlightingTokenFontStyle:_0,StatusBarAlignment:YT,SymbolInformation:Br,SymbolKind:zm,SymbolTag:Jy,Task:Jn,TaskEventKind:v0,TaskGroup:Hn,TaskPanelKind:y0,TaskRevealKind:h0,TaskRunOn:I0,TaskScope:iE,TerminalLink:uT,TerminalQuickFixTerminalCommand:mT,TerminalQuickFixOpener:pT,TerminalLocation:g0,TerminalProfile:gT,TerminalExitReason:p0,TerminalShellExecutionCommandLineConfidence:rE,TerminalCompletionItem:fT,TerminalCompletionItemKind:f0,TerminalCompletionList:hT,TerminalShellType:m0,TextDocumentSaveReason:ZT,TextEdit:Qn,SnippetTextEdit:ja,TextEditorCursorStyle:NA,TextEditorChangeKind:Zy,TextEditorLineNumbersStyle:XT,TextEditorRevealType:eE,TextEditorSelectionChangeKind:Vu,SyntaxTokenType:Bu,TextDocumentChangeReason:tE,ThemeColor:Qa,ThemeIcon:fn,TreeItem:Ws,TreeItemCheckboxState:aE,TreeItemCollapsibleState:sE,TypeHierarchyItem:Nd,UIKind:Dw,Uri:y,ViewColumn:JT,WorkspaceEdit:Dr,DocumentPasteTriggerKind:S0,DocumentDropEdit:Jm,DocumentDropOrPasteEditKind:gi,DocumentPasteEdit:bT,InlayHint:Sd,InlayHintLabelPart:xd,InlayHintKind:u0,RemoteAuthorityResolverError:zs,ResolvedAuthority:cT,ManagedResolvedAuthority:Ad,SourceControlInputBoxValidationType:oE,ExtensionRuntime:PE,TimelineItem:Zm,NotebookRange:uo,NotebookCellKind:Qy,NotebookCellExecutionState:k0,NotebookCellData:Ls,NotebookData:Iu,NotebookRendererScript:ig,NotebookCellStatusBarAlignment:CE,NotebookEditorRevealType:TE,NotebookCellOutput:Os,NotebookCellOutputItem:xu,CellErrorStackFrame:CT,NotebookCellStatusBarItem:TT,NotebookControllerAffinity:P0,NotebookControllerAffinity2:EE,NotebookEdit:Qo,NotebookKernelSourceAction:ET,NotebookVariablesRequestKind:wE,PortAttributes:kT,LinkedEditingRanges:wT,TestResultState:R0,TestRunRequest:Dd,TestMessage:$s,TestMessageStackFrame:PT,TestTag:Xa,TestRunProfileKind:_E,TextSearchCompleteMessageType:Eb,DataTransfer:mi,DataTransferItem:Tu,TestCoverageCount:_u,FileCoverage:Za,StatementCoverage:ag,BranchCoverage:lg,DeclarationCoverage:dg,WorkspaceTrustState:A0,LanguageStatusSeverity:zT,QuickPickItemKind:bE,InputBoxValidationSeverity:IE,TabInputText:Ud,TabInputTextDiff:el,TabInputTextMerge:cg,TabInputCustom:Fd,TabInputNotebook:Hd,TabInputNotebookDiff:Wd,TabInputWebview:ug,TabInputTerminal:pg,TabInputInteractiveWindow:mg,TabInputChat:gg,TabInputTextMultiDiff:fg,TelemetryTrustedValue:fd,LogLevel:Ui,EditSessionIdentityMatch:FN,InteractiveSessionVoteDirection:L0,ChatCopyKind:O0,ChatSessionChangedFile:UT,ChatEditingSessionActionOutcome:RE,InteractiveEditorResponseFeedbackKind:F0,DebugStackFrame:ng,DebugThread:og,RelatedInformationType:K0,SpeechToTextStatus:G0,TextToSpeechStatus:Q0,PartialAcceptTriggerKind:jT,InlineCompletionEndOfLifeReasonKind:GT,InlineCompletionDisplayLocationKind:QT,KeywordRecognitionStatus:J0,ChatImageMimeType:q0,ChatResponseMarkdownPart:tl,ChatResponseFileTreePart:ol,ChatResponseAnchorPart:Ks,ChatResponseProgressPart:Ou,ChatResponseProgressPart2:Vd,ChatResponseThinkingProgressPart:Ji,ChatResponseHookPart:rl,ChatResponseVoiceProgressPart:Bd,ChatResponseAutoModeResolutionPart:js,ChatResponseReferencePart:fi,ChatResponseReferencePart2:fi,ChatResponseCodeCitationPart:ll,ChatResponseCodeblockUriPart:al,ChatResponseWarningPart:Gs,ChatResponseInfoPart:il,ChatResponseTextEditPart:Js,ChatResponseNotebookEditPart:cl,ChatResponseWorkspaceEditPart:qd,ChatResponseMarkdownWithVulnerabilitiesPart:qs,ChatResponseCommandButtonPart:sl,ChatResponseConfirmationPart:nl,ChatQuestion:vg,ChatQuestionType:AE,ChatResponseQuestionCarouselPart:Qs,ChatResponseMovePart:dl,ChatResponseExtensionsPart:$d,ChatResponseExternalEditPart:Lu,ChatResponsePullRequestPart:zd,ChatResponseMultiDiffPart:Mu,ChatResponseReferencePartStatusKind:V0,ChatResponseClearToPreviousToolInvocationReason:B0,ChatRequestTurn:Ys,ChatRequestTurn2:Ys,ChatResponseTurn:yg,ChatResponseTurn2:DT,ChatSubagentToolInvocationData:hg,ChatToolInvocationPart:Nu,ChatLocation:OE,ChatSessionStatus:H0,ChatSessionCustomizationType:hi,ChatDebugLogLevel:W0,ChatDebugToolCallResult:NE,ChatDebugHookResult:UE,ChatDebugToolCallEvent:bg,ChatDebugModelTurnEvent:Ig,ChatDebugGenericEvent:xg,ChatDebugSubagentInvocationEvent:Sg,ChatDebugUserMessageEvent:Cg,ChatDebugAgentResponseEvent:Tg,ChatDebugMessageSection:Uu,ChatDebugEventTextContent:AT,ChatDebugMessageContentType:FE,ChatDebugEventMessageContent:MT,ChatDebugEventToolCallContent:LT,ChatDebugEventModelTurnContent:OT,ChatDebugEventHookContent:NT,ChatRequestEditorData:Eg,ChatRequestNotebookData:wg,ChatReferenceBinaryData:Fu,ChatRequestEditedFileEventKind:U0,LanguageModelChatMessageRole:ob,LanguageModelChatMessage:kg,LanguageModelChatMessage2:Pg,LanguageModelToolResultPart:Xs,LanguageModelToolResultPart2:Xs,LanguageModelTextPart:sn,LanguageModelTextPart2:sn,LanguageModelPartAudience:HE,ToolResultAudience:HE,LanguageModelToolCallPart:vi,LanguageModelThinkingPart:Yi,LanguageModelError:Ar,LanguageModelToolResult:jd,LanguageModelToolResult2:FT,LanguageModelDataPart:Wn,LanguageModelDataPart2:Wn,LanguageModelToolExtensionSource:_g,LanguageModelToolMCPSource:Rg,ExtendedLanguageModelToolResult:HT,LanguageModelChatToolMode:WE,LanguageModelPromptTsxPart:yi,NewSymbolName:IT,NewSymbolNameTag:C0,NewSymbolNameTriggerKind:uE,ExcludeSettingOptions:gw,TextSearchContext2:ta,TextSearchMatch2:Yo,AISearchKeyword:Zu,TextSearchCompleteMessageTypeNew:Eb,ChatErrorLevel:$0,ChatInputNotificationSeverity:z0,McpHttpServerDefinition:Wu,McpHttpServerDefinition2:Wu,McpStdioServerDefinition:Hu,McpStdioServerDefinition2:Hu,McpToolAvailability:VE,McpToolInvocationContentData:RT,SettingsSearchResultKind:j0,ChatTodoStatus:ME,ChatDebugSubagentStatus:LE}}}var Nh=class{constructor(t,e,n,o,r,s,a){this._apiFactory=t;this._extensionRegistry=e;this._instaService=n;this._extHostConfiguration=o;this._extHostExtensionService=r;this._initData=s;this._logService=a;this._factories=new Map,this._alternatives=[]}async install(){this._installInterceptor(),Bt("code/extHost/willWaitForConfig");let t=await this._extHostConfiguration.getConfigProvider();Bt("code/extHost/didWaitForConfig");let e=await this._extHostExtensionService.getExtensionPathIndex();this.register(new cF(this._apiFactory,e,this._extensionRegistry,t,this._logService)),this.register(this._instaService.createInstance(Sc)),this._initData.remote.isRemote&&this.register(this._instaService.createInstance(OI,e,this._initData.environment.appUriScheme))}register(t){if("nodeModuleName"in t)if(Array.isArray(t.nodeModuleName))for(let e of t.nodeModuleName)this._factories.set(e,t);else this._factories.set(t.nodeModuleName,t);typeof t.alternativeModuleName=="function"&&this._alternatives.push(e=>t.alternativeModuleName(e))}};Nh=_([S(2,Dn),S(3,_n),S(4,io),S(5,Ye),S(6,te)],Nh);var Sc=class{static{this.aliased=new Map([["vscode-ripgrep","@vscode/ripgrep-universal"],["@vscode/ripgrep","@vscode/ripgrep-universal"],["vscode-windows-registry","@vscode/windows-registry"]])}constructor(t){if(t.environment.appRoot&&Sc.aliased.size){let e=nr(this.forceForwardSlashes(t.environment.appRoot.fsPath)),n="[a-z0-9_.-]",o=`@${n}+\\/${n}+|${n}+`,r="node_modules|node_modules\\.asar(?:\\.unpacked)?";this.re=new RegExp(`^(${e}/${r}\\/)(${o})(.*)$`,"i")}}alternativeModuleName(t){if(!this.re)return;let e=this.re.exec(this.forceForwardSlashes(t));if(!e)return;let[,n,o,r]=e,s=Sc.aliased.get(o);if(s!==void 0)return console.warn(`${o} as been renamed to ${s}, please update your imports`),n+s+r}forceForwardSlashes(t){return t.replace(/\\/g,"/")}};Sc=_([S(0,Ye)],Sc);var cF=class{constructor(t,e,n,o,r){this._apiFactory=t;this._extensionPaths=e;this._extensionRegistry=n;this._configProvider=o;this._logService=r;this.nodeModuleName="vscode";this._extApiImpl=new vo}load(t,e){let n=this._extensionPaths.findSubstr(e);if(n){let o=this._extApiImpl.get(n.identifier);return o||(o=this._apiFactory(n,this._extensionRegistry,this._configProvider),this._extApiImpl.set(n.identifier,o)),o}if(!this._defaultApiImpl){let o="";this._extensionPaths.forEach((r,s)=>o+=`	${s} -> ${r.identifier.value}
`),this._logService.warn(`Could not identify extension for 'vscode' require call from ${e}. These are the extension path mappings: 
${o}`),this._defaultApiImpl=this._apiFactory(m4,this._extensionRegistry,this._configProvider)}return this._defaultApiImpl}},OI=class{constructor(t,e,n){this._extensionPaths=t;this._appUriScheme=e;this.nodeModuleName=["open","opn"];this._mainThreadTelemetry=n.getProxy(F.MainThreadTelemetry);let o=n.getProxy(F.MainThreadWindow);this._impl=(r,s)=>{let a=y.parse(r);return s?this.callOriginal(r,s):a.scheme==="http"||a.scheme==="https"?o.$openUri(a,r,{allowTunneling:!0}):a.scheme==="mailto"||a.scheme===this._appUriScheme?o.$openUri(a,r,{}):this.callOriginal(r,s)}}load(t,e,n){let o=this._extensionPaths.findSubstr(e);return o&&(this._extensionId=o.identifier.value,this.sendShimmingTelemetry()),this._original=n(t),this._impl}callOriginal(t,e){return this.sendNoForwardTelemetry(),this._original(t,e)}sendShimmingTelemetry(){this._extensionId&&this._mainThreadTelemetry.$publicLog2("shimming.open",{extension:this._extensionId})}sendNoForwardTelemetry(){this._extensionId&&this._mainThreadTelemetry.$publicLog2("shimming.open.call.noForward",{extension:this._extensionId})}};OI=_([S(2,le)],OI);import{LogLevel as kp,createHttpPatch as d8,createProxyAuthorizationLookup as Hee,createProxyResolver as Wee,createTlsPatch as Vee,createNetPatch as Bee,loadSystemCertificates as c8}from"@vscode/proxy-agent";import{createRequire as $ee}from"node:module";import{parse as a8}from"url";import{spawn as Ree}from"child_process";import{userInfo as wee}from"os";import*as uF from"os";var e8=/^\d+$/,yee=/^Microsoft.PowerShell_.*/,bee=/^Microsoft.PowerShellPreview_.*/;var NI;switch(process.arch){case"ia32":NI=1;break;case"arm":case"arm64":NI=2;break;default:NI=0;break}var Uh;process.env.PROCESSOR_ARCHITEW6432?Uh=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Uh=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Uh=1:Uh=0;var wp=class{constructor(t,e,n){this.exePath=t;this.displayName=e;this.knownToExist=n}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await Wo.existsFile(this.exePath)),this.knownToExist}};function Iee({useAlternateBitness:i=!1}={}){return i?NI===0?process.env["ProgramFiles(x86)"]||null:Uh===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function w_({useAlternateBitness:i=!1,findPreview:t=!1}={}){let e=Iee({useAlternateBitness:i});if(!e)return null;let n=Be(e,"PowerShell");if(!await Wo.existsDirectory(n))return null;let o=-1,r=null;for(let l of await at.readdir(n)){let d=-1;if(t){let u=l.indexOf("-");if(u<0)continue;let m=l.substring(0,u);if(!e8.test(m)||l.substring(u+1)!=="preview")continue;d=parseInt(m,10)}else{if(!e8.test(l))continue;d=parseInt(l,10)}if(d<=o)continue;let c=Be(n,l,"pwsh.exe");await Wo.existsFile(c)&&(r=c,o=d)}if(!r)return null;let s=e.includes("x86")?" (x86)":"",a=t?" Preview":"";return new wp(r,`PowerShell${a}${s}`,!0)}async function t8({findPreview:i}={}){if(!process.env.LOCALAPPDATA)return null;let t=Be(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await Wo.existsDirectory(t))return null;let{pwshMsixDirRegex:e,pwshMsixName:n}=i?{pwshMsixDirRegex:bee,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:yee,pwshMsixName:"PowerShell (Store)"};for(let o of await at.readdir(t))if(e.test(o)){let r=Be(t,o,"pwsh.exe");return new wp(r,n)}return null}function xee(){let i=Be(uF.homedir(),".dotnet","tools","pwsh.exe");return new wp(i,".NET Core PowerShell Global Tool")}function See(){let i=Be(uF.homedir(),"scoop","apps"),t=Be(i,"pwsh","current","pwsh.exe");return new wp(t,"PowerShell (Scoop)")}function Cee(){let i=Be(process.env.windir,NI===1&&Uh!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new wp(i,"Windows PowerShell",!0)}async function*Tee(){let i=await w_();i&&(yield i),i=await w_({useAlternateBitness:!0}),i&&(yield i),i=await t8(),i&&(yield i),i=xee(),i&&(yield i),i=await w_({findPreview:!0}),i&&(yield i),i=await t8({findPreview:!0}),i&&(yield i),i=await w_({useAlternateBitness:!0,findPreview:!0}),i&&(yield i),i=await See(),i&&(yield i),i=Cee(),i&&(yield i)}async function*Eee(){for await(let i of Tee())await i.exists()&&(yield i)}async function n8(){for await(let i of Eee())return i;return null}async function o8(i,t){return i===1?Te?Pee():gk(t):kee(i,t)}var pF=null;function kee(i,t){if(Xe&&i===2||St&&i===3)return"/bin/bash";if(!pF){let e;if(Te)e="/bin/bash";else{if(e=t.SHELL,!e)try{e=wee().shell}catch{}e||(e="sh"),e==="/bin/false"&&(e="/bin/bash")}pF=e}return pF}var mF=null;async function Pee(){return mF||(mF=(await n8()).exePath),mF}import TOt from"assert";import hOt from"minimist";var bOt={o:p(2868,null),e:p(2852,null),t:p(2882,null),m:p(2863,null)};var _ee={chat:{type:"subcommand",description:"Pass in a prompt to run in a chat session in the current working directory.",options:{_:{type:"string[]",description:p(2872,null)},mode:{type:"string",cat:"o",alias:"m",args:"mode",description:p(2840,null)},"add-file":{type:"string[]",cat:"o",alias:"a",args:"path",description:p(2835,null)},maximize:{type:"boolean",cat:"o",description:p(2839,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:p(2875,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:p(2866,null)},profile:{type:"string",cat:"o",args:"profileName",description:p(2871,null)},help:{type:"boolean",alias:"h",description:p(2854,null)}}},"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:p(2841,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},agent:{type:"subcommand",description:"Start and interact with AI agent hosts.",options:{"cli-data-dir":{type:"string",args:"dir",description:p(2841,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},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:p(2841,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:p(2844,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:p(2864,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:p(2834,null)},remove:{type:"boolean",cat:"o",args:"folder",description:p(2873,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:p(2853,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:p(2865,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:p(2874,null)},agents:{type:"boolean",cat:"o",deprecates:["sessions"],description:p(2837,null)},wait:{type:"boolean",cat:"o",alias:"w",description:p(2892,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:p(2860,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:p(2889,null)},profile:{type:"string",cat:"o",args:"profileName",description:p(2871,null)},help:{type:"boolean",cat:"o",alias:"h",description:p(2854,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:p(2851,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"shared-data-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:p(2859,null)},"agent-plugins-dir":{type:"string"},"agents-user-data-dir":{type:"string"},"agents-extensions-dir":{type:"string"},"show-versions":{type:"boolean",cat:"e",description:p(2876,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:p(2838,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:p(2858,null)},"pre-release":{type:"boolean",cat:"e",description:p(2857,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:p(2884,null)},"update-extensions":{type:"boolean",cat:"e",description:p(2887,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:p(2850,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:p(2836,null)},version:{type:"boolean",cat:"t",alias:"v",description:p(2891,null)},verbose:{type:"boolean",cat:"t",global:!0,description:p(2890,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:p(2862,null)},status:{type:"boolean",alias:"s",cat:"t",description:p(2877,null)},"prof-startup":{type:"boolean",cat:"t",description:p(2870,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:p(2847,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:p(2846,null)},sync:{type:"string",cat:"t",description:p(2883,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:p(2856,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:p(2855,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:p(2849,null)},"disable-gpu":{type:"boolean",cat:"t",description:p(2848,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:p(2845,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:p(2861,null)},telemetry:{type:"boolean",cat:"t",description:p(2880,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-agenthost":{type:"string",allowEmptyValue:!0},"inspect-brk-agenthost":{type:"string",allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"export-default-keybindings":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},"skip-sessions-welcome":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},"disable-updates":{type:"boolean"},"share-secrets-with-agents-app":{type:"boolean"},transient:{type:"boolean",cat:"t",description:p(2881,null)},"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"},"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"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"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"},_:{type:"string[]"}};function gF(i){return i.VSCODE_CLI==="1"}var fF;async function r8(i,t,e,n){return e["force-disable-user-env"]?(t.trace("resolveShellEnv(): skipped (--force-disable-user-env)"),{}):Te?(t.trace("resolveShellEnv(): skipped (Windows)"),{}):gF(n)&&!e["force-user-env"]?(t.trace("resolveShellEnv(): skipped (VSCODE_CLI is set)"),{}):(gF(n)?t.trace("resolveShellEnv(): running (--force-user-env)"):t.trace("resolveShellEnv(): running (macOS/Linux)"),fF||(fF=ii.withAsyncBody(async(o,r)=>{let s=new Ee,a=1e4,l=i.getValue("application.shellEnvironmentResolutionTimeout");typeof l=="number"&&(a=jW(l,1,120)*1e3);let d=setTimeout(()=>{s.dispose(!0),r(new Error(p(3242,null)))},a);try{o(await Dee(t,s.token))}catch(c){!Yt(c)&&!s.token.isCancellationRequested?r(new Error(p(3240,null,To(c)))):o({})}finally{clearTimeout(d),s.dispose()}})),fF)}async function Dee(i,t){let e=process.env.ELECTRON_RUN_AS_NODE;i.trace("getUnixShellEnvironment#runAsNode",e);let n=process.env.ELECTRON_NO_ATTACH_CONSOLE;i.trace("getUnixShellEnvironment#noAttach",n);let o=_e().replace(/-/g,"").substr(0,12),r=new RegExp(o+"({.*})"+o),s={...process.env,ELECTRON_RUN_AS_NODE:"1",ELECTRON_NO_ATTACH_CONSOLE:"1",VSCODE_RESOLVING_ENVIRONMENT:"1"};i.trace("getUnixShellEnvironment#env",s);let a=await o8(gr,s);return i.trace("getUnixShellEnvironment#shell",a),new Promise((l,d)=>{if(t.isCancellationRequested)return d(new Oe);let c=ot(a),u,m,g="";/^(?:pwsh|powershell)(?:-preview)?$/.test(c)?(u=`& '${process.execPath}' ${g} -p '''${o}'' + JSON.stringify(process.env) + ''${o}'''`,m=["-Login","-Command"]):c==="nu"?(u=`^'${process.execPath}' ${g} -p '"${o}" + JSON.stringify(process.env) + "${o}"'`,m=["-i","-l","-c"]):c==="xonsh"?(u=`import os, json; print("${o}", json.dumps(dict(os.environ)), "${o}")`,m=["-i","-l","-c"]):(u=`'${process.execPath}' ${g} -p '"${o}" + JSON.stringify(process.env) + "${o}"'`,c==="tcsh"||c==="csh"?m=["-ic"]:m=["-i","-l","-c"]),i.trace("getUnixShellEnvironment#spawn",JSON.stringify(m),u);let h=Ree(a,[...m,u],{detached:!0,stdio:["ignore","pipe","pipe"],env:s});t.onCancellationRequested(()=>(h.kill(),d(new Oe))),h.on("error",x=>{i.error("getUnixShellEnvironment#errorChildProcess",To(x)),d(x)});let f=[];h.stdout.on("data",x=>f.push(x));let I=[];h.stderr.on("data",x=>I.push(x)),h.on("close",(x,E)=>{let w=Buffer.concat(f).toString("utf8");i.trace("getUnixShellEnvironment#raw",w);let R=Buffer.concat(I).toString("utf8");if(R.trim()&&i.trace("getUnixShellEnvironment#stderr",R),x||E)return d(new Error(p(3241,null,x,E)));let L=r.exec(w),U=L?L[1]:"{}";try{let z=JSON.parse(U);e?z.ELECTRON_RUN_AS_NODE=e:delete z.ELECTRON_RUN_AS_NODE,n?z.ELECTRON_NO_ATTACH_CONSOLE=n:delete z.ELECTRON_NO_ATTACH_CONSOLE,delete z.VSCODE_RESOLVING_ENVIRONMENT,delete z.XDG_RUNTIME_DIR,i.trace("getUnixShellEnvironment#result",z),l(z)}catch(z){i.error("getUnixShellEnvironment#errorCaught",To(z)),d(z)}})})}import{parse as i8}from"url";function Aee(i,t){return i.protocol==="http:"?t.HTTP_PROXY||t.http_proxy||null:i.protocol==="https:"&&(t.HTTPS_PROXY||t.https_proxy||t.HTTP_PROXY||t.http_proxy)||null}async function s8(i,t,e={}){let n=i8(i),o=e.proxyUrl||Aee(n,t);if(!o)return null;let r=i8(o);if(!/^https?:$/.test(r.protocol||""))return null;let s={host:r.hostname||"",port:(r.port?+r.port:0)||(r.protocol==="https"?443:80),auth:r.auth,rejectUnauthorized:XI(e.strictSSL)?e.strictSSL:!0};if(n.protocol==="http:"){let{default:a}=await import("http-proxy-agent");return new a.HttpProxyAgent(o,s)}else{let{default:a}=await import("https-proxy-agent");return new a.HttpsProxyAgent(o,s)}}import{createGunzip as Mee}from"zlib";var Lee=new Set(["EAI_AGAIN","ECONNREFUSED","EHOSTDOWN","EHOSTUNREACH","ENETDOWN","ENETUNREACH","EPROTO"]),Oee=/^(GET|HEAD|OPTIONS)$/i;function Nee(i){if(i instanceof Error){let t=i.code;return!!t&&Lee.has(t)}return!1}var k_=class extends iC{constructor(e,n,o,r){super(r);this.machine=e;this.configurationService=n;this.environmentService=o;this.configure(),this._register(n.onDidChangeConfiguration(s=>{s.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,n){let{proxyUrl:o,strictSSL:r}=this,s;try{s=await r8(this.configurationService,this.logService,this.environmentService.args,process.env)}catch(d){this.shellEnvErrorLogged||(this.shellEnvErrorLogged=!0,this.logService.error("resolving shell environment failed",ds(d)))}let a={...process.env,...s},l=e.agent?e.agent:await s8(e.url||"",a,{proxyUrl:o,strictSSL:r});return e.agent=l,e.strictSSL=r,this.authorization&&(e.headers={...e.headers||{},"Proxy-Authorization":this.authorization}),this.logAndRequest(e,()=>l8(e,n))}async resolveProxy(e){}async lookupAuthorization(e){}async lookupKerberosAuthorization(e){try{let n=this.getConfigValue("http.proxyKerberosServicePrincipal");return"Negotiate "+await hF(e,n,this.logService,"RequestService#lookupKerberosAuthorization")}catch(n){this.logService.debug("RequestService#lookupKerberosAuthorization Kerberos authentication failed",n);return}}async loadCertificates(){return(await import("@vscode/proxy-agent")).loadSystemCertificates({loadSystemCertificatesFromNode:()=>this.getConfigValue("http.systemCertificatesNode",ym),log:this.logService})}getConfigValue(e,n){if(this.machine==="remote")return this.configurationService.getValue(e);let o=this.configurationService.inspect(e);return o.userLocalValue??o.defaultValue??n}};k_=_([S(1,$t),S(2,LB),S(3,te)],k_);async function hF(i,t,e,n){let o=await import("kerberos"),r=o.default||o,s=new URL(i),a=t||(process.platform==="win32"?`HTTP/${s.hostname}`:`HTTP@${s.hostname}`);return e.debug(`${n} Kerberos authentication lookup`,`proxyURL:${s}`,`spn:${a}`),(await r.initializeClient(a)).step("")}async function Uee(i){return(a8(i.url).protocol==="https:"?await import("https"):await import("http")).request}async function l8(i,t){let n,o=Oee.test(i.type||"GET");for(let r=1;r<=3;r++)try{return await Fee(i,t)}catch(s){if(n=s,s instanceof Oe||!o||!Nee(s)||r===3)throw s;await Vt(100*r,t)}throw n}async function Fee(i,t){return ii.withAsyncBody(async(e,n)=>{let o=a8(i.url),r=i.getRawRequest?i.getRawRequest(i):await Uee(i),s={hostname:o.hostname,port:o.port?parseInt(o.port):o.protocol==="https:"?443:80,protocol:o.protocol,path:o.path,method:i.type||"GET",headers:i.headers,agent:i.agent,rejectUnauthorized:XI(i.strictSSL)?i.strictSSL:!0};i.user&&i.password&&(s.auth=i.user+":"+i.password),i.disableCache&&(s.cache="no-store");let a=r(s,d=>{let c=jn(i.followRedirects)?i.followRedirects:3;if(d.statusCode&&d.statusCode>=300&&d.statusCode<400&&c>0&&d.headers.location)l8({...i,url:d.headers.location,followRedirects:c-1},t).then(e,n);else{let u=d;!i.isChromiumNetwork&&d.headers["content-encoding"]==="gzip"&&(u=d.pipe(Mee())),e({res:d,stream:j2(u)})}});if(a.on("error",n),i.timeout)if(i.isChromiumNetwork){let d=setTimeout(()=>{a.abort(),n(new Error(`Request timeout after ${i.timeout}ms`))},i.timeout);a.on("response",()=>clearTimeout(d)),a.on("error",()=>clearTimeout(d)),a.on("abort",()=>clearTimeout(d))}else a.setTimeout(i.timeout);i.isChromiumNetwork&&a.removeHeader("Content-Length"),i.data&&typeof i.data=="string"&&a.write(i.data),a.end();let l=t.onCancellationRequested(()=>{l.dispose(),a.abort(),n(new Oe)});a.on("response",()=>l.dispose()),a.on("error",()=>l.dispose())})}import*as El from"@vscode/proxy-agent";var Hh=$ee(import.meta.url),u8=Hh("http"),p8=Hh("https"),m8=Hh("tls"),g8=Hh("net"),I8=!1,f8=!1;function x8(i,t,e,n,o,r,s){let a=r.remote.isRemote,l=r.environment.useHostProxy??!a,d=l,c=l,u=()=>!a||t.getConfiguration("http").get("useLocalProxyConfiguration",l),g={resolveProxy:Yee(i,o),lookupProxyAuthorization:Hee({log:n,lookupKerberosAuthorization:async w=>{try{let R=Qr(t,a,"http.proxyKerberosServicePrincipal");return"Negotiate "+await hF(w,R,n,"ProxyResolver#lookupProxyAuthorization")}catch(R){n.debug("ProxyResolver#lookupProxyAuthorization Kerberos authentication failed",R)}if(a&&d){n.debug("ProxyResolver#lookupProxyAuthorization Kerberos authentication lookup on host",`proxyURL:${w}`);let R=await i.lookupKerberosAuthorization(w);if(R)return R}},lookupAuthorization:w=>i.lookupAuthorization(w),onDidRequestAuthentication:w=>ote(o,w,a)}),getProxyURL:()=>Qr(t,a,"http.proxy"),getProxySupport:()=>Qr(t,a,"http.proxySupport")||"off",getNoProxyConfig:()=>Qr(t,a,"http.noProxy")||[],isAdditionalFetchSupportEnabled:()=>Qr(t,a,"http.fetchAdditionalSupport",!0),isWebSocketPatchEnabled:()=>Qr(t,a,"http.webSocketAdditionalSupport",!0),addCertificatesV1:()=>Zee(t,a),addCertificatesV2:()=>ete(t,a),loadSystemCertificatesFromNode:()=>Qr(t,a,"http.systemCertificatesNode",ym),log:n,getLogLevel:()=>{let w=n.getLevel();switch(w){case 1:return kp.Trace;case 2:return kp.Debug;case 3:return kp.Info;case 4:return kp.Warning;case 5:return kp.Error;case 0:return kp.Off;default:return R(w)}function R(L){return n.error("Unknown log level",L),kp.Debug}},proxyResolveTelemetry:()=>{},isUseHostProxyEnabled:u,getNetworkInterfaceCheckInterval:()=>Qr(t,a,"http.experimental.networkInterfaceCheckInterval",300)*1e3,loadAdditionalCertificates:async()=>{let w=Qr(t,a,"http.systemCertificatesNode",ym),R=[];if(a&&R.push(c8({loadSystemCertificatesFromNode:()=>w,log:n})),c)if(!a&&w)R.push(c8({loadSystemCertificatesFromNode:()=>w,log:n}));else{n.trace("ProxyResolver#loadAdditionalCertificates: Loading certificates from main process");let U=i.loadCertificates();U.then(z=>n.trace("ProxyResolver#loadAdditionalCertificates: Loaded certificates from main process",z.length)),R.push(U)}let L=(await Promise.all(R)).flat();return o.$publicLog2("additionalCertificates",{count:L.length,isRemote:a,loadLocalCertificates:c,useNodeSystemCerts:w}),L},env:process.env},{resolveProxyWithRequest:h,resolveProxyURL:f,resolveProxyByURL:I}=Wee(g),x=El.default||El;x.resolveProxyURL=f,x.resolveProxyByURL=I,qee(g,t,o,r,f,s),Kee(g,f);let E=Xee(g,h);return tte(e,E)}var zee=["content-length","host","trailer","te","upgrade","cookie2","keep-alive","transfer-encoding","set-cookie"];function qee(i,t,e,n,o,r){if(!globalThis.__vscodeOriginalFetch){let s=globalThis.fetch;globalThis.__vscodeOriginalFetch=s;let a=c=>El.createFetchPatch(i,s,o,c),l=a();globalThis.__vscodePatchedFetch=l,globalThis.__vscodeCreateFetchPatch=a;let d=!1;n.remote.isRemote||(d=t.getConfiguration("http").get("electronFetch",f8),r.add(t.onDidChangeConfiguration(c=>{c.affectsConfiguration("http.electronFetch")&&(d=t.getConfiguration("http").get("electronFetch",f8))}))),globalThis.fetch=async function(u,m){function g(U){return m&&U in m?m[U]:typeof u=="object"&&"cache"in u?u[U]:void 0}let h=typeof u=="string"?u:"cache"in u?u.url:u.toString(),f=h.startsWith("data:");f&&Fh(e,"data");let I=h.startsWith("blob:");I&&Fh(e,"blob");let x=g("redirect")==="manual";x&&Fh(e,"manualRedirect");let E=g("integrity");if(E&&Fh(e,"integrity"),!d||f||I||x||E){let U=await l(u,m);return h8(e,U,h),U}if(m?.headers){let U=new Headers(m.headers);for(let z of zee)U.delete(z);m={...m,headers:U}}let w=u instanceof URL?u.toString():u,L=await Hh("electron").net.fetch(w,m);return h8(e,L,h),L}}}function Kee(i,t){if(!globalThis.__vscodeOriginalWebSocket){let e=globalThis.WebSocket;globalThis.__vscodeOriginalWebSocket=e,globalThis.WebSocket=El.createWebSocketPatch(i,e,t)}}function h8(i,t,e){let n=t.url;Object.defineProperty(t,"url",{get(){return Fh(i,"url"),n||e}});let o=t.type;Object.defineProperty(t,"type",{get(){return Fh(i,"typeProperty"),o!=="default"?o:"basic"}})}var v8={url:0,typeProperty:0,data:0,blob:0,integrity:0,manualRedirect:0},P_,jee=!1;function Fh(i,t){jee&&!v8[t]++&&(P_&&clearTimeout(P_),P_=setTimeout(()=>{i.$publicLog2("fetchFeatureUse",v8)},1e4),P_.unref?.())}var $n={count:0,totalDuration:0,minDuration:Number.MAX_SAFE_INTEGER,maxDuration:0,types:new Set,lastSentTime:0},Gee=3600*1e3;function Qee(i){let t=i?String(i).trim().split(/\s+/,1)[0]:"EMPTY";return["DIRECT","PROXY","HTTPS","SOCKS","EMPTY"].indexOf(t)===-1?"UNKNOWN":t}function Jee(i){if($n.count>0){let t=$n.totalDuration/$n.count;i.$publicLog2("proxyResolveStats",{count:$n.count,totalDuration:$n.totalDuration,minDuration:$n.minDuration,maxDuration:$n.maxDuration,avgDuration:t,type:[...$n.types].sort().join(",")}),$n.count=0,$n.totalDuration=0,$n.minDuration=Number.MAX_SAFE_INTEGER,$n.maxDuration=0,$n.types.clear()}$n.lastSentTime=Date.now()}function Yee(i,t){return async e=>{let n=performance.now(),o;try{return o=await i.resolveProxy(e),o}finally{let r=performance.now()-n;$n.count++,$n.totalDuration+=r,$n.minDuration=Math.min($n.minDuration,r),$n.maxDuration=Math.max($n.maxDuration,r),$n.types.add(Qee(o)),Date.now()-$n.lastSentTime>=Gee&&Jee(t)}}}function Xee(i,t){function e(n,o){let r=n.default||n;return r.__vscodeOriginal=Object.assign({},r),Object.assign(r,o)}return{http:e(u8,d8(i,u8,t)),https:e(p8,d8(i,p8,t)),net:e(g8,Bee(i,g8)),tls:e(m8,Vee(i,m8))}}function Zee(i,t){return!Qr(i,t,"http.experimental.systemCertificatesV2",I8)&&!!Qr(i,t,"http.systemCertificates")}function ete(i,t){return!!Qr(i,t,"http.experimental.systemCertificatesV2",I8)&&!!Qr(i,t,"http.systemCertificates")}var y8=new Map;function tte(i,t){return i.getExtensionPathIndex().then(e=>{let n=Hh("module"),o=n._load;n._load=function(s,a,l){if(s==="net")return t.net;if(s==="tls")return t.tls;if(s!=="http"&&s!=="https"&&s!=="undici")return o.apply(this,arguments);let d=e.findSubstr(y.file(a.filename)),c=y8.get(d);if(c||y8.set(d,c={}),!c[s])if(s==="undici"){let u=o.apply(this,arguments);El.patchUndici(u),c[s]=u}else{let u=t[s];c[s]={...u}}return c[s]}})}var b8=!1,nte=!1;function ote(i,t,e){!nte||b8||!t.length||(b8=!0,i.$publicLog2("proxyAuthenticationRequest",{authenticationType:t.map(n=>n.split(" ")[0]).join(","),extensionHostType:e?"remote":"local"}))}function Qr(i,t,e,n){if(t)return i.getConfiguration().get(e)??n;let o=i.getConfiguration().inspect(e);return o?.globalLocalValue??o?.defaultValue??n}import{tmpdir as rte}from"os";var Wh=class extends N{constructor(t,e){super();let n=t.getProxy(F.MainThreadDownloadService);e.registerCommand(!1,"_workbench.downloadResource",async o=>{let r=y.file(Be(rte(),_e()));return await n.$download(o,r),r})}};Wh=_([S(0,le),S(1,Bn)],Wh);import*as __ from"fs";var vF=class{constructor(t,e,n){this._commands=t;this.logService=e;this._ipcHandlePath=n;this._server=void 0;this._disposed=!1;this.setup()}get ipcHandlePath(){return this._ipcHandlePath}async setup(){try{let t=await import("http");if(this._disposed)return;this._server=t.createServer((e,n)=>this.onRequest(e,n));try{this._server.listen(this.ipcHandlePath),this._server.on("error",e=>this.logService.error(e))}catch{this.logService.error("Could not start open from terminal server.")}}catch(t){this.logService.error("Error setting up CLI server",t)}}onRequest(t,e){let n=(r,s)=>{e.writeHead(r,{"content-type":"application/json"}),e.end(JSON.stringify(s||null),a=>a&&this.logService.error(a))},o=[];t.setEncoding("utf8"),t.on("data",r=>o.push(r)),t.on("end",async()=>{try{let r=JSON.parse(o.join("")),s;switch(r.type){case"open":s=await this.open(r);break;case"openExternal":s=await this.openExternal(r);break;case"status":s=await this.getStatus(r);break;case"extensionManagement":s=await this.manageExtensions(r);break;default:n(404,`Unknown message type: ${r.type}`);break}n(200,s)}catch(r){let s=r instanceof Error?r.message:JSON.stringify(r);n(500,s),this.logService.error("Error while processing pipe request",r)}})}async open(t){let{fileURIs:e,folderURIs:n,forceNewWindow:o,diffMode:r,mergeMode:s,addMode:a,removeMode:l,forceReuseWindow:d,gotoLineMode:c,waitMarkerFilePath:u,remoteAuthority:m}=t,g=[];if(Array.isArray(n))for(let x of n)try{g.push({folderUri:y.parse(x)})}catch{}if(Array.isArray(e))for(let x of e)try{oV(x)?g.push({workspaceUri:y.parse(x)}):g.push({fileUri:y.parse(x)})}catch{}let h=u?y.file(u):void 0,I={forceNewWindow:o,diffMode:r,mergeMode:s,addMode:a,removeMode:l,gotoLineMode:c,forceReuseWindow:d,preferNewWindow:!d&&!h&&!a&&!l,waitMarkerFileURI:h,remoteAuthority:m};this._commands.executeCommand("_remoteCLI.windowOpen",g,I)}async openExternal(t){for(let e of t.uris)y.parse(e).scheme!=="file"&&await this._commands.executeCommand("_remoteCLI.openExternal",e)}async manageExtensions(t){let e=o=>o?.map(r=>/\.vsix$/i.test(r)?y.parse(r):r),n={list:t.list,install:e(t.install),uninstall:e(t.uninstall),force:t.force};return await this._commands.executeCommand("_remoteCLI.manageExtensions",n)}async getStatus(t){return await this._commands.executeCommand("_remoteCLI.getSystemStatus")}dispose(){this._disposed=!0,this._server?.close(),this._ipcHandlePath&&process.platform!=="win32"&&__.existsSync(this._ipcHandlePath)&&__.unlinkSync(this._ipcHandlePath)}},Vh=class extends vF{constructor(t,e){super(t,e,bW())}};Vh=_([S(0,Bn),S(1,te)],Vh);var Bh=class{constructor(t,e){this._mainThreadConsole=t.getProxy(F.MainThreadConsole),this._includeStack=e.consoleForward.includeStack,this._logNative=e.consoleForward.logNative,this._wrapConsoleMethod("info","log"),this._wrapConsoleMethod("log","log"),this._wrapConsoleMethod("warn","warn"),this._wrapConsoleMethod("debug","debug"),this._wrapConsoleMethod("error","error")}_wrapConsoleMethod(t,e){let n=this,o=console[t];Object.defineProperty(console,t,{set:()=>{},get:()=>(...r)=>{n._handleConsoleCall(t,e,o,r)}})}_handleConsoleCall(t,e,n,o){this._mainThreadConsole.$logExtensionHostMessage({type:"__$console",severity:e,arguments:ste(o,this._includeStack)}),this._logNative&&this._nativeConsoleLogMessage(t,n,o)}};Bh=_([S(0,le),S(1,Ye)],Bh);var ite=1e5;function ste(i,t){let e=[];if(i.length)for(let n=0;n<i.length;n++){let o=i[n];if(typeof o>"u")o="undefined";else if(o instanceof Error){let r=o;r.stack?o=r.stack:o=r.toString()}e.push(o)}if(t){let n=new Error().stack;n&&e.push({__$stack:n.split(`
`).slice(3).join(`
`)})}try{let n=Jp(e);return n.length>ite?"Output omitted for a large object that exceeds the limits":n}catch(n){return`Output omitted for an object that cannot be inspected ('${n.toString()}')`}}var ate=1024*1024,$h=class extends Bh{constructor(e,n){super(e,n);this._isMakingConsoleCall=!1;this._wrapStream("stderr","error"),this._wrapStream("stdout","log")}_nativeConsoleLogMessage(e,n,o){let r=e==="error"||e==="warn"?process.stderr:process.stdout;this._isMakingConsoleCall=!0,r.write(`
START_NATIVE_LOG
`),n.apply(console,o),r.write(`
END_NATIVE_LOG
`),this._isMakingConsoleCall=!1}_wrapStream(e,n){let o=process[e],r=o.write,s="";Object.defineProperty(o,"write",{set:()=>{},get:()=>(a,l,d)=>{if(!this._isMakingConsoleCall){s+=a.toString(l);let c=s.length>ate?s.length:s.lastIndexOf(`
`);c!==-1&&(console[n](s.slice(0,c)),s=s.slice(c+1))}r.call(o,a,l,d)}})}};$h=_([S(0,le),S(1,Ye)],$h);import{constants as bF,promises as Pp}from"fs";async function S8(i,t,e,n,o,r){let s;try{await lte(i,t,e,n,o,r)}catch(a){s=a}finally{s&&o.errorTransformer&&(s=o.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function lte(i,t,e,n,o,r){yF(r);let s=await i.open(t,{create:!1});try{yF(r);let a=0,l=0,d=o&&typeof o.length=="number"?o.length:void 0,c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),u=o&&typeof o.position=="number"?o.position:0,m=0;do l=await i.read(s,u,c.buffer,m,c.byteLength-m),u+=l,m+=l,a+=l,typeof d=="number"&&(d-=l),m===c.byteLength&&(await e.write(n(c)),c=H.alloc(Math.min(o.bufferSize,typeof d=="number"?d:o.bufferSize)),m=0);while(l>0&&(typeof d!="number"||d>0)&&yF(r)&&dte(a,o));if(m>0){let g=m;typeof d=="number"&&(g=Math.min(m,d)),e.write(n(c.slice(0,g)))}}catch(a){throw QW(a)}finally{await i.close(s)}}function yF(i){if(i.isCancellationRequested)throw Ia();return!0}function dte(i,t){if(typeof t?.limits?.size=="number"&&i>t.limits.size)throw Fi(p(3045,null),"EntryTooLarge");return!0}var R_=class extends N{constructor(e,n){super();this.logService=e;this.options=n;this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new T);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Pa(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Pa(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,n){return n.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,n):this.watchNonRecursive(e,n)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,n){let o=this.toWatchRequest(e,n),r=mR(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),q(()=>{r(),this.refreshUniversalWatchers()})}toWatchRequest(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:n.recursive,filter:n.filter,correlationId:n.correlationId};if(s9(o)){let r=this.options?.watcher?.recursive?.usePolling;r===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(r)&&r.includes(o.path)&&(o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return o}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>Ge(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(rU(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.universalWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.universalWatcher.watch(this.universalWatchRequests)}watchNonRecursive(e,n){let o={path:this.toWatchPath(e),excludes:n.excludes,includes:n.includes,recursive:!1,filter:n.filter,correlationId:n.correlationId},r=mR(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),q(()=>{r(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>Ge(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(rU(e)),e=>this.onWatcherLogMessage(e),this.logService.getLevel()===1)),this._register(this.logService.onDidChangeLogLevel(()=>{this.nonRecursiveWatcher?.setVerboseLogging(this.logService.getLevel()===1)}))),this.nonRecursiveWatcher.watch(this.nonRecursiveWatchRequests)}onWatcherLogMessage(e){e.type==="error"&&this._onDidWatchError.fire(e.message),this.logWatcherMessage(e)}logWatcherMessage(e){this.logService[e.type](e.message)}toFilePath(e){return so(e.fsPath)}toWatchPath(e){let n=this.toFilePath(e);return S2(n)}};import{fork as pte}from"child_process";function C8(i){let t=i;return t&&typeof t.type=="string"&&typeof t.severity=="string"}function cte(i){let t=[],e;try{let n=JSON.parse(i.arguments),o=n[n.length-1];o&&o.__$stack&&(n.pop(),e=o.__$stack),t.push(...n)}catch{t.push("Unable to log remote console arguments",i.arguments)}return{args:t,stack:e}}function ute(i){if(!i)return i;let t=i.indexOf(`
`);return t===-1?i:i.substring(0,t)}function T8(i,t){let{args:e,stack:n}=cte(i),o=typeof e[0]=="string"&&e.length===1,r=ute(n);r&&(r=`(${r.trim()})`);let s=[];if(typeof e[0]=="string"?r&&o?s=[`%c[${t}] %c${e[0]} %c${r}`,zh("blue"),zh(""),zh("grey")]:s=[`%c[${t}] %c${e[0]}`,zh("blue"),zh(""),...e.slice(1)]:s=[`%c[${t}]%`,zh("blue"),...e],r&&!o&&s.push(r),typeof console[i.severity]!="function")throw new Error("Unknown console method");console[i.severity].apply(console,s)}function zh(i){return`color: ${i}`}var D_=class{constructor(t,e){this.modulePath=t;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new T;this.onDidProcessExit=this._onDidProcessExit.event;let n=e.timeout||6e4;this.disposeDelayer=new Iv(n),this.child=null,this._client=null}getChannel(t){let e=this;return{call(n,o,r){return e.requestPromise(t,n,o,r)},listen(n,o){return e.requestEvent(t,n,o)}}}requestPromise(t,e,n,o=pe.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(o.isCancellationRequested)return Promise.reject(Ia());this.disposeDelayer.cancel();let r=this.getCachedChannel(t),s=br(c=>r.call(e,n,c)),a=o.onCancellationRequested(()=>s.cancel()),l=q(()=>s.cancel());this.activeRequests.add(l);let d=()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())};return s.then(d,d),s}requestEvent(t,e,n){if(!this.disposeDelayer)return ye.None;this.disposeDelayer.cancel();let o,r=new T({onWillAddFirstListener:()=>{o=this.getCachedChannel(t).listen(e,n)(r.fire,r),this.activeRequests.add(o)},onDidRemoveLastListener:()=>{this.activeRequests.delete(o),o.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return r.event}get client(){if(!this._client){let t=this.options.args||[],e=Object.create(null);e.env={...ft(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(u=>!/^--inspect(-brk)?=/.test(u)).filter(u=>!u.startsWith("--vscode-"))),pz(e.env),this.child=pte(this.modulePath,t,e);let n=new T,r=ye.fromNodeEventEmitter(this.child,"message",u=>u)(u=>{if(C8(u)){T8(u,`IPC Library: ${this.options.serverName}`);return}n.fire(H.wrap(Buffer.from(u,"base64")))}),s=this.options.useQueue?gz(this.child):this.child,a=u=>this.child?.connected&&s.send(u.buffer.toString("base64")),l=n.event,d={send:a,onMessage:l};this._client=new Av(d);let c=()=>this.disposeClient();process.once("exit",c),this.child.on("error",u=>console.warn('IPC "'+this.options.serverName+'" errored with '+u)),this.child.on("exit",(u,m)=>{process.removeListener("exit",c),r.dispose(),this.activeRequests.forEach(g=>In(g)),this.activeRequests.clear(),u!==0&&m!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+u+" and signal "+m),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:u,signal:m})})}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()}};var A_=class extends iP{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){let e=t.add(new D_(Gl.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:n,signal:o})=>this.onError(`terminated by itself with code ${n}, signal: ${o} (ETERM)`))),xD.toService(cW(e.getChannel("watcher")))}};import{watchFile as mte,unwatchFile as gte}from"fs";var M_=class extends N{constructor(){super();this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new T);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new T);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new bn);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Pa(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new jt;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return sP(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:to(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new jt;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let n of e)this.isCorrelated(n)?this.correlatedWatchRequests.set(n.correlationId,n):this.nonCorrelatedWatchRequests.set(this.computeId(n),n);for(let[n]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(n)&&!this.correlatedWatchRequests.has(n)&&(this.suspendedWatchRequests.deleteAndDispose(n),this.suspendedWatchRequestsWithPolling.delete(n));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let n=[];for(let[o,r]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(o)||n.push(r);return this.updateWatchersDelayer.trigger(()=>this.doWatch(n),e?this.getUpdateWatchersDelay():0).catch(o=>Ge(o))}getUpdateWatchersDelay(){return 800}isSuspended(e){let n=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(n)?"polling":this.suspendedWatchRequests.has(n)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let n=new $;this.suspendedWatchRequests.set(e.id,n),await this.joinWatch.p,!n.isDisposed&&(this.monitorSuspendedWatchRequest(e,n),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,n){this.doMonitorWithExistingWatcher(e,n)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,n),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,n){let o=this.recursiveWatcher?.subscribe(e.path,(r,s)=>{n.isDisposed||(r?this.monitorSuspendedWatchRequest(e,n):s?.type===1&&this.onMonitoredPathAdded(e))});return o?(n.add(o),!0):!1}doMonitorWithNodeJS(e,n){let o=!1,r=(s,a)=>{if(n.isDisposed)return;let l=this.isPathNotFound(s),d=this.isPathNotFound(a),c=o;o=l,!l&&(d||c)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{mte(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},r)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}n.add(q(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{gte(e.path,r)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let n={resource:y.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([n]),this.traceEvent(n,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,n){if(this.verboseLogging){let o=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(o,n)}}traceWithCorrelation(e,n){this.verboseLogging&&this.trace(`${e}${typeof n.correlationId=="number"?` <${n.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:"<none>"}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):"<all>"}, filter: ${d9(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:"<none>"})`}async setVerboseLogging(e){this.verboseLogging=e}};import{watch as fte,promises as hte}from"fs";var L_=class i extends N{constructor(e,n,o,r,s,a){super();this.request=e;this.recursiveWatcher=n;this.onDidFilesChange=o;this.onDidWatchFail=r;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new zp({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new Mx(e=>this.handleFileChanges(e),i.FILE_CHANGES_HANDLER_DELAY));this.cts=new Ee;this.realPath=new mt(async()=>{let e=this.request.path;try{e=await at.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!Xe;this.excludes=sU(this.request.path,this.request.excludes,l),this.includes=this.request.includes?sU(this.request.path,this.request.includes,l):void 0,this.filter=sP(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await hte.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;await AH(this.doWatch(e.isDirectory()),this._store)}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){let n=new tn;try{return await this.doWatchGeneration(e,n),n}catch(o){throw n.dispose(),o}}async doWatchGeneration(e,n){let o=new $;if(n.value=o,n.value!==o){o.dispose();return}this.doWatchWithExistingWatcher(e,o,n)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,o,n))}doWatchWithExistingWatcher(e,n,o){if(e)return!1;let r=y.file(this.request.path),s=this.recursiveWatcher?.subscribe(this.request.path,async(a,l)=>{n.isDisposed||(a?await this.doWatchGeneration(e,o):l&&(typeof l.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:r,type:l.type,cId:this.request.correlationId},!0))});return s?(n.add(s),!0):!1}async doWatchWithNodeJS(e,n,o){let r=await this.realPath.value;if(this.cts.token.isCancellationRequested||n.isDisposed)return;if(St&&Or(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}let s=new Ee(this.cts.token);n.add(q(()=>s.dispose(!0)));let a=new $;n.add(a);try{let l=y.file(this.request.path),d=ot(r),c=fte(r);a.add(q(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${r}'`);let u=new Set;if(e)try{for(let g of await at.readdir(r))u.add(g)}catch(g){this.error(g)}if(s.token.isCancellationRequested)return;let m=new Map;a.add(q(()=>{for(let[,g]of m)g.dispose();m.clear()})),c.on("error",(g,h)=>{s.token.isCancellationRequested||(this.error(`Failed to watch ${r} for changes using fs.watch() (${g}, ${h})`),this.notifyWatchFailed())}),c.on("change",(g,h)=>{if(s.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${g}"] ${h}`);let f="";if(h&&(f=h.toString(),St&&(f=Fc(f))),!(!f||g!=="change"&&g!=="rename"))if(e)if(g==="rename"){let I=cn(f)&&Oc(ot(f),d,!Xe),x=m.get(f);if(I&&x)return;x?.dispose();let E=setTimeout(async()=>{if(m.delete(f),I){o.clear();let L=await at.exists(r);if(this.cts.token.isCancellationRequested)return;L?await this.doWatchGeneration(!0,o):this.onWatchedPathDeleted(l);return}if(Oc(f,d,!Xe)&&!await at.exists(r)){o.clear(),this.onWatchedPathDeleted(l);return}if(s.token.isCancellationRequested)return;let w=await this.existsChildStrictCase(Be(r,f));if(s.token.isCancellationRequested)return;let R;w?u.has(f)?R=0:(R=1,u.add(f)):(u.delete(f),R=2),this.onFileChange({resource:gt(l,f),type:R,cId:this.request.correlationId})},i.FILE_DELETE_HANDLER_DELAY);m.set(f,q(()=>clearTimeout(E)))}else{let I;u.has(f)?I=0:(I=1,u.add(f)),this.onFileChange({resource:gt(l,f),type:I,cId:this.request.correlationId})}else if(g==="rename"||!Oc(f,d,!Xe)){let I=setTimeout(async()=>{let x=await at.exists(r);s.token.isCancellationRequested||(x?(o.clear(),this.onFileChange({resource:l,type:0,cId:this.request.correlationId},!0),await this.doWatchGeneration(!1,o)):(o.clear(),this.onWatchedPathDeleted(l)))},i.FILE_DELETE_HANDLER_DELAY);a.clear(),a.add(q(()=>clearTimeout(I)))}else this.onFileChange({resource:l,type:0,cId:this.request.correlationId},!0)})}catch(l){if(s.token.isCancellationRequested)return;this.error(`Failed to watch ${r} for changes using fs.watch() (${l.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,n=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!n&&this.excludes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!n&&this.includes&&this.includes.length>0&&!this.includes.some(o=>o(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let n=a9(e),o=[];for(let s of n){if(l9(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}o.push(s)}if(o.length===0)return;if(this.verboseLogging)for(let s of o)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(o)?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: ${o[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: ${o.length}, most recent change: ${o[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(Xe)return at.exists(e);try{let n=ot(e);return(await at.readdir(gn(e))).some(r=>r===n)}catch(n){return this.trace(n),!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()}};var O_=class extends M_{constructor(e){super();this.recursiveWatcher=e;this.onDidError=ye.None;this._watchers=new Map;this.worker=this._register(new tn)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let n=[],o=new Set(Array.from(this.watchers));for(let r of e){let s=this._watchers.get(this.requestToWatcherKey(r));s&&w1(s.request.excludes,r.excludes)&&w1(s.request.includes,r.includes)?o.delete(s):n.push(r)}n.length&&this.trace(`Request to start watching: ${n.map(r=>this.requestToString(r)).join(",")}`),o.size&&this.trace(`Request to stop watching: ${Array.from(o).map(r=>this.requestToString(r.request)).join(",")}`),this.worker.clear();for(let r of o)this.stopWatching(r);this.createWatchWorker().work(n)}createWatchWorker(){return this.worker.value=new zp({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let n of e)this.startWatching(n)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return Xe?e:e.toLowerCase()}startWatching(e){let n=new L_(e,this.recursiveWatcher,r=>this._onDidChangeFile.fire(r),()=>this._onDidWatchFail.fire(e),r=>this._onDidLogMessage.fire(r),this.verboseLogging),o={request:e,instance:n};this._watchers.set(this.requestToWatcherKey(e),o)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let n=new Map;for(let o of e){let r=n.get(o.correlationId);r||(r=new Map,n.set(o.correlationId,r));let s=this.pathToWatcherKey(o.path);r.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(o)}`),r.set(s,o)}return Array.from(n.values()).flatMap(o=>Array.from(o.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let n of this.watchers)n.instance.setVerboseLogging(e)}trace(e,n){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,n)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,n){return n?`[File Watcher (node.js)] ${e} (${this.requestToString(n.request)})`:`[File Watcher (node.js)] ${e}`}};var N_=class extends rP{constructor(t,e,n){super(t,e,n),this.init()}createWatcher(t){return t.add(new O_(void 0))}};var U_=class i extends R_{constructor(){super(...arguments);this.onDidChangeCapabilities=ye.None;this.resourceLocks=new Ve(e=>Nc.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,Xe&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:n,symbolicLink:o}=await Wo.stat(this.toFilePath(e)),r;return(n.mode&128)===0&&(r=2),(n.mode&bF.S_IXUSR||n.mode&bF.S_IXGRP||n.mode&bF.S_IXOTH)&&(r=(r??0)|4),{type:this.toType(n,o),ctime:n.birthtime.getTime(),mtime:n.mtime.getTime(),size:n.size,permissions:r}}catch(n){throw this.toFileSystemProviderError(n)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let n=this.toFilePath(e);return at.realpath(n)}async readdir(e){try{let n=await at.readdir(this.toFilePath(e),{withFileTypes:!0}),o=[];return await Promise.all(n.map(async r=>{try{let s;r.isSymbolicLink()?s=(await this.stat(gt(e,r.name))).type:s=this.toType(r),o.push([r.name,s])}catch(s){this.logService.trace(s)}})),o}catch(n){throw this.toFileSystemProviderError(n)}}toType(e,n){let o;return n?.dangling?o=0:e.isFile()?o=1:e.isDirectory()?o=2:o=0,n&&(o|=64),o}async createResourceLock(e){let n=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${n})`);let o;for(;o=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${n})`),await o.wait();let r=new kn;return this.resourceLocks.set(e,r),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${n})`),q(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${n})`),this.resourceLocks.get(e)===r&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${n})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${n})`),r.open()})}async readFile(e,n){let o;try{n?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),o=await this.createResourceLock(e));let r=this.toFilePath(e);return await Pp.readFile(r)}catch(r){throw this.toFileSystemProviderError(r)}finally{o?.dispose()}}traceLock(e){i.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,n,o){let r=Uc(s=>H.concat(s.map(a=>H.wrap(a))).buffer);return S8(this,e,r,s=>s.buffer,{...n,bufferSize:256*1024},o),r}async writeFile(e,n,o){return o?.atomic!==!1&&o?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,gt(Ho(e),`${Ze(e)}${o.atomic.postfix}`),n,o):this.doWriteFile(e,n,o)}async canWriteFileAtomic(e){try{let n=this.toFilePath(e),{symbolicLink:o}=await Wo.stat(n);if(o)return!1}catch{}return!0}async doWriteFileAtomic(e,n,o,r){let s=new $;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(n)),await this.doWriteFile(n,o,{...r,create:!0,overwrite:!0},!0);try{await this.rename(n,e,{overwrite:!0})}catch(a){try{await this.delete(n,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,n,o,r){let s;try{let a=this.toFilePath(e);if(!o.create||!o.overwrite){if(await at.exists(a)){if(!o.overwrite)throw Fi(p(3050,null),"EntryExists")}else if(!o.create)throw Fi(p(3053,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:o.append,unlock:o.unlock},r),await this.write(s,0,n,0,n.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){i.canFlush=e}async open(e,n,o){let r=this.toFilePath(e),s;Qc(n)&&!o&&(s=await this.createResourceLock(e));let a;try{if(Qc(n)&&n.unlock)try{let{stat:l}=await Wo.stat(r);l.mode&128||await Pp.chmod(r,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(Te&&Qc(n)&&!n.append)try{a=await at.open(r,"r+"),await at.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await at.close(a)}catch(d){this.logService.trace(d)}a=void 0}}typeof a!="number"&&(a=await at.open(r,Qc(n)?n.append?"a":"w":"r"))}catch(l){throw s?.dispose(),Qc(n)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),Qc(n)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${r})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${r})`),l.dispose())}return a}async close(e){let n=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&i.canFlush)try{await at.fdatasync(e)}catch(o){i.configureFlushOnWrite(!1),this.logService.error(o)}return await at.close(e)}catch(o){throw this.toFileSystemProviderError(o)}finally{n&&(this.mapHandleToLock.get(e)===n&&(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}`),n.dispose())}}async read(e,n,o,r,s){let a=this.normalizePos(e,n),l=null;try{l=(await at.read(e,o,r,s,a)).bytesRead}catch(d){throw this.toFileSystemProviderError(d)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,n){return n===this.mapHandleToPos.get(e)?null:n}updatePos(e,n,o){let r=this.mapHandleToPos.get(e);typeof r=="number"&&(typeof n=="number"||(typeof o=="number"?this.mapHandleToPos.set(e,r+o):this.mapHandleToPos.delete(e)))}async write(e,n,o,r,s){return U2(()=>this.doWrite(e,n,o,r,s),100,3)}async doWrite(e,n,o,r,s){let a=this.normalizePos(e,n),l=null;try{l=(await at.write(e,o,r,s,a)).bytesWritten}catch(d){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),d)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await Pp.mkdir(this.toFilePath(e))}catch(n){throw this.toFileSystemProviderError(n)}}async delete(e,n){try{let o=this.toFilePath(e);if(n.recursive){let r;n?.atomic!==!1&&n.atomic.postfix&&(r=Be(gn(o),`${ot(o)}${n.atomic.postfix}`)),await at.rm(o,1,r)}else try{await Pp.unlink(o)}catch(r){if(r.code==="EPERM"||r.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Wo.stat(o);s=a.isDirectory()&&!l}catch{}if(s)await Pp.rmdir(o);else throw r}else throw r}}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n);if(r!==s)try{await this.validateMoveCopy(e,n,"move",o.overwrite),await at.rename(r,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(3054,null,ot(r),ot(gn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n);if(r!==s)try{await this.validateMoveCopy(e,n,"copy",o.overwrite),await at.copy(r,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(p(3048,null,ot(r),ot(gn(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,n,o,r){let s=this.toFilePath(e),a=this.toFilePath(n),l=!1;if(this.capabilities&1024||(l=Oc(s,a,!0)),l){if(o==="copy")throw Fi(p(3049,null),"EntryExists");if(o==="move")return}let c=await this.statIgnoreError(e);if(!c)throw Fi(p(3052,null),"EntryNotFound");let u=await this.statIgnoreError(n);if(u){if(!r)throw Fi(p(3051,null),"EntryExists");(c.type&1)!==0&&(u.type&1)!==0||await this.delete(n,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,n){return this.doCloneFile(e,n,!1)}async doCloneFile(e,n,o){let r=this.toFilePath(e),s=this.toFilePath(n),a=!!(this.capabilities&1024);if(Oc(r,s,!a))return;let l=new $;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(n)),o&&await Pp.mkdir(gn(s),{recursive:!0}),await Pp.copyFile(r,s)}catch(d){if(d.code==="ENOENT"&&!o)return this.doCloneFile(e,n,!0);throw this.toFileSystemProviderError(d)}finally{l.dispose()}}createUniversalWatcher(e,n,o){return new A_(r=>e(r),r=>n(r),o)}createNonRecursiveWatcher(e,n,o){return new N_(r=>e(r),r=>n(r),o)}toFileSystemProviderError(e){if(e instanceof id)return e;let n=e,o;switch(e.code){case"ENOENT":o="EntryNotFound";break;case"EISDIR":o="EntryIsADirectory";break;case"ENOTDIR":o="EntryNotADirectory";break;case"EEXIST":o="EntryExists";break;case"EPERM":case"EACCES":o="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":n=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,o="Unknown";break;default:o="Unknown"}return Fi(n,o)}async toFileSystemProviderWriteError(e,n){let o=this.toFileSystemProviderError(n);if(e&&o.code==="NoPermissions")try{let{stat:r}=await Wo.stat(this.toFilePath(e));r.mode&128||(o=Fi(n,"EntryWriteLocked"))}catch(r){this.logService.trace(r)}return o}};var qh=class{constructor(t,e){t.addFileSystemProvider(B.file,new IF(e),{isCaseSensitive:Xe})}};qh=_([S(0,oa),S(1,te)],qh);var IF=class{constructor(t){this.impl=new U_(t)}async stat(t){let e=await this.impl.stat(t);return{type:e.type,ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.permissions===1?1:void 0}}readDirectory(t){return this.impl.readdir(t)}createDirectory(t){return this.impl.mkdir(t)}readFile(t){return this.impl.readFile(t)}writeFile(t,e,n){return this.impl.writeFile(t,e,{...n,unlock:!1,atomic:!1})}delete(t,e){return this.impl.delete(t,{...e,useTrash:!1,atomic:!1})}rename(t,e,n){return this.impl.rename(t,e,n)}copy(t,e,n){return this.impl.copy(t,e,n)}get onDidChangeFile(){throw new Error("Method not implemented.")}watch(t,e){throw new Error("Method not implemented.")}};import E8 from"node:module";var w8=E8.createRequire(import.meta.url),xF=class i extends Nh{constructor(){super(...arguments);this._store=new $}static _createDataUri(e){return`data:text/javascript;base64,${Buffer.from(e).toString("base64")}`}static{this._vscodeImportFnName="_VSCODE_IMPORT_VSCODE_API"}dispose(){this._store.dispose()}_installInterceptor(){let e=this,n=w8("module"),o=n._load;n._load=function(h,f,I){return h=a(h),e._factories.has(h)?e._factories.get(h).load(h,y.file(hD(f.filename)),x=>o.apply(this,[x,f,I])):o.apply(this,arguments)};let r=n._resolveLookupPaths;n._resolveLookupPaths=(g,h)=>r.call(this,a(g),h);let s=n._resolveFilename;n._resolveFilename=function(h,f,I,x){return h==="vsda"&&Array.isArray(x?.paths)&&x.paths.length===0&&(x.paths=n._nodeModulePaths(import.meta.dirname)),s.call(this,h,f,I,x)};let a=g=>{for(let h of e._alternatives){let f=h(g);if(f){g=f;break}}return g},l=new YI,d=new Map;Object.defineProperty(globalThis,i._vscodeImportFnName,{enumerable:!1,configurable:!1,writable:!1,value:g=>l.getKey(g)});let c,u=g=>{c||(c=this._factories.get("vscode"),Lp(c));let h=y.parse(g),f=c.load("_not_used",h,()=>{throw new Error("CANNOT LOAD MODULE from here.")}),I=l.get(f);I||(I=_e(),l.set(f,I));let x=d.get(I);if(!x){let E=`const _vscodeInstance = globalThis.${i._vscodeImportFnName}('${I}');

${Object.keys(f).map((w=>`export const ${w} = _vscodeInstance['${w}'];`)).join(`
`)}`;x=i._createDataUri(E),d.set(I,x)}return x},m=E8.registerHooks({resolve:(g,h,f)=>g!=="vscode"||!h.parentURL?f(g,h):{url:u(h.parentURL),shortCircuit:!0}});this._store.add(q(()=>m.deregister()))}},F_=class extends dc{constructor(){super(...arguments);this.extensionRuntime=1}async _beforeAlmostReadyToRunExtensions(){this._instaService.createInstance($h);let e=this._instaService.invokeFunction(Z9);if(this._instaService.createInstance(Wh),this._initData.remote.isRemote&&this._initData.remote.authority){let o=this._instaService.createInstance(Vh);process.env.VSCODE_IPC_HOOK_CLI=o.ipcHandlePath}this._instaService.createInstance(qh),await this._store.add(this._instaService.createInstance(xF,e,{mine:this._myRegistry,all:this._globalRegistry})).install(),Bt("code/extHost/didInitAPI");let n=await this._extHostConfiguration.getConfigProvider();await x8(this._extHostWorkspace,n,this,this._logService,this._mainThreadTelemetryProxy,this._initData,this._store),Bt("code/extHost/didInitProxyResolver")}_getEntryPoint(e){return e.main}async _doLoadModule(e,n,o,r){if(n.scheme!==B.file)throw new Error(`Cannot load URI: '${n}', must be of file-scheme`);let s=null;o.codeLoadingStart(),this._logService.trace(`ExtensionService#loadModule [${r}] -> ${n.toString(!0)}`),this._logService.flush();let a=e?.identifier.value;e&&await this._extHostLocalizationService.initializeLocalizedMessages(e);try{a&&Bt(`code/extHost/willLoadExtensionCode/${a}`),r==="esm"?s=await import(n.toString(!0)):s=w8(n.fsPath)}finally{a&&Bt(`code/extHost/didLoadExtensionCode/${a}`),o.codeLoadingStop()}return s}async _loadCommonJSModule(e,n,o){return this._doLoadModule(e,n,o,"cjs")}async _loadESMModule(e,n,o){return this._doLoadModule(e,n,o,"esm")}async $setRemoteEnvironment(e){if(this._initData.remote.isRemote)for(let n in e){let o=e[n];o===null?delete process.env[n]:process.env[n]=o}}};import*as jh from"fs";import{exec as F8}from"child_process";var SF=(i,t,e)=>{let n=new Uint8Array(16);for(let s=0;s<16;s++)n[s]=Math.round(Math.random()*256);let o=eo(H.wrap(n));return[`GET ws://localhost${i}?${t}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r
`)+`\r
\r
`},k8=H.fromString(`\r
\r
`);async function P8(i,t,e,n,o){i.write(H.fromString(SF(t,e,n)));let r=new $;try{return await new Promise((s,a)=>{let l;r.add(i.onData(d=>{l?l=H.concat([l,d],l.byteLength+d.byteLength):l=d;let c=l.indexOf(k8);if(c===-1)return;s(i),i.pauseData();let u=l.slice(c+k8.byteLength);u.byteLength&&o.onData.fire(u)})),r.add(i.onClose(d=>a(d??new Error("socket closed")))),r.add(i.onEnd(()=>a(new Error("socket ended"))))})}catch(s){throw i.dispose(),s}finally{r.dispose()}}var H_=class extends N{constructor(e,n){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new gs);this.onData=(...e)=>(this.pausableDataEmitter.isPaused&&queueMicrotask(()=>this.pausableDataEmitter.resume()),this.pausableDataEmitter.event(...e));this.didDisposeEmitter=this._register(new T);this.onDidDispose=this.didDisposeEmitter.event;this.ended=!1;this._register(n.onData),this._register(n.onData.event(o=>this.pausableDataEmitter.fire(o))),this.onClose=this._register(n.onClose).event,this.onEnd=this._register(n.onEnd).event}pauseData(){this.pausableDataEmitter.pause()}drain(){return Promise.resolve()}end(){this.ended=!0,this.closeRemote()}traceSocketEvent(e,n){Lv.traceSocketEvent(this,this.debugLabel,e,n)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var vte="signService",ua=A(vte);import*as L8 from"net";import*as O8 from"os";import*as CF from"net";var TF={1:!0,7:!0,9:!0,11:!0,13:!0,15:!0,17:!0,19:!0,20:!0,21:!0,22:!0,23:!0,25:!0,37:!0,42:!0,43:!0,53:!0,69:!0,77:!0,79:!0,87:!0,95:!0,101:!0,102:!0,103:!0,104:!0,109:!0,110:!0,111:!0,113:!0,115:!0,117:!0,119:!0,123:!0,135:!0,137:!0,139:!0,143:!0,161:!0,179:!0,389:!0,427:!0,465:!0,512:!0,513:!0,514:!0,515:!0,526:!0,530:!0,531:!0,532:!0,540:!0,548:!0,554:!0,556:!0,563:!0,587:!0,601:!0,636:!0,989:!0,990:!0,993:!0,995:!0,1719:!0,1720:!0,1723:!0,2049:!0,3659:!0,4045:!0,5060:!0,5061:!0,6e3:!0,6566:!0,6665:!0,6666:!0,6667:!0,6668:!0,6669:!0,6697:!0,10080:!0};function W_(i,t,e,n="127.0.0.1"){let o=!1,r,s=1,a=CF.createServer({pauseOnConnect:!0});function l(d,c){o||(o=!0,a.removeAllListeners(),a.close(),r&&clearTimeout(r),c(d))}return new Promise(d=>{r=setTimeout(()=>{l(0,d)},e),a.on("listening",()=>{l(i,d)}),a.on("error",c=>{c&&(c.code==="EADDRINUSE"||c.code==="EACCES")&&s<t?(i++,s++,a.listen(i,n)):l(0,d)}),a.on("close",()=>{l(0,d)}),a.listen(i,n)})}var bte=30*1e3;function wF(i){switch(i){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function R8(i){let t=new Ee;return setTimeout(()=>t.cancel(),i),t.token}function Ite(i,t){if(i.isCancellationRequested||t.isCancellationRequested)return pe.Cancelled;let e=new Ee;return i.onCancellationRequested(()=>e.cancel()),t.onCancellationRequested(()=>e.cancel()),e.token}var Kh=class{get didTimeout(){return this._state==="timedout"}constructor(t){this._state="pending",this._disposables=new $,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=Ev(),t.isCancellationRequested?this._timeout():this._disposables.add(t.onCancellationRequested(()=>this._timeout()))}registerDisposable(t){this._state==="pending"?this._disposables.add(t):t.dispose()}_timeout(){this._state==="pending"&&(this._disposables.dispose(),this._state="timedout",this._rejectPromise(this._createTimeoutError()))}_createTimeoutError(){let t=new Error("Time limit reached");return t.code="ETIMEDOUT",t.syscall="connect",t}resolve(t){this._state==="pending"&&(this._disposables.dispose(),this._state="resolved",this._resolvePromise(t))}reject(t){this._state==="pending"&&(this._disposables.dispose(),this._state="rejected",this._rejectPromise(t))}};function xte(i,t){let e=new Kh(t);return e.registerDisposable(i.onControlMessage(n=>{let o=JSON.parse(n.toString()),r=A8(o);r?e.reject(r):e.resolve(o)})),e.promise}function Ste(i,t,e,n,o,r,s,a){let l=new Kh(a),d=Xt.create(!1);return i.info(`Creating a socket (${s})...`),Bt(`code/willCreateSocket/${r}`),t.connect(e,n,o,s).then(c=>{l.didTimeout?(Bt(`code/didCreateSocketError/${r}`),i.info(`Creating a socket (${s}) finished after ${d.elapsed()} ms, but this is too late and has timed out already.`),c?.dispose()):(Bt(`code/didCreateSocketOK/${r}`),i.info(`Creating a socket (${s}) was successful after ${d.elapsed()} ms.`),l.resolve(c))},c=>{Bt(`code/didCreateSocketError/${r}`),i.info(`Creating a socket (${s}) returned an error after ${d.elapsed()} ms.`),i.error(c),l.reject(c)}),l.promise}function EF(i,t){let e=new Kh(t);return i.then(n=>{e.didTimeout||e.resolve(n)},n=>{e.didTimeout||e.reject(n)}),e.promise}async function Cte(i,t,e,n){let o=AF(i,t);i.logService.trace(`${o} 1/6. invoking socketFactory.connect().`);let r;try{r=await Ste(i.logService,i.remoteSocketFactoryService,i.connectTo,YR.getServerRootPath(),`reconnectionToken=${i.reconnectionToken}&reconnection=${i.reconnectionProtocol?"true":"false"}`,wF(t),`renderer-${wF(t)}-${i.reconnectionToken}`,n)}catch(c){throw i.logService.error(`${o} socketFactory.connect() failed or timed out. Error:`),i.logService.error(c),c}i.logService.trace(`${o} 2/6. socketFactory.connect() was successful.`);let s,a;i.reconnectionProtocol?(i.reconnectionProtocol.beginAcceptReconnection(r,null),s=i.reconnectionProtocol,a=!1):(s=new Vc({socket:r}),a=!0),i.logService.trace(`${o} 3/6. sending AuthRequest control message.`);let l=await EF(i.signService.createNewMessage(_e()),n),d={type:"auth",auth:i.connectionToken||"00000000000000000000",data:l.data};s.sendControl(H.fromString(JSON.stringify(d)));try{let c=await xte(s,Ite(n,R8(1e4)));if(c.type!=="sign"||typeof c.data!="string"){let h=new Error("Unexpected handshake message");throw h.code="VSCODE_CONNECTION_ERROR",h}if(i.logService.trace(`${o} 4/6. received SignRequest control message.`),!await EF(i.signService.validate(l,c.signedData),n)){let h=new Error("Refused to connect to unsupported server");throw h.code="VSCODE_CONNECTION_ERROR",h}let m=await EF(i.signService.sign(c.data),n),g={type:"connectionType",commit:i.commit,signedData:m,desiredConnectionType:t};return e&&(g.args=e),i.logService.trace(`${o} 5/6. sending ConnectionTypeRequest control message.`),s.sendControl(H.fromString(JSON.stringify(g))),{protocol:s,ownsProtocol:a}}catch(c){throw c&&c.code==="ETIMEDOUT"&&(i.logService.error(`${o} the handshake timed out. Error:`),i.logService.error(c)),c&&c.code==="VSCODE_CONNECTION_ERROR"&&(i.logService.error(`${o} received error control message when negotiating connection. Error:`),i.logService.error(c)),a&&DF(s),c}}async function Tte(i,t,e,n){let o=Date.now(),r=AF(i,t),{protocol:s,ownsProtocol:a}=await Cte(i,t,e,n),l=new Kh(n);return l.registerDisposable(s.onControlMessage(d=>{let c=JSON.parse(d.toString()),u=A8(c);u?(i.logService.error(`${r} received error control message when negotiating connection. Error:`),i.logService.error(u),a&&DF(s),l.reject(u)):(i.reconnectionProtocol?.endAcceptReconnection(),i.logService.trace(`${r} 6/6. handshake finished, connection is up and running after ${M8(o)}!`),l.resolve({protocol:s,firstMessage:c}))})),l.promise}async function Ete(i,t,e){let n=Date.now(),o=AF(i,3),{protocol:r}=await Tte(i,3,t,e);return i.logService.trace(`${o} 6/6. handshake finished, connection is up and running after ${M8(n)}!`),r}async function D8(i,t,e){let{connectTo:n,connectionToken:o}=await i.addressProvider.getAddress();return{commit:i.commit,quality:i.quality,connectTo:n,connectionToken:o,reconnectionToken:t,reconnectionProtocol:e,remoteSocketFactoryService:i.remoteSocketFactoryService,signService:i.signService,logService:i.logService}}async function B_(i,t,e){let n=await D8(i,_e(),null);return await Ete(n,{host:t,port:e},pe.None)}function wte(i){return br(t=>new Promise((e,n)=>{let o=setTimeout(e,i*1e3);t.onCancellationRequested(()=>{clearTimeout(o),e()})}))}var kF=class{constructor(t,e){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.type=0}},PF=class{constructor(t,e,n,o){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.durationSeconds=n;this.cancellableTimer=o;this.type=1}skipWait(){this.cancellableTimer.cancel()}},_F=class{constructor(t,e,n){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.type=2}},V_=class{constructor(t,e,n){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.type=4}},RF=class{constructor(t,e,n,o){this.reconnectionToken=t;this.millisSinceLastIncomingData=e;this.attempt=n;this.handled=o;this.type=3}},_8=class i extends N{constructor(e,n,o,r,s){super();this._connectionType=e;this._options=n;this.reconnectionToken=o;this.protocol=r;this._reconnectionFailureIsFatal=s;this._onDidStateChange=this._register(new T);this.onDidStateChange=this._onDidStateChange.event;this._permanentFailure=!1;this._isReconnecting=!1;this._isDisposed=!1;this._reconnectionGraceTime=108e5;this._onDidStateChange.fire(new V_(this.reconnectionToken,0,0)),this._register(r.onSocketClose(a=>{let l=UI(this._connectionType,this.reconnectionToken,!0);a?a.type===0?(this._options.logService.info(`${l} received socket close event (hadError: ${a.hadError}).`),a.error&&this._options.logService.error(a.error)):(this._options.logService.info(`${l} received socket close event (wasClean: ${a.wasClean}, code: ${a.code}, reason: ${a.reason}).`),a.event&&this._options.logService.error(a.event)):this._options.logService.info(`${l} received socket close event.`),this._beginReconnecting()})),this._register(r.onSocketTimeout(a=>{let l=UI(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${l} received socket timeout event (reason: ${a.reason}, unacknowledgedMsgCount: ${a.unacknowledgedMsgCount}, timeSinceOldestUnacknowledgedMsg: ${a.timeSinceOldestUnacknowledgedMsg}, timeSinceLastReceivedSomeData: ${a.timeSinceLastReceivedSomeData}).`),this._beginReconnecting()})),i._instances.push(this),this._register(q(()=>{let a=i._instances.indexOf(this);a>=0&&i._instances.splice(a,1)})),this._isPermanentFailure&&this._gotoPermanentFailure(i._permanentFailureMillisSinceLastIncomingData,i._permanentFailureAttempt,i._permanentFailureHandled)}static triggerPermanentFailure(e,n,o){this._permanentFailure=!0,this._permanentFailureMillisSinceLastIncomingData=e,this._permanentFailureAttempt=n,this._permanentFailureHandled=o,this._instances.forEach(r=>r._gotoPermanentFailure(this._permanentFailureMillisSinceLastIncomingData,this._permanentFailureAttempt,this._permanentFailureHandled))}static debugTriggerReconnection(){this._instances.forEach(e=>e._beginReconnecting())}static debugPauseSocketWriting(){this._instances.forEach(e=>e._pauseSocketWriting())}static{this._permanentFailure=!1}static{this._permanentFailureMillisSinceLastIncomingData=0}static{this._permanentFailureAttempt=0}static{this._permanentFailureHandled=!1}static{this._instances=[]}get _isPermanentFailure(){return this._permanentFailure||i._permanentFailure}updateGraceTime(e){let n=kte(e,108e5),o=UI(this._connectionType,this.reconnectionToken,!1);this._options.logService.trace(`${o} Applying reconnection grace time: ${n}ms (${Math.floor(n/1e3)}s)`),this._reconnectionGraceTime=n}dispose(){super.dispose(),this._isDisposed=!0}async _beginReconnecting(){if(!this._isReconnecting)try{this._isReconnecting=!0,await this._runReconnectingLoop()}finally{this._isReconnecting=!1}}async _runReconnectingLoop(){if(this._isPermanentFailure||this._isDisposed)return;let e=UI(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${e} starting reconnecting loop. You can get more information with the trace log level.`),this._onDidStateChange.fire(new kF(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData()));let n=[0,5,5,10,10,10,10,10,30],o=this._reconnectionGraceTime;if(this._options.logService.info(`${e} starting reconnection with grace time: ${o}ms (${Math.floor(o/1e3)}s)`),o<=0){this._options.logService.error(`${e} reconnection grace time is set to 0ms, will not attempt to reconnect.`),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),0,!1);return}let r=Date.now(),s=-1;do{s++;let a=s<n.length?n[s]:n[n.length-1];try{if(a>0){let d=wte(a);this._onDidStateChange.fire(new PF(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),a,d)),this._options.logService.info(`${e} waiting for ${a} seconds before reconnecting...`);try{await d}catch{}}if(this._isPermanentFailure){this._options.logService.error(`${e} permanent failure occurred while running the reconnecting loop.`);break}this._onDidStateChange.fire(new _F(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1)),this._options.logService.info(`${e} resolving connection...`);let l=await D8(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,R8(bte)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new V_(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1));break}catch(l){if(l.code==="VSCODE_CONNECTION_ERROR"){this._options.logService.error(`${e} A permanent error occurred in the reconnecting loop! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}if(Date.now()-r>=o){let d=Math.round(o/1e3);this._options.logService.error(`${e} An error occurred while reconnecting, but it will be treated as a permanent error because the reconnection grace time (${d}s) has expired! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}if($m.isTemporarilyNotAvailable(l)){this._options.logService.info(`${e} A temporarily not available error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if((l.code==="ETIMEDOUT"||l.code==="ENETUNREACH"||l.code==="ECONNREFUSED"||l.code==="ECONNRESET")&&l.syscall==="connect"){this._options.logService.info(`${e} A network error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if(Yt(l)){this._options.logService.info(`${e} A promise cancelation error occurred while trying to reconnect, will try again...`),this._options.logService.trace(l);continue}if(l instanceof $m){this._options.logService.error(`${e} A RemoteAuthorityResolverError occurred while trying to reconnect. Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,$m.isHandled(l));break}this._options.logService.error(`${e} An unknown error occurred while trying to reconnect, since this is an unknown case, it will be treated as a permanent error! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}}while(!this._isPermanentFailure&&!this._isDisposed)}_onReconnectionPermanentFailure(e,n,o){this._reconnectionFailureIsFatal?i.triggerPermanentFailure(e,n,o):this._gotoPermanentFailure(e,n,o)}_gotoPermanentFailure(e,n,o){this._onDidStateChange.fire(new RF(this.reconnectionToken,e,n,o)),DF(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}};function DF(i){try{i.acceptDisconnect();let t=i.getSocket();i.dispose(),t.dispose()}catch(t){Ge(t)}}function A8(i){if(i&&i.type==="error"){let t=new Error(`Connection error: ${i.reason}`);return t.code="VSCODE_CONNECTION_ERROR",t}return null}function kte(i,t){return typeof i!="number"||!isFinite(i)||i<0?t:i>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(i)}function Pte(i,t){for(;i.length<t;)i+=" ";return i}function _te(i,t){return`[remote-connection][${Pte(wF(i),13)}][${t.substr(0,5)}\u2026]`}function UI(i,t,e){return`${_te(i,t)}[${e?"reconnect":"initial"}]`}function AF(i,t){return`${UI(t,i.reconnectionToken,!!i.reconnectionProtocol)}[${i.connectTo}]`}function M8(i){return`${Date.now()-i} ms`}var $_=A("remoteSocketFactoryService");async function Rte(i,t,e,n,o){let r;for(let s=3;s&&(r?.dispose(),r=await new WI(i,t,e,n,o).waitForReady(),!(o&&TF[o]||!TF[r.tunnelLocalPort]));s--);return r}var WI=class extends N{constructor(e,n,o,r,s){super();this.defaultTunnelHost=n;this.suggestedLocalPort=s;this.privacy="private";this._socketsDispose=new Map;this._options=e,this._server=L8.createServer(),this._barrier=new kn,this._listeningListener=()=>this._barrier.open(),this._server.on("listening",this._listeningListener),this._connectionListener=a=>this._onConnection(a),this._server.on("connection",this._connectionListener),this._errorListener=()=>{},this._server.on("error",this._errorListener),this.tunnelRemotePort=r,this.tunnelRemoteHost=o}async dispose(){super.dispose(),this._server.removeListener("listening",this._listeningListener),this._server.removeListener("connection",this._connectionListener),this._server.removeListener("error",this._errorListener),this._server.close(),Array.from(this._socketsDispose.values()).forEach(n=>{n()})}async waitForReady(){let e=this.suggestedLocalPort??this.tunnelRemotePort,n=xi(this.defaultTunnelHost)?"0.0.0.0":"127.0.0.1",o=await W_(e,2,1e3,n),r=null;return this._server.listen(o,this.defaultTunnelHost),await this._barrier.wait(),r=this._server.address(),r||(o=0,this._server.listen(o,this.defaultTunnelHost),await this._barrier.wait(),r=this._server.address()),this.tunnelLocalPort=r.port,this.localAddress=`${this.tunnelRemoteHost==="127.0.0.1"?"127.0.0.1":"localhost"}:${r.port}`,this}async _onConnection(e){e.pause();let n=ra(this.tunnelRemoteHost)||xi(this.tunnelRemoteHost)?"localhost":this.tunnelRemoteHost,o=await B_(this._options,n,this.tunnelRemotePort),r=o.getSocket(),s=o.readEntireBuffer();o.dispose(),s.byteLength>0&&e.write(s.buffer),e.on("end",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),r.end()}),e.on("close",()=>r.end()),e.on("error",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),r instanceof Ur?r.socket.destroy():r.end()}),r instanceof Ur?this._mirrorNodeSocket(e,r):this._mirrorGenericSocket(e,r),e.localAddress&&this._socketsDispose.set(e.localAddress,()=>{e.end(),r.end()})}_mirrorGenericSocket(e,n){n.onClose(()=>e.destroy()),n.onEnd(()=>e.end()),n.onData(o=>e.write(o.buffer)),e.on("data",o=>n.write(H.wrap(o))),e.resume()}_mirrorNodeSocket(e,n){let o=n.socket;o.on("end",()=>e.end()),o.on("close",()=>e.end()),o.on("error",()=>{e.destroy()}),o.pipe(e),e.pipe(o)}},FI=class extends rf{constructor(e,n,o,r,s){super(n,s);this.remoteSocketFactoryService=e;this.signService=o;this.productService=r}isPortPrivileged(e){return g5(e,this.defaultTunnelHost,gr,O8.release())}retainOrCreateTunnel(e,n,o,r,s,a,l,d){let c=this.getTunnelFromMap(n,o);if(c)return++c.refcount,c.value;if(m5(e))return this.createWithProvider(e,n,o,s,a,l,d);{this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${n}:${o} on local port ${s}.`);let u={commit:this.productService.commit,quality:this.productService.quality,addressProvider:e,remoteSocketFactoryService:this.remoteSocketFactoryService,signService:this.signService,logService:this.logService,ipcLogger:null},m=Rte(u,r,n,o,s);return this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created without provider."),this.addTunnelToMap(n,o,m),m}}};FI=_([S(0,$_),S(1,te),S(2,ua),S(3,Es),S(4,$t)],FI);var HI=class extends FI{constructor(t,e,n,o,r){super(t,e,n,o,r)}};HI=_([S(0,$_),S(1,te),S(2,ua),S(3,Es),S(4,$t)],HI);var z_=class extends N{constructor(e,n,o,r,s){super();this.remoteSocketFactoryService=e;this.logService=n;this.productService=o;this.signService=r;this.configurationService=s;this._tunnelServices=new Map}async openTunnel(e,n,o,r,s,a,l,d,c){if(this.logService.trace(`ForwardedPorts: (SharedTunnelService) openTunnel request for ${o}:${r} on local port ${a}.`),!this._tunnelServices.has(e)){let u=new HI(this.remoteSocketFactoryService,this.logService,this.signService,this.productService,this.configurationService);this._register(u),this._tunnelServices.set(e,u),u.onTunnelClosed(async()=>{(await u.tunnels).length===0&&(u.dispose(),this._tunnelServices.delete(e))})}return this._tunnelServices.get(e).openTunnel(n,o,r,s,a,l,d,c)}};z_=_([S(0,$_),S(1,te),S(2,Es),S(3,ua),S(4,$t)],z_);var Dte=10*1e3,q_="remote.tunnels.toRestore",MF="remote.tunnels.toRestoreExpiration",Ate=1e3*60*60*24*14,N8="onTunnel",FWt=new k("forwardedPortsViewEnabled",!1,p(23428,null)),Mte=new k("forwardedPortsViewOnlyEnabled",!1,p(23428,null));function OF(i){let t=i.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);if(t)return{host:t[1]?.substring(0,t[1].length-1)||"localhost",port:Number(t[2])}}var LF={source:0,description:p(23430,null)},HWt={source:1,description:p(23429,null)};function U8(i,t,e){let n=i.get(Mr(t,e));if(n)return n;if(ra(t))for(let o of sf){let r=Mr(o,e);if(i.has(r))return i.get(r)}else if(xi(t))for(let o of Ub){let r=Mr(o,e);if(i.has(r))return i.get(r)}}function cr(i,t,e){let n=U8(i,t,e);if(n)return n;let o=xi(t)?"localhost":ra(t)?"0.0.0.0":void 0;if(o)return U8(i,o,e)}function Mr(i,t){return i+":"+t}function Lte(i){return i&&"host"in i&&typeof i.host=="string"&&"port"in i&&typeof i.port=="number"&&(!("detail"in i)||typeof i.detail=="string")&&(!("pid"in i)||typeof i.pid=="string")}var K_=class i extends N{constructor(e){super();this.configurationService=e;this.portsAttributes=[];this._onDidChangeAttributes=this._register(new T);this.onDidChangeAttributes=this._onDidChangeAttributes.event;this._register(e.onDidChangeConfiguration(n=>{(n.affectsConfiguration(i.SETTING)||n.affectsConfiguration(i.DEFAULTS))&&this.updateAttributes()})),this.updateAttributes()}static{this.SETTING="remote.portsAttributes"}static{this.DEFAULTS="remote.otherPortsAttributes"}static{this.RANGE=/^(\d+)\-(\d+)$/}static{this.HOST_AND_PORT=/^([a-z0-9\-]+):(\d{1,5})$/}updateAttributes(){this.portsAttributes=this.readSetting(),this._onDidChangeAttributes.fire()}getAttributes(e,n,o){let r=this.findNextIndex(e,n,o,this.portsAttributes,0),s={label:void 0,onAutoForward:void 0,elevateIfNeeded:void 0,requireLocalPort:void 0,protocol:void 0};for(;r>=0;){let a=this.portsAttributes[r];a.key===e?(s.onAutoForward=a.onAutoForward??s.onAutoForward,s.elevateIfNeeded=a.elevateIfNeeded!==void 0?a.elevateIfNeeded:s.elevateIfNeeded,s.label=a.label??s.label,s.requireLocalPort=a.requireLocalPort,s.protocol=a.protocol):(s.onAutoForward=s.onAutoForward??a.onAutoForward,s.elevateIfNeeded=s.elevateIfNeeded!==void 0?s.elevateIfNeeded:a.elevateIfNeeded,s.label=s.label??a.label,s.requireLocalPort=s.requireLocalPort!==void 0?s.requireLocalPort:void 0,s.protocol=s.protocol??a.protocol),r=this.findNextIndex(e,n,o,this.portsAttributes,r+1)}return s.onAutoForward!==void 0||s.elevateIfNeeded!==void 0||s.label!==void 0||s.requireLocalPort!==void 0||s.protocol!==void 0?s:this.getOtherAttributes()}hasStartEnd(e){return e.start!==void 0&&e.end!==void 0}hasHostAndPort(e){return e.host!==void 0&&e.port!==void 0&&Pe(e.host)&&jn(e.port)}findNextIndex(e,n,o,r,s){if(s>=r.length)return-1;let a=!ra(n)&&!xi(n),d=r.slice(s).findIndex(c=>jn(c.key)?a?!1:c.key===e:this.hasStartEnd(c.key)?a?!1:e>=c.key.start&&e<=c.key.end:this.hasHostAndPort(c.key)?e===c.key.port&&n===c.key.host:o?c.key.test(o):!1);return d>=0?d+s:-1}readSetting(){let e=this.configurationService.getValue(i.SETTING);if(!e||!st(e))return[];let n=[];for(let r in e){if(r===void 0)continue;let s=e[r],a;if(Number(r))a=Number(r);else if(Pe(r))if(i.RANGE.test(r)){let l=r.match(i.RANGE);a={start:Number(l[1]),end:Number(l[2])}}else if(i.HOST_AND_PORT.test(r)){let l=r.match(i.HOST_AND_PORT);a={host:l[1],port:Number(l[2])}}else{let l;try{l=RegExp(r)}catch{}l&&(a=l)}a&&n.push({key:a,elevateIfNeeded:s.elevateIfNeeded,onAutoForward:s.onAutoForward,label:s.label,requireLocalPort:s.requireLocalPort,protocol:s.protocol})}let o=this.configurationService.getValue(i.DEFAULTS);return o&&(this.defaultPortAttributes={elevateIfNeeded:o.elevateIfNeeded,label:o.label,onAutoForward:o.onAutoForward,requireLocalPort:o.requireLocalPort,protocol:o.protocol}),this.sortAttributes(n)}sortAttributes(e){function n(o,r){return jn(o.key)?o.key:r.hasStartEnd(o.key)?o.key.start:r.hasHostAndPort(o.key)?o.key.port:Number.MAX_VALUE}return e.sort((o,r)=>n(o,this)-n(r,this))}getOtherAttributes(){return this.defaultPortAttributes}static providedActionToAction(e){switch(e){case 1:return"notify";case 2:return"openBrowser";case 6:return"openBrowserOnce";case 3:return"openPreview";case 4:return"silent";case 5:return"ignore";default:return}}async addAttributes(e,n,o){let s=this.configurationService.inspect(i.SETTING).userRemoteValue,a;!s||!st(s)?a={}:a=ft(s),a[`${e}`]||(a[`${e}`]={});for(let l in n)a[`${e}`][l]=n[l];return this.configurationService.updateValue(i.SETTING,a,o)}},VI=class extends N{constructor(e,n,o,r,s,a,l,d,c,u){super();this.tunnelService=e;this.storageService=n;this.configurationService=o;this.environmentService=r;this.remoteAuthorityResolverService=s;this.workspaceContextService=a;this.logService=l;this.dialogService=d;this.extensionService=c;this.contextKeyService=u;this.inProgress=new Map;this._onForwardPort=this._register(new T);this.onForwardPort=this._onForwardPort.event;this._onClosePort=this._register(new T);this.onClosePort=this._onClosePort.event;this._onPortName=this._register(new T);this.onPortName=this._onPortName.event;this._onCandidatesChanged=this._register(new T);this.onCandidatesChanged=this._onCandidatesChanged.event;this._onEnvironmentTunnelsSet=this._register(new T);this.onEnvironmentTunnelsSet=this._onEnvironmentTunnelsSet.event;this._environmentTunnelsSet=!1;this.restoreListener=void 0;this.restoreComplete=!1;this.onRestoreComplete=this._register(new T);this.unrestoredExtensionTunnels=new Map;this.sessionCachedProperties=new Map;this.portAttributesProviders=[];this.hasCheckedExtensionsOnTunnelOpened=!1;this.mismatchCooldown=new Date;this.configPortsAttributes=new K_(o),this.tunnelRestoreValue=this.getTunnelRestoreValue(),this._register(this.configPortsAttributes.onDidChangeAttributes(this.updateAttributes,this)),this.forwarded=new Map,this.remoteTunnels=new Map,this.tunnelService.tunnels.then(async m=>{let g=await this.getAttributes(m.map(h=>({port:h.tunnelRemotePort,host:h.tunnelRemoteHost})));for(let h of m)if(h.localAddress){let f=Mr(h.tunnelRemoteHost,h.tunnelRemotePort),I=cr(this._candidates??new Map,h.tunnelRemoteHost,h.tunnelRemotePort);this.forwarded.set(f,{remotePort:h.tunnelRemotePort,remoteHost:h.tunnelRemoteHost,localAddress:h.localAddress,protocol:g?.get(h.tunnelRemotePort)?.protocol??"http",localUri:await this.makeLocalUri(h.localAddress,g?.get(h.tunnelRemotePort)),localPort:h.tunnelLocalPort,name:g?.get(h.tunnelRemotePort)?.label,runningProcess:I?.detail,hasRunningProcess:!!I,pid:I?.pid,privacy:h.privacy,source:LF}),this.remoteTunnels.set(f,h)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async m=>{let g=Mr(m.tunnelRemoteHost,m.tunnelRemotePort);if(!cr(this.forwarded,m.tunnelRemoteHost,m.tunnelRemotePort)&&!cr(this.detected,m.tunnelRemoteHost,m.tunnelRemotePort)&&!cr(this.inProgress,m.tunnelRemoteHost,m.tunnelRemotePort)&&m.localAddress){let h=cr(this._candidates??new Map,m.tunnelRemoteHost,m.tunnelRemotePort),f=(await this.getAttributes([{port:m.tunnelRemotePort,host:m.tunnelRemoteHost}]))?.get(m.tunnelRemotePort);this.forwarded.set(g,{remoteHost:m.tunnelRemoteHost,remotePort:m.tunnelRemotePort,localAddress:m.localAddress,protocol:f?.protocol??"http",localUri:await this.makeLocalUri(m.localAddress,f),localPort:m.tunnelLocalPort,name:f?.label,closeable:!0,runningProcess:h?.detail,hasRunningProcess:!!h,pid:h?.pid,privacy:m.privacy,source:LF})}await this.storeForwarded(),this.checkExtensionActivationEvents(!0),this.remoteTunnels.set(g,m),this._onForwardPort.fire(this.forwarded.get(g))})),this._register(this.tunnelService.onTunnelClosed(m=>this.onTunnelClosed(m,"Other"))),this.checkExtensionActivationEvents(!1)}extensionHasActivationEvent(){return this.extensionService.extensions.find(e=>e.activationEvents?.includes(N8))?(this.contextKeyService.createKey(Mte.key,!0),!0):!1}checkExtensionActivationEvents(e){if(this.hasCheckedExtensionsOnTunnelOpened||(e&&(this.hasCheckedExtensionsOnTunnelOpened=!0),this.environmentService.remoteAuthority!==void 0&&!e)||this.extensionHasActivationEvent())return;let o=this._register(this.extensionService.onDidRegisterExtensions(()=>{this.extensionHasActivationEvent()&&o.dispose()}))}async onTunnelClosed(e,n){let o=Mr(e.host,e.port);this.forwarded.delete(o)&&(await this.storeForwarded(),this._onClosePort.fire(e))}makeLocalUri(e,n){if(e.startsWith("http"))return y.parse(e);let o=n?.protocol??"http";return y.parse(`${o}://${e}`)}async addStorageKeyPostfix(e){let n=this.workspaceContextService.getWorkspace(),o=n.configuration?to(n.configuration.path):n.folders.length>0?to(n.folders[0].uri.path):void 0;if(o===void 0){this.logService.debug("Could not get workspace hash for forwarded ports storage key.");return}return`${e}.${this.environmentService.remoteAuthority}.${o}`}async getTunnelRestoreStorageKey(){return this.addStorageKeyPostfix(q_)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(MF)}async getTunnelRestoreValue(){let e=this.storageService.get(q_,1);if(e)return this.storageService.remove(q_,1),await this.storeForwarded(),e;let n=await this.getTunnelRestoreStorageKey();if(n)return this.storageService.get(n,0)}async restoreForwarded(){if(this.cleanupExpiredTunnelsForRestore(),this.configurationService.getValue("remote.restoreForwardedPorts")){let e=await this.tunnelRestoreValue;if(e&&e!==this.knownPortsRestoreValue){let n=JSON.parse(e)??[];this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${n.map(o=>o.remotePort).join(", ")}`);for(let o of n){let r=cr(this.detected,o.remoteHost,o.remotePort);o.source.source!==2&&!r||o.source.source===2&&r?await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,source:o.source}):o.source.source===2&&!r&&this.unrestoredExtensionTunnels.set(Mr(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new $),this.restoreListener.add(this.storageService.onDidChangeValue(0,void 0,this.restoreListener)(async n=>{n.key===e&&(this.tunnelRestoreValue=Promise.resolve(this.storageService.get(e,0)),await this.restoreForwarded())}))}}cleanupExpiredTunnelsForRestore(){let e=this.storageService.keys(0,0).filter(n=>n.startsWith(MF));for(let n of e){let o=this.storageService.getNumber(n,0);if(o&&o<Date.now()){this.tunnelRestoreValue=Promise.resolve(void 0);let r=n.replace(MF,q_);this.storageService.remove(n,0),this.storageService.remove(r,0)}}}async storeForwarded(){if(this.configurationService.getValue("remote.restoreForwardedPorts")){let e=Array.from(this.forwarded.values()),n=e.map(a=>({remoteHost:a.remoteHost,remotePort:a.remotePort,localPort:a.localPort,name:a.name,localAddress:a.localAddress,localUri:a.localUri,protocol:a.protocol,source:a.source})),o;e.length>0&&(o=JSON.stringify(n));let r=await this.getTunnelRestoreStorageKey(),s=await this.getRestoreExpirationStorageKey();!o&&r&&s?(this.storageService.remove(r,0),this.storageService.remove(s,0)):o!==this.knownPortsRestoreValue&&r&&s&&(this.storageService.store(r,o,0,0),this.storageService.store(s,Date.now()+Ate,0,0)),this.knownPortsRestoreValue=o}}async showPortMismatchModalIfNeeded(e,n,o){if(!e.tunnelLocalPort||!o?.requireLocalPort||e.tunnelLocalPort===n)return;let r=new Date;if(this.mismatchCooldown.getTime()+Dte>r.getTime())return;this.mismatchCooldown=r;let s=p(23427,null,n,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(s)}async forward(e,n){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await ye.toPromise(this.onRestoreComplete.event),this.doForward(e,n)}async doForward(e,n){await this.extensionService.activateByEvent(N8);let o=cr(this.forwarded,e.remote.host,e.remote.port);n=n??(n!==null?(await this.getAttributes([e.remote]))?.get(e.remote.port):void 0);let r=e.local!==void 0?e.local:e.remote.port,s;if(o)return this.mergeAttributesIntoExistingTunnel(o,e,n);{let a=this.environmentService.remoteAuthority,l=a?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(a)).authority}:void 0,d=Mr(e.remote.host,e.remote.port);this.inProgress.set(d,!0),e=this.mergeCachedAndUnrestoredProperties(d,e);let c=await this.tunnelService.openTunnel(l,e.remote.host,e.remote.port,void 0,r,e.elevateIfNeeded?e.elevateIfNeeded:n?.elevateIfNeeded,e.privacy,n?.protocol);if(typeof c=="string")s=c;else if(c&&c.localAddress){let u=cr(this._candidates??new Map,e.remote.host,e.remote.port),m=c.protocol?c.protocol==="https"?"https":"http":n?.protocol??"http",g={remoteHost:c.tunnelRemoteHost,remotePort:c.tunnelRemotePort,localPort:c.tunnelLocalPort,name:n?.label??e.name,closeable:!0,localAddress:c.localAddress,protocol:m,localUri:await this.makeLocalUri(c.localAddress,n),runningProcess:u?.detail,hasRunningProcess:!!u,pid:u?.pid,source:e.source??LF,privacy:c.privacy};return this.forwarded.set(d,g),this.remoteTunnels.set(d,c),this.inProgress.delete(d),await this.storeForwarded(),await this.showPortMismatchModalIfNeeded(c,r,n),this._onForwardPort.fire(g),c}this.inProgress.delete(d)}return s}mergeCachedAndUnrestoredProperties(e,n){let o=this.unrestoredExtensionTunnels.has(e)?this.unrestoredExtensionTunnels:this.sessionCachedProperties.has(e)?this.sessionCachedProperties:void 0;if(o){let r=o.get(e);o.delete(e),r&&(n.name=r.name??n.name,n.local=("local"in r?r.local:"localPort"in r?r.localPort:void 0)??n.local,n.privacy=n.privacy)}return n}async mergeAttributesIntoExistingTunnel(e,n,o){let r=o?.label??n.name,s;(u=>(u[u.None=0]="None",u[u.Fire=1]="Fire",u[u.Reopen=2]="Reopen"))(s||={});let a=0;switch(r!==e.name&&(e.name=r,a=1),(o?.protocol||e.protocol!=="http")&&o?.protocol!==e.protocol&&(n.source=e.source,a=2),n.privacy&&e.privacy!==n.privacy&&(a=2),a){case 1:{this._onForwardPort.fire();break}case 2:await this.close(e.remoteHost,e.remotePort,"User"),await this.doForward(n,o)}return cr(this.remoteTunnels,n.remote.host,n.remote.port)}async name(e,n,o){let r=cr(this.forwarded,e,n),s=Mr(e,n);if(r){r.name=o,await this.storeForwarded(),this._onPortName.fire({host:e,port:n});return}else this.detected.has(s)&&(this.detected.get(s).name=o,this._onPortName.fire({host:e,port:n}))}async close(e,n,o){let r=Mr(e,n),s=this.forwarded.get(r);return o==="AutoForwardEnd"&&s&&s.source.source===1&&this.sessionCachedProperties.set(r,{local:s.localPort,name:s.name,privacy:s.privacy}),await this.tunnelService.closeTunnel(e,n),this.onTunnelClosed({host:e,port:n},o)}address(e,n){let o=Mr(e,n);return(this.forwarded.get(o)||this.detected.get(o))?.localAddress}get environmentTunnelsSet(){return this._environmentTunnelsSet}addEnvironmentTunnels(e){if(e)for(let n of e){let o=cr(this._candidates??new Map,n.remoteAddress.host,n.remoteAddress.port),r=typeof n.localAddress=="string"?n.localAddress:Mr(n.localAddress.host,n.localAddress.port);this.detected.set(Mr(n.remoteAddress.host,n.remoteAddress.port),{remoteHost:n.remoteAddress.host,remotePort:n.remoteAddress.port,localAddress:r,protocol:"http",localUri:this.makeLocalUri(r),closeable:!1,runningProcess:o?.detail,hasRunningProcess:!!o,pid:o?.pid,privacy:"constantPrivate",source:{source:2,description:p(23431,null)}}),this.tunnelService.setEnvironmentTunnel(n.remoteAddress.host,n.remoteAddress.port,r,"constantPrivate","http")}this._environmentTunnelsSet=!0,this._onEnvironmentTunnelsSet.fire(),this._onForwardPort.fire()}setCandidateFilter(e){this._candidateFilter=e}async setCandidates(e){let n=e;this._candidateFilter&&(n=await this._candidateFilter(e));let o=this.updateInResponseToCandidates(n);this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(o.values()).map(r=>r.port).join(", ")}`),this._onCandidatesChanged.fire(o)}updateInResponseToCandidates(e){let n=this._candidates??new Map,o=new Map;return this._candidates=o,e.forEach(r=>{let s=Mr(r.host,r.port);o.set(s,{host:r.host,port:r.port,detail:r.detail,pid:r.pid}),n.delete(s);let a=cr(this.forwarded,r.host,r.port);a&&(a.runningProcess=r.detail,a.hasRunningProcess=!0,a.pid=r.pid)}),n.forEach((r,s)=>{let a=OF(s);if(!a)return;let l=cr(this.forwarded,a.host,a.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let d=cr(this.detected,a.host,a.port);d&&(d.runningProcess=void 0,d.hasRunningProcess=!1,d.pid=void 0)}),n}get candidates(){return this._candidates?Array.from(this._candidates.values()):[]}get candidatesOrUndefined(){return this._candidates?this.candidates:void 0}async updateAttributes(){let e=Array.from(this.forwarded.values()),n=await this.getAttributes(e.map(o=>({port:o.remotePort,host:o.remoteHost})),!1);if(n)for(let o of e){let r=n.get(o.remotePort);(r?.protocol||o.protocol!=="http")&&r?.protocol!==o.protocol&&await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,source:o.source},r),r&&r.label&&r.label!==o.name&&await this.name(o.remoteHost,o.remotePort,r.label)}}async getAttributes(e,n=!0){let o=new Map,r=new Map;e.forEach(c=>{let u=cr(this._candidates??new Map,sf[0],c.port)??c;if(u){o.set(c.port,u);let m=Lte(u)?u.pid:void 0;r.has(m)||r.set(m,[]),r.get(m)?.push(c.port)}});let s=new Map;if(e.forEach(c=>{let u=this.configPortsAttributes.getAttributes(c.port,c.host,o.get(c.port)?.detail);u&&s.set(c.port,u)}),this.portAttributesProviders.length===0||!n)return s.size>0?s:void 0;let a=await Promise.all(this.portAttributesProviders.flatMap(c=>Array.from(r.entries()).map(u=>{let m=u[1],g=o.get(m[0]);return c.providePortAttributes(m,g?.pid,g?.detail,pe.None)}))),l=new Map;if(a.forEach(c=>c.forEach(u=>{u&&l.set(u.port,u)})),!s&&!l)return;let d=new Map;return e.forEach(c=>{let u=s.get(c.port),m=l.get(c.port);d.set(c.port,{elevateIfNeeded:u?.elevateIfNeeded,label:u?.label,onAutoForward:u?.onAutoForward??K_.providedActionToAction(m?.autoForwardAction),requireLocalPort:u?.requireLocalPort,protocol:u?.protocol})}),d}addAttributesProvider(e){this.portAttributesProviders.push(e)}};_([Hc(1e3)],VI.prototype,"storeForwarded",1),VI=_([S(0,p5),S(1,yo),S(2,$t),S(3,md),S(4,k$),S(5,Cr),S(6,te),S(7,YS),S(8,CC),S(9,Ir)],VI);function Ote(i){let t=i.trim().split(`
`),e=[];return t.forEach(o=>{let r=/\/proc\/(\d+)\/fd\/\d+ -> socket:\[(\d+)\]/.exec(o);r&&r.length>=3&&e.push({pid:parseInt(r[1],10),socket:parseInt(r[2],10)})}),e.reduce((o,r)=>(o[r.socket]=r,o),{})}function Nte(...i){let t=[].concat(...i.map(Fte));return[...new Map(t.filter(e=>e.st==="0A").map(e=>{let n=e.local_address.split(":");return{socket:parseInt(e.inode,10),ip:Ute(n[0]),port:parseInt(n[1],16)}}).map(e=>[e.ip+":"+e.port,e])).values()]}function Ute(i){let t="";if(i.length===8)for(let e=i.length-2;e>=0;e-=2)t+=parseInt(i.substr(e,2),16),e!==0&&(t+=".");else for(let e=0;e<i.length;e+=8){let n=i.substring(e,e+8),o="";for(let r=8;r>=2;r-=2)o+=n.substring(r-2,r),(r===6||r===2)&&(o=parseInt(o,16).toString(16),t+=`${o}`,o="",e+r!==i.length-6&&(t+=":"))}return t}function Fte(i){let t=i.trim().split(`
`),e=t.shift().trim().split(/\s+/).filter(o=>o!=="rx_queue"&&o!=="tm->when");return t.map(o=>o.trim().split(/\s+/).reduce((r,s,a)=>(r[e[a]||a]=s,r),{}))}function Hte(i){return i.length>500?!1:!!i.match(/.*\.vscode-server-[a-zA-Z]+\/bin.*/)||i.indexOf("out/server-main.js")!==-1||i.indexOf("_productName=VSCode")!==-1}function Wte(i){let t=i.trim().split(`
`),e=[];return t.forEach(n=>{let o=/^\d+\s+\D+\s+root\s+(\d+)\s+(\d+).+\d+\:\d+\:\d+\s+(.+)$/.exec(n);o&&o.length>=4&&e.push({pid:parseInt(o[1],10),ppid:parseInt(o[2]),cmd:o[3]})}),e}async function Vte(i,t,e){let n=e.reduce((r,s)=>(r[s.pid]=s,r),{}),o=[];return i.forEach(({socket:r,ip:s,port:a})=>{let l=t[r]?t[r].pid:void 0,d=l?n[l]?.cmd:void 0;l&&d&&!Hte(d)&&o.push({host:s,port:a,detail:d,pid:l})}),o}function Bte(i,t,e){let n=new Map,o=Wte(t);for(let r of i){let s=e.get(r.port);if(s){n.set(r.port,s);continue}let a=o.find(l=>l.cmd.includes(`${r.port}`));if(a){let l=a,d;do d=o.find(c=>c.ppid===l.pid),d&&(l=d);while(d);n.set(r.port,{host:r.ip,port:r.port,pid:l.pid,detail:l.cmd,ppid:l.ppid})}else n.set(r.port,{host:r.ip,port:r.port,ppid:Number.MAX_VALUE})}return n}var Gh=class extends ec{constructor(e,n,o,r,s){super(e,n,o);this.initData=n;this.signService=r;this.configurationService=s;this._initialCandidates=void 0;this._foundRootPorts=new Map;this._candidateFindingEnabled=!1;Xe&&n.remote.isRemote&&n.remote.authority&&(this._proxy.$setRemoteTunnelService(process.pid),this.setInitialCandidates())}async $registerCandidateFinder(e){if(e&&this._candidateFindingEnabled)return;this._candidateFindingEnabled=e;let n;this._initialCandidates&&(n=this._initialCandidates,await this._proxy.$onFoundNewCandidates(this._initialCandidates));let o=new hS,r=0;for(;this._candidateFindingEnabled;){let s=new Date().getTime(),a=(await this.findCandidatePorts()).filter(c=>ra(c.host)||xi(c.host));this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) found candidate ports ${a.map(c=>c.port).join(", ")}`);let l=new Date().getTime()-s;this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) candidate port scan took ${l} ms.`),r++>3&&o.update(l),(!n||JSON.stringify(n)!==JSON.stringify(a))&&(n=a,await this._proxy.$onFoundNewCandidates(n));let d=this.calculateDelay(o.value);this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) next candidate port scan in ${d} ms.`),await new Promise(c=>setTimeout(()=>c(),d))}}calculateDelay(e){return Math.max(e*20,2e3)}async setInitialCandidates(){this._initialCandidates=await this.findCandidatePorts(),this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) Initial candidates found: ${this._initialCandidates.map(e=>e.port).join(", ")}`)}async findCandidatePorts(){let e="",n="";try{e=await jh.promises.readFile("/proc/net/tcp","utf8"),n=await jh.promises.readFile("/proc/net/tcp6","utf8")}catch{}let o=Nte(e,n),r=await new Promise(g=>{F8("ls -l /proc/[0-9]*/fd/[0-9]* | grep socket:",(h,f,I)=>{g(f)})}),s=Ote(r),a=await at.readdir("/proc"),l=[];for(let g of a)try{let h=Number(g),f=gt(y.file("/proc"),g);if((await jh.promises.stat(f.fsPath)).isDirectory()&&!isNaN(h)){let x=await jh.promises.readlink(gt(f,"cwd").fsPath),E=await jh.promises.readFile(gt(f,"cmdline").fsPath,"utf8");l.push({pid:h,cwd:x,cmd:E})}}catch{}let d=[],c=o.filter((g=>{let h=s[g.socket];return h||d.push(g),h})),u=Vte(c,s,l),m;if(this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) number of possible root ports ${d.length}`),d.length>0){let g=await new Promise(h=>{F8("ps -F -A -l | grep root",(f,I,x)=>{h(I)})});this._foundRootPorts=Bte(d,g,this._foundRootPorts),m=Array.from(this._foundRootPorts.values()),this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) heuristic ports ${m.map(h=>h.port).join(", ")}`)}return u.then(g=>m?g.concat(m):g)}async defaultTunnelHost(){let e=(await this.configurationService.getConfigProvider()).getConfiguration("remote").get("localPortHost");return!e||e==="localhost"?"127.0.0.1":"0.0.0.0"}makeManagedTunnelFactory(e){return async n=>{let o=new WI({commit:this.initData.commit,quality:this.initData.quality,logService:this.logService,ipcLogger:null,remoteSocketFactoryService:{_serviceBrand:void 0,async connect(s,a,l,d){let c=await e.makeConnection();return BI.connect(c,a,l,d)},register(){throw new Error("not implemented")}},addressProvider:{getAddress(){return Promise.resolve({connectTo:new Bm(0),connectionToken:e.connectionToken})}},signService:this.signService},await this.defaultTunnelHost(),n.remoteAddress.host||"localhost",n.remoteAddress.port,n.localAddressPort);await o.waitForReady();let r=new T;return{localAddress:OF(o.localAddress)??o.localAddress,remoteAddress:{port:o.tunnelRemotePort,host:o.tunnelRemoteHost},onDidDispose:r.event,dispose:()=>{o.dispose(),r.fire(),r.dispose()}}}}};Gh=_([S(0,le),S(1,Ye),S(2,te),S(3,ua),S(4,_n)],Gh);var BI=class i extends H_{constructor(e,n,o){super(n,o);this.passing=e}static connect(e,n,o,r){let s=new $,a={onClose:s.add(new T),onData:s.add(new T),onEnd:s.add(new T)};s.add(e.onDidReceiveMessage(d=>a.onData.fire(H.wrap(d)))),s.add(e.onDidEnd(()=>a.onEnd.fire())),s.add(e.onDidClose(d=>a.onClose.fire({type:0,error:d,hadError:!!d})));let l=new i(e,r,a);return l._register(s),P8(l,n,o,r,a)}write(e){this.passing.send(e.buffer)}closeRemote(){this.passing.end()}async drain(){await this.passing.drain?.()}};import*as wl from"fs";var j_=class extends nf{constructor(){super(...arguments);this._workspaceStorageLock=null}async _getWorkspaceStorageURI(e){let n=await super._getWorkspaceStorageURI(e);if(n.scheme!==B.file)return n;if(this._environment.skipWorkspaceStorageLock)return this._logService.info(`Skipping acquiring lock for ${n.fsPath}.`),n;let o=n.fsPath,r=0;do{let s;r===0?s=o:s=/[/\\]$/.test(o)?`${o.substr(0,o.length-1)}-${r}`:`${o}-${r}`,await $te(s);let a=Be(s,"vscode.lock"),l=await W8(this._logService,a,!1);if(l)return this._workspaceStorageLock=l,process.on("exit",()=>{l.dispose()}),y.file(s);r++}while(r<10);return n}onWillDeactivateAll(){this._workspaceStorageLock?.setWillRelease(6e3)}};async function $te(i){try{await wl.promises.stat(i);return}catch{}try{await wl.promises.mkdir(i,{recursive:!0})}catch{}}var zte=1e3,H8=600*1e3,UF=class extends N{constructor(e,n){super();this.logService=e;this.filename=n;this._timer=this._register(new $p),this._timer.cancelAndSet(async()=>{let o=await FF(e,n);(!o||o.pid!==process.pid)&&(e.info(`Lock '${n}': The lock was lost unexpectedly.`),this._timer.cancel());try{await wl.promises.utimes(n,new Date,new Date)}catch(r){e.error(r),e.info(`Lock '${n}': Could not update mtime.`)}},zte)}dispose(){super.dispose();try{wl.unlinkSync(this.filename)}catch{}}async setWillRelease(e){this.logService.info(`Lock '${this.filename}': Marking the lockfile as scheduled to be released in ${e} ms.`);try{let n={pid:process.pid,willReleaseAt:Date.now()+e};await at.writeFile(this.filename,JSON.stringify(n),{flag:"w"})}catch(n){this.logService.error(n)}}};async function W8(i,t,e){try{let o={pid:process.pid,willReleaseAt:0};await at.writeFile(t,JSON.stringify(o),{flag:"wx"})}catch(o){i.error(o)}let n=await FF(i,t);return!n||n.pid!==process.pid?e?(i.info(`Lock '${t}': Could not acquire lock, giving up.`),null):(i.info(`Lock '${t}': Could not acquire lock, checking if the file is stale.`),Kte(i,t)):(i.info(`Lock '${t}': Lock acquired.`),new UF(i,t))}async function FF(i,t){let e;try{e=await wl.promises.readFile(t)}catch(n){return i.error(n),null}try{return JSON.parse(String(e))}catch(n){return i.error(n),null}}async function NF(i,t){let e;try{e=await wl.promises.stat(t)}catch(n){return i.error(n),0}return e.mtime.getTime()}function qte(i){try{return process.kill(i,0),!0}catch{return!1}}async function Kte(i,t){let e=await FF(i,t);if(!e)return i.info(`Lock '${t}': Could not read pid of lock holder.`),$I(i,t);if(e.willReleaseAt){let a=e.willReleaseAt-Date.now();if(a<5e3){for(a>0?i.info(`Lock '${t}': The lockfile is scheduled to be released in ${a} ms.`):i.info(`Lock '${t}': The lockfile is scheduled to have been released.`);a>0;){if(await Vt(Math.min(100,a)),await NF(i,t)===0)return $I(i,t);a=e.willReleaseAt-Date.now()}return $I(i,t)}}if(!qte(e.pid))return i.info(`Lock '${t}': The pid ${e.pid} appears to be gone.`),$I(i,t);let n=await NF(i,t),o=Date.now()-n;if(o<=H8)return i.info(`Lock '${t}': The lock does not look stale, elapsed: ${o} ms, giving up.`),null;i.info(`Lock '${t}': The lock looks stale, waiting for 2s.`),await Vt(2e3);let r=await NF(i,t),s=Date.now()-r;return s<=H8?(i.info(`Lock '${t}': The lock does not look stale, elapsed: ${s} ms, giving up.`),null):(i.info(`Lock '${t}': The lock looks stale even after waiting for 2s.`),$I(i,t))}async function $I(i,t){i.info(`Lock '${t}': Deleting a stale lock.`);try{await wl.promises.unlink(t)}catch{}return W8(i,t,!0)}async function jte(i,t,e,n,o){try{let r=await import("@vscode/spdlog");r.setFlushOn(0);let s=await r.createAsyncRotatingLogger(i,t,e,n);return o?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(r){console.error(r)}return null}function V8(i,t,e){switch(t){case 1:i.trace(e);break;case 2:i.debug(e);break;case 3:i.info(e);break;case 4:i.warn(e);break;case 5:i.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${t}`)}}function B8(i,t){switch(t){case 1:i.setLevel(0);break;case 2:i.setLevel(1);break;case 3:i.setLevel(2);break;case 4:i.setLevel(3);break;case 5:i.setLevel(4);break;case 0:i.setLevel(6);break;default:throw new Error(`Invalid log level ${t}`)}}var G_=class extends od{constructor(e,n,o,r,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(e,n,o,r),this._register(this.onDidChangeLogLevel(a=>{this._logger&&B8(this._logger,a)}))}async _createSpdLogLogger(e,n,o,r){let s=o?6:1,a=30/s*Gc.MB,l=await jte(e,n,a,s,r);if(l){this._logger=l,B8(this._logger,this.getLevel());for(let{level:d,message:c}of this.buffer)V8(this._logger,d,c);this.buffer=[]}}log(e,n){this._logger?V8(this._logger,e,n):this.getLevel()<=e&&this.buffer.push({level:e,message:n})}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)}};var Q_=class extends gc{doCreateLogger(t,e,n){return t.scheme===B.file?new G_(n?.name||_e(),t.fsPath,!n?.donotRotate,!!n?.donotUseFormatters,e):super.doCreateLogger(t,e,n)}registerLogger(t){super.registerLogger(t),this._proxy.$registerLogger(t)}deregisterLogger(t){super.deregisterLogger(t),this._proxy.$deregisterLogger(t)}};import{homedir as Gte}from"os";var J_=class extends pc{homeDir(){return Gte()}};var Y_=class extends N{constructor(t,e=[]){super(),this.logger=new lS([t,...e]),this._register(t.onDidChangeLogLevel(n=>this.setLevel(n)))}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()}};var Qh=class extends Y_{constructor(t,e,n){let o=n.remote.isRemote?"remoteexthost":t?"workerexthost":"exthost",r=n.remote.isRemote?p(5884,null):t?p(5885,null):p(5883,null);super(e.createLogger(o,{name:r}))}};Qh=_([S(1,ir),S(2,Ye)],Qh);import{spawn as Jte}from"child_process";import{readFile as Yte}from"fs/promises";import{homedir as Xte}from"os";function $8(i){let t=new Map,n=i.replace(/\r\n?/g,`
`).split(`
`);for(let s of n){if(s=s.trim(),!s||s.startsWith("#"))continue;let[a,l]=o(s);a&&t.set(a,l)}return t;function o(s){s.startsWith("export ")&&(s=s.substring(7).trim());let a=r(s,u=>u==="="||u===":");if(a===-1)return[null,null];let l=s.substring(0,a).trim(),d=s.substring(a+1).trim(),c=r(d,u=>u==="#");if(c!==-1&&(d=d.substring(0,c).trim()),d.length>=2){let u=d[0],m=d[d.length-1];(u==='"'&&m==='"'||u==="'"&&m==="'"||u==="`"&&m==="`")&&(d=d.substring(1,d.length-1),u==='"'&&(d=d.replace(/\\n/g,`
`).replace(/\\r/g,"\r")))}return[l,d]}function r(s,a){let l=!1,d="";for(let c=0;c<s.length;c++){let u=s[c];if(l)u===d&&s[c-1]!=="\\"&&(l=!1);else if(u==='"'||u==="'"||u==="`")l=!0,d=u;else if(a(u))return c}return-1}}import{Transform as Qte}from"stream";var zI=class extends Qte{constructor(t){if(super(),typeof t=="number")this.splitter=t,this.spitterLen=1;else{let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.splitter=e.length===1?e[0]:e,this.spitterLen=e.length}}_transform(t,e,n){this.buffer?this.buffer=Buffer.concat([this.buffer,t]):this.buffer=t;let o=0;for(;o<this.buffer.length;){let r=typeof this.splitter=="number"?this.buffer.indexOf(this.splitter,o):aD(this.buffer,this.splitter,o);if(r===-1)break;this.push(this.buffer.slice(o,r+this.spitterLen)),o=r+this.spitterLen}this.buffer=o===this.buffer.length?void 0:this.buffer.slice(o),n()}_flush(t){this.buffer&&this.push(this.buffer),t()}};var X_=class i{constructor(t,e=i.GRACE_TIME_MS){this._child=t;this._graceTimeMs=e;this._procState=0}static{this.GRACE_TIME_MS=1e4}get stopped(){return this._procState!==0}stop(){if(this._procState===0){let t=this._graceTimeMs;try{this._child.stdin.end()}catch{t=1}this._procState=1,this._nextTimeout=new Cv(()=>this.killPolite(),t)}else this._nextTimeout?.dispose(),this.killForceful()}async killPolite(){this._procState=2,this._nextTimeout=new Cv(()=>this.killForceful(),this._graceTimeMs),this._child.pid?Te||await Zb(this._child.pid,!1).catch(()=>{this._child.kill("SIGTERM")}):this._child.kill("SIGTERM")}async killForceful(){this._procState=3,this._child.pid?await Zb(this._child.pid,!0).catch(()=>{this._child.kill("SIGKILL")}):this._child.kill()}write(t){this.stopped||this._child.stdin.write(t+`
`)}dispose(){this._nextTimeout?.dispose()}};var Z_=class extends fc{constructor(){super(...arguments);this.nodeServers=this._register(new bn)}_startMcp(e,n,o,r){n.type===1?this.startNodeMpc(e,n,o):n.type===2?this._sseEventSources.set(e,new HF(e,n,this._proxy,this._logService,r)):super._startMcp(e,n,o,r)}$stopMcp(e){let n=this.nodeServers.get(e);n?n.stop():super.$stopMcp(e)}$sendMessage(e,n){let o=this.nodeServers.get(e);o?o.write(n):super.$sendMessage(e,n)}async startNodeMpc(e,n,o){let r=d=>this._proxy.$onDidChangeState(e,{state:_o.Kind.Error,code:d.hasOwnProperty("code")?String(d.code):void 0,message:typeof d=="string"?d:d.message}),s={...process.env};if(n.envFile)try{for(let[d,c]of $8(await Yte(n.envFile,"utf-8")))s[d]=c}catch(d){r(`Failed to read envFile '${n.envFile}': ${d.message}`);return}for(let[d,c]of Object.entries(n.env)){if(d.toUpperCase()==="PATH"&&c!==null){s[d]=s[d]?`${s[d]}${Wp}${String(c)}`:String(c);continue}s[d]=c===null?void 0:String(c)}let a;try{let d=Xte(),c=n.cwd?gu(n.cwd,d):o?.fsPath||d;cn(c)||(c=o?Be(o.fsPath,c):Be(d,c));let{executable:u,args:m,shell:g}=await ene(gu(n.command,d),n.args.map(h=>gu(h,d)),c,s);this._proxy.$onDidPublishLog(e,2,`Server command line: ${u} ${m.join(" ")}`),a=Jte(u,m,{stdio:"pipe",cwd:c,env:s,shell:g})}catch(d){r(d);return}let l=new X_(a);this._proxy.$onDidChangeState(e,{state:_o.Kind.Starting}),a.stdout.pipe(new zI(`
`)).on("data",d=>this._proxy.$onDidReceiveMessage(e,d.toString())),a.stdin.on("error",r),a.stdout.on("error",r),a.stderr.pipe(new zI(`
`)).on("data",d=>this._proxy.$onDidPublishLog(e,4,`[server stderr] ${d.toString().trimEnd()}`)),a.on("spawn",()=>this._proxy.$onDidChangeState(e,{state:_o.Kind.Running})),a.on("error",d=>{r(d)}),a.on("exit",d=>{this.nodeServers.deleteAndDispose(e),d===0||l.stopped?this._proxy.$onDidChangeState(e,{state:_o.Kind.Stopped}):this._proxy.$onDidChangeState(e,{state:_o.Kind.Error,message:`Process exited with code ${d}`})}),this.nodeServers.set(e,l)}},HF=class extends Xb{constructor(){super(...arguments);this._undici=new mt(()=>import("undici"))}async _fetchInternal(e,n){let{fetch:o,Agent:r}=await this._undici.value,s={...n},a=e,l=y.parse(e);if(l.scheme==="unix"||l.scheme==="pipe")s.dispatcher=new r({socketPath:l.path}),a=l.with({scheme:"http",authority:"localhost",path:l.fragment}).toString(!0);else return super._fetchInternal(e,n);let d=await o(a,s);return{status:d.status,statusText:d.statusText,headers:d.headers,body:d.body,url:d.url,json:()=>d.json(),text:()=>d.text()}}},Zte=/\.(bat|cmd)$/i,z8=i=>`"${i.replace(/"/g,'""')}"`,ene=async(i,t,e,n)=>{if(process.platform!=="win32")return{executable:i,args:t,shell:!1};let o=await gp(i,e,void 0,n);return o&&Zte.test(o)?{executable:z8(o),args:t.map(z8),shell:!0}:{executable:i,args:t,shell:!1}};import{URL as one}from"url";import{randomBytes as tne}from"crypto";import{URL as nne}from"url";var eR=class{constructor(t,e,n){this._logger=t;this._appUri=e;this._appName=n;this._state=tne(16).toString("base64");let o=new jt;this._resultPromise=o.p,this._server=(async()=>(await import("http")).createServer((s,a)=>{let l=new nne(s.url,`http://${s.headers.host}`);switch(l.pathname){case"/":{let d=l.searchParams.get("code")??void 0,c=l.searchParams.get("state")??void 0,u=l.searchParams.get("error")??void 0;if(u){a.writeHead(302,{location:`/done?error=${l.searchParams.get("error_description")||u}`}),a.end(),o.error(new Error(u));break}if(!d||!c){a.writeHead(400),a.end();break}if(this.state!==c){a.writeHead(302,{location:`/done?error=${encodeURIComponent("State does not match.")}`}),a.end(),o.error(new Error("State does not match."));break}o.complete({code:d,state:c}),a.writeHead(302,{location:"/done"}),a.end();break}case"/done":this._sendPage(a);break;default:a.writeHead(404),a.end();break}}))()}get state(){return this._state}get redirectUri(){if(this._port===void 0)throw new Error("Server is not started yet");return`http://127.0.0.1:${this._port}/`}_sendPage(t){let e=this.getHtml();t.writeHead(200,{"Content-Type":"text/html","Content-Length":Buffer.byteLength(e,"utf8")}),t.end(e)}async start(){let t=await this._server,e=new jt;if(t.listening)throw new Error("Server is already started");let n=setTimeout(()=>{e.error(new Error("Timeout waiting for port"))},5e3);return t.on("listening",()=>{let o=t.address();if(typeof o=="string")this._port=parseInt(o);else if(o instanceof Object)this._port=o.port;else throw new Error("Unable to determine port");clearTimeout(n),e.complete()}),t.on("error",o=>{if("code"in o&&o.code==="EADDRINUSE"){this._logger.error("Address in use, retrying with a different port..."),t.listen(0,"127.0.0.1");return}clearTimeout(n),e.error(new Error(`Error listening to server: ${o}`))}),t.on("close",()=>{e.error(new Error("Closed"))}),t.listen(lO,"127.0.0.1"),e.p}async stop(){let t=new jt,e=await this._server;return e.listening?(e.close(n=>{n?t.error(n):t.complete()}),setTimeout(()=>{t.isResolved||t.error(new Error("Timeout waiting for server to close"))},5e3),t.p):(t.complete(),t.p)}waitForOAuthResponse(){return this._resultPromise}getHtml(){let t=yx(this._appUri.toString(!0)),e=ti(this._appName),n="url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAQABAMAAACNMzawAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAJ1BMVEUAAAD///9Qm8+ozed8tNsWer+Lvd9trNfF3u9Ck8slgsMzi8eZxeM/Qa6mAAAAAXRSTlMAQObYZgAAAAFiS0dEAf8CLd4AAAAHdElNRQfiCwYULRt0g+ZLAAAJRUlEQVR42u3SUY0CQRREUSy0hSZtBA+wfOwv4wAPYwAJSMAfAthkB6YD79HnKqikzmYjSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIk6cmKhg4AAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBvBVAjtV2wfFe1ogcA+0gdFgBoe60IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnAjAP/1MkWoAvBvAsUTqBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAgAASAABIAAEAACQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKA7gDlbFwC6AijZagAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQDM2boA0BXAqAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIATARAAAkAAvF7N1hWArgBKthoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfBrAlK0bAF0BjBoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4EQABIAAEwOtN2boB0BVAyVYDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgE8DqNm6AtAVwKgBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAEwEQAAJAAPzd7xypMwDvBnAskToBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAIAAkAACAABIAAEgAAQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBKBGarsAwK5qRQ8ANGYAACAABIAAEAACQAAIAAEgAASAABAAAkDfCUCSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJC3uDtO80OSql+i8AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTA2VDIwOjQ1OjI3KzAwOjAwEjLurQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0wNlQyMDo0NToyNyswMDowMGNvVhEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAAAElFTkSuQmCC')";return this._appName==="Visual Studio Code"?n="url('data:image/svg+xml;base64, ')":this._appName==="Visual Studio Code - Insiders"&&(n="url('data:image/svg+xml;base64, ')"),`<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<title>GitHub Authentication - Sign In</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<style>
		html {
			height: 100%;
		}

		body {
			box-sizing: border-box;
			min-height: 100%;
			margin: 0;
			padding: 15px 30px;
			display: flex;
			flex-direction: column;
			color: white;
			font-family: "Segoe UI","Helvetica Neue","Helvetica",Arial,sans-serif;
			background-color: #2C2C32;
		}

		.branding {
			background-image: ${n};
			background-size: 24px;
			background-repeat: no-repeat;
			background-position: left center;
			padding-left: 36px;
			font-size: 20px;
			letter-spacing: -0.04rem;
			font-weight: 400;
			color: white;
			text-decoration: none;
		}

		.message-container {
			flex-grow: 1;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0 30px;
		}

		.message {
			font-weight: 300;
			font-size: 1.4rem;
		}

		body.error .message {
			display: none;
		}

		body.error .error-message {
			display: block;
		}

		.error-message {
			display: none;
			font-weight: 300;
			font-size: 1.3rem;
		}

		.error-text {
			color: red;
			font-size: 1rem;
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Light"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.svg#web") format("svg");
			font-weight: 200
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Semilight"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff2") format("woff2"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.svg#web") format("svg");
			font-weight: 300
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/normal/latest.svg#web") format("svg");
			font-weight: 400
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Semibold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.svg#web") format("svg");
			font-weight: 600
		}

		@font-face {
			font-family: 'Segoe UI';
			src: url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.eot?#iefix") format("embedded-opentype");
			src: local("Segoe UI Bold"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff2") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.woff") format("woff"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.ttf") format("truetype"),url("https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.svg#web") format("svg");
			font-weight: 700
		}
	</style>
</head>

<body>
	<a class="branding" href="https://code.visualstudio.com/">
		${e}
	</a>
	<div class="message-container">
		<div class="message">
			Sign-in successful! Returning to ${e}...
			<br><br>
			If you're not redirected automatically, <a id="redirect-link" href="${t}" style="color: #85CEFF;">click here</a> or close this page.
		</div>
		<div class="error-message">
			An error occurred while signing in:
			<div class="error-text"></div>
		</div>
	</div>
	<script>
		const search = window.location.search;
		const error = (/[?&^]error=([^&]+)/.exec(search) || [])[1];
		if (error) {
			document.querySelector('.error-text')
				.textContent = decodeURIComponent(error);
			document.querySelector('body')
				.classList.add('error');
		} else {
			// Redirect to the app URI after a 1-second delay to allow page to load
			setTimeout(function() {
				window.location.href = document.getElementById('redirect-link').getAttribute('href');
			}, 1000);
		}
	</script>
</body>
</html>`}};var tR=class extends sc{constructor(t,e,n,o,r,s,a,l,d,c,u,m,g){super(t,e,n,o,r,s,a,l,d,c,u,m,g),!n.remote.isRemote&&l.authorization_endpoint&&this._createFlows.unshift({label:p(5916,null),handler:(h,f,I)=>this._createWithLoopbackServer(h,f,I)}),l.device_authorization_endpoint&&this._createFlows.push({label:p(5915,null),handler:(h,f,I)=>this._createWithDeviceCode(h,f,I)})}async _createWithLoopbackServer(t,e,n){if(!this._serverMetadata.authorization_endpoint)throw new Error("Authorization Endpoint required");if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");let o=this.generateRandomString(64),r=await this.generateCodeChallenge(o),s=this.generateRandomString(32),a=y.parse(`${this._initData.environment.appUriScheme}://dynamicauthprovider/${this.authorizationServer.authority}/redirect?nonce=${s}`),l;try{l=await this._extHostUrls.createAppUri(a)}catch(g){throw new Error(`Failed to create external URI: ${g}`)}let d=new one(this._serverMetadata.authorization_endpoint);d.searchParams.append("client_id",this._clientId),d.searchParams.append("response_type","code"),d.searchParams.append("code_challenge",r),d.searchParams.append("code_challenge_method","S256");let c=t.join(" ");c&&d.searchParams.append("scope",c),this._resourceMetadata?.resource&&d.searchParams.append("resource",this._resourceMetadata.resource);let u=new eR(this._logger,l,this._initData.environment.appName);try{await u.start()}catch(g){throw new Error(`Failed to start loopback server: ${g}`)}d.searchParams.set("redirect_uri",u.redirectUri),d.searchParams.set("state",u.state);let m=u.waitForOAuthResponse();this._proxy.$waitForUriHandler(l);try{if(this._logger.info(`Opening authorization URL for scopes: ${c}`),this._logger.trace(`Authorization URL: ${d.toString()}`),!await this._extHostWindow.openUri(d.toString(),{}))throw new Oe;e.report({message:p(5914,null)});let h;try{h=(await ri(m,n)).code}catch(I){throw Yt(I)?(this._logger.info("Authorization code request was cancelled by the user."),I):(this._logger.error(`Failed to receive authorization code: ${I}`),new Error(`Failed to receive authorization code: ${I}`))}return this._logger.info(`Authorization code received for scopes: ${c}`),await this.exchangeCodeForToken(h,o,u.redirectUri)}finally{setTimeout(()=>{u.stop()},5e3)}}async _createWithDeviceCode(t,e,n){if(!this._serverMetadata.token_endpoint)throw new Error("Token endpoint not available in server metadata");if(!this._serverMetadata.device_authorization_endpoint)throw new Error("Device authorization endpoint not available in server metadata");let o=this._serverMetadata.device_authorization_endpoint,r=t.join(" ");this._logger.info(`Starting device code flow for scopes: ${r}`);let s=new URLSearchParams;s.append("client_id",this._clientId),r&&s.append("scope",r),this._resourceMetadata?.resource&&s.append("resource",this._resourceMetadata.resource);let a;try{a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:s.toString()})}catch(m){throw this._logger.error(`Failed to request device code: ${m}`),new Error(`Failed to request device code: ${m}`)}if(!a.ok){let m=await a.text();throw new Error(`Device code request failed: ${a.status} ${a.statusText} - ${m}`)}let l=await a.json();if(!E5(l))throw this._logger.error("Invalid device code response received from server"),new Error("Invalid device code response received from server");if(this._logger.info(`Device code received: ${l.user_code}`),!await this._proxy.$showDeviceCodeModal(l.user_code,l.verification_uri))throw new Oe;e.report({message:p(5917,null,l.verification_uri,l.user_code)});let c=(l.interval||5)*1e3,u=Date.now()+l.expires_in*1e3;for(;Date.now()<u;){if(n.isCancellationRequested)throw new Oe;if(await new Promise(g=>setTimeout(g,c)),n.isCancellationRequested)throw new Oe;let m=new URLSearchParams;m.append("grant_type","urn:ietf:params:oauth:grant-type:device_code"),m.append("device_code",l.device_code),m.append("client_id",this._clientId),this._resourceMetadata?.resource&&m.append("resource",this._resourceMetadata.resource);try{let g=await fetch(this._serverMetadata.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:m.toString()});if(g.ok){let h=await g.json();if(!ip(h))throw this._logger.error("Invalid token response received from server"),new Error("Invalid token response received from server");return this._logger.info(`Device code flow completed successfully for scopes: ${r}`),h}else{let h;try{h=await g.json()}catch(f){throw this._logger.error(`Failed to parse error response: ${f}`),new Error(`Token request failed with status ${g.status}: ${g.statusText}`)}if(h.error==="authorization_pending")continue;if(h.error==="slow_down"){await new Promise(f=>setTimeout(f,c));continue}else throw h.error==="expired_token"?new Error("Device code expired. Please try again."):h.error==="access_denied"?new Oe:h.error==="invalid_client"?(this._logger.warn(`Client ID (${this._clientId}) was invalid, generated a new one.`),await this._generateNewClientId(),new Error("Client ID was invalid, generated a new one. Please try again.")):new Error(`Token request failed: ${h.error_description||h.error||"Unknown error"}`)}}catch(g){throw Yt(g)?g:new Error(`Error polling for token: ${g}`)}}throw new Error("Device code flow timed out. Please try again.")}},nR=class extends vf{constructor(e,n,o,r,s,a,l){super(e,n,o,r,s,a,l);this._dynamicAuthProviderCtor=tR;this._xaaAuthProviderCtor=Ow(tR)}};import*as q8 from"net";var K8=new class{supports(i){return!0}connect({host:i,port:t},e,n,o){return new Promise((r,s)=>{let a=q8.createConnection({host:i,port:t},()=>{a.removeListener("error",s),a.write(SF(e,n,o));let l=d=>{d.toString().indexOf(`\r
\r
`)>=0&&(a.off("data",l),r(new Ur(a,o)))};a.on("data",l)});a.setNoDelay(!0),a.once("error",s)})}};import{Duplex as une}from"stream";async function G8(){let i=await import("crypto"),{privateKey:t,publicKey:e}=i.generateKeyPairSync("ec",{namedCurve:"prime256v1",publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}}),n=rne(i,t,e),o=Q8(n),s=`sha256/${i.createHash("sha256").update(o).digest("base64")}`;return{key:t,cert:n,fingerprint:s}}function rne(i,t,e){let n=Q8(e),o=i.randomBytes(8);o[0]&=127;let r=new Date,s=new Date(r);s.setFullYear(r.getFullYear()+1);let a=WF(Buffer.from([85,4,3])),l=kl([ane([kl([a,dne("TunnelProxy")])])]),d=kl([j8(r),j8(s)]),c=Buffer.from([160,3,2,1,2]),u=lne(o),m=Buffer.from([42,134,72,206,61,4,3,2]),g=kl([WF(m)]),h=ine(),f=Buffer.concat([Buffer.from([163]),sne(kl([h]))]),I=kl([c,u,g,l,d,l,n,f]),x=i.createSign("SHA256");x.update(I);let E=x.sign(t),w=Buffer.concat([Buffer.from([3]),pa(E.length+1),Buffer.from([0]),E]),L=kl([I,g,w]).toString("base64"),U=[];for(let z=0;z<L.length;z+=64)U.push(L.substring(z,z+64));return`-----BEGIN CERTIFICATE-----
${U.join(`
`)}
-----END CERTIFICATE-----
`}function ine(){let i=WF(Buffer.from([85,29,17])),t=Buffer.from([135,4,127,0,0,1]),e=cne(kl([t]));return kl([i,e])}function Q8(i){let t=i.replace(/-----[A-Z ]+-----/g,"").replace(/\s/g,"");return Buffer.from(t,"base64")}function pa(i){if(i<128)return Buffer.from([i]);if(i<256)return Buffer.from([129,i]);if(i<65536)return Buffer.from([130,i>>8&255,i&255]);if(i<16777216)return Buffer.from([131,i>>16&255,i>>8&255,i&255]);throw new Error(`derLength: value too large (${i})`)}function sne(i){return Buffer.concat([pa(i.length),i])}function kl(i){let t=Buffer.concat(i);return Buffer.concat([Buffer.from([48]),pa(t.length),t])}function ane(i){let t=Buffer.concat(i);return Buffer.concat([Buffer.from([49]),pa(t.length),t])}function lne(i){if(i.length===0)throw new Error("derInteger: value must be non-empty");let t=0;for(;t<i.length-1&&i[t]===0&&(i[t+1]&128)===0;)t++;let e=i.subarray(t);return e[0]&128&&(e=Buffer.concat([Buffer.from([0]),e])),Buffer.concat([Buffer.from([2]),pa(e.length),e])}function WF(i){return Buffer.concat([Buffer.from([6]),pa(i.length),i])}function dne(i){let t=Buffer.from(i,"utf8");return Buffer.concat([Buffer.from([12]),pa(t.length),t])}function cne(i){return Buffer.concat([Buffer.from([4]),pa(i.length),i])}function j8(i){let t=i.toISOString().replace(/[-:T]/g,""),e=i.getUTCFullYear();if(e>=1950&&e<2050){let n=Buffer.from(t.substring(2,14)+"Z","ascii");return Buffer.concat([Buffer.from([23]),pa(n.length),n])}else{let n=Buffer.from(t.substring(0,14)+"Z","ascii");return Buffer.concat([Buffer.from([24]),pa(n.length),n])}}var pne=6,oR=class extends N{constructor(e,n){super();this._connectTunnel=e;this._logService=n;this._localPort=0;this._connectSockets=new Set;this._remoteSockets=new Set;this._connectLimiter=this._register(new xv(pne))}get localPort(){return this._localPort}async start(){let e=await import("crypto"),n=await import("http"),o=await import("https"),r=e.randomBytes(16).toString("hex"),s=e.randomBytes(32).toString("hex");this._credentials={username:r,password:s},this._expectedAuthHeader="Basic "+Buffer.from(`${r}:${s}`).toString("base64");let{key:a,cert:l,fingerprint:d}=await G8();this._certFingerprint=d,this._http=n,this._tunnelAgent=this._createTunnelAgent();let c=o.createServer({key:a,cert:l},(g,h)=>this._onRequest(g,h));c.on("connect",(g,h,f)=>this._onConnect(g,h,f)),c.on("error",g=>{this._logService.error("[TunnelProxy] Server error:",g)}),this._server=c;let u=await W_(0,2,1e3,"127.0.0.1");c.listen(u,"127.0.0.1"),await new Promise((g,h)=>{c.once("listening",g),c.once("error",h)});let m=c.address();return this._localPort=m.port,this._logService.info(`[TunnelProxy] Listening on https://127.0.0.1:${this._localPort}`),{url:`https://127.0.0.1:${this._localPort}`,host:"127.0.0.1",port:this._localPort,credentials:this._credentials,certFingerprint:this._certFingerprint}}dispose(){for(let e of this._connectSockets)e.destroy();this._connectSockets.clear();for(let e of this._remoteSockets)e.destroy();this._remoteSockets.clear(),this._tunnelAgent?.destroy(),this._server?.closeAllConnections(),this._server?.close(),super.dispose()}_checkAuth(e){return e===this._expectedAuthHeader}_createTunnelAgent(){if(!this._http)throw new Error("HTTP module not initialized");let e=new this._http.Agent({keepAlive:!0});return e.createConnection=(n,o)=>{let r=n.hostname||n.host||"",s=Number(n.port)||80;this._createTunnelSocket(r,s).then(a=>o?.(null,a)).catch(a=>o?.(a,null))},e}drainConnectionPool(){if(!this._tunnelAgent)return;let e=this._tunnelAgent;this._tunnelAgent=this._createTunnelAgent(),e?.destroy(),this._logService.trace("[TunnelProxy] Upstream endpoint changed; drained pooled tunnel sockets")}async _onConnect(e,n,o){if(this._connectSockets.add(n),n.on("close",()=>this._connectSockets.delete(n)),!this._checkAuth(e.headers["proxy-authorization"])){n.write(`HTTP/1.1 407 Proxy Authentication Required\r
Proxy-Authenticate: Basic realm="TunnelProxy"\r
\r
`),n.end();return}let{host:r,port:s}=this._parseHostPort(e.url??"",443);if(!r){n.write(`HTTP/1.1 400 Bad Request\r
\r
`),n.end();return}this._logService.trace(`[TunnelProxy] CONNECT ${r}:${s}`);try{n.pause();let a=await this._connectLimiter.queue(()=>this._connectTunnel(r,s)),{stream:l,leftover:d}=this._takeRemoteStream(a);n.write(`HTTP/1.1 200 Connection Established\r
\r
`),d.byteLength>0&&n.write(d.buffer),o.length>0&&l.write(o),this._bridgeSockets(n,l)}catch(a){this._logService.error(`[TunnelProxy] Failed to tunnel to ${r}:${s}:`,a),n.write(`HTTP/1.1 502 Bad Gateway\r
\r
`),n.end()}}async _onRequest(e,n){if(!this._checkAuth(e.headers["proxy-authorization"])){n.writeHead(407,{"Proxy-Authenticate":'Basic realm="TunnelProxy"'}),n.end();return}let o;try{o=new URL(e.url??"")}catch{n.writeHead(400),n.end();return}if(o.protocol!=="http:"){this._logService.warn(`[TunnelProxy] Rejecting non-HTTP forwarded request: ${e.method} ${e.url}`),n.writeHead(400),n.end();return}let r=o.hostname,s=parseInt(o.port,10)||80;if(!r){n.writeHead(400),n.end();return}this._logService.trace(`[TunnelProxy] ${e.method} ${r}:${s}${o.pathname}`);try{let a=await import("http"),l=o.pathname+o.search,d={...e.headers},c=(d.connection??"").toString().split(",").map(m=>m.trim().toLowerCase()).filter(m=>m.length>0);for(let m of c)delete d[m];delete d.connection,delete d["keep-alive"],delete d["proxy-authorization"],delete d["proxy-connection"],delete d.te,delete d["transfer-encoding"],delete d.upgrade;let u=a.request({agent:this._tunnelAgent,hostname:r,port:s,path:l,method:e.method,headers:d},m=>{n.writeHead(m.statusCode,m.headers),m.pipe(n)});u.on("error",m=>{this._logService.error(`[TunnelProxy] Proxy request error for ${r}:${s}:`,m),n.destroy()}),e.pipe(u)}catch(a){this._logService.error(`[TunnelProxy] Failed to tunnel to ${r}:${s}:`,a),n.destroy()}}async _createTunnelSocket(e,n){let o=await this._connectLimiter.queue(()=>this._connectTunnel(e,n)),{stream:r,leftover:s}=this._takeRemoteStream(o);return this._trackRemoteSocket(r),s.byteLength>0&&r.unshift(s.buffer),r}_takeRemoteStream(e){let n=e.getSocket();if(n instanceof Ur){let r=n.socket,s=e.readEntireBuffer();return n.dispose(!1),e.dispose(),{stream:r,leftover:s}}let o=e.readEntireBuffer();return e.dispose(),{stream:new VF(n),leftover:o}}_parseHostPort(e,n){let o,r,s=/^\[(?<host>[^\]]+)\]:(?<port>\d+)$/.exec(e);if(s?.groups)o=s.groups.host,r=parseInt(s.groups.port,10);else{let a=/^\[(?<host>[^\]]+)\]$/.exec(e);if(a?.groups)o=a.groups.host,r=n;else{let l=e.lastIndexOf(":");if(l===-1)o=e,r=n;else{let d=parseInt(e.substring(l+1),10);isNaN(d)?(o=e,r=n):(o=e.substring(0,l),r=d)}}}return r<1||r>65535?{host:"",port:0}:{host:o,port:r}}_bridgeSockets(e,n){this._trackRemoteSocket(n),n.on("end",()=>e.end()),n.on("close",()=>e.end()),n.on("error",()=>e.destroy()),e.on("end",()=>n.end()),e.on("close",()=>n.end()),e.on("error",()=>n.destroy()),n.pipe(e),e.pipe(n)}_trackRemoteSocket(e){this._remoteSockets.add(e),e.on("error",()=>e.destroy()),e.on("close",()=>this._remoteSockets.delete(e))}},VF=class extends une{constructor(e){super();this._socket=e;this._disposables=new $;this._disposables.add(this._socket.onData(n=>this.push(n.buffer))),this._disposables.add(this._socket.onEnd(()=>this.push(null))),this._disposables.add(this._socket.onClose(n=>{this.destroy(n?.type===0?n.error:void 0)}))}setKeepAlive(){return this}setNoDelay(){return this}setTimeout(){return this}ref(){return this}unref(){return this}_read(){}_write(e,n,o){this._socket.write(H.wrap(e)),this._socket.drain().then(()=>o(),r=>o(r))}_final(e){this._socket.end(),e()}_destroy(e,n){this._disposables.dispose(),this._socket.dispose(),n(e)}};var Jh=class extends N{constructor(e,n,o,r,s,a){super();this._initData=n;this._signService=o;this._logService=r;this._managedSockets=s;this._addressProvider=new BF;this._enabled=!1;this._connection=null;this._proxy=e.getProxy(F.MainThreadBrowserTunnelProxy),this._setConnection(a.getRemoteConnectionData()),this._register(a.onDidChangeRemoteConnectionData(()=>this._setConnection(a.getRemoteConnectionData())))}dispose(){this._stop(),super.dispose()}$setEnabled(e){this._initData.remote.isRemote||this._enabled!==e&&(this._enabled=e,this._update())}_setConnection(e){if(!e)return;let n=!!this._connection&&!mne(this._connection,e);this._connection=e,this._addressProvider.setAddress({connectTo:e.connectTo,connectionToken:e.connectionToken}),n&&this._tunnelProxy?.drainConnectionPool()}_update(){this._enabled&&!this._tunnelProxy&&!this._startPromise?this._start():this._enabled||this._stop()}_start(){let e=this._createConnectionOptions(),n=new oR((r,s)=>B_(e,r,s),this._logService),o=n.start().then(r=>{if(this._startPromise!==o){n.dispose();return}this._tunnelProxy=n,this._startPromise=void 0,this._proxy.$updateProxyInfo(r)},r=>{this._logService.error("[ExtHostBrowserTunnelProxy] Failed to start tunnel proxy:",r),this._startPromise===o&&(this._startPromise=void 0),n.dispose()});this._startPromise=o}_stop(){let e=!!this._tunnelProxy||!!this._startPromise;this._tunnelProxy?.dispose(),this._tunnelProxy=void 0,this._startPromise=void 0,e&&this._proxy.$updateProxyInfo(void 0)}_createConnectionOptions(){let e=this._managedSockets,n={_serviceBrand:void 0,async connect(o,r,s,a){if(o.type===1){let l=await e.makeConnection();return BI.connect(l,r,s,a)}return K8.connect(o,r,s,a)},register(){throw new Error("BrowserTunnelProxy socket factory does not support register()")}};return{commit:this._initData.commit,quality:this._initData.quality,addressProvider:this._addressProvider,remoteSocketFactoryService:n,signService:this._signService,logService:this._logService,ipcLogger:null}}};Jh=_([S(0,le),S(1,Ye),S(2,ua),S(3,te),S(4,lc),S(5,io)],Jh);var BF=class{constructor(){this._address=null;this._pending=null}getAddress(){return this._address?Promise.resolve(this._address):(this._pending??=new jt,this._pending.p)}setAddress(t){this._address=t,this._pending?.complete(t),this._pending=null}};function mne(i,t){if(i===t)return!0;if(!i||!t||i.connectionToken!==t.connectionToken)return!1;let e=i.connectTo,n=t.connectTo;return e.type===1&&n.type===1?e.id===n.id:e.type===0&&n.type===0?e.host===n.host&&e.port===n.port:!1}Ue(io,F_,0);Ue(ir,Q_,1);Ue(te,new sr(Qh,[!1],!0));Ue(ua,Zf,1);Ue(of,j_,0);Ue(oc,new sr(cf,[!1],!0));Ue(yf,nR,0);Ue(Hf,eh,0);Ue(Bf,ih,0);Ue(Lf,Yf,0);Ue(Ao,Jf,0);Ue(tc,Gh,0);Ue(Gr,J_,0);Ue(mp,Z_,0);Ue(zf,Jh,0);import{createRequire as fne}from"node:module";var Y8=fne(import.meta.url);if(process.env.VSCODE_DEV){let i=process.listeners("warning");process.removeAllListeners("warning"),process.on("warning",t=>{if(t.code==="ExperimentalWarning"||t.name==="ExperimentalWarning"||t.name==="DeprecationWarning"){console.debug(t);return}i[0](t)})}(function(){for(let t=0;t<process.execArgv.length;t++)process.execArgv[t]==="--inspect-port=0"&&(process.execArgv.splice(t,1),t--)})();var qI=gne(process.argv.slice(2),{boolean:["transformURIs","skipWorkspaceStorageLock","supportGlobalNavigator"],string:["useHostProxy"]});(function(){let i=Y8("module"),t=i._load;i._load=function(e){if(e==="natives")throw new Error('Either the extension or an NPM dependency is using the [unsupported "natives" node module](https://go.microsoft.com/fwlink/?linkid=871887).');return t.apply(this,arguments)}})();var rR=process.exit.bind(process),hne=process.on.bind(process);function vne(i){process.exit=function(t){if(i)rR(t);else{let e=new Error("An extension called process.exit() and this was prevented.");console.warn(e.stack)}},process.crash=function(){let t=new Error("An extension called process.crash() and this was prevented.");console.warn(t.stack)},process.env.ELECTRON_RUN_AS_NODE="1",process.on=function(t,e){if(t==="uncaughtException"){let n=e;e=function(...o){try{return n.apply(void 0,o)}catch{}}}hne(t,e)}}qI.supportGlobalNavigator||Object.defineProperty(globalThis,"navigator",{get:()=>{ba(new ya("navigator is now a global in nodejs, please see https://aka.ms/vscode-extensions/navigator for additional info on this error."))}});var ma=function(i){rR()};function yne(i,t){let e=process.env[i];if(typeof e!="string"||e.trim().length===0)return console.log(`[reconnection-grace-time] Extension host: env var ${i} not set, using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let n=Number(e);if(!isFinite(n)||n<0)return console.log(`[reconnection-grace-time] Extension host: env var ${i} invalid value '${e}', using default: ${t}ms (${Math.floor(t/1e3)}s)`),t;let o=Math.floor(n),r=o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:o;return console.log(`[reconnection-grace-time] Extension host: read ${i}=${e}ms (${Math.floor(r/1e3)}s)`),r}function bne(){let i=B5(process.env);if(i.type===3)return new Promise((t,e)=>{let n=o=>{let r=o[0],s=new ys;r.on("message",a=>s.fire(H.wrap(a.data))),r.on("close",()=>{ma("renderer closed the MessagePort")}),r.start(),t({onMessage:s.event,send:a=>r.postMessage(a.buffer)})};process.parentPort.on("message",o=>n(o.ports))});if(i.type===2)return new Promise((t,e)=>{let n=null,o=setTimeout(()=>{ma("VSCODE_EXTHOST_IPC_SOCKET timeout")},6e4),r=yne("VSCODE_RECONNECTION_GRACE_TIME",108e5),s=r>0?Math.min(3e5,r):0,a=new Tv(()=>ma("renderer disconnected for too long (1)"),r),l=new Tv(()=>ma("renderer disconnected for too long (2)"),s);process.on("message",(c,u)=>{if(c&&c.type==="VSCODE_EXTHOST_IPC_SOCKET"){u.setNoDelay(!0);let m=H.wrap(Buffer.from(c.initialDataChunk,"base64")),g;if(c.skipWebSocketFrames)g=new Ur(u,"extHost-socket");else{let h=H.wrap(Buffer.from(c.inflateBytes,"base64"));g=new Qx(new Ur(u,"extHost-socket"),c.permessageDeflate,h,!1)}n?(a.cancel(),l.cancel(),n.beginAcceptReconnection(g,m),n.endAcceptReconnection(),n.sendResume()):(clearTimeout(o),n=new Vc({socket:g,initialChunk:m}),n.sendResume(),ye.once(n.onDidDispose)(()=>ma("renderer disconnected")),t(n),n.onSocketClose(()=>{a.schedule()}))}if(c&&c.type==="VSCODE_EXTHOST_IPC_REDUCE_GRACE_TIME"){if(l.isScheduled())return;a.isScheduled()&&l.schedule()}});let d={type:"VSCODE_EXTHOST_IPC_READY"};process.send?.(d)});{let t=i.pipeName;return new Promise((e,n)=>{let o=J8.createConnection(t,()=>{o.removeListener("error",n);let r=new Vc({socket:new Ur(o,"extHost-renderer")});r.sendResume(),e(r)});o.once("error",n),o.on("close",()=>{ma("renderer closed the socket")})})}}async function Ine(){let i=await bne();return new class{constructor(){this._onMessage=new ys;this.onMessage=this._onMessage.event;this._terminating=!1,this._protocolListener=i.onMessage(t=>{b5(t,2)?(this._terminating=!0,this._protocolListener.dispose(),ma("received terminate message from renderer")):this._onMessage.fire(t)})}send(t){this._terminating||i.send(t)}async drain(){if(i.drain)return i.drain()}}}function xne(i){return new Promise(t=>{let e=i.onMessage(n=>{e.dispose();let o=JSON.parse(n.toString()),r=o.commit,s=rr.commit;if(r&&s&&r!==s&&rR(55),o.parentPid){let a=0;setInterval(function(){try{process.kill(o.parentPid,0),a=0}catch(d){d&&d.code==="EPERM"?(a++,a>=3&&ma(`parent process ${o.parentPid} does not exist anymore (3 x EPERM): ${d.message} (code: ${d.code}) (errno: ${d.errno})`)):ma(`parent process ${o.parentPid} does not exist anymore: ${d.message} (code: ${d.code}) (errno: ${d.errno})`)}},1e3);let l;try{l=Y8("@vscode/native-watchdog"),l.start(o.parentPid)}catch(d){Ge(d)}}i.send(tO(0)),t({protocol:i,initData:o})});i.send(tO(1))})}async function Sne(){let i=[];process.on("unhandledRejection",(a,l)=>{i.push(l),setTimeout(()=>{let d=i.indexOf(l);d>=0&&l.catch(c=>{i.splice(d,1),Yt(c)||(console.warn(`rejected promise not handled within 1 second: ${c}`),c&&c.stack&&console.warn(`stack trace: ${c.stack}`),a&&Ge(a))})},1e3)}),process.on("rejectionHandled",a=>{let l=i.indexOf(a);l>=0&&i.splice(l,1)}),process.on("uncaughtException",function(a){cH(a)||Ge(a)}),Bt("code/extHost/willConnectToRenderer");let t=await Ine();Bt("code/extHost/didConnectToRenderer");let e=await xne(t);Bt("code/extHost/didWaitForInitData");let{initData:n}=e;vne(!!n.environment.extensionTestsLocationURI),n.environment.useHostProxy=qI.useHostProxy!==void 0?qI.useHostProxy!=="false":void 0,n.environment.skipWorkspaceStorageLock=ce(qI.skipWorkspaceStorageLock,!1);let o=new class{constructor(){this.pid=process.pid}exit(l){rR(l)}fsExists(l){return at.exists(l)}fsRealpath(l){return at.realpath(l)}},r=null;n.remote.authority&&qI.transformURIs&&(r=V5(n.remote.authority));let s=new Ww(e.protocol,n,o,r);ma=a=>s.terminate(a)}Sne().catch(i=>console.log(i));
